feat:BPM提交审核(创建审核部分,还缺少编辑审核部分)

This commit is contained in:
yangxinyu
2025-12-12 11:36:24 +08:00
parent c01a69c9df
commit f43d52c210
3 changed files with 68 additions and 4 deletions

View File

@@ -693,7 +693,7 @@ public class CourseManageApi extends ApiBaseController{
}
/**
* 25.12.10新增提交审核到BPM
*
*暂无BPM接口
*
*/
@PostMapping("/bpm-submit")
@@ -734,7 +734,6 @@ public class CourseManageApi extends ApiBaseController{
bpmResponsedto.setStatus("success");
bpmResponsedto.setAuditId("audit123456");
bpmResponsedto.setAuditApprover("管理员hrbp");
return success(bpmResponsedto);
}
else{
@@ -744,10 +743,23 @@ public class CourseManageApi extends ApiBaseController{
CourseHRBPAudit previousAudit = hrbpAuditService.hadAuditing(courseId);
if (previousAudit != null) {
// 存在历史审核记录,视为编辑审核
//编辑课程审核需要后端服务整理出本次编辑的内容与编辑前的前后差异提交至BPM系统。
dto.setAuditType(2);
} else {
// 无历史审核记录,视为创建审核
dto.setAuditType(1);
// 准备创建审核的JSON请求体,暂时先按照京东方大学堂后端调用BPM系统需要的接口文档的入参示例完成等到有外部接口时再修改
String jsonRequestBody = courseManageService.prepareCreateAuditRequest(dto);
// TODO: 调用BPM接口
// BPMResponseDto bpmResponsedto= courseManageService.callBPMInterface(jsonRequestBody);
// 构造返回结果
//实际使用中返回的值从BPM接口返回的JSON中获取
BPMResponseDto bpmResponsedto = new BPMResponseDto();
bpmResponsedto.setStatus("success");
bpmResponsedto.setAuditId("audit123456");
bpmResponsedto.setAuditApprover("管理员hrbp");
return success(bpmResponsedto);
}
}

View File

@@ -4,6 +4,16 @@ import com.xboe.module.course.dto.BPMResponseDto;
import com.xboe.module.course.dto.CourseFullDto;
public interface ICourseManageService {
/**
* 25.12.10新增,调用外部接口前,启用/停用进行数据准备和json请求体构建
*/
String prepareDisableAuditRequest(CourseFullDto dto);
/**
* 25.12.10新增调用外部接口前创建进行数据准备和json请求体构建
*/
String prepareCreateAuditRequest(CourseFullDto dto);
/**
* 25.12.10新增BPM外部接口调用
*/
BPMResponseDto callBPMInterface(String jsonRequestBody);
}

View File

@@ -18,7 +18,7 @@ public class CourseManageServiceImpl implements ICourseManageService {
@Autowired
private OkHttpUtil okHttpUtil;
/**
* 调用外部接口前讲DTO转换成JSON字符串
* 启用/停用调用外部接口前讲DTO转换成JSON字符串
*/
@Override
public String prepareDisableAuditRequest(CourseFullDto dto) {
@@ -58,7 +58,49 @@ public class CourseManageServiceImpl implements ICourseManageService {
}
}
/**
* 调用外部接口
* 创建调用外部接口前讲DTO转换成JSON字符串
*/
@Override
public String prepareCreateAuditRequest(CourseFullDto dto) {
try {
// 创建顶层对象
Map<String, Object> request = new HashMap<>();
// 构造auditContent部分
Map<String, Object> auditContent = new HashMap<>();
auditContent.put("auditType", "创建课程");
// 构造courseInfo部分
Map<String, Object> courseInfo = new HashMap<>();
courseInfo.put("name", dto.getCourse().getName());
//几级分类?几级归属?
courseInfo.put("sysType", dto.getCourse().getSysType1());
courseInfo.put("resOwner", dto.getCourse().getResOwner1());
courseInfo.put("teacherName", dto.getCourse().getTeacher());
courseInfo.put("forUsers", dto.getCourse().getForUsers());
courseInfo.put("tags", dto.getCourse().getTags());
courseInfo.put("device", dto.getCourse().getDevice());
courseInfo.put("coverImg", dto.getCourse().getCoverImg());
courseInfo.put("value", dto.getCourse().getValue());
courseInfo.put("summary", dto.getCourse().getSummary());
//课程目录等到拿到BPM接口需要查看getCatalogTree()得到的格式是否与BPM需要的格式一致
courseInfo.put("sections", dto.getCatalogTree());
auditContent.put("courseInfo", courseInfo);
// 将auditContent放入请求体
request.put("auditContent", auditContent);
// 添加用户ID
request.put("userId", dto.getUserId());
// 转换为JSON字符串
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.writeValueAsString(request);
} catch (Exception e) {
throw new RuntimeException("构造创建审核JSON请求体失败", e);
}
}
/**
* 调用BPM外部接口
*/
@Override
public BPMResponseDto callBPMInterface(String jsonRequestBody){