mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-14 21:36:48 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
package com.xboe.module.course.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程学习的传输类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CourseStudyDto {
|
||||||
|
|
||||||
|
/**id,对于原系统是kid*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**es中的id*/
|
||||||
|
private String esId;
|
||||||
|
|
||||||
|
/**用户账号的id*/
|
||||||
|
private String accountId;
|
||||||
|
|
||||||
|
/**课程的id*/
|
||||||
|
private String courseId;
|
||||||
|
|
||||||
|
/**课程类型,10无目录录播课,20 有目录录播课,30:面授课;40学习项目*/
|
||||||
|
private Integer courseType;
|
||||||
|
|
||||||
|
/**课程的名称*/
|
||||||
|
private String courseName;
|
||||||
|
|
||||||
|
/**课程的图片*/
|
||||||
|
private String courseImage;
|
||||||
|
|
||||||
|
/**课程来源,1表老系统,2表学员端,3表管理端*/
|
||||||
|
private Integer source;
|
||||||
|
|
||||||
|
/**报名时间,时间秒*/
|
||||||
|
private Long startTime;
|
||||||
|
|
||||||
|
/**状态,1表未开始,2表进行中,9表已完成*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**学习进度0-100的值*/
|
||||||
|
private Integer progress;
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.xboe.module.course.service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.xboe.common.PageList;
|
||||||
|
import com.xboe.module.course.dto.CourseStudyDto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 课程学习查询
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ICourseStudySearch {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 索引名称,固定的值
|
||||||
|
*/
|
||||||
|
public static final String IndexName="new_study_resource";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建索引
|
||||||
|
* @param indexName
|
||||||
|
*/
|
||||||
|
void createIndex() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除索引
|
||||||
|
* @param indexName
|
||||||
|
*/
|
||||||
|
void deleteIndex();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布学习课程,如果存在就更新,不存在就添加
|
||||||
|
* @param dto
|
||||||
|
* @param docId
|
||||||
|
*/
|
||||||
|
String publishOrUpdate(CourseStudyDto dto,String docId) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param startRow
|
||||||
|
* @param pageSize
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
PageList<CourseStudyDto> search(int startRow, int pageSize, CourseStudyDto dto) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新字段
|
||||||
|
* @param field
|
||||||
|
* @param value
|
||||||
|
* @param docId
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void updateFieldByDocId(String field,Object value, String docId) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新状态和进度
|
||||||
|
* @param docId
|
||||||
|
* @param status
|
||||||
|
* @param process
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void updateStatusAndProcessByDocId(String docId,int status,int process) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除课程
|
||||||
|
* @param id
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void removeByDocId(String id) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据学习id删除
|
||||||
|
* @param id
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void removeByStudyId(String id);
|
||||||
|
}
|
||||||
@@ -394,7 +394,6 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
|||||||
|
|
||||||
if(StringUtils.isNotBlank(params.getKeywords())) {
|
if(StringUtils.isNotBlank(params.getKeywords())) {
|
||||||
|
|
||||||
|
|
||||||
String words=QueryParser.escape(params.getKeywords());
|
String words=QueryParser.escape(params.getKeywords());
|
||||||
|
|
||||||
// System.out.println(params.getKeywords());
|
// System.out.println(params.getKeywords());
|
||||||
|
|||||||
@@ -0,0 +1,286 @@
|
|||||||
|
package com.xboe.module.elasticsearc;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.lucene.queryparser.classic.QueryParser;
|
||||||
|
import org.elasticsearch.action.DocWriteResponse;
|
||||||
|
import org.elasticsearch.action.delete.DeleteRequest;
|
||||||
|
import org.elasticsearch.action.delete.DeleteResponse;
|
||||||
|
import org.elasticsearch.action.get.GetRequest;
|
||||||
|
import org.elasticsearch.action.index.IndexRequest;
|
||||||
|
import org.elasticsearch.action.index.IndexResponse;
|
||||||
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
|
import org.elasticsearch.action.update.UpdateRequest;
|
||||||
|
import org.elasticsearch.action.update.UpdateResponse;
|
||||||
|
import org.elasticsearch.client.RequestOptions;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.client.indices.CreateIndexRequest;
|
||||||
|
import org.elasticsearch.client.indices.CreateIndexResponse;
|
||||||
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
|
import org.elasticsearch.index.query.TermQueryBuilder;
|
||||||
|
import org.elasticsearch.index.reindex.BulkByScrollResponse;
|
||||||
|
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
||||||
|
import org.elasticsearch.search.SearchHit;
|
||||||
|
import org.elasticsearch.search.SearchHits;
|
||||||
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||||
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.xboe.common.PageList;
|
||||||
|
import com.xboe.module.course.dto.CourseStudyDto;
|
||||||
|
import com.xboe.module.course.service.ICourseStudySearch;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程学习的ES实现
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class CourseStudyElasticsearchImpl implements ICourseStudySearch{
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
RestHighLevelClient restHighLevelClient;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
ElasticsearchUtil esUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createIndex() throws Exception{
|
||||||
|
boolean isExists = esUtil.isIndexExists(IndexName);
|
||||||
|
if(isExists) {
|
||||||
|
throw new Exception("索引已存在");
|
||||||
|
}
|
||||||
|
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||||
|
builder.startObject();
|
||||||
|
builder.field("properties").startObject();
|
||||||
|
builder.field("id").startObject().field("index", "true").field("type", "keyword").endObject();
|
||||||
|
builder.field("accountId").startObject().field("type", "keyword").endObject();
|
||||||
|
builder.field("courseId").startObject().field("type", "keyword").endObject();
|
||||||
|
builder.field("courseName").startObject().field("type", "keyword").endObject();
|
||||||
|
builder.field("courseImage").startObject().field("type", "keyword").endObject();
|
||||||
|
builder.field("courseType").startObject().field("type", "integer").endObject();
|
||||||
|
builder.field("source").startObject().field("type", "integer").endObject();
|
||||||
|
builder.field("startTime").startObject().field("type", "integer").endObject();
|
||||||
|
builder.field("status").startObject().field("type", "integer").endObject();
|
||||||
|
builder.field("progress").startObject().field("type", "integer").endObject();
|
||||||
|
builder.endObject();
|
||||||
|
builder.endObject();
|
||||||
|
|
||||||
|
CreateIndexRequest createIndexRequest = new CreateIndexRequest(IndexName);
|
||||||
|
createIndexRequest.mapping(builder);
|
||||||
|
CreateIndexResponse createIndexResponse = restHighLevelClient.indices().create(createIndexRequest, RequestOptions.DEFAULT);
|
||||||
|
boolean acknowledged = createIndexResponse.isAcknowledged();
|
||||||
|
if (!acknowledged) {
|
||||||
|
log.error("创建课程学习索引失败",createIndexResponse);
|
||||||
|
throw new Exception("创建索引失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteIndex() {
|
||||||
|
esUtil.deleteIndex(IndexName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String publishOrUpdate(CourseStudyDto dto,String docId) throws IOException {
|
||||||
|
|
||||||
|
boolean exists=false;
|
||||||
|
if(StringUtils.isNotBlank(docId)) {
|
||||||
|
GetRequest getRequest=new GetRequest(IndexName,docId);
|
||||||
|
exists = restHighLevelClient.exists(getRequest, RequestOptions.DEFAULT);
|
||||||
|
}
|
||||||
|
//System.out.println(item.getName()+"="+item.getType());
|
||||||
|
if(exists) {
|
||||||
|
UpdateRequest updateRequest = new UpdateRequest(IndexName, docId);
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
String textJson =mapper.writeValueAsString(dto);
|
||||||
|
updateRequest.doc(textJson, XContentType.JSON);
|
||||||
|
UpdateResponse updateResponse = restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
|
||||||
|
int ok=updateResponse.status().getStatus();
|
||||||
|
if (ok!=200) {
|
||||||
|
log.error("更新【"+docId+"】失败",updateResponse);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
IndexRequest indexRequest = new IndexRequest(IndexName);
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
String textJson =mapper.writeValueAsString(dto);
|
||||||
|
indexRequest.source(textJson, XContentType.JSON);
|
||||||
|
|
||||||
|
IndexResponse indexResponse = restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
|
||||||
|
if (indexResponse != null) {
|
||||||
|
String id = indexResponse.getId();
|
||||||
|
String index = indexResponse.getIndex();
|
||||||
|
long version = indexResponse.getVersion();
|
||||||
|
|
||||||
|
if (indexResponse.getResult() == DocWriteResponse.Result.CREATED) {
|
||||||
|
log.info("新增全文索引文档成功! " + index + "-" + id + "-" + version);
|
||||||
|
return id;
|
||||||
|
} else if (indexResponse.getResult() == DocWriteResponse.Result.UPDATED) {
|
||||||
|
log.info("修改文档成功!");
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return docId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFieldByDocId(String field, Object value, String docId) throws Exception {
|
||||||
|
UpdateRequest updateRequest = new UpdateRequest(IndexName, docId);
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
Map<String,Object> map=new HashMap<String,Object>();
|
||||||
|
map.put(field, value);
|
||||||
|
String textJson =mapper.writeValueAsString(map);
|
||||||
|
|
||||||
|
updateRequest.doc(textJson, XContentType.JSON);
|
||||||
|
UpdateResponse updateResponse = restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
|
||||||
|
if (updateResponse.getResult() == DocWriteResponse.Result.UPDATED) {
|
||||||
|
log.info("更新课程学习字段【"+docId+"】【"+field+"】成功!");
|
||||||
|
} else {
|
||||||
|
log.error("更新课程学习字段【"+docId+"】【"+field+"】失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeByDocId(String id) throws Exception {
|
||||||
|
|
||||||
|
DeleteRequest deleteRequest = new DeleteRequest(IndexName);
|
||||||
|
deleteRequest.id(id);
|
||||||
|
try {
|
||||||
|
DeleteResponse deleteResponse = restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
|
||||||
|
if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
|
||||||
|
log.error("删除失败,未找到索引id是【"+id+"】的文档");
|
||||||
|
}
|
||||||
|
//restHighLevelClient.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("删除ES索引错误",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageList<CourseStudyDto> search(int startRow, int pageSize, CourseStudyDto dto) throws Exception {
|
||||||
|
BoolQueryBuilder boolQuery= QueryBuilders.boolQuery();
|
||||||
|
if(StringUtils.isNotBlank(dto.getCourseName())) {
|
||||||
|
String words=QueryParser.escape(dto.getCourseName());
|
||||||
|
boolQuery.filter(QueryBuilders.wildcardQuery("courseName", "*"+words+"*"));
|
||||||
|
}
|
||||||
|
if(dto.getCourseType()!=null) {
|
||||||
|
if(dto.getCourseType()==10) {
|
||||||
|
int[] types=new int[] {10,20};
|
||||||
|
boolQuery.filter(QueryBuilders.termsQuery("courseType",types));
|
||||||
|
}else {
|
||||||
|
boolQuery.filter(QueryBuilders.termQuery("courseType",dto.getCourseType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dto.getStatus()!=null) {
|
||||||
|
boolQuery.filter(QueryBuilders.termQuery("status",dto.getStatus()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dto.getSource()!=null) {
|
||||||
|
boolQuery.filter(QueryBuilders.termQuery("source",dto.getSource()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dto.getAccountId()!=null) {
|
||||||
|
boolQuery.filter(QueryBuilders.termQuery("accountId",dto.getAccountId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SearchRequest searchRequest = new SearchRequest();
|
||||||
|
searchRequest.indices(IndexName);
|
||||||
|
|
||||||
|
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
|
||||||
|
sourceBuilder.from(startRow);
|
||||||
|
sourceBuilder.size(pageSize);
|
||||||
|
|
||||||
|
if(boolQuery.hasClauses()) {
|
||||||
|
sourceBuilder.query(boolQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceBuilder.sort("startTime",SortOrder.DESC);
|
||||||
|
|
||||||
|
sourceBuilder.timeout(new TimeValue(60, TimeUnit.SECONDS));
|
||||||
|
|
||||||
|
searchRequest.source(sourceBuilder);
|
||||||
|
|
||||||
|
//进行查询
|
||||||
|
List<CourseStudyDto> list=new ArrayList<>();
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
SearchResponse response = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
|
||||||
|
SearchHits hits = response.getHits();
|
||||||
|
//log.info("共查询到 : "+hits.getTotalHits());
|
||||||
|
for (SearchHit hit : hits) {
|
||||||
|
String sourceAsString = hit.getSourceAsString();
|
||||||
|
try {
|
||||||
|
CourseStudyDto cft =mapper.readValue(sourceAsString, CourseStudyDto.class);
|
||||||
|
cft.setEsId(hit.getId());
|
||||||
|
list.add(cft);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("转化json到对应失败",sourceAsString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageList<CourseStudyDto> rs=new PageList<CourseStudyDto>();
|
||||||
|
rs.setCount((int)hits.getTotalHits().value);
|
||||||
|
rs.setPageSize(pageSize);
|
||||||
|
rs.setList(list);
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateStatusAndProcessByDocId(String docId, int status, int progress) throws Exception {
|
||||||
|
//更新状态和进度
|
||||||
|
UpdateRequest updateRequest = new UpdateRequest(IndexName, docId);
|
||||||
|
ObjectMapper mapper=new ObjectMapper();
|
||||||
|
Map<String,Object> map=new HashMap<String,Object>();
|
||||||
|
map.put("status",status);
|
||||||
|
map.put("progress",progress);
|
||||||
|
String textJson =mapper.writeValueAsString(map);
|
||||||
|
updateRequest.doc(textJson, XContentType.JSON);
|
||||||
|
UpdateResponse updateResponse = restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
|
||||||
|
if (updateResponse.getResult() == DocWriteResponse.Result.UPDATED) {
|
||||||
|
log.info("更新课程学习状态进度成功!");
|
||||||
|
} else {
|
||||||
|
log.error("更新课程学习状态进度失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeByStudyId(String id) {
|
||||||
|
//根据学习id删除
|
||||||
|
try {
|
||||||
|
DeleteByQueryRequest deleteRequest=new DeleteByQueryRequest(IndexName);
|
||||||
|
deleteRequest.setQuery(new TermQueryBuilder("id",id));
|
||||||
|
BulkByScrollResponse response = restHighLevelClient.deleteByQuery(deleteRequest, RequestOptions.DEFAULT);
|
||||||
|
long n=response.getStatus().getTotal();
|
||||||
|
if(n==0) {
|
||||||
|
log.error("按id删除失败",response);
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
log.error("按id【"+id+"】删除失败",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -37,23 +37,18 @@
|
|||||||
<artifactId>xboe-module-course</artifactId>
|
<artifactId>xboe-module-course</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.xboe</groupId>
|
|
||||||
<artifactId>xboe-module-event</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xboe</groupId>
|
<groupId>com.xboe</groupId>
|
||||||
<artifactId>xboe-module-idconfig</artifactId>
|
<artifactId>xboe-module-idconfig</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xboe</groupId>
|
<groupId>com.xboe</groupId>
|
||||||
<artifactId>xboe-module-es</artifactId>
|
<artifactId>xboe-module-es</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>it.sauronsoftware</groupId>
|
<groupId>it.sauronsoftware</groupId>
|
||||||
<artifactId>jave</artifactId>
|
<artifactId>jave</artifactId>
|
||||||
|
|||||||
@@ -104,9 +104,11 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
|||||||
org.setCode("");
|
org.setCode("");
|
||||||
org.setId(user.getDepartId());
|
org.setId(user.getDepartId());
|
||||||
org.setName(user.getDepartName());
|
org.setName(user.getDepartName());
|
||||||
|
org.setNamePath(user.getOrgNamePath());
|
||||||
org.setDeleted(false);
|
org.setDeleted(false);
|
||||||
org.setStatus(1);
|
org.setStatus(1);
|
||||||
}
|
}
|
||||||
|
org.setName(user.getDepartName());
|
||||||
org.setNamePath(user.getOrgNamePath());
|
org.setNamePath(user.getOrgNamePath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import com.xboe.module.boecase.entity.CasesMajorType;
|
|||||||
import com.xboe.module.boecase.vo.CaseExportVo;
|
import com.xboe.module.boecase.vo.CaseExportVo;
|
||||||
import com.xboe.module.dict.entity.DictItem;
|
import com.xboe.module.dict.entity.DictItem;
|
||||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -50,6 +52,36 @@ public class CasesApi extends ApiBaseController {
|
|||||||
private CasesMajorTypeDao casesMajorTypeDao;
|
private CasesMajorTypeDao casesMajorTypeDao;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于后台管理
|
||||||
|
* @param pager
|
||||||
|
* @param caseVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/manage")
|
||||||
|
public JsonResponse<PageList<Cases>> manage(Pagination pager, CaseVo caseVo){
|
||||||
|
PageList<Cases> views = casesService.managerList(pager.getPageIndex(), pager.getPageSize(), caseVo);
|
||||||
|
if(views!=null){
|
||||||
|
if(views.getList()!=null && !views.getList().isEmpty()){
|
||||||
|
for (Cases c:views.getList()) {
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
List<CasesMajorType> caseId = casesMajorTypeDao.findList(FieldFilters.eq("caseId", c.getId()));
|
||||||
|
if(caseId!=null && !caseId.isEmpty()){
|
||||||
|
for (CasesMajorType cm:caseId) {
|
||||||
|
stringBuffer.append(cm.getMajorId());
|
||||||
|
stringBuffer.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(stringBuffer.length()>0){
|
||||||
|
stringBuffer.deleteCharAt(stringBuffer.length()-1);
|
||||||
|
c.setMajorType(stringBuffer.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success(views);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 案例分页搜索查询 orders 状态 1代表时间最近,2代表热度最高
|
* 案例分页搜索查询 orders 状态 1代表时间最近,2代表热度最高
|
||||||
@@ -313,6 +345,9 @@ public class CasesApi extends ApiBaseController {
|
|||||||
if(cases.getExcellent()==null){
|
if(cases.getExcellent()==null){
|
||||||
cases.setExcellent(false);
|
cases.setExcellent(false);
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isBlank(cases.getConfidentialityLevel())) {
|
||||||
|
cases.setConfidentialityLevel("内部");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
casesService.save(cases);
|
casesService.save(cases);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -341,6 +376,9 @@ public class CasesApi extends ApiBaseController {
|
|||||||
if(cases.getExcellent()==null){
|
if(cases.getExcellent()==null){
|
||||||
cases.setExcellent(false);
|
cases.setExcellent(false);
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isBlank(cases.getConfidentialityLevel())) {
|
||||||
|
cases.setConfidentialityLevel("内部");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
casesService.update(cases);
|
casesService.update(cases);
|
||||||
return success(true);
|
return success(true);
|
||||||
|
|||||||
@@ -550,12 +550,14 @@ public class CasesServiceImpl implements ICasesService {
|
|||||||
@Override
|
@Override
|
||||||
public List<DictItem> majorTypes() {
|
public List<DictItem> majorTypes() {
|
||||||
List<DictItem> major_type = sysDictionaryDao.findByKey("major_type");
|
List<DictItem> major_type = sysDictionaryDao.findByKey("major_type");
|
||||||
String hql="select majorId from CasesMajorType group by majorId";
|
String hql="select cm.majorId,count(cm.id) from CasesMajorType cm,Cases c where cm.caseId=c.id and c.deleted=false and (c.filePath is not null or c.filePath!='') group by cm.majorId";
|
||||||
List<String> listByHql = casesDao.findListByHql(hql);
|
List<Object[]> listByHql = casesDao.findListByHql(hql);
|
||||||
List<DictItem> dictItems = new ArrayList<>();
|
List<DictItem> dictItems = new ArrayList<>();
|
||||||
for (DictItem d:major_type) {
|
for (DictItem d:major_type) {
|
||||||
for (String s:listByHql) {
|
for (Object[] objs:listByHql) {
|
||||||
|
String s=(String)objs[0];
|
||||||
if(d.getCode().equals(s)){
|
if(d.getCode().equals(s)){
|
||||||
|
d.setExplanation(objs[1].toString());
|
||||||
dictItems.add(d);
|
dictItems.add(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import javax.annotation.Resource;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -16,22 +17,26 @@ import com.xboe.common.Pagination;
|
|||||||
import com.xboe.core.CurrentUser;
|
import com.xboe.core.CurrentUser;
|
||||||
import com.xboe.core.JsonResponse;
|
import com.xboe.core.JsonResponse;
|
||||||
import com.xboe.core.api.ApiBaseController;
|
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.CourseHRBPAuditDto;
|
||||||
import com.xboe.module.course.dto.CourseQueryDto;
|
import com.xboe.module.course.dto.CourseQueryDto;
|
||||||
import com.xboe.module.course.entity.Course;
|
import com.xboe.module.course.entity.Course;
|
||||||
import com.xboe.module.course.entity.CourseAudit;
|
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.entity.CourseHRBPAudit;
|
||||||
import com.xboe.module.course.service.ICourseAuditService;
|
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.ICourseHRBPAuditService;
|
||||||
import com.xboe.module.course.service.ICourseService;
|
import com.xboe.module.course.service.ICourseService;
|
||||||
import com.xboe.system.logs.entity.SysLogAudit;
|
import com.xboe.standard.enums.BoedxContentType;
|
||||||
|
import com.xboe.standard.enums.BoedxCourseType;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于课程的审核处理,指定审核 ,审核信息查询 ,审核 日志,审核,发布并审核.
|
* 用于课程的审核处理,指定审核 ,审核信息查询 ,审核 日志,审核,发布并审核.
|
||||||
* 当前审核,发布并审核.还在manager中,未移过来
|
* 因为它是后续添加的,之前的一些操作,有的还在manager中,未移过来
|
||||||
* @author seastar
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -48,6 +53,9 @@ public class CourseAuditApi extends ApiBaseController{
|
|||||||
@Resource
|
@Resource
|
||||||
ICourseService courseService;
|
ICourseService courseService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ICourseContentService ccontentService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 教师需要审核的课程
|
* 教师需要审核的课程
|
||||||
* @param pager
|
* @param pager
|
||||||
@@ -70,7 +78,7 @@ public class CourseAuditApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定审核人
|
* 指定审核人,指定教师审核
|
||||||
* @param auditId
|
* @param auditId
|
||||||
* @param courseId
|
* @param courseId
|
||||||
* @param teacherId
|
* @param teacherId
|
||||||
@@ -104,13 +112,16 @@ public class CourseAuditApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page-records")
|
@PostMapping("/page-records")
|
||||||
public JsonResponse<PageList<CourseHRBPAuditDto>> auditPageRecords(Pagination page, CourseHRBPAuditDto info){
|
public JsonResponse<PageList<CourseHRBPAudit>> auditPageRecords(Pagination page,Integer userType, CourseHRBPAudit info){
|
||||||
// CurrentUser cu=getCurrent();
|
// CurrentUser cu=getCurrent();
|
||||||
// if(StringUtils.isBlank(teacherId)){
|
// if(StringUtils.isBlank(teacherId)){
|
||||||
// teacherId=cu.getAccountId();//老师的id
|
// teacherId=cu.getAccountId();//老师的id
|
||||||
// }
|
// }
|
||||||
|
if(userType==null) {
|
||||||
|
return badRequest("参数错误");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
PageList<CourseHRBPAuditDto> list=hrbpAuditservice.findPageList(page.getPageIndex(),page.getPageSize(),info);
|
PageList<CourseHRBPAudit> list=hrbpAuditservice.pageList(page.getPageIndex(),page.getPageSize(),userType,info);
|
||||||
return success(list);
|
return success(list);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("查询课程审核信息错误",e);
|
log.error("查询课程审核信息错误",e);
|
||||||
@@ -118,6 +129,11 @@ public class CourseAuditApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询课程的所有的审核记录
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@PostMapping("/course-records")
|
@PostMapping("/course-records")
|
||||||
public JsonResponse<List<CourseHRBPAudit>> auditRecords(CourseHRBPAudit info){
|
public JsonResponse<List<CourseHRBPAudit>> auditRecords(CourseHRBPAudit info){
|
||||||
if(StringUtils.isBlank(info.getCourseId())){
|
if(StringUtils.isBlank(info.getCourseId())){
|
||||||
@@ -167,23 +183,270 @@ public class CourseAuditApi extends ApiBaseController{
|
|||||||
* @param remark
|
* @param remark
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/logs")
|
// @PostMapping("/logs")
|
||||||
public JsonResponse<List<SysLogAudit>> auditAppoint(String courseId,String teacherId,Boolean all){
|
// 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="课程标题没有";
|
||||||
|
}
|
||||||
|
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()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/hrbp-detail")
|
||||||
|
public JsonResponse<CourseHRBPAudit> hrbpDetail(String auditId){
|
||||||
|
if(StringUtils.isBlank(auditId)){
|
||||||
|
return badRequest("参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
CourseHRBPAudit detail=hrbpAuditservice.get(auditId);
|
||||||
|
return success(detail);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("查询课程审核信息错误",e);
|
||||||
|
return error("查询审核信息失败",e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 老师审核提交,需要转回到hrbp再审核
|
||||||
|
* @param auditId
|
||||||
|
* @param courseId
|
||||||
|
* @param title
|
||||||
|
* @param pass
|
||||||
|
* @param remark
|
||||||
|
* @param from
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/teacher-submit-audit")
|
||||||
|
public JsonResponse<Boolean> teacherAudit(String auditId,Boolean pass,String remark){
|
||||||
|
if(StringUtils.isBlank(auditId)){
|
||||||
|
return badRequest("参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pass==null){
|
||||||
|
return badRequest("无审核结果信息");
|
||||||
|
}
|
||||||
|
//检查是否允许
|
||||||
|
try {
|
||||||
|
//CurrentUser cu=getCurrent();
|
||||||
|
service.teacherSubmitAudit(auditId,pass,remark);
|
||||||
|
return success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("教师审核提交处理错误",e);
|
||||||
|
return error("审核处理失败",e.getMessage(),false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hrbp 提交审核
|
||||||
|
* @param auditId
|
||||||
|
* @param courseId
|
||||||
|
* @param title
|
||||||
|
* @param pass
|
||||||
|
* @param remark
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/hrbp-submit-audit")
|
||||||
|
public JsonResponse<Boolean> hrbpAudit(String auditId,String courseId,String title,Boolean pass,String remark){
|
||||||
|
if(StringUtils.isBlank(auditId)){
|
||||||
|
return badRequest("参数错误");
|
||||||
|
}
|
||||||
if(StringUtils.isBlank(courseId)){
|
if(StringUtils.isBlank(courseId)){
|
||||||
return badRequest("参数错误");
|
return badRequest("参数错误");
|
||||||
}
|
}
|
||||||
CurrentUser cu=getCurrent();
|
if(StringUtils.isBlank(title)){
|
||||||
if(StringUtils.isBlank(teacherId)){
|
return badRequest("未指定内容标题");
|
||||||
if(all==null || !all) {
|
}
|
||||||
teacherId=cu.getAccountId();//老师的id
|
if(pass==null){
|
||||||
|
return badRequest("无审核结果信息");
|
||||||
|
}
|
||||||
|
Course c=courseService.get(courseId);
|
||||||
|
if(c==null) {
|
||||||
|
return badRequest("课程不存在");
|
||||||
|
}
|
||||||
|
boolean open=false;
|
||||||
|
if(c.getOpenCourse()!=null && c.getOpenCourse()==1) {
|
||||||
|
open=true;
|
||||||
|
}
|
||||||
|
//检查是否允许
|
||||||
|
if(pass) {
|
||||||
|
String error=checkForSubmit(c);
|
||||||
|
if(error!=null) {
|
||||||
|
return badRequest(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<SysLogAudit> list=service.findLogs(courseId, teacherId);
|
CurrentUser cu=getCurrent();
|
||||||
return success(list);
|
service.hrbpSubmitAudit(auditId, courseId,open, pass,cu.getAccountId(),cu.getName(), remark);
|
||||||
|
return success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("查询课程审核日志错误",e);
|
log.error("HRBP审核提交处理错误",e);
|
||||||
return error("查询课程审核日志失败",e.getMessage());
|
return error("审核处理失败",e.getMessage(),false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/last-audit-list")
|
||||||
|
public JsonResponse<PageList<CourseHRBPAudit>> lastAuditList(Pagination page, CourseHRBPAuditDto info){
|
||||||
|
|
||||||
|
// CurrentUser cu=getCurrent();
|
||||||
|
// if(StringUtils.isBlank(teacherId)){
|
||||||
|
// teacherId=cu.getAccountId();//老师的id
|
||||||
|
// }
|
||||||
|
try {
|
||||||
|
//最后一个,用户id不传,权限由菜单控制
|
||||||
|
PageList<CourseHRBPAudit> list=service.pageLastAudit(page.getPageIndex(),page.getPageSize(), info.getCourseName(), info.getStatus(),null);
|
||||||
|
return success(list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("查询课程审核信息错误",e);
|
||||||
|
return error("查询审核信息失败",e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交并直接发布,用于默认管理直接操作
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/submit-publish")
|
||||||
|
@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("请选择资源归属");
|
||||||
|
}
|
||||||
|
CurrentUser cuser=getCurrent();
|
||||||
|
dto.getCourse().setStatus(Course.STATUS_AUDIT_FINISH);//设置为审核通过状态
|
||||||
|
dto.getCourse().setEnabled(true);//设置启用状态问题
|
||||||
|
dto.getCourse().setPublished(false);//重新提交审核设置为未发布状态
|
||||||
|
try {
|
||||||
|
courseService.submitAndPublish(dto,cuser.getAccountId(),cuser.getName());
|
||||||
|
return success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("默认管理员提交直接发布处理失败",e);
|
||||||
|
e.printStackTrace();
|
||||||
|
return error("发布课程失败",e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 审核
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/last-audit-submit")
|
||||||
|
@AutoLog(module = "课程",action = "最后(公开课)审核提交",info = "")
|
||||||
|
public JsonResponse<Boolean> lastAuditSubmit(String auditId,String courseId,Boolean pass,String remark){
|
||||||
|
if(StringUtils.isBlank(auditId)) {
|
||||||
|
return badRequest("参数错误");
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(courseId)) {
|
||||||
|
return badRequest("未指定课程");
|
||||||
|
}
|
||||||
|
if(pass==null) {
|
||||||
|
return badRequest("无审核结果");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//String auditId, String courseId,boolean pass, String aid, String name, String remark
|
||||||
|
CurrentUser cuser=getCurrent();
|
||||||
|
service.submitLastAudit(auditId,courseId,pass,cuser.getAccountId(),cuser.getName(),remark);
|
||||||
|
return success(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("最后审核提交处理错误",e);
|
||||||
|
e.printStackTrace();
|
||||||
|
return error("审核处理失败",e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,9 +247,14 @@ public class CourseFileApi extends ApiBaseController {
|
|||||||
file.setConverStatus(1);//转化中
|
file.setConverStatus(1);//转化中
|
||||||
}else if(file.getFileType().equalsIgnoreCase("zip")) {
|
}else if(file.getFileType().equalsIgnoreCase("zip")) {
|
||||||
//scorm包的内容
|
//scorm包的内容
|
||||||
SCORMParser scormParser=new SCORMParser();
|
try {
|
||||||
String json = scormParser.parserToJson(fileFullPath);
|
SCORMParser scormParser=new SCORMParser();
|
||||||
file.setContent(json);
|
String json = scormParser.parserToJson(fileFullPath);
|
||||||
|
file.setContent(json);
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error("上传的非scorm课件的zip文件", e);
|
||||||
|
return error("此课件不是标准的scorm课件打包文件,请上传标准的scorm打包的zip文件", e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//保存
|
//保存
|
||||||
courseFileService.save(file);
|
courseFileService.save(file);
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import com.xboe.core.api.ApiBaseController;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建立的用于hrbp审核的,还未移过来
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/xboe/m/course/HRBP/audit")
|
@RequestMapping("/xboe/m/course/HRBP/audit")
|
||||||
public class CourseHRBPAuditApi extends ApiBaseController {
|
public class CourseHRBPAuditApi extends ApiBaseController {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.xboe.core.CurrentUser;
|
|||||||
import com.xboe.core.JsonResponse;
|
import com.xboe.core.JsonResponse;
|
||||||
import com.xboe.core.api.ApiBaseController;
|
import com.xboe.core.api.ApiBaseController;
|
||||||
import com.xboe.core.log.AutoLog;
|
import com.xboe.core.log.AutoLog;
|
||||||
|
import com.xboe.data.outside.IOutSideDataService;
|
||||||
import com.xboe.externalinterface.system.service.IFwUserService;
|
import com.xboe.externalinterface.system.service.IFwUserService;
|
||||||
import com.xboe.module.assistance.service.IEmailService;
|
import com.xboe.module.assistance.service.IEmailService;
|
||||||
import com.xboe.module.course.dto.CourseExportDto;
|
import com.xboe.module.course.dto.CourseExportDto;
|
||||||
@@ -95,9 +96,12 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
@Resource
|
@Resource
|
||||||
private IUserService userService;
|
private IUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private ICourseHRBPAuditService hrbpAuditService;
|
private ICourseHRBPAuditService hrbpAuditService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IOutSideDataService outSideDataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理列表的查询
|
* 管理列表的查询
|
||||||
* @param pager
|
* @param pager
|
||||||
@@ -107,8 +111,23 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
@PostMapping("/pagelist")
|
@PostMapping("/pagelist")
|
||||||
public JsonResponse<PageList<Course>> findPage(Pagination pager,CourseQueryDto dto){
|
public JsonResponse<PageList<Course>> findPage(Pagination pager,CourseQueryDto dto){
|
||||||
|
|
||||||
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
//增加权限的过滤,只要看到自己或有权限的机构的
|
||||||
return success(coursePageList);
|
try {
|
||||||
|
List<String> orgIds = outSideDataService.getOrgIds();
|
||||||
|
String ids= StringUtils.join(orgIds,",");
|
||||||
|
String aid=getCurrent().getAccountId();
|
||||||
|
//如果前端查询当前人的,这里去掉
|
||||||
|
if(StringUtils.isNotBlank( dto.getAid())) {
|
||||||
|
dto.setAid(null);
|
||||||
|
}
|
||||||
|
dto.setOrgAid(aid);
|
||||||
|
dto.setOrgIds(ids);
|
||||||
|
PageList<Course> coursePageList = courseService.findPage(pager.getPageIndex(), pager.getPageSize(),dto);
|
||||||
|
return success(coursePageList);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("管理课程列表查询错误",e);
|
||||||
|
return error("查询失败",e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +162,7 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员审核列表,教师的审核不在这里
|
* 管理员审核列表,教师的审核不在这里,此审核也应该移动CourseAuditApi中去
|
||||||
* @param pager
|
* @param pager
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
@@ -362,6 +381,7 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/submit")
|
@PostMapping("/submit")
|
||||||
@AutoLog(module = "课程",action = "提交课程",info = "")
|
@AutoLog(module = "课程",action = "提交课程",info = "")
|
||||||
public JsonResponse<CourseFullDto> submitCourseFull(@RequestBody CourseFullDto dto){
|
public JsonResponse<CourseFullDto> submitCourseFull(@RequestBody CourseFullDto dto){
|
||||||
@@ -662,7 +682,7 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核并发布,未完成的处理
|
* 审核并发布,未完成的处理,
|
||||||
* @param id
|
* @param id
|
||||||
* @param title
|
* @param title
|
||||||
* @param pass
|
* @param pass
|
||||||
@@ -670,6 +690,7 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
* @param from 来源
|
* @param from 来源
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@PostMapping("/audit-publish")
|
@PostMapping("/audit-publish")
|
||||||
public JsonResponse<Boolean> auditAndPublish(String auditId,String courseId,String title, Boolean pass,String remark,Integer from){
|
public JsonResponse<Boolean> auditAndPublish(String auditId,String courseId,String title, Boolean pass,String remark,Integer from){
|
||||||
if(StringUtils.isBlank(auditId)){
|
if(StringUtils.isBlank(auditId)){
|
||||||
@@ -705,13 +726,14 @@ public class CourseManageApi extends ApiBaseController{
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布课程信息
|
* 发布课程信息,已经没有单独的发布了
|
||||||
* @param id
|
* @param id
|
||||||
* @param title
|
* @param title
|
||||||
* @param pass
|
* @param pass
|
||||||
* @param remark
|
* @param remark
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@PostMapping("/publish")
|
@PostMapping("/publish")
|
||||||
public JsonResponse<Boolean> publish(String ids,String title, Boolean pass){
|
public JsonResponse<Boolean> publish(String ids,String title, Boolean pass){
|
||||||
if(StringUtils.isBlank(ids)){
|
if(StringUtils.isBlank(ids)){
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ public class CourseHRBPAuditDto{
|
|||||||
/**审核人*/
|
/**审核人*/
|
||||||
private String auditUser;
|
private String auditUser;
|
||||||
|
|
||||||
|
/**实际审核人id*/
|
||||||
|
private String auditAid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否转发 1表未转发 2表已转发()
|
* 是否转发 1表未转发 2表已转发()
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -98,7 +98,10 @@ public class CourseQueryDto {
|
|||||||
private Integer openCourse;
|
private Integer openCourse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表资源归属的in查询
|
* 表资源归属的in查询,多个使用逗号分隔
|
||||||
* */
|
* */
|
||||||
private String orgId;
|
private String orgIds;
|
||||||
|
|
||||||
|
/**用户权限的查询*/
|
||||||
|
private String orgAid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.xboe.module.course.entity;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.xboe.core.SysConstant;
|
|
||||||
import com.xboe.core.orm.IdBaseEntity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 审核日志,当前只用于公开课的审核记录,因为hrbp和教师审核在hrbp审核中
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Entity
|
|
||||||
@Table(name = SysConstant.TABLE_PRE+"course_audit_record")
|
|
||||||
public class CourseAuditRecord extends IdBaseEntity{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**未审核*/
|
|
||||||
public static int AUDITSTATE_NULL=1;
|
|
||||||
|
|
||||||
/**审核通过*/
|
|
||||||
public static int AUDITSTATE_PASS=3;
|
|
||||||
|
|
||||||
/**审核不通过*/
|
|
||||||
public static int AUDITSTATE_NOPASS=2;
|
|
||||||
|
|
||||||
/**课程id*/
|
|
||||||
@Column(name = "course_id",nullable=false, length=20)
|
|
||||||
private String courseId;
|
|
||||||
|
|
||||||
/**审核人id*/
|
|
||||||
@Column(name = "aid",nullable=false, length=20)
|
|
||||||
private String aid;
|
|
||||||
|
|
||||||
/**审核人姓名*/
|
|
||||||
@Column(name = "aname",nullable=false, length=30)
|
|
||||||
private String aname;
|
|
||||||
|
|
||||||
/**审核时间*/
|
|
||||||
@Column(name = "audit_time",nullable=true)
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime auditTime;
|
|
||||||
|
|
||||||
/**审核类型,1表普通审核,2表转审,3表公开课审核*/
|
|
||||||
@Column(name = "audit_type",nullable=false, length=1)
|
|
||||||
private Integer auditType;
|
|
||||||
|
|
||||||
/**审核说明*/
|
|
||||||
@Column(name = "audit_remark",nullable=true, length=200)
|
|
||||||
private String auditRemark;
|
|
||||||
|
|
||||||
/**审核状态*/
|
|
||||||
@Column(name = "audit_state",nullable=false, length=1)
|
|
||||||
private Integer auditState;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,15 +19,20 @@ import java.time.LocalDateTime;
|
|||||||
@Table(name = SysConstant.TABLE_PRE+"course_HRBP_audit")
|
@Table(name = SysConstant.TABLE_PRE+"course_HRBP_audit")
|
||||||
public class CourseHRBPAudit extends IdEntity {
|
public class CourseHRBPAudit extends IdEntity {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**未转发*/
|
||||||
public static final int FORWARD_NONE=1;
|
public static final int FORWARD_NONE=1;
|
||||||
|
|
||||||
|
/**转发到教师审核*/
|
||||||
public static final int FORWARD_TEACHER=2;
|
public static final int FORWARD_TEACHER=2;
|
||||||
|
|
||||||
|
/**老师审核完成*/
|
||||||
|
public static final int FORWARD_TO_FINISH=3;
|
||||||
|
|
||||||
|
/**公开课的审核*/
|
||||||
|
public static final int FORWARD_LAST=6;
|
||||||
|
|
||||||
/**转发*/
|
/**转发*/
|
||||||
public static final int STATUS_NONE=1;
|
public static final int STATUS_NONE=1;
|
||||||
|
|
||||||
@@ -70,15 +75,27 @@ public class CourseHRBPAudit extends IdEntity {
|
|||||||
private String auditUser;
|
private String auditUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否转发 1表未转发 2表已转发(),3教师审核完成
|
* 审核人id
|
||||||
|
*/
|
||||||
|
@Column(name = "audit_aid",length=20)
|
||||||
|
private String auditAid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否转发 1表未转发 2表已转发(转发审核中),3教师审核完成,6表公开课审核
|
||||||
* */
|
* */
|
||||||
@Column(name = "forward")
|
@Column(name = "forward")
|
||||||
private Integer forward;
|
private Integer forward;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
* */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Column(name = "add_time")
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转发给用户id
|
* 转发给用户id
|
||||||
* */
|
*/
|
||||||
@Column(name = "to_aid",length = 20)
|
@Column(name = "to_aid",length = 20)
|
||||||
private String toAid;
|
private String toAid;
|
||||||
|
|
||||||
@@ -93,13 +110,36 @@ public class CourseHRBPAudit extends IdEntity {
|
|||||||
@Column(name = "to_remark")
|
@Column(name = "to_remark")
|
||||||
private String toRemark;
|
private String toRemark;
|
||||||
|
|
||||||
/**
|
//以下是新增加的字段
|
||||||
* 添加时间
|
/**审核时间*/
|
||||||
* */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Column(name = "add_time")
|
@Column(name = "to_audit_Time",length = 50)
|
||||||
private LocalDateTime addTime;
|
private LocalDateTime toAuditTime;
|
||||||
|
|
||||||
|
/**转审的处理状态,同status*/
|
||||||
|
@Column(name = "to_state")
|
||||||
|
private Integer toState;
|
||||||
|
|
||||||
|
/**公开课审核人id,*/
|
||||||
|
@Column(name = "last_aid",length = 20)
|
||||||
|
private String lastAid;
|
||||||
|
|
||||||
|
/**公开课审核人*/
|
||||||
|
@Column(name = "last_aname",length = 50)
|
||||||
|
private String lastAname;
|
||||||
|
|
||||||
|
/**公开课审核时间*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Column(name = "last_time",length = 50)
|
||||||
|
private LocalDateTime lastTime;
|
||||||
|
|
||||||
|
/**公开课审核结果,同status*/
|
||||||
|
@Column(name = "last_state")
|
||||||
|
private Integer lastState;
|
||||||
|
|
||||||
|
/**公开课审核说明*/
|
||||||
|
@Column(name = "last_remark")
|
||||||
|
private String lastRemark;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String courseName;
|
private String courseName;
|
||||||
@@ -107,17 +147,20 @@ public class CourseHRBPAudit extends IdEntity {
|
|||||||
@Transient
|
@Transient
|
||||||
private String courseUser;
|
private String courseUser;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Integer courseType;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private Boolean coursePublished;
|
private Boolean coursePublished;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String courseType1;
|
private String sysType1;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String courseType2;
|
private String sysType2;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private String courseType3;
|
private String sysType3;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ package com.xboe.module.course.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
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.CourseAudit;
|
||||||
import com.xboe.system.logs.entity.SysLogAudit;
|
import com.xboe.module.course.entity.CourseHRBPAudit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程审核的相关处理,注释的审核功能,在CourseSerivce中还没有移过来
|
* 课程审核的相关处理,注释的审核功能,在CourseSerivce中还没有移过来
|
||||||
|
* 最后确认流程后,使用此类来处理审核
|
||||||
* @author seastar
|
* @author seastar
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -23,19 +22,19 @@ public interface ICourseAuditService {
|
|||||||
// */
|
// */
|
||||||
// int countWaitAudit(String aid);
|
// int countWaitAudit(String aid);
|
||||||
//
|
//
|
||||||
/**
|
// /**
|
||||||
* 审核课程查询
|
// * 审核课程查询
|
||||||
* @param pageIndex
|
// * @param pageIndex
|
||||||
* @param pageSize
|
// * @param pageSize
|
||||||
* @param dto
|
// * @param dto
|
||||||
* @param aid 审核人的id
|
// * @param aid 审核人的id
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
PageList<Course> findAuditPage(int pageIndex, int pageSize, CourseQueryDto dto,String aid);
|
// PageList<Course> findAuditPage(int pageIndex, int pageSize, CourseQueryDto dto,String aid);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定审核人
|
* hrbp指定审核人
|
||||||
* @param auditId
|
* @param auditId
|
||||||
* @param courseId
|
* @param courseId
|
||||||
* @param teacherId
|
* @param teacherId
|
||||||
@@ -45,6 +44,31 @@ public interface ICourseAuditService {
|
|||||||
*/
|
*/
|
||||||
void appointAudit(String auditId,String courseId,String teacherId,String teacherName,String auditInfo, String remark);
|
void appointAudit(String auditId,String courseId,String teacherId,String teacherName,String auditInfo, String remark);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教师提交审核
|
||||||
|
* @param auditId
|
||||||
|
* @param courseId
|
||||||
|
* @param pass
|
||||||
|
* @param aid
|
||||||
|
* @param name
|
||||||
|
* @param remark
|
||||||
|
*/
|
||||||
|
void teacherSubmitAudit(String auditId,boolean pass,String remark);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hrbp提交审核
|
||||||
|
* @param auditId
|
||||||
|
* @param courseId
|
||||||
|
* @param openCourse 是否是公开课
|
||||||
|
* @param pass
|
||||||
|
* @param aid
|
||||||
|
* @param name
|
||||||
|
* @param remark
|
||||||
|
* @param publish
|
||||||
|
* @param from
|
||||||
|
*/
|
||||||
|
void hrbpSubmitAudit(String auditId, String courseId,boolean openCourse, boolean pass, String aid, String name, String remark);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询需要审核的信息
|
* 查询需要审核的信息
|
||||||
* @param courseId
|
* @param courseId
|
||||||
@@ -53,22 +77,31 @@ public interface ICourseAuditService {
|
|||||||
*/
|
*/
|
||||||
List<CourseAudit> findAudit(String courseId,String teacherId);
|
List<CourseAudit> findAudit(String courseId,String teacherId);
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 查询课程的审核记录信息
|
||||||
|
// * @param courseId
|
||||||
|
// * @param teacherId
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// List<SysLogAudit> findLogs(String courseId,String teacherId);
|
||||||
|
|
||||||
|
//以下是新增加的公开课的审核
|
||||||
/**
|
/**
|
||||||
* 查询课程的审核记录信息
|
* 最后的审核查询,公开课审核查询
|
||||||
* @param courseId
|
* @param pageIndex
|
||||||
* @param teacherId
|
* @param pageSize
|
||||||
|
* @param courseName
|
||||||
|
* @param lastState
|
||||||
|
* @param aid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SysLogAudit> findLogs(String courseId,String teacherId);
|
PageList<CourseHRBPAudit> pageLastAudit(int pageIndex, int pageSize,String courseName,Integer lastState, String aid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公开课提交审核,最后的提交审核
|
||||||
|
* @param record
|
||||||
|
*/
|
||||||
|
void submitLastAudit(String auditId, String courseId, boolean pass, String aid, String name, String remark);
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 课程审核
|
|
||||||
// * @param id
|
|
||||||
// * @param pass
|
|
||||||
// * @param aid
|
|
||||||
// * @param name
|
|
||||||
// * @param remark
|
|
||||||
// * @param publish 是否发布
|
|
||||||
// */
|
|
||||||
// void audit(String id,Boolean pass,String aid,String name,String remark,boolean publish);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,13 @@ public interface ICourseHRBPAuditService {
|
|||||||
* */
|
* */
|
||||||
void save(CourseHRBPAudit coursePersonAudit);
|
void save(CourseHRBPAudit coursePersonAudit);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核
|
* 获取详细信息
|
||||||
* */
|
* @param id
|
||||||
//void audit(String id,Integer status,String remark);
|
* @return
|
||||||
|
*/
|
||||||
|
CourseHRBPAudit get(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查课程是否已经在审核中了
|
* 检查课程是否已经在审核中了
|
||||||
@@ -37,8 +40,21 @@ public interface ICourseHRBPAuditService {
|
|||||||
List<CourseHRBPAudit> findList(CourseHRBPAudit info);
|
List<CourseHRBPAudit> findList(CourseHRBPAudit info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前用户可以审核的课程
|
* 当前用户可以审核的课程.
|
||||||
|
* 用于查询教师的待审核课程及已审核课程
|
||||||
* */
|
* */
|
||||||
|
@Deprecated
|
||||||
PageList<CourseHRBPAuditDto> findPageList(Integer pageIndex, Integer pageSize, CourseHRBPAuditDto info);
|
PageList<CourseHRBPAuditDto> findPageList(Integer pageIndex, Integer pageSize, CourseHRBPAuditDto info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的已审核的课程记录
|
||||||
|
* @param pageIndex
|
||||||
|
* @param pageSize
|
||||||
|
* @param userType 1表教师个人,2表hrbp管理员
|
||||||
|
* @param info
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageList<CourseHRBPAudit> pageList(Integer pageIndex, Integer pageSize,int userType, CourseHRBPAudit info);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,15 @@ public interface ICourseService {
|
|||||||
*/
|
*/
|
||||||
void submit(CourseFullDto full)throws Exception;
|
void submit(CourseFullDto full)throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于默认管理员,直接提交发布,不走审核流程
|
||||||
|
* @param full
|
||||||
|
* @param aid 操作人id
|
||||||
|
* @param aname 姓名
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void submitAndPublish(CourseFullDto full,String aid,String aname)throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交一个课程
|
* 提交一个课程
|
||||||
* @param audit
|
* @param audit
|
||||||
|
|||||||
@@ -1,32 +1,40 @@
|
|||||||
package com.xboe.module.course.service.impl;
|
package com.xboe.module.course.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
|
import com.xboe.core.event.IEventDataSender;
|
||||||
import com.xboe.core.orm.FieldFilters;
|
import com.xboe.core.orm.FieldFilters;
|
||||||
import com.xboe.core.orm.IFieldFilter;
|
import com.xboe.core.orm.QueryBuilder;
|
||||||
import com.xboe.core.orm.UpdateBuilder;
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
import com.xboe.module.course.dao.CourseAuditDao;
|
import com.xboe.module.course.dao.CourseAuditDao;
|
||||||
import com.xboe.module.course.dao.CourseDao;
|
import com.xboe.module.course.dao.CourseDao;
|
||||||
import com.xboe.module.course.dao.CourseHRBPAuditDao;
|
import com.xboe.module.course.dao.CourseHRBPAuditDao;
|
||||||
import com.xboe.module.course.dto.CourseQueryDto;
|
import com.xboe.module.course.dao.CourseTeacherDao;
|
||||||
import com.xboe.module.course.entity.Course;
|
import com.xboe.module.course.entity.Course;
|
||||||
import com.xboe.module.course.entity.CourseAudit;
|
import com.xboe.module.course.entity.CourseAudit;
|
||||||
import com.xboe.module.course.entity.CourseHRBPAudit;
|
import com.xboe.module.course.entity.CourseHRBPAudit;
|
||||||
|
import com.xboe.module.course.entity.CourseTeacher;
|
||||||
import com.xboe.module.course.service.ICourseAuditService;
|
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;
|
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程审核的处理,因为这个是后续增加的,所以之前审核的一些操作还是在课程处理中
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class CourseAuditServiceImpl implements ICourseAuditService{
|
public class CourseAuditServiceImpl implements ICourseAuditService{
|
||||||
|
|
||||||
@@ -34,25 +42,25 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
|
|||||||
CourseAuditDao auditDao;
|
CourseAuditDao auditDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
SysLogAuditDao auditLogDao;
|
CourseHRBPAuditDao courseHRBPAuditDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private CourseHRBPAuditDao courseHRBPAuditDao;
|
CourseTeacherDao courseTeacherDao;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
CourseDao courseDao;
|
CourseDao courseDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PublishCourseUtil publishUtil;
|
||||||
|
|
||||||
|
@Autowired(required = false)
|
||||||
|
IEventDataSender eventSender;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void appointAudit(String auditId,String courseId, String teacherId, String teacherName,String auditInfo, String remark) {
|
public void appointAudit(String auditId,String courseId, String teacherId, String teacherName,String auditInfo, String remark) {
|
||||||
|
|
||||||
//更新课程的表
|
//更新课程的表
|
||||||
// courseDao.updateFieldById(courseId, "auditAid", teacherId);
|
|
||||||
// courseDao.updateMultiFieldById(courseId,
|
|
||||||
// UpdateBuilder.create("auditAid", teacherId),
|
|
||||||
// UpdateBuilder.create("auditInfo", auditInfo)
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// //增加审核的信息
|
// //增加审核的信息
|
||||||
// CourseAudit ca=new CourseAudit();
|
// CourseAudit ca=new CourseAudit();
|
||||||
// ca.setAuditRemark(remark);
|
// ca.setAuditRemark(remark);
|
||||||
@@ -68,7 +76,6 @@ public class CourseAuditServiceImpl implements ICourseAuditService{
|
|||||||
UpdateBuilder.create("toInfo", auditInfo),
|
UpdateBuilder.create("toInfo", auditInfo),
|
||||||
UpdateBuilder.create("toName", teacherName),
|
UpdateBuilder.create("toName", teacherName),
|
||||||
UpdateBuilder.create("toRemark", remark)
|
UpdateBuilder.create("toRemark", remark)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -82,48 +89,228 @@ 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
|
// @Override
|
||||||
public PageList<Course> findAuditPage(int pageIndex, int pageSize, CourseQueryDto dto, String aid) {
|
// public List<SysLogAudit> findLogs(String courseId, String teacherId) {
|
||||||
|
|
||||||
// List<IFieldFilter> filters = createFilters(dto);
|
|
||||||
// //自动添加过滤已删除
|
|
||||||
// filters.add(FieldFilters.eq("deleted",false));
|
|
||||||
// filters.add(FieldFilters.eq("enabled",true));
|
|
||||||
//
|
//
|
||||||
// filters.add(FieldFilters.eq("auditAid", aid));
|
// if(StringUtils.isBlank(teacherId)) {
|
||||||
//
|
// return auditLogDao.findList(OrderCondition.idDesc(),
|
||||||
// OrderCondition oc=null;
|
// FieldFilters.eq("objType", 1),
|
||||||
// if(StringUtils.isNotBlank(dto.getOrderField())) {
|
// FieldFilters.eq("objId", courseId)
|
||||||
// if(dto.getOrderAsc()||dto.getOrderAsc()==null) {
|
// );
|
||||||
// oc=OrderCondition.asc(dto.getOrderField());
|
|
||||||
// }else {
|
|
||||||
// oc=OrderCondition.desc(dto.getOrderField());
|
|
||||||
// }
|
|
||||||
// }else {
|
// }else {
|
||||||
// oc=OrderCondition.desc("id");
|
// 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) {
|
||||||
//
|
//
|
||||||
// PageList<Course> rs=courseDao.findPage(pageIndex, pageSize, filters, oc);
|
//// List<IFieldFilter> filters = createFilters(dto);
|
||||||
//
|
//// //自动添加过滤已删除
|
||||||
// return rs;
|
//// filters.add(FieldFilters.eq("deleted",false));
|
||||||
return null;
|
//// 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;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void teacherSubmitAudit(String auditId,boolean pass,String remark) {
|
||||||
|
|
||||||
|
LocalDateTime now=LocalDateTime.now();
|
||||||
|
//更新审核记录状态
|
||||||
|
courseHRBPAuditDao.updateMultiFieldById(auditId,
|
||||||
|
UpdateBuilder.create("toState", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS),
|
||||||
|
UpdateBuilder.create("toRemark", remark),
|
||||||
|
UpdateBuilder.create("toAuditTime", now),
|
||||||
|
UpdateBuilder.create("forward", CourseHRBPAudit.FORWARD_TO_FINISH)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void hrbpSubmitAudit(String auditId, String courseId,boolean openCourse, boolean pass, String aid, String name, String remark) {
|
||||||
|
|
||||||
|
LocalDateTime now=LocalDateTime.now();
|
||||||
|
int status=Course.STATUS_AUDIT_FINISH;
|
||||||
|
if(!pass) {
|
||||||
|
status=Course.STATUS_AUDIT_NOPASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新审核记录状态
|
||||||
|
courseHRBPAuditDao.updateMultiFieldById(auditId,
|
||||||
|
UpdateBuilder.create("status", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS),
|
||||||
|
UpdateBuilder.create("auditRemark", remark),
|
||||||
|
UpdateBuilder.create("auditUser", name),
|
||||||
|
UpdateBuilder.create("auditAid", aid),
|
||||||
|
UpdateBuilder.create("auditTime", now)
|
||||||
|
);
|
||||||
|
//更新课程的转审状态,并把转审的信息置为空,这会的状态还未审核通过
|
||||||
|
if(!openCourse) { //非公开课,这已表示处理完成,直接更新课程状态
|
||||||
|
courseDao.updateMultiFieldById(courseId,UpdateBuilder.create("status", status),UpdateBuilder.create("auditAid", null),UpdateBuilder.create("auditInfo", null));
|
||||||
|
//审核通过并发布,直接发布课程
|
||||||
|
if(pass) {
|
||||||
|
//设置课程状态已审核完成,这里是管理员的审核
|
||||||
|
courseDao.updateMultiFieldById(courseId,
|
||||||
|
UpdateBuilder.create("published", pass),
|
||||||
|
UpdateBuilder.create("erasable", false), //设置以后不能物理删除了
|
||||||
|
UpdateBuilder.create("publishTime", LocalDateTime.now()));
|
||||||
|
//发布到全文检索中
|
||||||
|
Course c=courseDao.get(courseId);
|
||||||
|
publishUtil.fullTextPublish(c);
|
||||||
|
//同时添加发布事件,这里的创建人需要修改为教师
|
||||||
|
if(eventSender!=null) {
|
||||||
|
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", courseId));
|
||||||
|
if(teachers.size()>0) {
|
||||||
|
String authorIds="";
|
||||||
|
for(CourseTeacher cteacher:teachers) {
|
||||||
|
if(authorIds.equals("")) {
|
||||||
|
authorIds+=cteacher.getTeacherId();
|
||||||
|
}else {
|
||||||
|
authorIds+="|"+cteacher.getTeacherId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"】", c.getId(), "1", c.getName(), aid,name,"authors:"+authorIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
log.error("未配置事件消息发送的实现");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//对于公开课
|
||||||
|
if(pass) {
|
||||||
|
//公开课,hrpb审核通过,下一步是公开课的审核,hrbp审核流程已经完成
|
||||||
|
courseHRBPAuditDao.updateMultiFieldById(auditId,
|
||||||
|
UpdateBuilder.create("forward", CourseHRBPAudit.FORWARD_LAST),
|
||||||
|
UpdateBuilder.create("lastState", CourseHRBPAudit.STATUS_NONE)
|
||||||
|
);
|
||||||
|
}else {
|
||||||
|
//如果未通过,直接修改课程状态
|
||||||
|
courseDao.updateMultiFieldById(courseId,UpdateBuilder.create("status", status),UpdateBuilder.create("auditAid", null),UpdateBuilder.create("auditInfo", null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageList<CourseHRBPAudit> pageLastAudit(int pageIndex, int pageSize,String courseName,Integer lastState, String aid) {
|
||||||
|
|
||||||
|
QueryBuilder query=QueryBuilder.from(Course.class.getSimpleName()+" c,"+CourseHRBPAudit.class.getSimpleName()+" a");
|
||||||
|
query.setPageIndex(pageIndex);
|
||||||
|
query.setPageSize(pageSize);
|
||||||
|
query.addField("a");
|
||||||
|
query.addField("c.name");
|
||||||
|
query.addField("c.sysCreateBy");
|
||||||
|
query.addField("c.type");
|
||||||
|
query.addFilter(FieldFilters.eqField("c.id", "a.courseId"));
|
||||||
|
|
||||||
|
//最后的审核,公开课审核
|
||||||
|
query.addFilter(FieldFilters.eq("a.forward",CourseHRBPAudit.FORWARD_LAST));
|
||||||
|
query.addFilter(FieldFilters.gt("a.status",CourseHRBPAudit.STATUS_NONE));
|
||||||
|
//审核状态
|
||||||
|
if(lastState!=null) {
|
||||||
|
if(lastState==9) {
|
||||||
|
query.addFilter(FieldFilters.gt("a.lastState",CourseHRBPAudit.STATUS_NONE));
|
||||||
|
}else {
|
||||||
|
query.addFilter(FieldFilters.eq("a.lastState",lastState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(courseName)){
|
||||||
|
query.addFilter(FieldFilters.like("c.name",courseName));
|
||||||
|
}
|
||||||
|
query.addFilter(FieldFilters.eq("c.deleted",false));
|
||||||
|
query.addFilter(FieldFilters.eq("c.enabled",true));
|
||||||
|
|
||||||
|
query.addOrder(OrderCondition.desc("a.addTime"));
|
||||||
|
PageList<CourseHRBPAudit> rs=new PageList<CourseHRBPAudit>();
|
||||||
|
rs.setList(new ArrayList<CourseHRBPAudit>());
|
||||||
|
try {
|
||||||
|
PageList<Object[]> list=courseDao.findPageFields(query.builder());
|
||||||
|
rs.setCount(list.getCount());
|
||||||
|
rs.setPageSize(pageSize);
|
||||||
|
for(Object[] objs : list.getList()) {
|
||||||
|
CourseHRBPAudit audit=(CourseHRBPAudit)objs[0];
|
||||||
|
audit.setCourseName(objs[1].toString());
|
||||||
|
audit.setCourseUser((String)objs[2]);
|
||||||
|
audit.setCourseType((Integer)objs[3]);
|
||||||
|
rs.getList().add(audit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("查询课程审核错误",e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void submitLastAudit(String auditId, String courseId,boolean pass, String aid, String name, String remark) {
|
||||||
|
LocalDateTime now=LocalDateTime.now();
|
||||||
|
int status=Course.STATUS_AUDIT_FINISH;
|
||||||
|
if(!pass) {
|
||||||
|
status=Course.STATUS_AUDIT_NOPASS;
|
||||||
|
}
|
||||||
|
courseDao.updateMultiFieldById(courseId,UpdateBuilder.create("status", status),UpdateBuilder.create("auditAid", null),UpdateBuilder.create("auditInfo", null));
|
||||||
|
|
||||||
|
courseHRBPAuditDao.updateMultiFieldById(auditId,
|
||||||
|
UpdateBuilder.create("lastRemark", remark),
|
||||||
|
UpdateBuilder.create("lastAid", aid),
|
||||||
|
UpdateBuilder.create("lastAname", name),
|
||||||
|
UpdateBuilder.create("lastTime", now),
|
||||||
|
UpdateBuilder.create("lastState", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS)
|
||||||
|
);
|
||||||
|
if(pass) {
|
||||||
|
//同步发布课程
|
||||||
|
//同步发布
|
||||||
|
Course c= courseDao.get(courseId);
|
||||||
|
publishUtil.fullTextPublish(c);
|
||||||
|
//发布事件处理
|
||||||
|
if(eventSender!=null) {
|
||||||
|
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId",courseId));
|
||||||
|
if(teachers.size()>0) {
|
||||||
|
String authorIds="";
|
||||||
|
for(CourseTeacher cteacher:teachers) {
|
||||||
|
if(authorIds.equals("")) {
|
||||||
|
authorIds+=cteacher.getTeacherId();
|
||||||
|
}else {
|
||||||
|
authorIds+="|"+cteacher.getTeacherId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"】",courseId, "1", c.getName(), aid,name,"authors:"+authorIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
log.error("未配置事件消息发送的实现");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class CourseHRBPAuditServiceImpl implements ICourseHRBPAuditService {
|
|||||||
dto.setToAid(hrbp.getToAid());
|
dto.setToAid(hrbp.getToAid());
|
||||||
dto.setToInfo(hrbp.getToInfo());
|
dto.setToInfo(hrbp.getToInfo());
|
||||||
dto.setAuditUser(hrbp.getAuditUser());
|
dto.setAuditUser(hrbp.getAuditUser());
|
||||||
|
dto.setAuditAid(hrbp.getAuditAid());
|
||||||
dto.setToName(hrbp.getToName());
|
dto.setToName(hrbp.getToName());
|
||||||
dto.setToRemark(hrbp.getToRemark());
|
dto.setToRemark(hrbp.getToRemark());
|
||||||
dto.setAddTime(hrbp.getAddTime());
|
dto.setAddTime(hrbp.getAddTime());
|
||||||
@@ -56,6 +57,7 @@ public class CourseHRBPAuditServiceImpl implements ICourseHRBPAuditService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public PageList<CourseHRBPAuditDto> findPageList(Integer pageIndex, Integer pageSize, CourseHRBPAuditDto info) {
|
public PageList<CourseHRBPAuditDto> findPageList(Integer pageIndex, Integer pageSize, CourseHRBPAuditDto info) {
|
||||||
|
|
||||||
QueryBuilder query=QueryBuilder.from(CourseHRBPAudit.class.getSimpleName()+" a,"+Course.class.getSimpleName()+" c");
|
QueryBuilder query=QueryBuilder.from(CourseHRBPAudit.class.getSimpleName()+" a,"+Course.class.getSimpleName()+" c");
|
||||||
@@ -66,24 +68,29 @@ public class CourseHRBPAuditServiceImpl implements ICourseHRBPAuditService {
|
|||||||
query.addFilter(FieldFilters.eqField("a.courseId", "c.id"));
|
query.addFilter(FieldFilters.eqField("a.courseId", "c.id"));
|
||||||
query.addFilter(FieldFilters.eq("a.courseId",info.getCourseId()));
|
query.addFilter(FieldFilters.eq("a.courseId",info.getCourseId()));
|
||||||
|
|
||||||
if(info.getForward()!=null) {
|
|
||||||
query.addFilter(FieldFilters.eq("a.forward",info.getForward()));
|
|
||||||
}
|
|
||||||
if(StringUtils.isNotBlank(info.getAid())) {
|
if(StringUtils.isNotBlank(info.getAid())) {
|
||||||
query.addFilter(FieldFilters.eq("a.aid",info.getAid()));
|
query.addFilter(FieldFilters.eq("a.aid",info.getAid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(info.getForward()!=null) {
|
||||||
|
query.addFilter(FieldFilters.eq("a.forward",info.getForward()));
|
||||||
|
}
|
||||||
if(StringUtils.isNotBlank(info.getToAid())) {
|
if(StringUtils.isNotBlank(info.getToAid())) {
|
||||||
query.addFilter(FieldFilters.eq("a.toAid",info.getToAid()));
|
query.addFilter(FieldFilters.eq("a.toAid",info.getToAid()));
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isNotBlank(info.getAuditAid())) {
|
||||||
|
query.addFilter(FieldFilters.eq("a.auditAid",info.getAuditAid()));
|
||||||
|
}
|
||||||
//审核状态
|
//审核状态
|
||||||
if(info.getStatus()!=null) {
|
if(info.getStatus()!=null) {
|
||||||
if(info.getStatus()==9) {
|
if(info.getStatus()==9) {
|
||||||
query.addFilter(FieldFilters.gt("a.status",CourseHRBPAudit.STATUS_NONE));
|
query.addFilter(FieldFilters.gt("a.toState",CourseHRBPAudit.STATUS_NONE));
|
||||||
}else {
|
}else {
|
||||||
query.addFilter(FieldFilters.eq("a.status",info.getStatus()));
|
query.addFilter(FieldFilters.eq("a.toState",info.getStatus()));
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
query.addFilter(FieldFilters.eq("a.status",CourseHRBPAudit.STATUS_NONE));
|
query.addFilter(FieldFilters.eq("a.toState",CourseHRBPAudit.STATUS_NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(info.getSysType1())) {
|
if(StringUtils.isNotBlank(info.getSysType1())) {
|
||||||
@@ -164,4 +171,96 @@ public class CourseHRBPAuditServiceImpl implements ICourseHRBPAuditService {
|
|||||||
return hrbp;
|
return hrbp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageList<CourseHRBPAudit> pageList(Integer pageIndex, Integer pageSize, int userType, CourseHRBPAudit info) {
|
||||||
|
QueryBuilder query=QueryBuilder.from(CourseHRBPAudit.class.getSimpleName()+" a,"+Course.class.getSimpleName()+" c");
|
||||||
|
query.setPageIndex(pageIndex);
|
||||||
|
query.setPageSize(pageSize);
|
||||||
|
query.addFields("a","c.name","c.type","c.sysType1","c.sysType2","c.sysType3","c.sysCreateBy");
|
||||||
|
//query.addGroupBy("")
|
||||||
|
query.addFilter(FieldFilters.eqField("a.courseId", "c.id"));
|
||||||
|
query.addFilter(FieldFilters.eq("a.courseId",info.getCourseId()));
|
||||||
|
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(info.getAid())) {
|
||||||
|
query.addFilter(FieldFilters.eq("a.aid",info.getAid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(info.getAuditAid())) {
|
||||||
|
query.addFilter(FieldFilters.eq("a.auditAid",info.getAuditAid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(userType==1) {
|
||||||
|
//教师审核,只会必须有过转么的
|
||||||
|
query.addFilter(FieldFilters.gt("a.forward",CourseHRBPAudit.FORWARD_NONE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(info.getToAid())) {
|
||||||
|
query.addFilter(FieldFilters.eq("a.toAid",info.getToAid()));
|
||||||
|
}
|
||||||
|
//hrbp审核状态
|
||||||
|
if(info.getStatus()!=null) {
|
||||||
|
if(info.getStatus()==9) {
|
||||||
|
query.addFilter(FieldFilters.gt("a.status",CourseHRBPAudit.STATUS_NONE));
|
||||||
|
}else {
|
||||||
|
query.addFilter(FieldFilters.eq("a.status",info.getStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//教师审核状态
|
||||||
|
if(info.getToState()!=null) {
|
||||||
|
if(info.getToState()==9) {
|
||||||
|
query.addFilter(FieldFilters.gt("a.toState",CourseHRBPAudit.STATUS_NONE));
|
||||||
|
}else {
|
||||||
|
query.addFilter(FieldFilters.eq("a.toState",info.getToState()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(info.getSysType1())) {
|
||||||
|
query.addFilter(FieldFilters.eq("c.sysType1",info.getSysType1()));
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(info.getSysType1())) {
|
||||||
|
query.addFilter(FieldFilters.eq("c.sysType2",info.getSysType2()));
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(info.getSysType1())) {
|
||||||
|
query.addFilter(FieldFilters.eq("c.sysType3",info.getSysType3()));
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(info.getAuditUser())) {
|
||||||
|
query.addFilter(FieldFilters.eq("a.auditUser",info.getAuditUser()));
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(info.getCourseName())) {
|
||||||
|
query.addFilter(FieldFilters.like("c.name",info.getCourseName()));
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(info.getCourseUser())) {
|
||||||
|
query.addFilter(FieldFilters.eq("c.sysCreateBy",info.getCourseUser()));
|
||||||
|
}
|
||||||
|
|
||||||
|
query.addOrder(OrderCondition.desc("a.addTime"));
|
||||||
|
|
||||||
|
PageList<CourseHRBPAudit> rs=new PageList<CourseHRBPAudit>();
|
||||||
|
rs.setList(new ArrayList<CourseHRBPAudit>());
|
||||||
|
try {
|
||||||
|
PageList<Object[]> list=courseHRBPAuditDao.findPageFields(query.builder());
|
||||||
|
rs.setCount(list.getCount());
|
||||||
|
rs.setPageSize(pageSize);
|
||||||
|
for(Object[] objs : list.getList()) {
|
||||||
|
CourseHRBPAudit hrbp=(CourseHRBPAudit)objs[0];
|
||||||
|
hrbp.setCourseName((String)objs[1]);
|
||||||
|
hrbp.setCourseType((Integer)objs[2]);
|
||||||
|
hrbp.setSysType1((String)objs[3]);
|
||||||
|
hrbp.setSysType2((String)objs[4]);
|
||||||
|
hrbp.setSysType3((String)objs[5]);
|
||||||
|
hrbp.setCourseUser((String)objs[6]);
|
||||||
|
rs.getList().add(hrbp);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("查询错误",e.getMessage());
|
||||||
|
}
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CourseHRBPAudit get(String id) {
|
||||||
|
return courseHRBPAuditDao.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.xboe.TempFilterConfig;
|
||||||
import com.xboe.account.service.IAccountService;
|
import com.xboe.account.service.IAccountService;
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
@@ -38,7 +39,6 @@ import com.xboe.module.course.dao.CourseSectionDao;
|
|||||||
import com.xboe.module.course.dao.CourseTeacherDao;
|
import com.xboe.module.course.dao.CourseTeacherDao;
|
||||||
import com.xboe.module.course.dao.CourseUpdateLogDao;
|
import com.xboe.module.course.dao.CourseUpdateLogDao;
|
||||||
import com.xboe.module.course.dto.CourseFullDto;
|
import com.xboe.module.course.dto.CourseFullDto;
|
||||||
import com.xboe.module.course.dto.CourseFullText;
|
|
||||||
import com.xboe.module.course.dto.CourseQueryDto;
|
import com.xboe.module.course.dto.CourseQueryDto;
|
||||||
import com.xboe.module.course.dto.RankingDto;
|
import com.xboe.module.course.dto.RankingDto;
|
||||||
import com.xboe.module.course.entity.Course;
|
import com.xboe.module.course.entity.Course;
|
||||||
@@ -47,7 +47,6 @@ import com.xboe.module.course.entity.CourseHRBPAudit;
|
|||||||
import com.xboe.module.course.entity.CourseSection;
|
import com.xboe.module.course.entity.CourseSection;
|
||||||
import com.xboe.module.course.entity.CourseTeacher;
|
import com.xboe.module.course.entity.CourseTeacher;
|
||||||
import com.xboe.module.course.entity.CourseUpdateLog;
|
import com.xboe.module.course.entity.CourseUpdateLog;
|
||||||
import com.xboe.module.course.service.CourseToCourseFullText;
|
|
||||||
import com.xboe.module.course.service.ICourseFullTextSearch;
|
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||||
import com.xboe.module.course.service.ICourseService;
|
import com.xboe.module.course.service.ICourseService;
|
||||||
import com.xboe.module.interaction.service.ICourseGradeService;
|
import com.xboe.module.interaction.service.ICourseGradeService;
|
||||||
@@ -105,6 +104,9 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private ICourseFullTextSearch fullTextSearch;
|
private ICourseFullTextSearch fullTextSearch;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PublishCourseUtil publishUtil;
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private IEventDataSender eventSender;
|
private IEventDataSender eventSender;
|
||||||
|
|
||||||
@@ -199,19 +201,10 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
filters.add(FieldFilters.eq("sysType1",dto.getSysType1()));
|
filters.add(FieldFilters.eq("sysType1",dto.getSysType1()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(dto.getPublish()!=null){
|
if(dto.getPublish()!=null){
|
||||||
filters.add(FieldFilters.eq("published",dto.getPublish()));
|
filters.add(FieldFilters.eq("published",dto.getPublish()));
|
||||||
}
|
}
|
||||||
if(StringUtil.isNotBlank(dto.getOrgId())){
|
|
||||||
if(dto.getOrgId().contains(",")){
|
|
||||||
String[] split = dto.getOrgId().split(",");
|
|
||||||
List<String> strings = Arrays.asList(split);
|
|
||||||
filters.add(FieldFilters.in("orgId",strings));
|
|
||||||
}else {
|
|
||||||
filters.add(FieldFilters.eq("orgId",dto.getOrgId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +242,25 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
@Override
|
@Override
|
||||||
public PageList<Course> findPage(int pageIndex, int pageSize, CourseQueryDto dto) {
|
public PageList<Course> findPage(int pageIndex, int pageSize, CourseQueryDto dto) {
|
||||||
List<IFieldFilter> filters = createFilters(dto);
|
List<IFieldFilter> filters = createFilters(dto);
|
||||||
|
|
||||||
|
//有权限的查询,也同时查询出创建人的数据,在权限上
|
||||||
|
if(TempFilterConfig.Manager_CourseFile_ByOrgIds && StringUtils.isNotBlank(dto.getOrgAid())) {
|
||||||
|
if(StringUtil.isNotBlank(dto.getOrgIds())){
|
||||||
|
if(dto.getOrgIds().contains(",")){
|
||||||
|
String[] split = dto.getOrgIds().split(",");
|
||||||
|
List<String> strings = Arrays.asList(split);
|
||||||
|
//filters.add(FieldFilters.in("orgId",strings));
|
||||||
|
filters.add(FieldFilters.or(FieldFilters.in("orgId",strings),FieldFilters.eq("sysCreateAid",dto.getOrgAid())));
|
||||||
|
}else {
|
||||||
|
//filters.add(FieldFilters.eq("orgId",dto.getOrgIds()));
|
||||||
|
filters.add(FieldFilters.or(FieldFilters.eq("orgId",dto.getOrgIds()),FieldFilters.eq("sysCreateAid",dto.getOrgAid())));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
//没有机构权限,只能查出自己创建的
|
||||||
|
filters.add(FieldFilters.eq("sysCreateAid",dto.getOrgAid()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//自动添加过滤已删除
|
//自动添加过滤已删除
|
||||||
filters.add(FieldFilters.eq("deleted",false));
|
filters.add(FieldFilters.eq("deleted",false));
|
||||||
OrderCondition oc=null;
|
OrderCondition oc=null;
|
||||||
@@ -459,11 +471,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
courseDao.update(course);
|
courseDao.update(course);
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(course.getFullTextId())) {
|
if(StringUtils.isNotBlank(course.getFullTextId())) {
|
||||||
try {
|
publishUtil.removeByDocId(course.getFullTextId());
|
||||||
fullTextSearch.removeByDocId(ICourseFullTextSearch.DEFAULT_INDEX_NAME,course.getFullTextId());
|
|
||||||
} catch (Exception e) {
|
|
||||||
//log.error("删除课程时删除全文索引错误",e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//记录日志
|
//记录日志
|
||||||
@@ -483,11 +491,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
Course c=courseDao.get(id);
|
Course c=courseDao.get(id);
|
||||||
//删除分两种情况,一个是管理员删除,一个是自己删除 ,所以这里的处理移到前端了
|
//删除分两种情况,一个是管理员删除,一个是自己删除 ,所以这里的处理移到前端了
|
||||||
if(c.getFullTextId()!=null) {
|
if(c.getFullTextId()!=null) {
|
||||||
try {
|
publishUtil.removeByDocId(c.getFullTextId());
|
||||||
fullTextSearch.removeByDocId(ICourseFullTextSearch.DEFAULT_INDEX_NAME,c.getFullTextId());
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("删除课程时删除全文索引错误",e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//只有速有全文检索返回标识的,才算是发布过再删除的,删除消息
|
//只有速有全文检索返回标识的,才算是发布过再删除的,删除消息
|
||||||
if(StringUtils.isNotBlank(c.getFullTextId())){
|
if(StringUtils.isNotBlank(c.getFullTextId())){
|
||||||
@@ -529,8 +533,6 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(CourseFullDto full) {
|
public void save(CourseFullDto full) {
|
||||||
Course c=full.getCourse();
|
Course c=full.getCourse();
|
||||||
@@ -660,11 +662,8 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
|
|
||||||
//更新后需要删除发布
|
//更新后需要删除发布
|
||||||
if(StringUtils.isNotBlank(c.getFullTextId())) {
|
if(StringUtils.isNotBlank(c.getFullTextId())) {
|
||||||
try {
|
publishUtil.removeByDocId(c.getFullTextId());
|
||||||
fullTextSearch.removeByDocId(ICourseFullTextSearch.DEFAULT_INDEX_NAME,c.getFullTextId());
|
|
||||||
} catch (Exception e) {
|
|
||||||
//log.error("删除课程时删除全文索引错误",e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -722,6 +721,53 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
courseHRBPAuditDao.save(hrbpAudit);
|
courseHRBPAuditDao.save(hrbpAudit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitAndPublish(CourseFullDto full,String aid,String aname) 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//同步发布
|
||||||
|
publishUtil.fullTextPublish(c);
|
||||||
|
//发布事件处理
|
||||||
|
if(eventSender!=null) {
|
||||||
|
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", c.getId()));
|
||||||
|
if(teachers.size()>0) {
|
||||||
|
String authorIds="";
|
||||||
|
for(CourseTeacher cteacher:teachers) {
|
||||||
|
if(authorIds.equals("")) {
|
||||||
|
authorIds+=cteacher.getTeacherId();
|
||||||
|
}else {
|
||||||
|
authorIds+="|"+cteacher.getTeacherId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eventSender.send("发布课程","PublishCourse", "发布课程【"+c.getName()+"】", c.getId(), "1", c.getName(), aid,aname,"authors:"+authorIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
log.error("未配置事件消息发送的实现");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void submit(CourseHRBPAudit hrbpAudit) throws Exception {
|
public void submit(CourseHRBPAudit hrbpAudit) throws Exception {
|
||||||
|
|
||||||
@@ -750,64 +796,64 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
* 发布全文索引
|
* 发布全文索引
|
||||||
* @param c
|
* @param c
|
||||||
*/
|
*/
|
||||||
private void fullTextPublish(Course c) {
|
// private void fullTextPublish(Course c) {
|
||||||
if(fullTextSearch==null) {
|
// if(fullTextSearch==null) {
|
||||||
log.error("未实现全文检索的接口:"+ICourseFullTextSearch.class);
|
// log.error("未实现全文检索的接口:"+ICourseFullTextSearch.class);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
CourseFullText cft=CourseToCourseFullText.convert(c);
|
// CourseFullText cft=CourseToCourseFullText.convert(c);
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
|
//
|
||||||
//计算课程时长
|
// //计算课程时长
|
||||||
int duration=courseContentDao.sumDurationByCourseId(c.getId());
|
// int duration=courseContentDao.sumDurationByCourseId(c.getId());
|
||||||
cft.setDuration(duration);
|
// cft.setDuration(duration);
|
||||||
cft.setType(c.getType());
|
// cft.setType(c.getType());
|
||||||
|
//
|
||||||
//查询教师
|
// //查询教师
|
||||||
List<String> teacherNames=new ArrayList<>();
|
// List<String> teacherNames=new ArrayList<>();
|
||||||
List<CourseTeacher> list = courseTeacherDao.findList(FieldFilters.eq("courseId",c.getId()));
|
// List<CourseTeacher> list = courseTeacherDao.findList(FieldFilters.eq("courseId",c.getId()));
|
||||||
if(list != null && !list.isEmpty()){
|
// if(list != null && !list.isEmpty()){
|
||||||
|
//
|
||||||
for (CourseTeacher ct : list){
|
// for (CourseTeacher ct : list){
|
||||||
teacherNames.add(ct.getTeacherName());
|
// teacherNames.add(ct.getTeacherName());
|
||||||
}
|
// }
|
||||||
cft.setTeacher(StringUtils.join(teacherNames,","));
|
// cft.setTeacher(StringUtils.join(teacherNames,","));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//查询课程受众
|
// //查询课程受众
|
||||||
List<CourseCrowd> crowds =this.findCrowdByCourseId(c.getId());
|
// List<CourseCrowd> crowds =this.findCrowdByCourseId(c.getId());
|
||||||
if(crowds!=null && !crowds.isEmpty()) {
|
// if(crowds!=null && !crowds.isEmpty()) {
|
||||||
String[] crowdIds=new String[crowds.size()];
|
// String[] crowdIds=new String[crowds.size()];
|
||||||
for(int i=0;i<crowds.size();i++) {
|
// for(int i=0;i<crowds.size();i++) {
|
||||||
crowdIds[i]=crowds.get(i).getGroupId();
|
// crowdIds[i]=crowds.get(i).getGroupId();
|
||||||
}
|
// }
|
||||||
//String audienceIds=StringUtils.join(crowdIds,",");
|
// //String audienceIds=StringUtils.join(crowdIds,",");
|
||||||
//log.info("受众信息",audienceIds);
|
// //log.info("受众信息",audienceIds);
|
||||||
//cft.setAudience(audienceIds);
|
// //cft.setAudience(audienceIds);
|
||||||
cft.setAudiences(crowdIds);
|
// cft.setAudiences(crowdIds);
|
||||||
//cft.setAudiences(new String[]{"0C76ECF8-5A14-B6B3-A513-CD22AE912B3E"});
|
// //cft.setAudiences(new String[]{"0C76ECF8-5A14-B6B3-A513-CD22AE912B3E"});
|
||||||
cft.setIsSetAudience(1);//有受众
|
// cft.setIsSetAudience(1);//有受众
|
||||||
}else {
|
// }else {
|
||||||
cft.setIsSetAudience(0);//无受众
|
// cft.setIsSetAudience(0);//无受众
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//String fullTextId="";//全文检索返回的id,用于移除时处理
|
// //String fullTextId="";//全文检索返回的id,用于移除时处理
|
||||||
String newFullId=fullTextSearch.republish(ICourseFullTextSearch.DEFAULT_INDEX_NAME, cft, c.getFullTextId());
|
// String newFullId=fullTextSearch.republish(ICourseFullTextSearch.DEFAULT_INDEX_NAME, cft, c.getFullTextId());
|
||||||
if(StringUtils.isNotBlank(c.getFullTextId())) {
|
// if(StringUtils.isNotBlank(c.getFullTextId())) {
|
||||||
if(StringUtils.isNotBlank(newFullId) && !c.getFullTextId().equals(newFullId)) {
|
// if(StringUtils.isNotBlank(newFullId) && !c.getFullTextId().equals(newFullId)) {
|
||||||
this.updateFieldById(c.getId(),"fullTextId", newFullId);
|
// this.updateFieldById(c.getId(),"fullTextId", newFullId);
|
||||||
}
|
// }
|
||||||
}else {
|
// }else {
|
||||||
if(StringUtils.isNotBlank(newFullId)) {
|
// if(StringUtils.isNotBlank(newFullId)) {
|
||||||
this.updateFieldById(c.getId(),"fullTextId", newFullId);
|
// this.updateFieldById(c.getId(),"fullTextId", newFullId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}catch(Exception e) {
|
// }catch(Exception e) {
|
||||||
log.error("课程发布全文检索失败",e);
|
// log.error("课程发布全文检索失败",e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void audit(String auditId, String courseId, Boolean pass, String aid, String name, String remark,boolean publish,Integer from) {
|
public void audit(String auditId, String courseId, Boolean pass, String aid, String name, String remark,boolean publish,Integer from) {
|
||||||
@@ -836,6 +882,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
UpdateBuilder.create("status", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS),
|
UpdateBuilder.create("status", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS),
|
||||||
UpdateBuilder.create("auditRemark", remark),
|
UpdateBuilder.create("auditRemark", remark),
|
||||||
UpdateBuilder.create("auditUser", name),
|
UpdateBuilder.create("auditUser", name),
|
||||||
|
UpdateBuilder.create("auditAid", aid),
|
||||||
UpdateBuilder.create("auditTime", now),
|
UpdateBuilder.create("auditTime", now),
|
||||||
UpdateBuilder.create("forward", from)
|
UpdateBuilder.create("forward", from)
|
||||||
);
|
);
|
||||||
@@ -843,6 +890,8 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
courseHRBPAuditDao.updateMultiFieldById(auditId,
|
courseHRBPAuditDao.updateMultiFieldById(auditId,
|
||||||
UpdateBuilder.create("status", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS),
|
UpdateBuilder.create("status", pass? CourseHRBPAudit.STATUS_PASS:CourseHRBPAudit.STATUS_NOPASS),
|
||||||
UpdateBuilder.create("auditRemark", remark),
|
UpdateBuilder.create("auditRemark", remark),
|
||||||
|
UpdateBuilder.create("auditUser", name),
|
||||||
|
UpdateBuilder.create("auditAid", aid),
|
||||||
UpdateBuilder.create("auditTime", now)
|
UpdateBuilder.create("auditTime", now)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -857,9 +906,10 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
UpdateBuilder.create("publishTime", LocalDateTime.now()));
|
UpdateBuilder.create("publishTime", LocalDateTime.now()));
|
||||||
//发布到全文检索中
|
//发布到全文检索中
|
||||||
Course c=courseDao.get(courseId);
|
Course c=courseDao.get(courseId);
|
||||||
if(fullTextSearch!=null) {
|
// if(fullTextSearch!=null) {
|
||||||
this.fullTextPublish(c);
|
// this.fullTextPublish(c);
|
||||||
}
|
// }
|
||||||
|
publishUtil.fullTextPublish(c);
|
||||||
//同时添加发布事件,这里的创建人需要修改为教师
|
//同时添加发布事件,这里的创建人需要修改为教师
|
||||||
if(eventSender!=null) {
|
if(eventSender!=null) {
|
||||||
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", courseId));
|
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", courseId));
|
||||||
@@ -893,20 +943,16 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
//发布到全文检索中
|
//发布到全文检索中
|
||||||
if(fullTextSearch!=null) {
|
if(fullTextSearch!=null) {
|
||||||
Course c=courseDao.get(id);
|
Course c=courseDao.get(id);
|
||||||
this.fullTextPublish(c);
|
//this.fullTextPublish(c);
|
||||||
|
publishUtil.fullTextPublish(c);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
courseDao.updateMultiFieldById(id,
|
courseDao.updateMultiFieldById(id,UpdateBuilder.create("published", pass));
|
||||||
UpdateBuilder.create("published", pass));
|
|
||||||
|
|
||||||
if(this.fullTextSearch!=null) {
|
if(this.fullTextSearch!=null) {
|
||||||
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
|
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
|
||||||
if(fullId!=null) {
|
if(fullId!=null) {
|
||||||
try {
|
publishUtil.removeByDocId((String)fullId);
|
||||||
fullTextSearch.removeByDocId(ICourseFullTextSearch.DEFAULT_INDEX_NAME, (String)fullId);
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("更新全文索引字段错误",e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -929,11 +975,7 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
if(this.fullTextSearch!=null) {
|
if(this.fullTextSearch!=null) {
|
||||||
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
|
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
|
||||||
if(fullId!=null) {
|
if(fullId!=null) {
|
||||||
try {
|
publishUtil.updateFieldByDocId((String)fullId, "isTop", top?1:0);
|
||||||
fullTextSearch.updateField(ICourseFullTextSearch.DEFAULT_INDEX_NAME, "isTop", top?1:0, (String)fullId);
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("更新全文索引字段错误",e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -948,15 +990,12 @@ public class CourseServiceImpl implements ICourseService {
|
|||||||
if(this.fullTextSearch!=null) {
|
if(this.fullTextSearch!=null) {
|
||||||
if(enabled) { //启用,重新必
|
if(enabled) { //启用,重新必
|
||||||
Course c=courseDao.get(id);
|
Course c=courseDao.get(id);
|
||||||
this.fullTextPublish(c);
|
//this.fullTextPublish(c);
|
||||||
|
publishUtil.fullTextPublish(c);
|
||||||
}else {
|
}else {
|
||||||
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
|
Object fullId=courseDao.findField("fullTextId", FieldFilters.eq("id", id));
|
||||||
if(fullId!=null) {
|
if(fullId!=null) {
|
||||||
try {
|
publishUtil.removeByDocId((String)fullId);
|
||||||
fullTextSearch.removeByDocId(ICourseFullTextSearch.DEFAULT_INDEX_NAME, (String)fullId);
|
|
||||||
}catch(Exception e) {
|
|
||||||
log.error("停用,从索引中删除课程失败",e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.xboe.module.course.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.FieldFilters;
|
||||||
|
import com.xboe.module.course.dao.CourseContentDao;
|
||||||
|
import com.xboe.module.course.dao.CourseCrowdDao;
|
||||||
|
import com.xboe.module.course.dao.CourseDao;
|
||||||
|
import com.xboe.module.course.dao.CourseTeacherDao;
|
||||||
|
import com.xboe.module.course.dto.CourseFullText;
|
||||||
|
import com.xboe.module.course.entity.Course;
|
||||||
|
import com.xboe.module.course.entity.CourseCrowd;
|
||||||
|
import com.xboe.module.course.entity.CourseTeacher;
|
||||||
|
import com.xboe.module.course.service.CourseToCourseFullText;
|
||||||
|
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布课程的工具类
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class PublishCourseUtil {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseDao courseDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseContentDao courseContentDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseTeacherDao courseTeacherDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CourseCrowdDao courseCrowdDao;
|
||||||
|
|
||||||
|
@Autowired(required = false)
|
||||||
|
private ICourseFullTextSearch fullTextSearch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布课程
|
||||||
|
* @param c
|
||||||
|
*/
|
||||||
|
public void fullTextPublish(Course c) {
|
||||||
|
if(fullTextSearch==null) {
|
||||||
|
log.error("未实现全文检索的接口:"+ICourseFullTextSearch.class);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CourseFullText cft=CourseToCourseFullText.convert(c);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
//计算课程时长
|
||||||
|
int duration=courseContentDao.sumDurationByCourseId(c.getId());
|
||||||
|
cft.setDuration(duration);
|
||||||
|
cft.setType(c.getType());
|
||||||
|
|
||||||
|
//查询教师
|
||||||
|
List<String> teacherNames=new ArrayList<>();
|
||||||
|
List<CourseTeacher> list = courseTeacherDao.findList(FieldFilters.eq("courseId",c.getId()));
|
||||||
|
if(list != null && !list.isEmpty()){
|
||||||
|
|
||||||
|
for (CourseTeacher ct : list){
|
||||||
|
teacherNames.add(ct.getTeacherName());
|
||||||
|
}
|
||||||
|
cft.setTeacher(StringUtils.join(teacherNames,","));
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询课程受众
|
||||||
|
//List<CourseCrowd> crowds =this.findCrowdByCourseId(c.getId());
|
||||||
|
List<CourseCrowd> crowds =courseCrowdDao.findList("courseId", c.getId());
|
||||||
|
if(crowds!=null && !crowds.isEmpty()) {
|
||||||
|
String[] crowdIds=new String[crowds.size()];
|
||||||
|
for(int i=0;i<crowds.size();i++) {
|
||||||
|
crowdIds[i]=crowds.get(i).getGroupId();
|
||||||
|
}
|
||||||
|
//String audienceIds=StringUtils.join(crowdIds,",");
|
||||||
|
//log.info("受众信息",audienceIds);
|
||||||
|
//cft.setAudience(audienceIds);
|
||||||
|
cft.setAudiences(crowdIds);
|
||||||
|
//cft.setAudiences(new String[]{"0C76ECF8-5A14-B6B3-A513-CD22AE912B3E"});
|
||||||
|
cft.setIsSetAudience(1);//有受众
|
||||||
|
}else {
|
||||||
|
cft.setIsSetAudience(0);//无受众
|
||||||
|
}
|
||||||
|
|
||||||
|
//String fullTextId="";//全文检索返回的id,用于移除时处理
|
||||||
|
String newFullId=fullTextSearch.republish(ICourseFullTextSearch.DEFAULT_INDEX_NAME, cft, c.getFullTextId());
|
||||||
|
if(StringUtils.isNotBlank(c.getFullTextId())) {
|
||||||
|
if(StringUtils.isNotBlank(newFullId) && !c.getFullTextId().equals(newFullId)) {
|
||||||
|
courseDao.updateFieldById(c.getId(), "fullTextId", newFullId);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(StringUtils.isNotBlank(newFullId)) {
|
||||||
|
courseDao.updateFieldById(c.getId(), "fullTextId", newFullId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("课程发布全文检索失败",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateFieldByDocId(String docId,String field,Object value) {
|
||||||
|
try {
|
||||||
|
fullTextSearch.updateField(ICourseFullTextSearch.DEFAULT_INDEX_NAME, field,value,docId);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("更新全文索引字段错误",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeByDocId(String docId){
|
||||||
|
if(fullTextSearch==null) {
|
||||||
|
log.error("未实现全文检索的接口:"+ICourseFullTextSearch.class);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
fullTextSearch.removeByDocId(ICourseFullTextSearch.DEFAULT_INDEX_NAME, docId);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("停用,从索引中删除课程失败",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,28 @@
|
|||||||
package com.xboe.module.exam.api;
|
package com.xboe.module.exam.api;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
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;
|
||||||
|
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
import com.xboe.common.Pagination;
|
import com.xboe.common.Pagination;
|
||||||
import com.xboe.common.utils.StringUtil;
|
import com.xboe.common.utils.StringUtil;
|
||||||
import com.xboe.core.JsonResponse;
|
import com.xboe.core.JsonResponse;
|
||||||
import com.xboe.core.api.ApiBaseController;
|
import com.xboe.core.api.ApiBaseController;
|
||||||
|
import com.xboe.module.exam.dto.TestUserDto;
|
||||||
|
import com.xboe.module.exam.dto.TestUserQuery;
|
||||||
import com.xboe.module.exam.entity.AloneExam;
|
import com.xboe.module.exam.entity.AloneExam;
|
||||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||||
import com.xboe.module.exam.service.IAloneExamService;
|
import com.xboe.module.exam.service.IAloneExamService;
|
||||||
import com.xboe.module.exam.vo.AloneExamQuery;
|
import com.xboe.module.exam.vo.AloneExamQuery;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对于与第三方对接的扩展接口
|
* 对于与第三方对接的扩展接口
|
||||||
@@ -94,5 +104,39 @@ public class AloneExamExtendApi extends ApiBaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试情况统计,按考试
|
||||||
|
* 总人数,完成人数,进行中的人数,未开始的人数,通过的人数,未通过的人数
|
||||||
|
* @param testId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/stat")
|
||||||
|
public JsonResponse<Map<String,Object>> stat(String testId){
|
||||||
|
if(StringUtil.isBlank(testId)){
|
||||||
|
return badRequest("参数异常");
|
||||||
|
}
|
||||||
|
//List<AloneExamAnswer> answer = aloneExamService.findAnswer(aloneId);
|
||||||
|
Map<String,Object> map=new HashMap<String,Object>();
|
||||||
|
try {
|
||||||
|
|
||||||
|
return success(map);
|
||||||
|
}catch(Exception e) {
|
||||||
|
return error("考试统计错误",e.getMessage(),null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/user-answers")
|
||||||
|
public JsonResponse<PageList<TestUserDto>> userAnswers(@RequestBody TestUserQuery query){
|
||||||
|
if(StringUtil.isBlank(query.getTestId())){
|
||||||
|
return badRequest("参数异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
//PageList<TestUserDto> rs=aloneExamService.
|
||||||
|
return success(null);
|
||||||
|
}catch(Exception e) {
|
||||||
|
return error("考试统计错误",e.getMessage(),null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.xboe.module.exam.dto;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TestUserAnswerDto {
|
||||||
|
|
||||||
|
private Integer totalScore;
|
||||||
|
|
||||||
|
private Float realScore;
|
||||||
|
|
||||||
|
private Float score;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private Integer testDuration;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime lastTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.xboe.module.exam.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TestUserDto implements java.io.Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer pageIndex;
|
||||||
|
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private String testId;
|
||||||
|
|
||||||
|
private String testName;//这一项为什么还要呀,就是指定的考试
|
||||||
|
|
||||||
|
private String aloneId;
|
||||||
|
|
||||||
|
private String aid;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private List<TestUserAnswerDto> answers;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.xboe.module.exam.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TestUserQuery implements java.io.Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Integer pageIndex;
|
||||||
|
private Integer pageSize;
|
||||||
|
private Integer status;
|
||||||
|
private String[] aids;
|
||||||
|
private String testId;
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.xboe.module.exam.service;
|
package com.xboe.module.exam.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
|
import com.xboe.module.exam.dto.TestUserDto;
|
||||||
|
import com.xboe.module.exam.dto.TestUserQuery;
|
||||||
import com.xboe.module.exam.entity.AloneExam;
|
import com.xboe.module.exam.entity.AloneExam;
|
||||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||||
import com.xboe.module.exam.vo.AloneExamQuery;
|
import com.xboe.module.exam.vo.AloneExamQuery;
|
||||||
@@ -138,4 +141,20 @@ public interface IAloneExamService {
|
|||||||
* */
|
* */
|
||||||
List<AloneExamAnswer> findAnswer(String aloneId);
|
List<AloneExamAnswer> findAnswer(String aloneId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计答卷情况
|
||||||
|
* @param testId
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
Map<String,Object> statByTestId(String testId) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询答卷情况
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
PageList<TestUserDto> findTestUserAnswers(TestUserQuery params) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,31 @@
|
|||||||
package com.xboe.module.exam.service.impl;
|
package com.xboe.module.exam.service.impl;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import com.xboe.common.utils.StringUtil;
|
|
||||||
import com.xboe.module.exam.vo.AloneExamQuery;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.xboe.common.OrderCondition;
|
import com.xboe.common.OrderCondition;
|
||||||
import com.xboe.common.PageList;
|
import com.xboe.common.PageList;
|
||||||
|
import com.xboe.common.utils.StringUtil;
|
||||||
import com.xboe.core.orm.FieldFilters;
|
import com.xboe.core.orm.FieldFilters;
|
||||||
import com.xboe.core.orm.QueryBuilder;
|
import com.xboe.core.orm.QueryBuilder;
|
||||||
import com.xboe.core.orm.UpdateBuilder;
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
import com.xboe.module.exam.dao.AloneExamAnswerDao;
|
import com.xboe.module.exam.dao.AloneExamAnswerDao;
|
||||||
import com.xboe.module.exam.dao.AloneExamDao;
|
import com.xboe.module.exam.dao.AloneExamDao;
|
||||||
|
import com.xboe.module.exam.dto.TestUserDto;
|
||||||
|
import com.xboe.module.exam.dto.TestUserQuery;
|
||||||
import com.xboe.module.exam.entity.AloneExam;
|
import com.xboe.module.exam.entity.AloneExam;
|
||||||
import com.xboe.module.exam.entity.AloneExamAnswer;
|
import com.xboe.module.exam.entity.AloneExamAnswer;
|
||||||
import com.xboe.module.exam.entity.ExamTest;
|
import com.xboe.module.exam.entity.ExamTest;
|
||||||
import com.xboe.module.exam.service.IAloneExamService;
|
import com.xboe.module.exam.service.IAloneExamService;
|
||||||
|
import com.xboe.module.exam.vo.AloneExamQuery;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AloneExamServiceImpl implements IAloneExamService{
|
public class AloneExamServiceImpl implements IAloneExamService{
|
||||||
@@ -332,4 +336,52 @@ public class AloneExamServiceImpl implements IAloneExamService{
|
|||||||
return aeDao.get(id);
|
return aeDao.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//新增加的接口
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按考试统计(总人数,完成人数,进行中的人数,未开始的人数,通过的人数,未通过的人数)
|
||||||
|
* @param testId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String,Object> statByTestId(String testId) throws Exception {
|
||||||
|
// QueryBuilder query=QueryBuilder.from(AloneExamAnswer.class);
|
||||||
|
// query.addField("new AloneExamAnswer(id,aid,name,testId,testName,arrange,passLine,status,startTime,endTime,lastTime,clientIp,ucode,score,totalScore,realScore,useSecond)");
|
||||||
|
// query.addFilter(FieldFilters.eq("aid",aid));
|
||||||
|
// query.addFilter(FieldFilters.eq("testId",testId));
|
||||||
|
// query.addOrder(OrderCondition.desc("id"));
|
||||||
|
// query.setPageSize(1);
|
||||||
|
// List<AloneExamAnswer> list=dao.findList(query.builder());
|
||||||
|
// if(list.isEmpty()) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PageList<TestUserDto> findTestUserAnswers(TestUserQuery params) throws Exception{
|
||||||
|
|
||||||
|
QueryBuilder query=QueryBuilder.from(AloneExam.class);
|
||||||
|
query.addFields("id,aid,name,testName,passLine,score,status");
|
||||||
|
query.setPageIndex(params.getPageIndex());
|
||||||
|
query.setPageSize(params.getPageSize());
|
||||||
|
query.addFilter(FieldFilters.eq("testId",params.getTestId()));
|
||||||
|
if(params.getAids()!=null) {
|
||||||
|
query.addFilter(FieldFilters.in("aid",params.getAids()));
|
||||||
|
}
|
||||||
|
if(params.getStatus()!=null) {
|
||||||
|
query.addFilter(FieldFilters.eq("status",params.getStatus()));
|
||||||
|
}
|
||||||
|
PageList<Object[]> rsUsers=aeDao.findPageFields(query.builder());
|
||||||
|
List<TestUserDto> dtoUsers=new ArrayList<TestUserDto>();
|
||||||
|
for(Object[] objs : rsUsers.getList()) {
|
||||||
|
TestUserDto dto=new TestUserDto();
|
||||||
|
dto.setAloneId((String)objs[0]);
|
||||||
|
dto.setAid((String)objs[1]);
|
||||||
|
dto.setName((String)objs[2]);
|
||||||
|
dto.setTestId(params.getTestId());
|
||||||
|
dto.setTestName((String)objs[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
PageList<TestUserDto> rs=new PageList<TestUserDto>();
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,52 +87,58 @@ public class PortalConsoleApi extends ApiBaseController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//检查是否是教师,并计算用户的类型,修改于220507
|
//检查是否是教师,并计算用户的类型,修改于220507
|
||||||
Teacher t = teacherService.get(account.getId());
|
|
||||||
int utype=1,ttype=0;
|
// Teacher t = teacherService.get(account.getId());
|
||||||
//本地判断是否是管理员
|
// int utype=1,ttype=0;
|
||||||
if(user.getUserType()!=null && user.getUserType()==3) {
|
// //本地判断是否是管理员
|
||||||
utype=3;
|
// if(user.getUserType()!=null && user.getUserType()==3) {
|
||||||
}
|
// utype=3;
|
||||||
//判断是否是老师
|
// }
|
||||||
if(t!=null && (t.getDeleted()==null || !t.getDeleted())) {
|
// //判断是否是老师
|
||||||
ttype=2;
|
// if(t!=null && (t.getDeleted()==null || !t.getDeleted())) {
|
||||||
}
|
// ttype=2;
|
||||||
if(utype==3) {
|
// }
|
||||||
if(ttype==2) {
|
// if(utype==3) {
|
||||||
utype=5;//是管理员,又是教师
|
// if(ttype==2) {
|
||||||
}
|
// utype=5;//是管理员,又是教师
|
||||||
}else {
|
// }
|
||||||
if(ttype==2) {
|
// }else {
|
||||||
utype=2;
|
// if(ttype==2) {
|
||||||
}
|
// utype=2;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
//以下是使用的接口数据判断身份
|
//以下是使用的接口数据判断身份
|
||||||
// int utype=1;//仅仅是学员
|
int utype=1;//仅仅是学员
|
||||||
// if(userData!=null) {
|
if(userData!=null) {
|
||||||
//
|
|
||||||
// if(userData.getTeacher()) {
|
if(userData.getTeacher()) {
|
||||||
// utype=2;
|
utype=2;
|
||||||
// }
|
}
|
||||||
// if(userData.getAdminType()>0) {
|
if(userData.getAdminType()>0) {
|
||||||
// if(utype==2) {
|
if(utype==2) {
|
||||||
// utype=5;//是管理员,又是教师
|
utype=5;//是管理员,又是教师
|
||||||
// }else {
|
}else {
|
||||||
// utype=3;
|
utype=3;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
map.put("aid",account.getId());
|
map.put("aid",account.getId());
|
||||||
map.put("sysId",user.getSysId());
|
map.put("sysId",user.getSysId());
|
||||||
map.put("adminType",userData==null? 0:userData.getAdminType());//管理员类型,1表默认管理员,2表非默认管理员,0表不是管理员
|
map.put("adminType",userData==null? 0:userData.getAdminType());//管理员类型,1表默认管理员,2表非默认管理员,0表不是管理员
|
||||||
//map.put("adminType",0);
|
//map.put("adminType",2);
|
||||||
map.put("companyId",user.getCompanyId());
|
map.put("companyId",user.getCompanyId());
|
||||||
map.put("name",user.getName());
|
map.put("name",user.getName());
|
||||||
map.put("sex",user.getGender());
|
map.put("sex",user.getGender());
|
||||||
map.put("userNo",user.getUserNo());
|
map.put("userNo",user.getUserNo());
|
||||||
map.put("showHome",user.getShowHome()==null? true:user.getShowHome());
|
map.put("showHome",user.getShowHome()==null? true:user.getShowHome());
|
||||||
map.put("userType",utype);
|
if(isLocalDevelopment()) {
|
||||||
|
map.put("userType",5);
|
||||||
|
}else {
|
||||||
|
map.put("userType",utype);
|
||||||
|
}
|
||||||
|
|
||||||
map.put("departId",user.getDepartId());
|
map.put("departId",user.getDepartId());
|
||||||
map.put("sign",user.getSign());
|
map.put("sign",user.getSign());
|
||||||
map.put("departName",departName);
|
map.put("departName",departName);
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package com.xboe.school.study.api;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.xboe.common.PageList;
|
||||||
|
import com.xboe.common.Pagination;
|
||||||
|
import com.xboe.core.JsonResponse;
|
||||||
|
import com.xboe.core.api.ApiBaseController;
|
||||||
|
import com.xboe.module.course.dto.CourseStudyDto;
|
||||||
|
import com.xboe.module.course.service.ICourseStudySearch;
|
||||||
|
import com.xboe.school.study.entity.StudyCourse;
|
||||||
|
import com.xboe.school.study.service.IStudyCourseService;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ES的课程检索
|
||||||
|
* @author seastar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value="/xboe/school/study/es")
|
||||||
|
public class StudyCourseESApi extends ApiBaseController{
|
||||||
|
|
||||||
|
@Autowired(required = false)
|
||||||
|
ICourseStudySearch search;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IStudyCourseService service;
|
||||||
|
|
||||||
|
@RequestMapping(value="/search",method = {RequestMethod.GET,RequestMethod.POST})
|
||||||
|
public JsonResponse<PageList<CourseStudyDto>> search(Pagination page, CourseStudyDto dto){
|
||||||
|
if(search==null) {
|
||||||
|
return error("无ES的实现","");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
PageList<CourseStudyDto> rs=search.search(page.getStartRow(),page.getPageSize(), dto);
|
||||||
|
return success(rs);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("查询报名学习ES失败",e);
|
||||||
|
return error("查询失败",e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/index-create")
|
||||||
|
public JsonResponse<Boolean> createIndex(){
|
||||||
|
if(search==null) {
|
||||||
|
return error("无ES的实现","",false);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
search.createIndex();
|
||||||
|
return success(true);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("创建索引失败",e);
|
||||||
|
return error("创建索引失败:"+e.getMessage(),e.getMessage(),false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/index-delete")
|
||||||
|
public JsonResponse<Boolean> deleteIndex(){
|
||||||
|
//前端一定要二次询问
|
||||||
|
if(search==null) {
|
||||||
|
return error("无ES的实现","",false);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
search.deleteIndex();
|
||||||
|
return success(true);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("删除索引失败",e);
|
||||||
|
return error("删除索引失败:"+e.getMessage(),e.getMessage(),false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete-by-esid")
|
||||||
|
public JsonResponse<Boolean> deleteByDocId(String esid){
|
||||||
|
//前端一定要二次询问
|
||||||
|
if(search==null) {
|
||||||
|
return error("无ES的实现","",false);
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(esid)) {
|
||||||
|
return badRequest("未指定ESId");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
search.removeByDocId(esid);
|
||||||
|
return success(true);
|
||||||
|
}catch(Exception e) {
|
||||||
|
log.error("删除ES学习课程错误",e);
|
||||||
|
return error("删除失败:"+e.getMessage(),e.getMessage(),false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化课程学习数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/init")
|
||||||
|
public JsonResponse<Boolean> init(){
|
||||||
|
if(search==null) {
|
||||||
|
return error("无ES的实现","",false);
|
||||||
|
}
|
||||||
|
//按分页初始化
|
||||||
|
int pageIndex=1;
|
||||||
|
int pageSize=1000;
|
||||||
|
int total=1001;
|
||||||
|
while(total>pageIndex*pageSize) {
|
||||||
|
PageList<StudyCourse> result = service.findPage(pageIndex,pageSize, null, null, null);
|
||||||
|
pageIndex++;
|
||||||
|
total=result.getCount();
|
||||||
|
for(StudyCourse sc : result.getList()) {
|
||||||
|
CourseStudyDto dto=new CourseStudyDto();
|
||||||
|
dto.setId(sc.getId());
|
||||||
|
dto.setAccountId(sc.getAid());
|
||||||
|
dto.setCourseId(sc.getCourseId());
|
||||||
|
dto.setCourseImage(sc.getCourseImage());
|
||||||
|
dto.setCourseName(sc.getCourseName());
|
||||||
|
dto.setCourseType(sc.getCourseType());
|
||||||
|
dto.setProgress(sc.getProgress()==null? 0:sc.getProgress().intValue());
|
||||||
|
dto.setSource(2);//固定值,新系统
|
||||||
|
//如果开始时间没有,就使用添加时间
|
||||||
|
if(sc.getStartTime()!=null) {
|
||||||
|
dto.setStartTime(sc.getStartTime().toEpochSecond(ZoneOffset.of("+8")));
|
||||||
|
}else {
|
||||||
|
dto.setStartTime(sc.getAddTime().toEpochSecond(ZoneOffset.of("+8")));
|
||||||
|
}
|
||||||
|
dto.setStatus(sc.getStatus());
|
||||||
|
try {
|
||||||
|
search.publishOrUpdate(dto, null);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("ES发布课程学习【"+sc.getAname()+","+sc.getCourseName()+"】失败",e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,6 +36,14 @@ public interface IStudyCourseService {
|
|||||||
*/
|
*/
|
||||||
StudyCourse findByCourseIdAndAid(String courseId,String aid);
|
StudyCourse findByCourseIdAndAid(String courseId,String aid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为ES初始化的处理
|
||||||
|
* @param pageIndex
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageList<StudyCourse> findByES(int pageIndex,int pageSize) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询课程学习记录,用户的课程学习记录
|
* 分页查询课程学习记录,用户的课程学习记录
|
||||||
* @param pageIndex
|
* @param pageIndex
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.xboe.core.utils.ConvertUtil;
|
|||||||
import com.xboe.module.course.dao.CourseContentDao;
|
import com.xboe.module.course.dao.CourseContentDao;
|
||||||
import com.xboe.module.course.dao.CourseDao;
|
import com.xboe.module.course.dao.CourseDao;
|
||||||
import com.xboe.module.course.entity.Course;
|
import com.xboe.module.course.entity.Course;
|
||||||
|
import com.xboe.module.course.service.ICourseStudySearch;
|
||||||
import com.xboe.school.study.dao.StudyAssessDao;
|
import com.xboe.school.study.dao.StudyAssessDao;
|
||||||
import com.xboe.school.study.dao.StudyCourseDao;
|
import com.xboe.school.study.dao.StudyCourseDao;
|
||||||
import com.xboe.school.study.dao.StudyCourseItemDao;
|
import com.xboe.school.study.dao.StudyCourseItemDao;
|
||||||
@@ -84,6 +85,8 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
|||||||
@Autowired
|
@Autowired
|
||||||
CourseDao courseDao;
|
CourseDao courseDao;
|
||||||
|
|
||||||
|
@Autowired(required = false)
|
||||||
|
ICourseStudySearch search;//对ES的处理
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StudyCourse findByCourseIdAndAid(String courseId, String aid) {
|
public StudyCourse findByCourseIdAndAid(String courseId, String aid) {
|
||||||
@@ -221,10 +224,10 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
|||||||
query.addFilter(FieldFilters.eq("c.deleted",false));
|
query.addFilter(FieldFilters.eq("c.deleted",false));
|
||||||
|
|
||||||
query.addField("sc");
|
query.addField("sc");
|
||||||
// 先写死
|
|
||||||
// if(oc!=null) {
|
if(oc==null) {
|
||||||
// oc=OrderCondition.desc("sc.id");
|
oc=OrderCondition.desc("sc.addTime");
|
||||||
// }
|
}
|
||||||
query.addOrder(oc);
|
query.addOrder(oc);
|
||||||
if(sc!=null) {
|
if(sc!=null) {
|
||||||
if(StringUtils.isNotBlank(sc.getCourseName())) {
|
if(StringUtils.isNotBlank(sc.getCourseName())) {
|
||||||
@@ -277,6 +280,11 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
|||||||
studySignupDao.deleteByFilter(FieldFilters.and(FieldFilters.eq("courseId",courseId),FieldFilters.eq("aid",aid)));
|
studySignupDao.deleteByFilter(FieldFilters.and(FieldFilters.eq("courseId",courseId),FieldFilters.eq("aid",aid)));
|
||||||
//修改课程学习人数
|
//修改课程学习人数
|
||||||
courseDao.updateMultiFieldById(courseId, UpdateBuilder.create("studys", "studys-1", FieldUpdateType.EXPRESSION));
|
courseDao.updateMultiFieldById(courseId, UpdateBuilder.create("studys", "studys-1", FieldUpdateType.EXPRESSION));
|
||||||
|
//同步删除ES的处理
|
||||||
|
if(search!=null) {
|
||||||
|
//search.removeByStudyId(id);
|
||||||
|
log.info("删除,同步操作ES的删除未启用,如果确认已配置ES,请启用");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +437,7 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
|||||||
List<Object[]> clist= studyCourseDao.findListFields(courseHql,studyCourseQuery.getIds());
|
List<Object[]> clist= studyCourseDao.findListFields(courseHql,studyCourseQuery.getIds());
|
||||||
List<Object[]> slist= studyCourseDao.findListFields(studyHql,studyCourseQuery.getAids(),studyCourseQuery.getIds());
|
List<Object[]> slist= studyCourseDao.findListFields(studyHql,studyCourseQuery.getAids(),studyCourseQuery.getIds());
|
||||||
//数据数量一般不会太多,不超过20条,所以直接使用嵌套循环
|
//数据数量一般不会太多,不超过20条,所以直接使用嵌套循环
|
||||||
Map<String,Object> map=new HashMap<String,Object>();
|
//Map<String,Object> map=new HashMap<String,Object>();
|
||||||
for(Object[] sobjs : slist) {
|
for(Object[] sobjs : slist) {
|
||||||
StudyCourseSimple sc=new StudyCourseSimple();
|
StudyCourseSimple sc=new StudyCourseSimple();
|
||||||
sc.setCourseId(ConvertUtil.toStr(sobjs[0]));
|
sc.setCourseId(ConvertUtil.toStr(sobjs[0]));
|
||||||
@@ -601,7 +609,7 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Object[]> progress(String aid, List<String> courseIds) {
|
public List<Object[]> progress(String aid, List<String> courseIds) {
|
||||||
List<Object> floats = new ArrayList<>();
|
//List<Object> floats = new ArrayList<>();
|
||||||
QueryBuilder builder = QueryBuilder.from(StudyCourse.class);
|
QueryBuilder builder = QueryBuilder.from(StudyCourse.class);
|
||||||
builder.addFilter(FieldFilters.eq("aid",aid));
|
builder.addFilter(FieldFilters.eq("aid",aid));
|
||||||
builder.addFilter(FieldFilters.in("courseId",courseIds));
|
builder.addFilter(FieldFilters.in("courseId",courseIds));
|
||||||
@@ -666,4 +674,28 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
|||||||
return sc;
|
return sc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageList<StudyCourse> findByES(int pageIndex, int pageSize) throws Exception {
|
||||||
|
QueryBuilder query=QueryBuilder.from(StudyCourse.class.getSimpleName()+" sc,"+ Course.class.getSimpleName()+" c");
|
||||||
|
query.addField("sc");
|
||||||
|
query.addField("c.coverImg");
|
||||||
|
query.setPageIndex(pageIndex);
|
||||||
|
query.setPageSize(pageSize);
|
||||||
|
query.addFilter(FieldFilters.eqField("sc.courseId","c.id"));
|
||||||
|
query.addFilter(FieldFilters.eq("c.enabled",true));
|
||||||
|
query.addFilter(FieldFilters.eq("c.deleted",false));
|
||||||
|
List<StudyCourse> rslist=new ArrayList<StudyCourse>();
|
||||||
|
PageList<Object[]> list=studyCourseDao.findPageFields(query.builder());
|
||||||
|
for(Object[] objs : list.getList()) {
|
||||||
|
StudyCourse sc=(StudyCourse)objs[0];
|
||||||
|
sc.setCourseImage((String)objs[1]);
|
||||||
|
rslist.add(sc);
|
||||||
|
}
|
||||||
|
PageList<StudyCourse> rs=new PageList<StudyCourse>();
|
||||||
|
rs.setCount(list.getCount());
|
||||||
|
rs.setPageSize(pageSize);
|
||||||
|
rs.setList(rslist);
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user