修改动态不允许标题重复

This commit is contained in:
pserimal
2023-06-30 17:22:55 +08:00
parent d79d17645a
commit d8cba61a84
4 changed files with 11 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ public interface ContentService {
* 更新动态信息 * 更新动态信息
* @param dto * @param dto
*/ */
void updateContent(ContentUpdateDto dto); void updateContent(ContentUpdateDto dto) throws ApiException;
/** /**
* 查询动态列表 * 查询动态列表

View File

@@ -63,7 +63,12 @@ public class ContentServiceImpl implements ContentService {
* @param dto * @param dto
*/ */
@Override @Override
public void updateContent(ContentUpdateDto dto) { public void updateContent(ContentUpdateDto dto) throws ApiException {
//增加不允许重复标题的逻辑
Boolean isDuplicated = contentInfoMapper.whetherTitleDuplicated(dto.getContentTitle());
if (isDuplicated) {
throw new ApiException(ErrorCodeEnum.CONTENT_DUPLICATED);
}
HyContentInfoDO hyContentInfoDO = new HyContentInfoDO(); HyContentInfoDO hyContentInfoDO = new HyContentInfoDO();
BeanUtil.copyProperties(dto, hyContentInfoDO); BeanUtil.copyProperties(dto, hyContentInfoDO);
hyContentInfoDO.setId(Long.parseLong(dto.getContentId())); hyContentInfoDO.setId(Long.parseLong(dto.getContentId()));

View File

@@ -295,7 +295,7 @@ public class FlowServiceImpl implements FlowService {
SkrRelshipProve skrRelshipProve= BeanUtil.fillBeanWithMap(data, new SkrRelshipProve(), false); SkrRelshipProve skrRelshipProve= BeanUtil.fillBeanWithMap(data, new SkrRelshipProve(), false);
relshipProves.add(skrRelshipProve); relshipProves.add(skrRelshipProve);
} catch (Exception e) { } catch (Exception e) {
log.info("调用MDM接口出错{}", e.getMessage()); log.info("调用MDM接口出错 url{}, fileUrl{}, e{}", url, fileUrl, e);
throw new ApiException(e.getMessage()); throw new ApiException(e.getMessage());
} finally { } finally {
outputStream.close(); outputStream.close();
@@ -319,7 +319,7 @@ public class FlowServiceImpl implements FlowService {
return JSONObject.toJSONString(responseEntity.getBody().getData()); return JSONObject.toJSONString(responseEntity.getBody().getData());
} }
} catch (Exception e) { } catch (Exception e) {
log.info("调用MDM接口出错{}", e); log.info("调用MDM接口出错 url{}, e{}", url, e);
throw new ApiException(e.getMessage()); throw new ApiException(e.getMessage());
} }
return null; return null;
@@ -340,7 +340,7 @@ public class FlowServiceImpl implements FlowService {
return accessTokenDTO.getAccessToken(); return accessTokenDTO.getAccessToken();
} }
} catch (Exception e) { } catch (Exception e) {
log.info("调用MDM接口出错{}", e); log.info("获取MDM Token 出错 url:\t{}, e:\t{}", url, e);
throw new ApiException(e.getMessage()); throw new ApiException(e.getMessage());
} }
return null; return null;

View File

@@ -48,7 +48,7 @@ public class ContentController {
@PostMapping("/modify") @PostMapping("/modify")
@ApiOperation("修改动态") @ApiOperation("修改动态")
public ResponseResult updateContent(@RequestBody ContentUpdateDto dto) { public ResponseResult updateContent(@RequestBody ContentUpdateDto dto) throws ApiException {
contentService.updateContent(dto); contentService.updateContent(dto);
return ResponseResult.success(); return ResponseResult.success();
} }