模板添加两个参数

This commit is contained in:
Jerry Yan 2025-02-19 14:36:27 +08:00
parent e87ce424fb
commit 373922bbbf
6 changed files with 21 additions and 16 deletions

View File

@ -19,6 +19,8 @@ import com.ycwl.basic.utils.ApiResponse;
import com.ycwl.basic.utils.JwtTokenUtil; import com.ycwl.basic.utils.JwtTokenUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -28,6 +30,7 @@ import java.util.List;
* @Authorlongbinbin * @Authorlongbinbin
* @Date2024/12/5 10:22 * @Date2024/12/5 10:22
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/api/mobile/scenic/v1") @RequestMapping("/api/mobile/scenic/v1")
@Api(tags = "景区相关接口") @Api(tags = "景区相关接口")
@ -71,9 +74,14 @@ public class AppScenicController {
@ApiOperation("景区视频源素材列表") @ApiOperation("景区视频源素材列表")
@GetMapping("/face/{faceId}/contentList") @GetMapping("/face/{faceId}/contentList")
public ApiResponse<List<ContentPageVO>> contentList(@PathVariable Long faceId) { public ApiResponse<List<ContentPageVO>> contentList(@PathVariable String faceId) {
if (!StringUtils.isNumeric(faceId)) {
log.error("请求异常, faceId: [{}]",faceId);
return ApiResponse.fail("请求异常");
}
Long id = Long.parseLong(faceId);
JwtInfo worker = JwtTokenUtil.getWorker(); JwtInfo worker = JwtTokenUtil.getWorker();
List<ContentPageVO> contentPageVOS = appScenicService.faceContentList(worker.getUserId(), faceId); List<ContentPageVO> contentPageVOS = appScenicService.faceContentList(worker.getUserId(), id);
return ApiResponse.success(contentPageVOS); return ApiResponse.success(contentPageVOS);
} }

View File

@ -72,15 +72,8 @@ public class CustomExceptionHandle {
*/ */
@ExceptionHandler(value = Exception.class) @ExceptionHandler(value = Exception.class)
public ApiResponse<String> handle(Exception e) { public ApiResponse<String> handle(Exception e) {
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
String requestText = getRequestAsText(); String requestText = getRequestAsText();
new Thread(() -> NotifyFactory.via().sendTo( LOGGER.error("系统异常 -> {}\n{}", e.getMessage(), requestText, e);
new NotifyContent(
"帧途后台报错了!",
e.getMessage() + "\n---\n请求主体\n```\n" + requestText + "\n```\n---\n错误栈\n```\n" + getStackTrace(e) + "\n```"
),
"default_user"
)).start();
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR); return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
} }

View File

@ -76,5 +76,6 @@ public class TemplateEntity {
private Integer sort; private Integer sort;
private Integer cropEnable; private Integer cropEnable;
private String onlyIf; private String onlyIf;
private String resolution;
private List<TemplateEntity> children; private List<TemplateEntity> children;
} }

View File

@ -86,6 +86,7 @@ public class TemplateRespVO {
private BigDecimal price; private BigDecimal price;
private BigDecimal slashPrice; private BigDecimal slashPrice;
private Integer sort; private Integer sort;
private String resolution;
private Integer cropEnable; private Integer cropEnable;
private String onlyIf; private String onlyIf;
private List<TemplateRespVO> children; private List<TemplateRespVO> children;

View File

@ -70,9 +70,9 @@ public class TemplateServiceImpl implements TemplateService {
@Override @Override
public ApiResponse<Integer> deleteById(Long id) { public ApiResponse<Integer> deleteById(Long id) {
int i = templateMapper.deleteById(id); int i = templateMapper.deleteById(id);
templateRepository.clearTemplateCache(id);
if (i > 0) { if (i > 0) {
templateMapper.deleteByPid(id); templateMapper.deleteByPid(id);
templateRepository.clearTemplateCache(id);
return ApiResponse.success(i); return ApiResponse.success(i);
}else { }else {
return ApiResponse.fail("删除模版失败"); return ApiResponse.fail("删除模版失败");
@ -92,8 +92,8 @@ public class TemplateServiceImpl implements TemplateService {
item.setStatus(1); item.setStatus(1);
templateMapper.add(item); templateMapper.add(item);
}); });
templateRepository.clearTemplateCache(template.getId());
} }
templateRepository.clearTemplateCache(template.getId());
if (i > 0) { if (i > 0) {
return ApiResponse.success(true); return ApiResponse.success(true);
}else { }else {
@ -120,7 +120,7 @@ public class TemplateServiceImpl implements TemplateService {
@Override @Override
public void saveConfig(Long configId, TemplateConfigEntity config) { public void saveConfig(Long configId, TemplateConfigEntity config) {
config.setId(configId); config.setId(configId);
templateRepository.clearTemplateCache(config.getTemplateId());
templateMapper.updateConfigById(config); templateMapper.updateConfigById(config);
templateRepository.clearTemplateCache(config.getTemplateId());
} }
} }

View File

@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycwl.basic.mapper.TemplateMapper"> <mapper namespace="com.ycwl.basic.mapper.TemplateMapper">
<insert id="add"> <insert id="add">
insert into template(id, scenic_id, `name`, pid, is_placeholder, source_url, luts, overlays, audios, cover_url, frame_rate, speed, price, slash_price, crop_enable, only_if) insert into template(id, scenic_id, `name`, pid, is_placeholder, source_url, luts, overlays, audios, cover_url, frame_rate, speed, price, slash_price, crop_enable, only_if, resolution, create_time)
values (#{id}, #{scenicId}, #{name}, #{pid}, #{isPlaceholder}, #{sourceUrl}, #{luts}, #{overlays}, #{audios}, #{coverUrl}, #{frameRate}, #{speed}, #{price}, #{slashPrice}, #{cropEnable}, #{onlyIf}) values (#{id}, #{scenicId}, #{name}, #{pid}, #{isPlaceholder}, #{sourceUrl}, #{luts}, #{overlays}, #{audios}, #{coverUrl}, #{frameRate}, #{speed}, #{price}, #{slashPrice}, #{cropEnable}, #{onlyIf}, #{resolution}, now())
</insert> </insert>
<insert id="addConfig"> <insert id="addConfig">
insert into template_config(id, template_id, create_time) insert into template_config(id, template_id, create_time)
@ -12,6 +12,7 @@
<update id="update"> <update id="update">
update template update template
<set> <set>
update_time = now(),
<if test="name!= null">`name` = #{name}, </if> <if test="name!= null">`name` = #{name}, </if>
<if test="scenicId!= null">`scenic_id` = #{scenicId}, </if> <if test="scenicId!= null">`scenic_id` = #{scenicId}, </if>
<if test="pid!= null">pid = #{pid}, </if> <if test="pid!= null">pid = #{pid}, </if>
@ -28,8 +29,9 @@
<if test="sort!= null">sort = #{sort}, </if> <if test="sort!= null">sort = #{sort}, </if>
<if test="cropEnable!= null">crop_enable = #{cropEnable}, </if> <if test="cropEnable!= null">crop_enable = #{cropEnable}, </if>
<if test="onlyIf!= null">only_if = #{onlyIf}, </if> <if test="onlyIf!= null">only_if = #{onlyIf}, </if>
<if test="resolution!= null">resolution = #{resolution}, </if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
<update id="updateStatus"> <update id="updateStatus">
update template update template