mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
提交对课程审核的调整
This commit is contained in:
@@ -15,6 +15,8 @@ import com.xboe.module.boecase.entity.CasesMajorType;
|
||||
import com.xboe.module.boecase.vo.CaseExportVo;
|
||||
import com.xboe.module.dict.entity.DictItem;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -313,6 +315,9 @@ public class CasesApi extends ApiBaseController {
|
||||
if(cases.getExcellent()==null){
|
||||
cases.setExcellent(false);
|
||||
}
|
||||
if(StringUtils.isBlank(cases.getConfidentialityLevel())) {
|
||||
cases.setConfidentialityLevel("内部");
|
||||
}
|
||||
try {
|
||||
casesService.save(cases);
|
||||
return success(true);
|
||||
@@ -341,6 +346,9 @@ public class CasesApi extends ApiBaseController {
|
||||
if(cases.getExcellent()==null){
|
||||
cases.setExcellent(false);
|
||||
}
|
||||
if(StringUtils.isBlank(cases.getConfidentialityLevel())) {
|
||||
cases.setConfidentialityLevel("内部");
|
||||
}
|
||||
try {
|
||||
casesService.update(cases);
|
||||
return success(true);
|
||||
|
||||
@@ -8,6 +8,7 @@ import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -16,23 +17,28 @@ import com.xboe.common.Pagination;
|
||||
import com.xboe.core.CurrentUser;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.log.AutoLog;
|
||||
import com.xboe.module.course.dto.CourseFullDto;
|
||||
import com.xboe.module.course.dto.CourseHRBPAuditDto;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseAudit;
|
||||
import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.entity.CourseHRBPAudit;
|
||||
import com.xboe.module.course.service.ICourseAuditService;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseHRBPAuditService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.standard.enums.BoedxContentType;
|
||||
import com.xboe.standard.enums.BoedxCourseType;
|
||||
import com.xboe.system.logs.entity.SysLogAudit;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 用于课程的审核处理,指定审核 ,审核信息查询 ,审核 日志,审核,发布并审核.
|
||||
* 当前审核,发布并审核.还在manager中,未移过来
|
||||
* @author seastar
|
||||
*
|
||||
* 因为它是后续添加的,之前的一些操作,有的还在manager中,未移过来
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@@ -48,6 +54,9 @@ public class CourseAuditApi extends ApiBaseController{
|
||||
@Resource
|
||||
ICourseService courseService;
|
||||
|
||||
@Resource
|
||||
private ICourseContentService ccontentService;
|
||||
|
||||
/**
|
||||
* 教师需要审核的课程
|
||||
* @param pager
|
||||
@@ -167,23 +176,125 @@ public class CourseAuditApi extends ApiBaseController{
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/logs")
|
||||
public JsonResponse<List<SysLogAudit>> auditAppoint(String courseId,String teacherId,Boolean all){
|
||||
if(StringUtils.isBlank(courseId)){
|
||||
return badRequest("参数错误");
|
||||
// @PostMapping("/logs")
|
||||
// public JsonResponse<List<SysLogAudit>> auditAppoint(String courseId,String teacherId,Boolean all){
|
||||
// if(StringUtils.isBlank(courseId)){
|
||||
// return badRequest("参数错误");
|
||||
// }
|
||||
// CurrentUser cu=getCurrent();
|
||||
// if(StringUtils.isBlank(teacherId)){
|
||||
// if(all==null || !all) {
|
||||
// teacherId=cu.getAccountId();//老师的id
|
||||
// }
|
||||
// }
|
||||
// try {
|
||||
// List<SysLogAudit> list=service.findLogs(courseId, teacherId);
|
||||
// return success(list);
|
||||
// } catch (Exception e) {
|
||||
// log.error("查询课程审核日志错误",e);
|
||||
// return error("查询课程审核日志失败",e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
private String checkForSubmit(Course c) {
|
||||
String error=null;
|
||||
if(StringUtils.isBlank(c.getName())) {
|
||||
error="课程标题没有";
|
||||
}
|
||||
CurrentUser cu=getCurrent();
|
||||
if(StringUtils.isBlank(teacherId)){
|
||||
if(all==null || !all) {
|
||||
teacherId=cu.getAccountId();//老师的id
|
||||
if(StringUtils.isBlank(c.getResOwner1())) {
|
||||
error="未设置资源归属";
|
||||
}
|
||||
if(StringUtils.isBlank(c.getSysType1())) {
|
||||
error="未设置分类";
|
||||
}
|
||||
if(StringUtils.isBlank(c.getForUsers())) {
|
||||
error="未设置目标人群";
|
||||
}
|
||||
|
||||
//检查是否有课程内容
|
||||
List<CourseContent> cclist = ccontentService.getByCheckByCourseId(c.getId());
|
||||
if(cclist.isEmpty()) {
|
||||
error="课程还没有内容,不能提交审核";
|
||||
}
|
||||
if(c.getType()==BoedxCourseType.WeiKe.value()){
|
||||
//微课就一项内容,cclist不为空就可以了,如果更细的判断,那就要单独的处理了
|
||||
boolean has=false;
|
||||
for(CourseContent cc : cclist) {
|
||||
if(cc.getSortIndex()==1) {
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has) {
|
||||
error="还没有课件信息,不能提交";
|
||||
}
|
||||
}else if(c.getType()==BoedxCourseType.LuboKe.value()) {
|
||||
for(CourseContent cc : cclist) {
|
||||
if(cc.getContentType()<BoedxContentType.Html.value()) {
|
||||
if(StringUtils.isBlank(cc.getContentRefId())) {
|
||||
error="课程内容["+cc.getContentName()+"]没有相应的课件信息";
|
||||
break;
|
||||
}
|
||||
}else if(cc.getContentType()==BoedxContentType.Html.value() || cc.getContentType()==BoedxContentType.Scrom.value()) {
|
||||
// if(StringUtils.isBlank(cc.getContent())) {
|
||||
// error="课程内容["+cc.getContentName()+"]信息不全";
|
||||
// break;
|
||||
// }
|
||||
}else if(cc.getContentType()==BoedxContentType.Homework.value()) {
|
||||
//作业检查
|
||||
}else if(cc.getContentType()==BoedxContentType.Exam.value()) {
|
||||
//考试
|
||||
}else if(cc.getContentType()==BoedxContentType.Assess.value()) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
List<SysLogAudit> list=service.findLogs(courseId, teacherId);
|
||||
return success(list);
|
||||
} catch (Exception e) {
|
||||
log.error("查询课程审核日志错误",e);
|
||||
return error("查询课程审核日志失败",e.getMessage());
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@AutoLog(module = "课程",action = "默认管理员直接提交发布",info = "")
|
||||
public JsonResponse<Boolean> submitAndPublish(@RequestBody CourseFullDto dto){
|
||||
if(dto.getCourse()==null){
|
||||
return badRequest("无课程信息");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(dto.getCourse().getId())) {
|
||||
return badRequest("未保存课程不能提交");
|
||||
}
|
||||
String error=checkForSubmit(dto.getCourse());
|
||||
if(error!=null) {
|
||||
return badRequest(error);
|
||||
}
|
||||
|
||||
if(dto.getTeachers()==null || dto.getTeachers().isEmpty()) {
|
||||
return badRequest("请添加授课老师");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(dto.getCourse().getName())) {
|
||||
return badRequest("请填写标题");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(dto.getCourse().getOrgId())) {
|
||||
return badRequest("请选择资源归属");
|
||||
}
|
||||
|
||||
dto.getCourse().setStatus(Course.STATUS_AUDIT_FINISH);//设置为审核通过状态
|
||||
dto.getCourse().setEnabled(true);//设置启用状态问题
|
||||
dto.getCourse().setPublished(false);//重新提交审核设置为未发布状态
|
||||
try {
|
||||
courseService.submitAndPublish(dto);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("默认管理员提交直接发布处理失败",e);
|
||||
e.printStackTrace();
|
||||
return error("发布课程失败",e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//以下两个方法是公开课的审核
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ import com.xboe.core.api.ApiBaseController;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 新建立的用于hrbp审核的,还未移过来
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xboe/m/course/HRBP/audit")
|
||||
public class CourseHRBPAuditApi extends ApiBaseController {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.module.course.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.course.entity.CourseAudit;
|
||||
|
||||
@Repository
|
||||
public class CourseAuditRecordDao extends BaseDao<CourseAudit>{
|
||||
|
||||
}
|
||||
@@ -23,15 +23,15 @@ public interface ICourseAuditService {
|
||||
// */
|
||||
// int countWaitAudit(String aid);
|
||||
//
|
||||
/**
|
||||
* 审核课程查询
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param dto
|
||||
* @param aid 审核人的id
|
||||
* @return
|
||||
*/
|
||||
PageList<Course> findAuditPage(int pageIndex, int pageSize, CourseQueryDto dto,String aid);
|
||||
// /**
|
||||
// * 审核课程查询
|
||||
// * @param pageIndex
|
||||
// * @param pageSize
|
||||
// * @param dto
|
||||
// * @param aid 审核人的id
|
||||
// * @return
|
||||
// */
|
||||
// PageList<Course> findAuditPage(int pageIndex, int pageSize, CourseQueryDto dto,String aid);
|
||||
|
||||
|
||||
/**
|
||||
@@ -53,22 +53,16 @@ public interface ICourseAuditService {
|
||||
*/
|
||||
List<CourseAudit> findAudit(String courseId,String teacherId);
|
||||
|
||||
/**
|
||||
* 查询课程的审核记录信息
|
||||
* @param courseId
|
||||
* @param teacherId
|
||||
* @return
|
||||
*/
|
||||
List<SysLogAudit> findLogs(String courseId,String teacherId);
|
||||
|
||||
// /**
|
||||
// * 课程审核
|
||||
// * @param id
|
||||
// * @param pass
|
||||
// * @param aid
|
||||
// * @param name
|
||||
// * @param remark
|
||||
// * @param publish 是否发布
|
||||
// * 查询课程的审核记录信息
|
||||
// * @param courseId
|
||||
// * @param teacherId
|
||||
// * @return
|
||||
// */
|
||||
// void audit(String id,Boolean pass,String aid,String name,String remark,boolean publish);
|
||||
// List<SysLogAudit> findLogs(String courseId,String teacherId);
|
||||
|
||||
//以下是新增加的公开课的审核
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -165,6 +165,13 @@ public interface ICourseService {
|
||||
*/
|
||||
void submit(CourseFullDto full)throws Exception;
|
||||
|
||||
/**
|
||||
* 用于默认管理员,直接提交发布,不走审核流程
|
||||
* @param full
|
||||
* @throws Exception
|
||||
*/
|
||||
void submitAndPublish(CourseFullDto full)throws Exception;
|
||||
|
||||
/**
|
||||
* 提交一个课程
|
||||
* @param audit
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.xboe.module.course.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.transaction.Transactional;
|
||||
@@ -13,9 +11,9 @@ import org.springframework.stereotype.Service;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.core.orm.UpdateBuilder;
|
||||
import com.xboe.module.course.dao.CourseAuditDao;
|
||||
import com.xboe.module.course.dao.CourseAuditRecordDao;
|
||||
import com.xboe.module.course.dao.CourseDao;
|
||||
import com.xboe.module.course.dao.CourseHRBPAuditDao;
|
||||
import com.xboe.module.course.dto.CourseQueryDto;
|
||||
@@ -23,9 +21,6 @@ import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseAudit;
|
||||
import com.xboe.module.course.entity.CourseHRBPAudit;
|
||||
import com.xboe.module.course.service.ICourseAuditService;
|
||||
import com.xboe.system.authority.entity.ResDataManager;
|
||||
import com.xboe.system.logs.dao.SysLogAuditDao;
|
||||
import com.xboe.system.logs.entity.SysLogAudit;
|
||||
|
||||
@Service
|
||||
public class CourseAuditServiceImpl implements ICourseAuditService{
|
||||
@@ -34,10 +29,10 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
|
||||
CourseAuditDao auditDao;
|
||||
|
||||
@Resource
|
||||
SysLogAuditDao auditLogDao;
|
||||
CourseAuditRecordDao auditRecordDao;
|
||||
|
||||
@Resource
|
||||
private CourseHRBPAuditDao courseHRBPAuditDao;
|
||||
CourseHRBPAuditDao courseHRBPAuditDao;
|
||||
|
||||
@Resource
|
||||
CourseDao courseDao;
|
||||
@@ -82,48 +77,48 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogAudit> findLogs(String courseId, String teacherId) {
|
||||
|
||||
if(StringUtils.isBlank(teacherId)) {
|
||||
return auditLogDao.findList(OrderCondition.idDesc(),
|
||||
FieldFilters.eq("objType", 1),
|
||||
FieldFilters.eq("objId", courseId)
|
||||
);
|
||||
}else {
|
||||
return auditLogDao.findList(OrderCondition.idDesc(),
|
||||
FieldFilters.eq("objType", 1),
|
||||
FieldFilters.eq("objId", courseId),
|
||||
FieldFilters.eq("sysCreateAid", teacherId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<Course> findAuditPage(int pageIndex, int pageSize, CourseQueryDto dto, String aid) {
|
||||
|
||||
// List<IFieldFilter> filters = createFilters(dto);
|
||||
// //自动添加过滤已删除
|
||||
// filters.add(FieldFilters.eq("deleted",false));
|
||||
// filters.add(FieldFilters.eq("enabled",true));
|
||||
// @Override
|
||||
// public List<SysLogAudit> findLogs(String courseId, String teacherId) {
|
||||
//
|
||||
// filters.add(FieldFilters.eq("auditAid", aid));
|
||||
//
|
||||
// OrderCondition oc=null;
|
||||
// if(StringUtils.isNotBlank(dto.getOrderField())) {
|
||||
// if(dto.getOrderAsc()||dto.getOrderAsc()==null) {
|
||||
// oc=OrderCondition.asc(dto.getOrderField());
|
||||
// }else {
|
||||
// oc=OrderCondition.desc(dto.getOrderField());
|
||||
// }
|
||||
// if(StringUtils.isBlank(teacherId)) {
|
||||
// return auditLogDao.findList(OrderCondition.idDesc(),
|
||||
// FieldFilters.eq("objType", 1),
|
||||
// FieldFilters.eq("objId", courseId)
|
||||
// );
|
||||
// }else {
|
||||
// oc=OrderCondition.desc("id");
|
||||
// return auditLogDao.findList(OrderCondition.idDesc(),
|
||||
// FieldFilters.eq("objType", 1),
|
||||
// FieldFilters.eq("objId", courseId),
|
||||
// FieldFilters.eq("sysCreateAid", teacherId)
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
||||
//
|
||||
// return rs;
|
||||
return null;
|
||||
}
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public PageList<Course> findAuditPage(int pageIndex, int pageSize, CourseQueryDto dto, String aid) {
|
||||
//
|
||||
//// List<IFieldFilter> filters = createFilters(dto);
|
||||
//// //自动添加过滤已删除
|
||||
//// filters.add(FieldFilters.eq("deleted",false));
|
||||
//// filters.add(FieldFilters.eq("enabled",true));
|
||||
////
|
||||
//// filters.add(FieldFilters.eq("auditAid", aid));
|
||||
////
|
||||
//// OrderCondition oc=null;
|
||||
//// if(StringUtils.isNotBlank(dto.getOrderField())) {
|
||||
//// if(dto.getOrderAsc()||dto.getOrderAsc()==null) {
|
||||
//// oc=OrderCondition.asc(dto.getOrderField());
|
||||
//// }else {
|
||||
//// oc=OrderCondition.desc(dto.getOrderField());
|
||||
//// }
|
||||
//// }else {
|
||||
//// oc=OrderCondition.desc("id");
|
||||
//// }
|
||||
////
|
||||
//// PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
||||
////
|
||||
//// return rs;
|
||||
// return null;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -722,6 +722,34 @@ public class CourseServiceImpl implements ICourseService {
|
||||
courseHRBPAuditDao.save(hrbpAudit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitAndPublish(CourseFullDto full) throws Exception {
|
||||
|
||||
Course c=full.getCourse();//当前的课程信息
|
||||
c.setPublished(true);
|
||||
c.setPublishTime(LocalDateTime.now());
|
||||
courseDao.update(c);
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if(full.getTeachers()!=null && !full.getTeachers().isEmpty()) {
|
||||
for(CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
courseCrowdDao.deleteByField("courseId", c.getId());
|
||||
if(full.getCrowds()!=null && !full.getCrowds().isEmpty()) {
|
||||
for(CourseCrowd cc : full.getCrowds()) {
|
||||
cc.setCourseId(c.getId());
|
||||
courseCrowdDao.saveOrUpdate(cc);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submit(CourseHRBPAudit hrbpAudit) throws Exception {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user