Commit 0660e9f8 by jianan

Fna接口20

parent 0733ad4e
......@@ -72,7 +72,7 @@ public class ApiFnaController {
@PostMapping("/delete")
@Operation(summary = "删除流程")
public Result<Boolean> deleteFna(@RequestBody DeleteFnaRequest deleteRequest, HttpServletRequest request) {
if (deleteRequest == null || deleteRequest.getId() == null) {
if (deleteRequest == null || StringUtils.isBlank(deleteRequest.getFnaBizId())) {
throw new BusinessException(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
return Result.success(fnaService.deleteFna(deleteRequest));
......@@ -121,19 +121,19 @@ public class ApiFnaController {
}
/**
* 根据 id 获取fna(封装类)
* 根据 fnaBizId 获取fna(封装类)
*
* @param id
* @param fnaBizId
* @return
*/
@GetMapping("/get/vo")
@Operation(summary = "流程详情")
public Result<FnaVO> getFnaVOById(long id, HttpServletRequest request) {
if (id == 0) {
public Result<FnaVO> getFnaVOByBizId(String fnaBizId, HttpServletRequest request) {
if (StringUtils.isBlank(fnaBizId)) {
return Result.fail(ErrorCode.PARAMS_ERROR.getCode(), ErrorCode.PARAMS_ERROR.getMessage());
}
// 查询数据库
Fna fna = fnaService.getById(id);
Fna fna = fnaService.getByBizId(fnaBizId);
if (fna == null) {
return Result.fail(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
......
......@@ -4,5 +4,5 @@ import lombok.Data;
@Data
public class DeleteFnaRequest {
private Long id;
private String fnaBizId;
}
......@@ -12,6 +12,7 @@ import java.time.LocalDateTime;
/**
* 查询fna请求
*/
@Schema(description = "查询fna请求")
@EqualsAndHashCode(callSuper = true)
@Data
public class FnaQueryRequest extends PageDto implements Serializable {
......@@ -19,14 +20,16 @@ public class FnaQueryRequest extends PageDto implements Serializable {
/**
* 创建时间开始
*/
@Schema(description = "创建时间开始", example = "2025-07-31 00:00:00")
@Schema(description = "创建时间开始 2025-07-31 00:00:00",
pattern = "yyyy-MM-dd HH:mm:ss", example = "2025-07-31 00:00:00", defaultValue = "2025-07-31 00:00:00")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime startTime;
/**
* 创建时间结束
*/
@Schema(description = "创建时间结束", example = "2025-07-31 23:59:59")
@Schema(description = "创建时间结束 2025-07-31 23:59:59",
pattern = "yyyy-MM-dd HH:mm:ss", example = "2025-07-31 23:59:59", defaultValue = "2025-07-31 23:59:59")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime endTime;
......
......@@ -4,7 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 更新fna请求
......@@ -16,7 +15,7 @@ public class FnaUpdateRequest implements Serializable {
/**
* fna唯一业务ID
*/
@Schema(description = "fna唯一业务ID")
@Schema(description = "fna唯一业务ID", nullable = true)
private String fnaBizId;
/**
......
......@@ -212,14 +212,14 @@ public class FnaServiceImpl extends ServiceImpl<FnaMapper, Fna> implements FnaSe
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteFna(DeleteFnaRequest deleteRequest) {
Long id = deleteRequest.getId();
String fnaBizId = deleteRequest.getFnaBizId();
// 判断是否存在
Fna oldFna = this.getById(id);
Fna oldFna = this.getByBizId(fnaBizId);
if (oldFna == null) {
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
}
// 操作数据库
boolean result = this.removeById(id);
boolean result = this.removeById(oldFna.getId());
if (!result) {
throw new BusinessException(ErrorCode.OPERATION_ERROR.getCode(), ErrorCode.OPERATION_ERROR.getMessage());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment