mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 19:36:50 +08:00
Merge branch 'master' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/baseservers
This commit is contained in:
@@ -15,7 +15,6 @@ public class CourseFullText {
|
||||
/**es中的id*/
|
||||
private String esId;
|
||||
|
||||
|
||||
/**名称*/
|
||||
private String name;
|
||||
|
||||
@@ -29,6 +28,8 @@ public class CourseFullText {
|
||||
|
||||
/**10无目录录播课,20 有目录录播课,30:面授课;40学习项目*/
|
||||
private Integer type;
|
||||
/**多个时用到*/
|
||||
private String types;
|
||||
|
||||
/**原系统的企业id,对应sass模式的字段*/
|
||||
private String companyId;
|
||||
|
||||
@@ -110,6 +110,8 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
||||
builder.field("teacher").startObject().field("type", "text").field("analyzer","comma").endObject();
|
||||
builder.field("teacherCode").startObject().field("type", "text").field("analyzer","comma").endObject();
|
||||
builder.field("publishTime").startObject().field("type", "integer").endObject();
|
||||
builder.field("startTime").startObject().field("type", "integer").endObject();
|
||||
builder.field("endTime").startObject().field("type", "integer").endObject();
|
||||
builder.field("duration").startObject().field("type", "integer").endObject();
|
||||
builder.field("tags").startObject().field("type", "text").endObject();
|
||||
builder.field("sysType1").startObject().field("type", "keyword").endObject();
|
||||
@@ -264,8 +266,20 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
||||
}else {
|
||||
boolQuery.filter(QueryBuilders.termQuery("type", params.getType()));
|
||||
}
|
||||
}else if(StringUtils.isNotBlank(params.getTypes())) {
|
||||
List<Integer> typeList=new ArrayList<>();
|
||||
if(params.getTypes().indexOf("20")>-1) {
|
||||
typeList.add(10);
|
||||
}
|
||||
String[] typeArray=params.getTypes().split("-");
|
||||
for(String s:typeArray) {
|
||||
typeList.add(Integer.valueOf(s));
|
||||
}
|
||||
boolQuery.filter(QueryBuilders.termsQuery("type", typeList));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(params.getSource()!=null) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("source", params.getSource()));
|
||||
}
|
||||
@@ -273,13 +287,29 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
||||
boolQuery.filter(QueryBuilders.termQuery("openCourse", params.getOpenCourse()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getSysType1())) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("sysType1", params.getSysType1()));
|
||||
if(params.getSysType1().indexOf("-")>-1) {
|
||||
String[] typeArray=params.getSysType1().split("-");
|
||||
boolQuery.filter(QueryBuilders.termsQuery("sysType1", typeArray));
|
||||
}else {
|
||||
boolQuery.filter(QueryBuilders.termQuery("sysType1", params.getSysType1()));
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getSysType2())) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("sysType2", params.getSysType2()));
|
||||
if(params.getSysType2().indexOf("-")>-1) {
|
||||
String[] typeArray=params.getSysType2().split("-");
|
||||
boolQuery.filter(QueryBuilders.termsQuery("sysType2", typeArray));
|
||||
}else {
|
||||
boolQuery.filter(QueryBuilders.termQuery("sysType2", params.getSysType2()));
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(params.getSysType3())) {
|
||||
boolQuery.filter(QueryBuilders.termQuery("sysType3", params.getSysType3()));
|
||||
if(params.getSysType3().indexOf("-")>-1) {
|
||||
String[] typeArray=params.getSysType3().split("-");
|
||||
boolQuery.filter(QueryBuilders.termsQuery("sysType3", typeArray));
|
||||
}else {
|
||||
boolQuery.filter(QueryBuilders.termQuery("sysType3", params.getSysType3()));
|
||||
}
|
||||
}
|
||||
//增加companyId过滤
|
||||
if(StringUtils.isNotBlank(params.getCompanyId())) {
|
||||
@@ -433,6 +463,7 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
|
||||
sourceBuilder.sort("publishTime",SortOrder.DESC);
|
||||
}else if(paras.getOrderType()==2) {
|
||||
sourceBuilder.sort("studies",SortOrder.DESC);
|
||||
sourceBuilder.sort("publishTime",SortOrder.DESC);
|
||||
}
|
||||
}
|
||||
//sourceBuilder.sort("isTop",SortOrder.DESC);
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.xboe.module.scorm.cam.model.Manifest;
|
||||
|
||||
/**
|
||||
* manifest.xml内容的保存
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
public interface IManifestInfoSave{
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xboe.module.scorm;
|
||||
|
||||
import com.xboe.module.scorm.data.ScormFile;
|
||||
|
||||
/**
|
||||
* SCORM课件文件的相关处理
|
||||
*
|
||||
*/
|
||||
public interface IScormFileHandle {
|
||||
|
||||
/**
|
||||
* 根据传入的id获到scorm文件的目录信息
|
||||
* @param scormId
|
||||
* @return
|
||||
*/
|
||||
ScormFile getById(String scormId)throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.xboe.module.scorm;
|
||||
|
||||
/**
|
||||
* 课程学习回调。
|
||||
* 开始学习时触发回调事件,学习sco完成的回调事件
|
||||
*
|
||||
*/
|
||||
public interface IScormStudyCallback {
|
||||
|
||||
|
||||
/**
|
||||
* 学习完成回调
|
||||
* @param lmsId 初始化时传入的学习lmsId
|
||||
* @param courseId 初始化时传入的课程id
|
||||
* @param contentId 初始化时传入的课程内容id
|
||||
* @param studentId 学生id
|
||||
* @param studentName 学习姓名
|
||||
* @param scormId scorm课程的id
|
||||
* @param scoId sco的id
|
||||
*/
|
||||
void finishCallback(String lmsId,String courseId,String contentId,String studentId,String studentName,String scormId,String scoId);
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.xboe.module.scorm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.module.scorm.cam.load.SCORMPackageManager;
|
||||
import com.xboe.module.scorm.cam.model.ContentPackage;
|
||||
import com.xboe.module.scorm.cam.model.Item;
|
||||
import com.xboe.module.scorm.cam.model.Manifest;
|
||||
import com.xboe.module.scorm.cam.model.Organization;
|
||||
import com.xboe.module.scorm.cam.model.Resource;
|
||||
import com.xboe.module.scorm.cam.model.datatype.IDRef;
|
||||
import com.xboe.module.scorm.data.ScoItem;
|
||||
import com.xboe.module.scorm.data.ScormData;
|
||||
|
||||
/**
|
||||
* 解析程序,转化为课程存储的json
|
||||
*/
|
||||
public class SCORMParser {
|
||||
|
||||
public String parserToJson(String path) throws Exception {
|
||||
// System.out.println("test");
|
||||
ContentPackage cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", path);
|
||||
Manifest manifest= cp.getManifest();
|
||||
// System.out.println(cp.getManifest().getIdentifier());
|
||||
// System.out.println(cp.getContent());
|
||||
|
||||
ScormData data=new ScormData();
|
||||
List<ScoItem> scoItems=new ArrayList<ScoItem>();
|
||||
|
||||
// System.out.println("title="+cp.getManifest().getOrganizations().getOrganizationList().get(0).getTitle());
|
||||
// for(Resource res : cp.getManifest().getResources().getResourceList()) {
|
||||
// System.out.println(res.getHref());
|
||||
// }
|
||||
//提取组织菜单
|
||||
IDRef ref = manifest.getOrganizations().getDefaultOrganizationID();
|
||||
if(ref!=null){
|
||||
data.setDefaultId(ref.getValue());
|
||||
}
|
||||
|
||||
List<Organization> orgList = manifest.getOrganizations().getOrganizationList();
|
||||
for(Organization organ :orgList) {
|
||||
for(Item item : organ.getItemList()) {
|
||||
if(StringUtils.isNotBlank(item.getIdentifierref())) {
|
||||
Resource res=findResource(manifest.getResources().getResourceList(),item.getIdentifierref());
|
||||
if(res!=null) {
|
||||
//if(res.getScormType().equals("sco")) {
|
||||
ScoItem sco=new ScoItem();
|
||||
sco.setId(res.getIdentifier().getValue());
|
||||
sco.setTitle(item.getTitle());
|
||||
//sco.setScoId(res.getIdentifier().getValue());
|
||||
sco.setScoUrl(res.getHref());
|
||||
sco.setScoType(res.getScormType());
|
||||
scoItems.add(sco);
|
||||
//}
|
||||
}
|
||||
}else { //多个item 的处理
|
||||
if(item.getItemList()!=null) {
|
||||
for(Item subItem : item.getItemList()) {
|
||||
Resource res=findResource(manifest.getResources().getResourceList(),subItem.getIdentifierref());
|
||||
if(res!=null) {
|
||||
//if(res.getScormType().equals("sco")) {
|
||||
ScoItem sco=new ScoItem();
|
||||
sco.setId(res.getIdentifier().getValue());
|
||||
sco.setTitle(subItem.getTitle());
|
||||
//sco.setScoId(res.getIdentifier().getValue());
|
||||
sco.setScoUrl(res.getHref());
|
||||
sco.setScoType(res.getScormType());
|
||||
scoItems.add(sco);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//scorm的版本
|
||||
data.setSchema(manifest.getMetadata().getSchema());
|
||||
data.setVersion(manifest.getMetadata().getSchemaVersion());
|
||||
data.setScoItems(scoItems);//sco共有多少个
|
||||
if(scoItems.size()>0 && scoItems.get(0).getScoUrl()!=null) {
|
||||
data.setIndex(scoItems.get(0).getScoUrl());//打开播放时进入的第一个sco
|
||||
}else {
|
||||
data.setIndex("");//无首页地址
|
||||
}
|
||||
|
||||
|
||||
ObjectMapper om=new ObjectMapper();
|
||||
String json=om.writeValueAsString(data);
|
||||
return json;
|
||||
}
|
||||
|
||||
private Resource findResource(List<Resource> resList,String identifier) {
|
||||
for(Resource res : resList) {
|
||||
if(res.getIdentifier().getValue().equals(identifier)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// SCORMParser parser=new SCORMParser();
|
||||
// //String path1="E:/Projects/BOEU/scorm/file/ContentPackagingOneFilePerSCO_SCORM12.zip";
|
||||
// String path1="E:/Projects/BOEU/scorm/file/7a462dbee222ba62810191d2f512576e.zip";
|
||||
// try {
|
||||
// String json= parser.parserToJson(path1);
|
||||
// System.out.println(json);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.Element;
|
||||
@@ -452,11 +453,10 @@ public class ContentPackageGenerator {
|
||||
private void parseResources(Element resourcesNode) {
|
||||
if (resourcesNode != null) {
|
||||
Resources resources = new Resources();
|
||||
String base = resourcesNode.attributeValue(
|
||||
rootQNameGenerator.xml("base", resourcesNode.getNamespace()));
|
||||
String base = resourcesNode.attributeValue(rootQNameGenerator.xml("base", resourcesNode.getNamespace()));
|
||||
resources.setXmlBase(base == null ? null : new AnyURI(base));
|
||||
resourcesNode.elements(rootQNameGenerator.imscp("resource"))
|
||||
.forEach(element -> parseResource(resources, (Element) element));
|
||||
resourcesNode.elements(rootQNameGenerator.imscp("resource")).forEach(element -> parseResource(resources, (Element) element));
|
||||
//resourcesNode.elements("resource").forEach(element -> parseResource(resources, (Element) element));
|
||||
contentPackage.getManifest().setResources(resources);
|
||||
}
|
||||
}
|
||||
@@ -465,13 +465,32 @@ public class ContentPackageGenerator {
|
||||
if (resourceNode != null) {
|
||||
Resource resource = new Resource();
|
||||
Namespace pns = resourceNode.getNamespace();
|
||||
String id = resourceNode.attributeValue(rootQNameGenerator.imscp("identifier", pns));
|
||||
//String id = resourceNode.attributeValue(rootQNameGenerator.imscp("identifier", pns));
|
||||
String id = resourceNode.attributeValue(rootQNameGenerator.imscp("identifier"));
|
||||
resource.setIdentifier(id == null ? null : new ID(id));
|
||||
resource.setType(resourceNode.attributeValue(rootQNameGenerator.imscp("type", pns)));
|
||||
resource.setHref(resourceNode.attributeValue(rootQNameGenerator.imscp("href", pns)));
|
||||
String base = resourceNode.attributeValue(rootQNameGenerator.xml("base", pns));
|
||||
//resource.setType(resourceNode.attributeValue(rootQNameGenerator.imscp("type", pns)));
|
||||
resource.setType(resourceNode.attributeValue(rootQNameGenerator.imscp("type")));
|
||||
//resource.setHref(resourceNode.attributeValue(rootQNameGenerator.imscp("href", pns)));
|
||||
resource.setHref(resourceNode.attributeValue(rootQNameGenerator.imscp("href")));
|
||||
//String base = resourceNode.attributeValue(rootQNameGenerator.xml("base", pns));
|
||||
String base = resourceNode.attributeValue(rootQNameGenerator.xml("base"));
|
||||
resource.setXmlBase(base == null ? null : new AnyURI(base));
|
||||
resource.setScormType(resourceNode.attributeValue(rootQNameGenerator.adlcp("scormType", pns)));
|
||||
//resource.setScormType(resourceNode.attributeValue(rootQNameGenerator.adlcp("scormtype", pns)));
|
||||
resource.setScormType(resourceNode.attributeValue(rootQNameGenerator.adlcp("scormtype")));
|
||||
// String scormType=rootQNameGenerator.adlcp("scormType");
|
||||
// //使用此方法无法获取到value值
|
||||
// //resource.setScormType(resourceNode.attributeValue(scormType));
|
||||
// //改成这样查询获取
|
||||
// List<Attribute> attrList=resourceNode.attributes();
|
||||
// for(Attribute attr :attrList){
|
||||
// System.out.println(attr.getName()+"="+attr.getValue());
|
||||
// if(attr.getName().equalsIgnoreCase·(scormType)) {
|
||||
// resource.setScormType(attr.getValue());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
String qNameForFile = rootQNameGenerator.imscp("file");
|
||||
String qNameForDependency = rootQNameGenerator.imscp("dependency");
|
||||
for (Object obj : resourceNode.elements()) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SCORMPackageManager {
|
||||
}
|
||||
}
|
||||
|
||||
private ContentPackage loadSCORMContentPackageFromZipFile(String lmsContentPackageID, String zipFilePath) {
|
||||
public ContentPackage loadSCORMContentPackageFromZipFile(String lmsContentPackageID, String zipFilePath) {
|
||||
if (!ZipUtils.isEndWithZip(zipFilePath)) {
|
||||
return null;
|
||||
}
|
||||
@@ -117,35 +117,35 @@ public class SCORMPackageManager {
|
||||
return contentPackageMap.size();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// System.out.println(SCORMPackageManager.getInstance()
|
||||
// .loadSCORMContentPackageFromZipFile("1", "learningserver-scorm/scorm-test-pkg.zip")
|
||||
// .getContent());
|
||||
System.out.println("test");
|
||||
ContentPackage cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/ContentPackagingOneFilePerSCO_SCORM12.zip");
|
||||
System.out.println(cp.getManifest().getIdentifier());
|
||||
System.out.println(cp.getContent());
|
||||
System.out.println("title="+cp.getManifest().getOrganizations().getOrganizationList().get(0).getTitle());
|
||||
for(Resource res : cp.getManifest().getResources().getResourceList()) {
|
||||
System.out.println(res.getHref());
|
||||
}
|
||||
|
||||
// System.out.println("ADL_Maritime_Navigation");
|
||||
// cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/ADL_Maritime_Navigation.zip");
|
||||
// public static void main(String[] args) {
|
||||
//// System.out.println(SCORMPackageManager.getInstance()
|
||||
//// .loadSCORMContentPackageFromZipFile("1", "learningserver-scorm/scorm-test-pkg.zip")
|
||||
//// .getContent());
|
||||
// System.out.println("test");
|
||||
// ContentPackage cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/ContentPackagingOneFilePerSCO_SCORM12.zip");
|
||||
// System.out.println(cp.getManifest().getIdentifier());
|
||||
// System.out.println(cp.getContent());
|
||||
// System.out.println("title="+cp.getManifest().getOrganizations().getOrganizationList().get(0).getTitle());
|
||||
// for(Resource res : cp.getManifest().getResources().getResourceList()) {
|
||||
// System.out.print(res.getHref());
|
||||
// System.out.println(res.getHref());
|
||||
// }
|
||||
//
|
||||
// System.out.println("7a462dbee222ba62810191d2f512576e");
|
||||
// ContentPackage cp3=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/7a462dbee222ba62810191d2f512576e.zip");
|
||||
// System.out.println(cp3.getManifest().getIdentifier());
|
||||
// System.out.println(cp3.getContent());
|
||||
// for(Resource res : cp3.getManifest().getResources().getResourceList()) {
|
||||
// System.out.print(res.getHref());
|
||||
// }
|
||||
//
|
||||
}
|
||||
//// System.out.println("ADL_Maritime_Navigation");
|
||||
//// cp=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/ADL_Maritime_Navigation.zip");
|
||||
//// System.out.println(cp.getManifest().getIdentifier());
|
||||
//// System.out.println(cp.getContent());
|
||||
//// for(Resource res : cp.getManifest().getResources().getResourceList()) {
|
||||
//// System.out.print(res.getHref());
|
||||
//// }
|
||||
////
|
||||
//// System.out.println("7a462dbee222ba62810191d2f512576e");
|
||||
//// ContentPackage cp3=SCORMPackageManager.getInstance().loadSCORMContentPackageFromZipFile("1", "E:/Projects/BOEU/scorm/file/7a462dbee222ba62810191d2f512576e.zip");
|
||||
//// System.out.println(cp3.getManifest().getIdentifier());
|
||||
//// System.out.println(cp3.getContent());
|
||||
//// for(Resource res : cp3.getManifest().getResources().getResourceList()) {
|
||||
//// System.out.print(res.getHref());
|
||||
//// }
|
||||
////
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.xboe.module.scorm.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* sco的信息
|
||||
*
|
||||
*/
|
||||
public class ScoItem {
|
||||
|
||||
private String id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String scoType;
|
||||
|
||||
private String scoUrl;
|
||||
|
||||
private List<ScoItem> items;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
public String getScoType() {
|
||||
return scoType;
|
||||
}
|
||||
|
||||
public void setScoType(String scoType) {
|
||||
this.scoType = scoType;
|
||||
}
|
||||
|
||||
public String getScoUrl() {
|
||||
return scoUrl;
|
||||
}
|
||||
|
||||
public void setScoUrl(String scoUrl) {
|
||||
this.scoUrl = scoUrl;
|
||||
}
|
||||
|
||||
public List<ScoItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<ScoItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xboe.module.scorm.data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* scorm数据信息,简化后的,只是记录需要的,其它的不需要
|
||||
* @author seastar
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class ScormData {
|
||||
|
||||
/**
|
||||
* 默认就是 “ADL SCORM”
|
||||
*/
|
||||
private String schema="ADL SCORM";
|
||||
|
||||
/**
|
||||
* 对应的 schema version
|
||||
*/
|
||||
private String version;
|
||||
|
||||
private String defaultId;//默认的组织id
|
||||
|
||||
/**
|
||||
* 默认的页面
|
||||
*/
|
||||
private String index;
|
||||
|
||||
/**
|
||||
* 对应的学习内容的页面数据
|
||||
*/
|
||||
private List<ScoItem> scoItems;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xboe.module.scorm.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ScormFile {
|
||||
|
||||
/**
|
||||
* 文件的id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 文件所在的目录
|
||||
*/
|
||||
private String dirPath;
|
||||
|
||||
/**
|
||||
* zip文件名
|
||||
*/
|
||||
private String zipName;
|
||||
|
||||
/**
|
||||
* scorm的数据
|
||||
*/
|
||||
private ScormData data;
|
||||
|
||||
}
|
||||
@@ -1,28 +1,25 @@
|
||||
package com.xboe.module.scorm.rte.model.result;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.rte.model.error.ScormError;
|
||||
|
||||
public class CollectionScormResult<Instance> extends ScormResult {
|
||||
|
||||
private Instance instance;
|
||||
|
||||
public CollectionScormResult(@NotNull String returnValue, @NotNull ScormError error) {
|
||||
public CollectionScormResult(String returnValue, ScormError error) {
|
||||
this(returnValue, error, (Instance) null);
|
||||
}
|
||||
|
||||
public CollectionScormResult(@NotNull String returnValue, @NotNull ScormError error, @NotNull String diagnostic) {
|
||||
public CollectionScormResult(String returnValue,ScormError error,String diagnostic) {
|
||||
this(returnValue, error, diagnostic, (Instance) null);
|
||||
}
|
||||
|
||||
public CollectionScormResult(@NotNull String returnValue, @NotNull ScormError error, Instance instance) {
|
||||
public CollectionScormResult(String returnValue,ScormError error, Instance instance) {
|
||||
super(returnValue, error);
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public CollectionScormResult(@NotNull String returnValue, @NotNull ScormError error,
|
||||
@NotNull String diagnostic, Instance instance) {
|
||||
public CollectionScormResult(String returnValue, ScormError error,String diagnostic, Instance instance) {
|
||||
super(returnValue, error, diagnostic);
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.xboe.module.scorm.rte.model.result;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.rte.model.error.ScormError;
|
||||
|
||||
public class ScormResult {
|
||||
@@ -14,11 +12,11 @@ public class ScormResult {
|
||||
|
||||
private String diagnostic;
|
||||
|
||||
public ScormResult(@NotNull String returnValue, @NotNull ScormError error) {
|
||||
public ScormResult(String returnValue, ScormError error) {
|
||||
this(returnValue, error, error.getMsg());
|
||||
}
|
||||
|
||||
public ScormResult(@NotNull String returnValue, @NotNull ScormError error, @NotNull String diagnostic) {
|
||||
public ScormResult(String returnValue, ScormError error, String diagnostic) {
|
||||
this.returnValue = returnValue;
|
||||
this.error = error;
|
||||
this.diagnostic = diagnostic;
|
||||
@@ -28,7 +26,7 @@ public class ScormResult {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public ScormResult setReturnValue(@NotNull String returnValue) {
|
||||
public ScormResult setReturnValue(String returnValue) {
|
||||
this.returnValue = returnValue;
|
||||
return this;
|
||||
}
|
||||
@@ -41,7 +39,7 @@ public class ScormResult {
|
||||
return diagnostic;
|
||||
}
|
||||
|
||||
public ScormResult setDiagnostic(@NotNull String diagnostic) {
|
||||
public ScormResult setDiagnostic(String diagnostic) {
|
||||
this.diagnostic = diagnostic;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.xboe.module.scorm.sn.api.behavior;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.sn.api.behavior.result.NavigationBehaviorResult;
|
||||
import com.xboe.module.scorm.sn.api.behavior.result.SequencingException;
|
||||
import com.xboe.module.scorm.sn.api.request.NavigationRequest;
|
||||
@@ -31,7 +29,7 @@ public class NavigationBehavior {
|
||||
* Available Children AM.1.1
|
||||
* Suspended Activity AM.1.2
|
||||
*/
|
||||
public static NavigationBehaviorResult processNavigationRequest(@NotNull NavigationRequest navigationRequest) {
|
||||
public static NavigationBehaviorResult processNavigationRequest(NavigationRequest navigationRequest) {
|
||||
NavigationRequest.Type type = navigationRequest.getRequestType();
|
||||
ActivityTree activityTree = navigationRequest.getTargetActivityTree();
|
||||
Activity currentActivity = activityTree.getGlobalStateInformation().getCurrentActivity();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xboe.module.scorm.sn.api.behavior;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.sn.api.behavior.result.DeliveryBehaviorResult;
|
||||
import com.xboe.module.scorm.sn.api.behavior.result.NavigationBehaviorResult;
|
||||
import com.xboe.module.scorm.sn.api.behavior.result.OverallSequencingResult;
|
||||
@@ -30,7 +28,7 @@ public class OverallSequencingBehavior {
|
||||
* @see SequencingBehavior#processSequencingRequest(SequencingRequest) SB.2.12
|
||||
* @see TerminationBehavior#processTerminationRequest(TerminationRequest) TB.2.3
|
||||
*/
|
||||
public static OverallSequencingResult overallSequencing(@NotNull NavigationRequest navigationRequest) {
|
||||
public static OverallSequencingResult overallSequencing(NavigationRequest navigationRequest) {
|
||||
// 1.1
|
||||
NavigationBehaviorResult navigationBehaviorResult = NavigationBehavior.processNavigationRequest(navigationRequest);
|
||||
// 1.2
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xboe.module.scorm.sn.api.event;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.sn.api.request.NavigationRequest;
|
||||
import com.xboe.module.scorm.sn.api.request.NavigationRequest.Type;
|
||||
import com.xboe.module.scorm.sn.model.tree.Activity;
|
||||
@@ -9,7 +7,7 @@ import com.xboe.module.scorm.sn.model.tree.ActivityTree;
|
||||
|
||||
public class EventTranslator {
|
||||
|
||||
public static NavigationRequest translateEventToRequestType(@NotNull NavigationEvent event,
|
||||
public static NavigationRequest translateEventToRequestType(NavigationEvent event,
|
||||
ActivityTree activityTree, Activity activity) {
|
||||
return new NavigationRequest(getRequestType(event), activityTree, activity);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xboe.module.scorm.sn.api.request;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.sn.model.tree.Activity;
|
||||
import com.xboe.module.scorm.sn.model.tree.ActivityTree;
|
||||
|
||||
@@ -9,7 +7,7 @@ public class NavigationRequest extends Request {
|
||||
|
||||
private Type requestType;
|
||||
|
||||
public NavigationRequest(@NotNull Type requestType, ActivityTree targetActivityTree, Activity targetActivity) {
|
||||
public NavigationRequest(Type requestType, ActivityTree targetActivityTree, Activity targetActivity) {
|
||||
super(targetActivityTree, targetActivity);
|
||||
this.requestType = requestType;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xboe.module.scorm.sn.api.request;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.sn.api.behavior.common.TraversalDirection;
|
||||
import com.xboe.module.scorm.sn.model.tree.Activity;
|
||||
import com.xboe.module.scorm.sn.model.tree.ActivityTree;
|
||||
@@ -16,7 +14,7 @@ public class SequencingRequest extends Request {
|
||||
|
||||
private boolean considerChildren;
|
||||
|
||||
public SequencingRequest(@NotNull Type requestType, ActivityTree targetActivityTree, Activity targetActivity) {
|
||||
public SequencingRequest(Type requestType, ActivityTree targetActivityTree, Activity targetActivity) {
|
||||
super(targetActivityTree, targetActivity);
|
||||
this.requestType = requestType;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.xboe.module.scorm.sn.api.request;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.sn.model.tree.Activity;
|
||||
import com.xboe.module.scorm.sn.model.tree.ActivityTree;
|
||||
|
||||
@@ -9,7 +7,7 @@ public class TerminationRequest extends Request {
|
||||
|
||||
private Type requestType;
|
||||
|
||||
public TerminationRequest(@NotNull Type requestType, ActivityTree targetActivityTree, Activity targetActivity) {
|
||||
public TerminationRequest(Type requestType, ActivityTree targetActivityTree, Activity targetActivity) {
|
||||
super(targetActivityTree, targetActivity);
|
||||
this.requestType = requestType;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.xboe.module.scorm.sn.model.definition;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.sn.model.datatype.Vocabulary;
|
||||
|
||||
@@ -18,7 +17,7 @@ public class SequencingRuleDescription implements DefinitionElementSet {
|
||||
private final List<RuleCondition> ruleConditions;
|
||||
private final Vocabulary ruleAction;
|
||||
|
||||
public SequencingRuleDescription(@NotNull ConditionType conditionType) {
|
||||
public SequencingRuleDescription(ConditionType conditionType) {
|
||||
this.conditionType = conditionType;
|
||||
conditionCombination = new Vocabulary("All", "All", "Any");
|
||||
ruleConditions = new ArrayList<>();
|
||||
|
||||
@@ -9,8 +9,6 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Stack;
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
|
||||
import com.xboe.module.scorm.common.ID;
|
||||
import com.xboe.module.scorm.sn.model.global.GlobalObjectiveDescription;
|
||||
import com.xboe.module.scorm.sn.model.tracking.GlobalStateInformation;
|
||||
@@ -76,14 +74,14 @@ public class ActivityTree {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean existActivity(@NotNull Activity activity) {
|
||||
public boolean existActivity(Activity activity) {
|
||||
if (root == null) {
|
||||
return false;
|
||||
}
|
||||
return existActivity(root, activity);
|
||||
}
|
||||
|
||||
public boolean existActivity(@NotNull Activity activity, @NotNull Activity target) {
|
||||
public boolean existActivity(Activity activity, Activity target) {
|
||||
if (activity.equals(target)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.xboe.module.scorm.web;
|
||||
|
||||
/**
|
||||
* 全文检索查询实现
|
||||
*/
|
||||
public class ScormPlayer {
|
||||
|
||||
}
|
||||
@@ -17,6 +17,11 @@
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-module-scorm</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-core</artifactId>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xboe;
|
||||
|
||||
/**
|
||||
* 临时常量,用于控制与用户同步的一些实现的处理控制,是否启动控制过滤
|
||||
*
|
||||
*/
|
||||
public class TempFilterConfig {
|
||||
|
||||
/**
|
||||
* 课件管理查询,启动按机构查询过滤
|
||||
*/
|
||||
public static final boolean Manager_CourseFile_ByOrgIds=true;
|
||||
|
||||
/**
|
||||
* 课程管理热裤机构id过滤
|
||||
*/
|
||||
public static final boolean Manager_Course_ByOrgIds=true;
|
||||
|
||||
/**
|
||||
* 用户登录使用api
|
||||
*/
|
||||
public static final boolean Login_User_ByApi=true;
|
||||
}
|
||||
@@ -19,10 +19,12 @@ public class UserData {
|
||||
/**用户工号*/
|
||||
private String code;
|
||||
|
||||
private String mobile;
|
||||
|
||||
/**band的级别*/
|
||||
private Integer bandLevel;
|
||||
|
||||
/**姓名*/
|
||||
/**姓名,对应realName*/
|
||||
private String name;
|
||||
|
||||
/**用户的头像*/
|
||||
@@ -44,9 +46,24 @@ public class UserData {
|
||||
private String orgNamePath;
|
||||
|
||||
/**
|
||||
* 用户类型,1表学员,2表教师,3表管理员
|
||||
* 用户类型,1表学员 此在这只默认只表学员
|
||||
*/
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 表教师 是为1
|
||||
* */
|
||||
private Boolean teacher;
|
||||
|
||||
/**
|
||||
* 表系统管理员 是为1
|
||||
* */
|
||||
private Boolean sysAdmin;
|
||||
|
||||
/**
|
||||
* 管理员类型,1表默认管理员,2表非默认管理员,0表不是管理员
|
||||
* */
|
||||
private Integer adminType;
|
||||
|
||||
/**
|
||||
* 是否删除的,如果是删除的,上面所有的字段可以不提供,只提供id就可以了
|
||||
|
||||
@@ -14,8 +14,14 @@ public interface IOutSideDataService {
|
||||
List<AudienceUser> getUsersByAudienceId(String audienceId);
|
||||
|
||||
/**
|
||||
* 通过统一用户id获取用户的信息
|
||||
* 通过统一用户id获取用户的信息,如果是空,就是当前登录的用户
|
||||
*/
|
||||
UserData getUserInfoByUserId(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户有权限的机构id
|
||||
* */
|
||||
List<String> getOrgIds();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.xboe.data.outside;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -76,19 +73,28 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// OutSideDataServiceImpl impl=new OutSideDataServiceImpl();
|
||||
// impl.getUserInfoByUserId(null);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public UserData getUserInfoByUserId(String userId) {
|
||||
|
||||
String token = TokenProxy.getToken(request);
|
||||
//String token="eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzIxMTI3NTUsImV4cCI6MTY3MjExOTk1NSwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.1348e0cfbb064d6d348d3976db3618974c1b1e8d2f6c6f45ae8294f09223f9b1";
|
||||
String type="application/json";
|
||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
String url= getBaseUrl("/user/info");
|
||||
//String url="https://u-pre.boe.com/userbasic/user/info";
|
||||
ObjectMapper mapper=new ObjectMapper();
|
||||
try {
|
||||
//OkHttpUtil http=new OkHttpUtil();
|
||||
String responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||
//System.out.println(responseStr);
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
int code = rootNode.get("code").asInt();
|
||||
int code = rootNode.get("status").asInt();
|
||||
if(code!=200) {
|
||||
log.error("获取当前用户信息返回结果错误:"+responseStr);
|
||||
return null;
|
||||
@@ -105,37 +111,92 @@ public class OutSideDataServiceImpl implements IOutSideDataService {
|
||||
}else {
|
||||
user.setBandLevel(0);
|
||||
}
|
||||
user.setAvatar("");
|
||||
user.setAvatar(getNodeText(result.get("avatar")));
|
||||
user.setCode(getNodeText(result.get("userNo")));
|
||||
user.setDeleted(result.get("deleted").asBoolean());
|
||||
//user.setDeleted(result.get("deleted").asBoolean());//无此字段
|
||||
user.setDeleted(false);
|
||||
user.setDepartId(getNodeText(result.get("departId")));
|
||||
user.setDepartName("");//无此字段
|
||||
user.setDepartName(getNodeText(result.get("departName")));//无此字段
|
||||
user.setGender(1);//少此字段
|
||||
user.setKid(getNodeText(result.get("kid")));
|
||||
user.setLearningDuration(result.get("learningDuration").asInt());
|
||||
user.setName(result.get("realName").asText());
|
||||
user.setOrgNamePath(result.get("orgNamePath").asText());
|
||||
user.setOrgNamePath(result.get("orgName").asText());
|
||||
user.setUserType(1);//直接设置为学员
|
||||
user.setTeacher(false);
|
||||
user.setAdminType(0);
|
||||
JsonNode roleList = result.get("roleList");
|
||||
if(roleList!=null){
|
||||
for(JsonNode jsonNode :roleList) {
|
||||
String roleCode=getNodeText(jsonNode.get("code"));
|
||||
if(roleCode.equals("system-admin")){
|
||||
user.setSysAdmin(true);//系统管理员
|
||||
}
|
||||
if(roleCode.equals("learning-admin")){
|
||||
user.setAdminType(1);//默认管理员
|
||||
}else if(roleCode.equals("non-default-admin")) {
|
||||
user.setAdminType(2);//非默认管理员
|
||||
}
|
||||
if(roleCode.equals("teacher")){
|
||||
user.setTeacher(true);//是老师
|
||||
user.setUserType(2);//教师
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(user.getCode())) {
|
||||
log.error("通过接口获取当前用户信息【"+user.getId()+"】"+user.getName()+",工号为空,不能使用");
|
||||
throw new RuntimeException("通过接口获取当前用户信息,工号为空,不能使用");
|
||||
}
|
||||
|
||||
}
|
||||
//System.out.println("用户管理员:"+user.getAdminType());
|
||||
//System.out.println("老师:"+user.getTeacher());
|
||||
return user;
|
||||
} catch (Exception e) {
|
||||
log.error("获取当前用户信息错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getOrgIds() {
|
||||
List<String> orgIds = new ArrayList<>();
|
||||
String token = TokenProxy.getToken(request);
|
||||
String type="application/json";
|
||||
String[] headers=new String[] {"token",token,"Content-Type",type};
|
||||
String url= getBaseUrl("/org/listOrgIds");
|
||||
ObjectMapper mapper=new ObjectMapper();
|
||||
String responseStr=null;
|
||||
try{
|
||||
responseStr = okHttpUtil.doPostJson(url,"{}", headers);
|
||||
JsonNode rootNode= mapper.readTree(responseStr);
|
||||
int code = rootNode.get("status").asInt();
|
||||
if(code!=200) {
|
||||
log.error("获取当前用户拥有权限机构id错误:"+responseStr);
|
||||
return null;
|
||||
}
|
||||
|
||||
if(rootNode.get("result")!=null & rootNode.get("result").isObject()) {
|
||||
JsonNode result = rootNode.get("result");
|
||||
Iterator<JsonNode> elements = result.elements();
|
||||
while (elements.hasNext()){
|
||||
orgIds.add(elements.next().toString());
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("获取当前用户有权限的机构id错误",e);
|
||||
}
|
||||
return orgIds;
|
||||
|
||||
}
|
||||
|
||||
private String getBaseUrl(String url) {
|
||||
String baseUrl=SysConstant.getConfigValue("xboe.server.userbasic.url");
|
||||
if(StringUtils.isBlank(baseUrl)) {
|
||||
log.error("调用用户接口错误,未配置用户服务的地址【xboe.server.userbasic.url】");
|
||||
throw new RuntimeException("获取用户信息错误,未配置用户服务的地址");
|
||||
}
|
||||
String reqUrl= baseUrl+"/user/info";
|
||||
String reqUrl= baseUrl+url;
|
||||
return reqUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,10 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
@Override
|
||||
@Transactional
|
||||
public void syncUserFull(UserData user) {
|
||||
|
||||
//如果删除状态为空,则设置为不删除
|
||||
if(user.getDeleted()==null) {
|
||||
user.setDeleted(false);
|
||||
}
|
||||
//先查询是否存在
|
||||
Account a=accountDao.get(user.getId());
|
||||
User u=userDao.get(user.getId());
|
||||
@@ -48,11 +51,11 @@ public class DataUserSyncServiceImpl implements IDataUserSyncService{
|
||||
if(user.getDeleted()!=null) {
|
||||
a.setDeleted(user.getDeleted());
|
||||
}
|
||||
|
||||
}else {
|
||||
//新账户
|
||||
a=new Account();
|
||||
a.setDeleted(user.getDeleted());
|
||||
|
||||
a.setSysId(user.getKid());
|
||||
a.setLoginName(user.getCode());
|
||||
a.setAvatar(user.getAvatar());
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
package com.xboe.module.boecase.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.module.boecase.dao.CasesMajorTypeDao;
|
||||
import com.xboe.module.boecase.dto.*;
|
||||
import com.xboe.module.boecase.entity.CasesMajorType;
|
||||
import com.xboe.module.boecase.vo.CaseExportVo;
|
||||
import com.xboe.module.dict.entity.DictItem;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -94,6 +96,67 @@ public class CasesApi extends ApiBaseController {
|
||||
PageList<CasesFiledVo> pageList = casesService.queryList(pager.getPageIndex(), pager.getPageSize(), caseVo);
|
||||
return success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的案例
|
||||
* */
|
||||
@PostMapping("/mylist")
|
||||
public JsonResponse<PageList<Cases>> mylist(Pagination pager,CaseVo caseVo){
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
PageList<Cases> casesPageList = casesService.myList(pager.getPageIndex(), pager.getPageSize(), caseVo, aid);
|
||||
return success(casesPageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出我的案例
|
||||
* */
|
||||
@PostMapping("/export")
|
||||
public void export(CaseVo caseVo,HttpServletResponse response){
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
OutputStream OutputStream=null;
|
||||
try {
|
||||
OutputStream = response.getOutputStream();
|
||||
LinkedHashMap<String,String> map = new LinkedHashMap<>();
|
||||
map.put("案例名称","title");
|
||||
map.put("状态","status");
|
||||
map.put("审批完成时间","endTime");
|
||||
map.put("公开范围","caseScope");
|
||||
map.put("浏览量","views");
|
||||
map.put("点赞量","praises");
|
||||
map.put("分享量","shares");
|
||||
map.put("收藏量","favorites");
|
||||
List<Cases> list = casesService.myList(caseVo, aid);
|
||||
List<CaseExportVo> exportVos = new ArrayList<>();
|
||||
for (Cases c:list){
|
||||
CaseExportVo caseExportVo = new CaseExportVo();
|
||||
caseExportVo.setTitle(c.getTitle());
|
||||
if(c.getStatus()!=null){
|
||||
if(c.getStatus()==1){
|
||||
caseExportVo.setStatus("待审核");
|
||||
}
|
||||
if(c.getStatus()==2){
|
||||
caseExportVo.setStatus("未通过");
|
||||
}
|
||||
if(c.getStatus()==3){
|
||||
caseExportVo.setStatus("已通过");
|
||||
}
|
||||
}
|
||||
caseExportVo.setEndTime(c.getEndTime());
|
||||
caseExportVo.setCaseScope(c.getCaseScope());
|
||||
caseExportVo.setViews(c.getViews());
|
||||
caseExportVo.setPraises(c.getPraises());
|
||||
caseExportVo.setShares(c.getShares());
|
||||
caseExportVo.setFavorites(c.getFavorites());
|
||||
exportVos.add(caseExportVo);
|
||||
}
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-disposition", "attachment;filename=cases.xls");
|
||||
ExportsExcelSenderUtil.export(map,exportVos, OutputStream,"yyyy-MM-dd HH:mm:ss");
|
||||
}catch (Exception e){
|
||||
log.error("导出失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置置顶
|
||||
@@ -247,7 +310,9 @@ public class CasesApi extends ApiBaseController {
|
||||
if(StringUtil.isBlank(cases.getAuthorId())){
|
||||
return badRequest("请选择作者");
|
||||
}
|
||||
|
||||
if(cases.getExcellent()==null){
|
||||
cases.setExcellent(false);
|
||||
}
|
||||
try {
|
||||
casesService.save(cases);
|
||||
return success(true);
|
||||
@@ -273,6 +338,9 @@ public class CasesApi extends ApiBaseController {
|
||||
if(StringUtil.isBlank(cases.getAuthorId())){
|
||||
return badRequest("请选择作者");
|
||||
}
|
||||
if(cases.getExcellent()==null){
|
||||
cases.setExcellent(false);
|
||||
}
|
||||
try {
|
||||
casesService.update(cases);
|
||||
return success(true);
|
||||
@@ -353,5 +421,24 @@ public class CasesApi extends ApiBaseController {
|
||||
return success(cases);
|
||||
}
|
||||
|
||||
/**
|
||||
*设置/取消优秀案例
|
||||
* */
|
||||
@PostMapping("/excellent")
|
||||
public JsonResponse<Boolean> excellent(String id,Boolean excellent){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
if(excellent==null){
|
||||
excellent=false;//默认设置取消
|
||||
}
|
||||
try {
|
||||
casesService.excellent(id,excellent);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
return error("设置或者取消失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ public class CaseVo {
|
||||
|
||||
private String caseType;
|
||||
|
||||
private Boolean excellent;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ public class Cases extends BaseEntity {
|
||||
* 2:已审核未通过
|
||||
* 3:已审核通过
|
||||
* */
|
||||
// @Column(name = "status",length = 1)
|
||||
// private Integer status;
|
||||
@Column(name = "status",length = 1)
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "views", nullable = false)
|
||||
private Integer views;
|
||||
@@ -224,6 +224,15 @@ public class Cases extends BaseEntity {
|
||||
private String caseValue;
|
||||
|
||||
|
||||
@Column(name = "excellent")
|
||||
private Boolean excellent;
|
||||
|
||||
/**
|
||||
* 设置时间
|
||||
* */
|
||||
@Column(name = "excellent_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime excellentTime;
|
||||
|
||||
@Transient
|
||||
private List<String> majorIds;
|
||||
@@ -232,6 +241,19 @@ public class Cases extends BaseEntity {
|
||||
public Cases() {
|
||||
|
||||
}
|
||||
|
||||
public Cases(String id,String title,LocalDateTime endTime,Integer status, String caseScope,Integer views,Integer comments,Integer praises,Integer shares,Integer favorites){
|
||||
this.title=title;
|
||||
super.setId(id);
|
||||
this.endTime=endTime;
|
||||
this.status=status;
|
||||
this.caseScope=caseScope;
|
||||
this.views=views;
|
||||
this.comments=comments;
|
||||
this.praises=praises;
|
||||
this.shares=shares;
|
||||
this.favorites=favorites;
|
||||
}
|
||||
|
||||
public Cases(String id,String title,String summary,String coverUrl,String authorId,String authorName,LocalDateTime sysCreateTime,Integer breCommend){
|
||||
this.title=title;
|
||||
|
||||
@@ -24,6 +24,17 @@ public interface ICasesService{
|
||||
* */
|
||||
PageList<CasesFiledVo> queryList(int pageIndex,int pageSize,CaseVo caseVo);
|
||||
|
||||
|
||||
/**
|
||||
* 我的案例
|
||||
* */
|
||||
PageList<Cases> myList(int pageIndex,int pageSize,CaseVo caseVo,String aid);
|
||||
|
||||
/**
|
||||
* 导出的查询
|
||||
* */
|
||||
List<Cases> myList(CaseVo caseVo,String aid);
|
||||
|
||||
/**
|
||||
* 设置置顶
|
||||
* */
|
||||
@@ -80,6 +91,11 @@ public interface ICasesService{
|
||||
* */
|
||||
List<CasesVo> caseIndex(Integer type);
|
||||
|
||||
/**
|
||||
* 设置或者取消优秀案例
|
||||
* */
|
||||
void excellent(String id,Boolean excellent);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -63,20 +63,42 @@ public class CasesServiceImpl implements ICasesService {
|
||||
likes.add(FieldFilters.like("keyword4", LikeMatchMode.ANYWHERE, caseVo.getKeyWord()));
|
||||
likes.add(FieldFilters.like("keyword5", LikeMatchMode.ANYWHERE, caseVo.getKeyWord()));
|
||||
|
||||
|
||||
if(StringUtil.isNotBlank(caseVo.getKeyWord())) {
|
||||
filters.add(FieldFilters.or(likes));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(caseVo.getOrgDomain())){
|
||||
filters.add(FieldFilters.eq("orgDomainParent",caseVo.getOrgDomain()));
|
||||
if(caseVo.getOrgDomain().contains(",")){
|
||||
String[] split = caseVo.getOrgDomain().split(",");
|
||||
List<String> strings = Arrays.asList(split);
|
||||
filters.add(FieldFilters.in("orgDomainParent",strings));
|
||||
}else{
|
||||
filters.add(FieldFilters.eq("orgDomainParent",caseVo.getOrgDomain()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//增加只是查询有附件的
|
||||
filters.add(FieldFilters.isNotNull("filePath"));
|
||||
filters.add(FieldFilters.ne("filePath",""));
|
||||
|
||||
// if(StringUtil.isNotBlank(caseVo.getMajorType())){
|
||||
// filters.add(FieldFilters.eq("majorType",caseVo.getMajorType()));
|
||||
// }
|
||||
if(StringUtil.isNotBlank(caseVo.getMajorType())){
|
||||
|
||||
QueryBuilder from = QueryBuilder.from(CasesMajorType.class);
|
||||
from.addFilter(FieldFilters.eq("majorId",caseVo.getMajorType()));
|
||||
//前端直接字符串拼接传,后端转化数组
|
||||
if(caseVo.getMajorType().contains(",")){
|
||||
String[] split = caseVo.getMajorType().split(",");
|
||||
List<String> strings = Arrays.asList(split);
|
||||
from.addFilter(FieldFilters.in("majorId",strings));
|
||||
}else{
|
||||
from.addFilter(FieldFilters.eq("majorId",caseVo.getMajorType()));
|
||||
}
|
||||
from.addGroupBy("caseId");
|
||||
from.addFields("id","caseId");
|
||||
// List<CasesMajorType> list = casesMajorTypeDao.findList(from.builder());
|
||||
@@ -114,9 +136,12 @@ public class CasesServiceImpl implements ICasesService {
|
||||
query.addOrder(OrderCondition.desc("isTop"));
|
||||
query.addOrder(OrderCondition.desc("topTime"));
|
||||
}
|
||||
|
||||
//如果选择的是优秀案例,那么这里就按优秀案例的试试排序
|
||||
if(caseVo.getExcellent()!=null && caseVo.getExcellent()){
|
||||
filters.add(FieldFilters.eq("excellent",caseVo.getExcellent()));
|
||||
}
|
||||
OrderCondition order=null;
|
||||
if(StringUtils.isNotBlank(caseVo.getOrderField())) {
|
||||
if(StringUtils.isNotBlank(caseVo.getOrderField())) {
|
||||
if(caseVo.getOrderAsc()==null || caseVo.getOrderAsc()) {
|
||||
order=OrderCondition.asc(caseVo.getOrderField());
|
||||
}else {
|
||||
@@ -125,6 +150,8 @@ public class CasesServiceImpl implements ICasesService {
|
||||
}else {
|
||||
order=OrderCondition.desc("sysCreateTime");
|
||||
}
|
||||
|
||||
|
||||
query.addFilters(filters);
|
||||
query.addOrder(order);
|
||||
query.setPageIndex(pageIndex);
|
||||
@@ -145,12 +172,16 @@ public class CasesServiceImpl implements ICasesService {
|
||||
if(StringUtils.isNotBlank(caseVo.getOrgDomain())){
|
||||
query.addFilter(FieldFilters.eq("orgDomainParent",caseVo.getOrgDomain()));
|
||||
}
|
||||
if(caseVo.getExcellent()!=null){
|
||||
query.addFilter(FieldFilters.eq("excellent",caseVo.getExcellent()));
|
||||
}
|
||||
// if(StringUtil.isNotBlank(caseVo.getMajorType())){
|
||||
// query.addFilter(FieldFilters.eq("majorType",caseVo.getMajorType()));
|
||||
// }
|
||||
if(caseVo.getIsTop()!=null) {
|
||||
query.addFilter(FieldFilters.eq("isTop",caseVo.getIsTop()));
|
||||
}
|
||||
|
||||
OrderCondition order=null;
|
||||
if(StringUtils.isNotBlank(caseVo.getOrderField())) {
|
||||
if(caseVo.getOrderAsc()==null || caseVo.getOrderAsc()) {
|
||||
@@ -215,6 +246,89 @@ public class CasesServiceImpl implements ICasesService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<Cases> myList(int pageIndex, int pageSize, CaseVo caseVo, String aid) {
|
||||
QueryBuilder query=QueryBuilder.from(Cases.class);
|
||||
query.addFilter(FieldFilters.eq("deleted",false));
|
||||
if(StringUtils.isNotBlank(caseVo.getKeyWord())){
|
||||
query.addFilter(FieldFilters.like("title", LikeMatchMode.ANYWHERE, caseVo.getKeyWord()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(caseVo.getOrgDomain())){
|
||||
query.addFilter(FieldFilters.eq("orgDomainParent",caseVo.getOrgDomain()));
|
||||
}
|
||||
if(caseVo.getExcellent()!=null){
|
||||
query.addFilter(FieldFilters.eq("excellent",caseVo.getExcellent()));
|
||||
}
|
||||
// if(StringUtil.isNotBlank(caseVo.getMajorType())){
|
||||
// query.addFilter(FieldFilters.eq("majorType",caseVo.getMajorType()));
|
||||
// }
|
||||
if(caseVo.getIsTop()!=null) {
|
||||
query.addFilter(FieldFilters.eq("isTop",caseVo.getIsTop()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(aid)){
|
||||
query.addFilter(FieldFilters.eq("authorId",aid));
|
||||
}
|
||||
|
||||
OrderCondition order=null;
|
||||
if(StringUtils.isNotBlank(caseVo.getOrderField())) {
|
||||
if(caseVo.getOrderAsc()==null || caseVo.getOrderAsc()) {
|
||||
order=OrderCondition.asc(caseVo.getOrderField());
|
||||
}else {
|
||||
order=OrderCondition.desc(caseVo.getOrderField());
|
||||
}
|
||||
}else {
|
||||
order=OrderCondition.desc("sysCreateTime");
|
||||
}
|
||||
query.addOrder(order);
|
||||
query.setPageIndex(pageIndex);
|
||||
query.setPageSize(pageSize);
|
||||
query.addFields("new Cases(id,title,endTime,status,caseScope,views,comments,praises,shares,favorites)");
|
||||
PageList<Cases> page = casesDao.findPage(query.builder());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cases> myList(CaseVo caseVo, String aid) {
|
||||
QueryBuilder query=QueryBuilder.from(Cases.class);
|
||||
query.addFilter(FieldFilters.eq("deleted",false));
|
||||
if(StringUtils.isNotBlank(caseVo.getKeyWord())){
|
||||
query.addFilter(FieldFilters.like("title", LikeMatchMode.ANYWHERE, caseVo.getKeyWord()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(caseVo.getOrgDomain())){
|
||||
query.addFilter(FieldFilters.eq("orgDomainParent",caseVo.getOrgDomain()));
|
||||
}
|
||||
if(caseVo.getExcellent()!=null){
|
||||
query.addFilter(FieldFilters.eq("excellent",caseVo.getExcellent()));
|
||||
}
|
||||
// if(StringUtil.isNotBlank(caseVo.getMajorType())){
|
||||
// query.addFilter(FieldFilters.eq("majorType",caseVo.getMajorType()));
|
||||
// }
|
||||
if(caseVo.getIsTop()!=null) {
|
||||
query.addFilter(FieldFilters.eq("isTop",caseVo.getIsTop()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(aid)){
|
||||
query.addFilter(FieldFilters.eq("authorId",aid));
|
||||
}
|
||||
|
||||
OrderCondition order=null;
|
||||
if(StringUtils.isNotBlank(caseVo.getOrderField())) {
|
||||
if(caseVo.getOrderAsc()==null || caseVo.getOrderAsc()) {
|
||||
order=OrderCondition.asc(caseVo.getOrderField());
|
||||
}else {
|
||||
order=OrderCondition.desc(caseVo.getOrderField());
|
||||
}
|
||||
}else {
|
||||
order=OrderCondition.desc("sysCreateTime");
|
||||
}
|
||||
query.addOrder(order);
|
||||
|
||||
query.addFields("new Cases(id,title,endTime,status,caseScope,views,comments,praises,shares,favorites)");
|
||||
List<Cases> list = casesDao.findList(query.builder());
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置置顶
|
||||
* */
|
||||
@@ -516,5 +630,16 @@ public class CasesServiceImpl implements ICasesService {
|
||||
return casesVos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void excellent(String id, Boolean excellent) {
|
||||
//取消时,把时间清空
|
||||
if(excellent) {
|
||||
casesDao.updateMultiFieldById(id,UpdateBuilder.create("excellent",excellent),UpdateBuilder.create("excellentTime",LocalDateTime.now()));
|
||||
}else {
|
||||
casesDao.updateMultiFieldById(id,UpdateBuilder.create("excellent",excellent),UpdateBuilder.create("excellentTime",null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xboe.module.boecase.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.tomcat.jni.Local;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class CaseExportVo {
|
||||
|
||||
|
||||
|
||||
private String title;
|
||||
|
||||
private String status;
|
||||
|
||||
private LocalDateTime endTime;
|
||||
|
||||
private String caseScope;
|
||||
|
||||
private Integer views;
|
||||
|
||||
private Integer praises;
|
||||
|
||||
private Integer shares;
|
||||
|
||||
private Integer favorites;
|
||||
}
|
||||
@@ -8,13 +8,13 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.core.orm.LikeMatchMode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.orm.ObjectOptimisticLockingFailureException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -24,20 +24,26 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.xboe.TempFilterConfig;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.Pagination;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.JsonResponseStatus;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.core.orm.LikeMatchMode;
|
||||
import com.xboe.core.upload.XFileUploader;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.module.course.entity.CourseFile;
|
||||
import com.xboe.module.course.service.ICourseFileService;
|
||||
import com.xboe.module.course.service.impl.FileConverterProvider;
|
||||
import com.xboe.module.scorm.SCORMParser;
|
||||
import com.xboe.standard.BaseConstant;
|
||||
import com.xboe.standard.enums.BoedxCourseFileType;
|
||||
|
||||
import it.sauronsoftware.jave.Encoder;
|
||||
import it.sauronsoftware.jave.MultimediaInfo;
|
||||
@@ -60,6 +66,9 @@ public class CourseFileApi extends ApiBaseController {
|
||||
@Resource
|
||||
XFileUploader fileUploader;
|
||||
|
||||
@Resource
|
||||
IOutSideDataService outSideDataService;
|
||||
|
||||
/**
|
||||
* 管理文件,查询的是全部
|
||||
* @param pager
|
||||
@@ -95,7 +104,18 @@ public class CourseFileApi extends ApiBaseController {
|
||||
if (cfile.getResType() != null) {
|
||||
filters.add(FieldFilters.eq("resType", cfile.getResType()));
|
||||
}
|
||||
|
||||
//增加权限的过滤,只要看到自己或有权限的机构的
|
||||
if(TempFilterConfig.Manager_CourseFile_ByOrgIds) {
|
||||
List<String> orgIds = outSideDataService.getOrgIds();
|
||||
String aid=getCurrent().getAccountId();
|
||||
if(!orgIds.isEmpty()){
|
||||
//filters.add(FieldFilters.in("orgId", orgIds));
|
||||
filters.add(FieldFilters.or(FieldFilters.eq("sysCreateAid", aid),FieldFilters.in("orgId", orgIds)));
|
||||
}else {
|
||||
filters.add(FieldFilters.eq("sysCreateAid", aid));
|
||||
}
|
||||
}
|
||||
|
||||
//默认是查询自己的课件。
|
||||
//
|
||||
PageList<CourseFile> courseFilePageList = courseFileService.queryPage(pager.getPageIndex(), pager.getPageSize(), OrderCondition.desc("id"), filters);
|
||||
@@ -133,6 +153,15 @@ public class CourseFileApi extends ApiBaseController {
|
||||
if (cfile.getResType() != null) {
|
||||
filters.add(FieldFilters.eq("resType", cfile.getResType()));
|
||||
}
|
||||
if(StringUtil.isNotBlank(cfile.getOrgId())){
|
||||
if(cfile.getOrgId().contains(",")){
|
||||
String[] split = cfile.getOrgId().split(",");
|
||||
List<String> strings = Arrays.asList(split);
|
||||
filters.add(FieldFilters.in("orgId",strings));
|
||||
}else {
|
||||
filters.add(FieldFilters.eq("orgId",cfile.getOrgId()));
|
||||
}
|
||||
}
|
||||
|
||||
//默认是查询自己的课件。
|
||||
if (self == null) {
|
||||
@@ -180,14 +209,15 @@ public class CourseFileApi extends ApiBaseController {
|
||||
file.setResType(20);//以后换成变量
|
||||
} else if ("doc,xls,ppt,docx,xlsx,pptx".indexOf(file.getFileType()) > -1) {
|
||||
file.setResType(40);//以后换成变量
|
||||
}else if(file.getFileType().equalsIgnoreCase("zip")) {
|
||||
file.setResType(BoedxCourseFileType.Scrom.getValue());//scorm课件
|
||||
} else {
|
||||
file.setResType(90);//以后换成变量
|
||||
}
|
||||
}
|
||||
|
||||
String fileFullPath = SysConstant.getConfigValue(BaseConstant.CONFIG_UPLOAD_FILES_SAVEPATH) + file.getFilePath();
|
||||
if ("mp3,mp4".indexOf(file.getFileType()) > -1){
|
||||
Encoder encoder = new Encoder();
|
||||
String fileFullPath = SysConstant.getConfigValue(BaseConstant.CONFIG_UPLOAD_FILES_SAVEPATH) + file.getFilePath();
|
||||
try {
|
||||
//System.out.println(fileFullPath);
|
||||
MultimediaInfo m = encoder.getInfo(new File(fileFullPath));
|
||||
@@ -210,11 +240,16 @@ public class CourseFileApi extends ApiBaseController {
|
||||
try {
|
||||
file.setFileType(file.getFileType());
|
||||
|
||||
if(file.getFileType().equals("pdf")) {
|
||||
if(file.getFileType().equalsIgnoreCase("pdf")) {
|
||||
file.setPreviewFilePath(file.getFilePath());
|
||||
file.setConverStatus(0);//代表不需要转化
|
||||
}else if ("doc,xls,ppt,docx,xlsx,pptx".indexOf(file.getFileType().toLowerCase()) > -1) {
|
||||
file.setConverStatus(1);//转化中
|
||||
}else if(file.getFileType().equalsIgnoreCase("zip")) {
|
||||
//scorm包的内容
|
||||
SCORMParser scormParser=new SCORMParser();
|
||||
String json = scormParser.parserToJson(fileFullPath);
|
||||
file.setContent(json);
|
||||
}
|
||||
//保存
|
||||
courseFileService.save(file);
|
||||
@@ -230,6 +265,7 @@ public class CourseFileApi extends ApiBaseController {
|
||||
return error("保存上传课件文件信息失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/detail")
|
||||
public JsonResponse<CourseFile> detail(String id) {
|
||||
|
||||
@@ -134,6 +134,7 @@ public class CourseFullTextApi extends ApiBaseController{
|
||||
paras.setSysType2(dto.getSysType2());//专业分类二级
|
||||
paras.setSysType3(dto.getSysType3());//专业分类三级
|
||||
paras.setDevice(dto.getDevice());
|
||||
paras.setTypes(dto.getTypes());//多个分类的情况
|
||||
//用户的companyId
|
||||
paras.setCompanyId(dto.getCompanyId());
|
||||
//paras.setAudience(dto.getAudiences());
|
||||
|
||||
@@ -43,6 +43,8 @@ public class CourseDao extends BaseDao<Course> {
|
||||
query.addFilter(FieldFilters.eq("status",Course.STATUS_AUDIT_FINISH));
|
||||
query.addFilter(FieldFilters.eq("published", true));
|
||||
query.addFilter(FieldFilters.eq("enabled",true));
|
||||
query.addFilter(FieldFilters.gt("studys",100));
|
||||
query.addFilter(FieldFilters.isNull("kid"));
|
||||
LocalDateTime parse = LocalDate.parse("2022-01-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
||||
query.addFilter(FieldFilters.gt("publishTime",parse));
|
||||
query.addOrder(OrderCondition.desc("studys"));
|
||||
|
||||
@@ -96,4 +96,9 @@ public class CourseQueryDto {
|
||||
* 是否公开课,0表非公开课,1表公开课
|
||||
*/
|
||||
private Integer openCourse;
|
||||
|
||||
/**
|
||||
* 表资源归属的in查询
|
||||
* */
|
||||
private String orgId;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class CourseContent extends BaseEntity {
|
||||
private String contentRefId;
|
||||
|
||||
/**
|
||||
* 内容 具体的内容
|
||||
* 内容 具体的内容,一般是json内容
|
||||
* */
|
||||
@Column(name = "content",columnDefinition = "mediumtext")
|
||||
private String content;
|
||||
|
||||
@@ -123,7 +123,7 @@ public class CourseExam extends BaseEntity {
|
||||
private Boolean percentScore;
|
||||
|
||||
/**
|
||||
* 试题的id,使用已有试卷时保存选择试卷的id
|
||||
* 试卷的id,使用已有试卷时保存选择试卷的id
|
||||
*/
|
||||
@Column(name = "paper_id",nullable=true,length=20)
|
||||
private String paperId;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xboe.module.course.entity;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.BaseEntity;
|
||||
@@ -27,6 +28,18 @@ public class CourseFile extends BaseEntity {
|
||||
@Column(name = "name",nullable=false,length = 100)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所属机构id
|
||||
*/
|
||||
@Column(name = "org_id",length = 36)
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 所属机构名称,冗余存储,因为机构是从其它服务查询过来的,不是本地的的,所以这里存储是为了方便查询显示
|
||||
*/
|
||||
@Column(name = "org_name",length = 100)
|
||||
private String orgName;
|
||||
|
||||
|
||||
/**
|
||||
* 课程id,可以为空,管理员直接上传的课件,属于非课程课件
|
||||
@@ -137,12 +150,24 @@ public class CourseFile extends BaseEntity {
|
||||
@Column(name = "ownership3",length = 50)
|
||||
private String ownership3;
|
||||
|
||||
/**
|
||||
* 对应的内容的json
|
||||
*/
|
||||
@Column(name = "content",columnDefinition = "text")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
* */
|
||||
@Column(name = "remark",length = 200)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* duration 转化为分钟的显示
|
||||
*/
|
||||
@Transient
|
||||
private Integer minute;
|
||||
|
||||
public CourseFile() {
|
||||
|
||||
}
|
||||
|
||||
@@ -320,4 +320,8 @@ public interface ICourseService {
|
||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -202,6 +203,15 @@ public class CourseServiceImpl implements ICourseService {
|
||||
if(dto.getPublish()!=null){
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -483,7 +493,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
if(StringUtils.isNotBlank(c.getFullTextId())){
|
||||
if(eventSender!=null) {
|
||||
List<CourseTeacher> teachers = courseTeacherDao.findList(FieldFilters.eq("courseId", id));
|
||||
if(teachers.size()>0) {
|
||||
if(teachers.size()>0) {
|
||||
String authorIds="";
|
||||
for(CourseTeacher cteacher:teachers) {
|
||||
if(authorIds.equals("")) {
|
||||
@@ -1029,10 +1039,12 @@ public class CourseServiceImpl implements ICourseService {
|
||||
builder.addFilter(FieldFilters.eq("status",Course.STATUS_AUDIT_FINISH));
|
||||
builder.addFilter(FieldFilters.eq("published", true));
|
||||
builder.addFilter(FieldFilters.eq("enabled",true));
|
||||
builder.addFilter(FieldFilters.isNull("kid"));
|
||||
builder.addFilter(FieldFilters.gt("studys",100));
|
||||
LocalDateTime parse = LocalDate.parse("2022-01-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
||||
builder.addFilter(FieldFilters.gt("publishTime",parse));
|
||||
if(index==1){
|
||||
builder.addOrder(OrderCondition.desc("views"));
|
||||
builder.addOrder(OrderCondition.desc("studys"));
|
||||
}else {
|
||||
builder.addOrder(OrderCondition.desc("score"));
|
||||
}
|
||||
@@ -1171,6 +1183,8 @@ public class CourseServiceImpl implements ICourseService {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int countWaitAudit(String aid) {
|
||||
//查询待审核的课程
|
||||
|
||||
@@ -657,6 +657,7 @@ public class AloneExamApi extends ApiBaseController {
|
||||
try {
|
||||
// 排除掉非vo中的数据,减少传输消耗
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
List<TestQuestionVo> voList = objectMapper.readValue(detail.getPaperJson(), new TypeReference<List<TestQuestionVo>>() {});
|
||||
List<TestQuestionVo> eqVoList = objectMapper.readValue(pageJson, new TypeReference<List<TestQuestionVo>>() {});
|
||||
for(TestQuestionVo vo : voList) {
|
||||
@@ -687,6 +688,7 @@ public class AloneExamApi extends ApiBaseController {
|
||||
vo.setDefaultScore(eqVo.getDefaultScore());
|
||||
vo.setTitle(eqVo.getTitle());
|
||||
vo.setType(eqVo.getType());
|
||||
vo.setImages(eqVo.getImages());
|
||||
if(vo.getOptionList()!=null && vo.getOptionList().size()>0) {
|
||||
for(TestOptionVo opt : vo.getOptionList()) {
|
||||
for(TestOptionVo eqOpt : eqVo.getOptionList()) {
|
||||
@@ -695,6 +697,7 @@ public class AloneExamApi extends ApiBaseController {
|
||||
opt.setIsAnswer(eqOpt.getIsAnswer());
|
||||
opt.setOptions(eqOpt.getOptions());
|
||||
opt.setScore(eqOpt.getScore());
|
||||
opt.setImages(eqOpt.getImages());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +131,24 @@ public class ExamPaperApi extends ApiBaseController {
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
public JsonResponse<ExamPaper> detail(String id,Boolean content){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("缺少必要参数");
|
||||
}
|
||||
try {
|
||||
ExamPaper query = examPaperService.query(id);
|
||||
if(content==null || content==false) {
|
||||
query.setPaperContent("");
|
||||
}
|
||||
return success(query);
|
||||
} catch (Exception e) {
|
||||
log.error("查询试卷失败",e);
|
||||
return error("查询试卷失败",e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*编辑详情
|
||||
* */
|
||||
@@ -168,7 +186,6 @@ public class ExamPaperApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<ExamQuestion> examQuestionList = examPaperService.batchForImport(vo);
|
||||
return success(examQuestionList);
|
||||
}
|
||||
|
||||
@@ -141,4 +141,24 @@ public class ExamTestApi extends ApiBaseController {
|
||||
return error("发布考试失败",e.getMessage(),false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*下架上架
|
||||
* */
|
||||
@PostMapping("/enabled")
|
||||
public JsonResponse<Boolean> enabled(String id,Boolean enabled){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
if(enabled==null){
|
||||
enabled=true;//默认上架
|
||||
}
|
||||
try {
|
||||
examTestService.enabled(id, enabled);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("上下架异常",e);
|
||||
return error("上下级失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ public class ExamOption extends BaseEntity {
|
||||
@Column(name = "score")
|
||||
private Float score;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
* */
|
||||
@Column(name = "images")
|
||||
private String images;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ public class ExamPaper extends BaseEntity {
|
||||
private Integer counts;
|
||||
|
||||
|
||||
|
||||
public ExamPaper(String testName, String paperType, Integer paperMode, String resOwner1,
|
||||
String resOwner2, String resOwner3,String sysCreateBy,LocalDateTime sysUpdateTime,String id,Integer counts) {
|
||||
this.testName = testName;
|
||||
@@ -94,5 +95,6 @@ public class ExamPaper extends BaseEntity {
|
||||
}
|
||||
|
||||
public ExamPaper() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,12 @@ public class ExamQuestion extends BaseEntity {
|
||||
@Column(name = "knowledge")
|
||||
private String knowledge;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
* */
|
||||
@Column(name = "images")
|
||||
private String images;
|
||||
|
||||
@Transient
|
||||
private List<ExamOption> optionList;
|
||||
|
||||
|
||||
@@ -24,11 +24,25 @@ import lombok.EqualsAndHashCode;
|
||||
public class ExamTest extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 考试名称
|
||||
* */
|
||||
@Column(name = "test_name",nullable = false,length = 50)
|
||||
private String testName;
|
||||
|
||||
/**
|
||||
* 所属机构id
|
||||
*/
|
||||
@Column(name = "org_id",length = 36)
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 所属机构名称,冗余存储,因为机构是从其它服务查询过来的,不是本地的的,所以这里存储是为了方便查询显示
|
||||
*/
|
||||
@Column(name = "org_name",length = 100)
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 考试时长 分钟
|
||||
* */
|
||||
@@ -50,7 +64,7 @@ public class ExamTest extends BaseEntity {
|
||||
@Column(name = "times")
|
||||
private Integer times;
|
||||
/**
|
||||
* 试题排列 1试题乱序,2选项乱序,3全部乱序
|
||||
* 试题排列 1试题乱序,2选项乱序,3全部乱序 4,不乱序
|
||||
* */
|
||||
@Column(name = "arrange")
|
||||
private Integer arrange;
|
||||
@@ -157,6 +171,10 @@ public class ExamTest extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime deadlineTime;
|
||||
|
||||
|
||||
/**启用的,上架*/
|
||||
@Column(name = "enabled", nullable = false, length = 1)
|
||||
private Boolean enabled;
|
||||
|
||||
@Transient
|
||||
private String paperName;
|
||||
|
||||
@@ -46,4 +46,9 @@ public interface IExamTestService {
|
||||
* */
|
||||
Boolean has(String paperId);
|
||||
|
||||
/**
|
||||
* 上架下架
|
||||
* */
|
||||
void enabled(String id,Boolean enabled);
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,15 @@ public class ExamTestServiceImpl implements IExamTestService {
|
||||
|
||||
@Override
|
||||
public void sava(ExamTest examTest) {
|
||||
examTest.setPublished(false);
|
||||
if(examTest.getPublished()==null) {
|
||||
examTest.setPublished(false);
|
||||
}
|
||||
if(examTest.getEnabled()==null) {
|
||||
examTest.setEnabled(true);
|
||||
}
|
||||
if(examTest.getPublished()) {
|
||||
examTest.setPublishTime(LocalDateTime.now());
|
||||
}
|
||||
examTest.setDeleted(false);
|
||||
examTestDao.save(examTest);
|
||||
}
|
||||
@@ -64,7 +72,9 @@ public class ExamTestServiceImpl implements IExamTestService {
|
||||
|
||||
@Override
|
||||
public void publish(String id,boolean flag) {
|
||||
//默认发布后,就是上架状态
|
||||
examTestDao.updateMultiFieldById(id,
|
||||
UpdateBuilder.create("enabled",true),
|
||||
UpdateBuilder.create("published", flag),
|
||||
UpdateBuilder.create("publishTime", LocalDateTime.now()));
|
||||
}
|
||||
@@ -80,6 +90,11 @@ public class ExamTestServiceImpl implements IExamTestService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enabled(String id, Boolean enabled) {
|
||||
examTestDao.updateFieldById(id,"enabled",enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaperContent(String id) throws Exception {
|
||||
QueryBuilder query=QueryBuilder.from(ExamTest.class.getSimpleName()+" et,"+ExamPaper.class.getSimpleName()+" ep");
|
||||
|
||||
@@ -29,4 +29,6 @@ public class TestOptionVo {
|
||||
private Boolean isAnswer;
|
||||
|
||||
private Float score;
|
||||
|
||||
private String images;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,11 @@ public class TestQuestionVo {
|
||||
* 答案
|
||||
*/
|
||||
private String answer;
|
||||
|
||||
/**
|
||||
* 图片信息
|
||||
*/
|
||||
private String images;
|
||||
|
||||
/**
|
||||
* 选项
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.xboe.module.popup.api;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.module.popup.entity.Popup;
|
||||
import com.xboe.module.popup.service.IPopupService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/xboe/m/popup")
|
||||
public class PopupApi extends ApiBaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
IPopupService service;
|
||||
|
||||
|
||||
/**
|
||||
* 前端查询,只是查询出对于当前用户来说需要弹出的
|
||||
* */
|
||||
@GetMapping("/user")
|
||||
public JsonResponse<List<Popup>> userList(Integer device){
|
||||
String aid=getCurrent().getAccountId();
|
||||
List<Popup> list = service.findForUser(aid,device);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 后台弹窗管理列表
|
||||
* */
|
||||
@PostMapping("/list")
|
||||
public JsonResponse<List<Popup>> list(Popup popup){
|
||||
List<Popup> list = service.list(popup);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public JsonResponse<Boolean> list(String popupId){
|
||||
String aid=getCurrent().getAccountId();
|
||||
service.addUser(aid, popupId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @GetMapping("/find-user")
|
||||
// public JsonResponse<List<Popup>> findForUser(String aid){
|
||||
// if(StringUtil.isBlank(aid)){
|
||||
// aid=this.getCurrent().getAccountId();
|
||||
// }
|
||||
// List<Popup> forUser = service.findForUser(aid);
|
||||
// return success(forUser);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 添加弹窗
|
||||
* */
|
||||
@PostMapping("/save")
|
||||
public JsonResponse<Popup> save(@RequestBody Popup popup){
|
||||
if(StringUtil.isBlank(popup.getTitle())){
|
||||
return badRequest("标题不能为空");
|
||||
}
|
||||
if(popup.getLoginEd()==null){
|
||||
popup.setLoginEd(false);
|
||||
}
|
||||
if(popup.getDaily()==null){
|
||||
popup.setDaily(false);
|
||||
}
|
||||
if (popup.getOnce()==null){
|
||||
popup.setOnce(false);
|
||||
}
|
||||
if(popup.getCloseable()==null){
|
||||
popup.setCloseable(false);
|
||||
}
|
||||
try {
|
||||
service.save(popup);
|
||||
return success(popup);
|
||||
} catch (Exception e) {
|
||||
return error("添加失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改弹窗
|
||||
* */
|
||||
@PostMapping("/update")
|
||||
public JsonResponse<Popup> update(@RequestBody Popup popup){
|
||||
if(StringUtil.isBlank(popup.getTitle())){
|
||||
return badRequest("标题不能为空");
|
||||
}
|
||||
try {
|
||||
service.update(popup);
|
||||
return success(popup);
|
||||
} catch (Exception e) {
|
||||
return error("编辑失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
* */
|
||||
@GetMapping("/detail")
|
||||
public JsonResponse<Popup> detail(String id){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
Popup popup = service.detail(id);
|
||||
return success(popup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* */
|
||||
@GetMapping("/delete")
|
||||
public JsonResponse<Boolean> delete(String id){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
try {
|
||||
service.delete(id);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
return error("删除失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.xboe.module.popup.dao;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.popup.entity.Popup;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class PopupDao extends BaseDao<Popup> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.xboe.module.popup.dao;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.module.popup.entity.PopupUser;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class PopupUserDao extends BaseDao<PopupUser> {
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.xboe.module.popup.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE+"popup")
|
||||
public class Popup extends IdEntity {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
* */
|
||||
@Column(name = "start_time")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
* */
|
||||
@Column(name = "end_time")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
/**
|
||||
* 是否每次登录后弹出一次
|
||||
* */
|
||||
@Column(name = "login_ed")
|
||||
private Boolean loginEd;
|
||||
|
||||
|
||||
/**
|
||||
* 是否每天弹出一次
|
||||
* */
|
||||
@Column(name = "daily")
|
||||
private Boolean daily;
|
||||
|
||||
/**
|
||||
* 是否每个人弹出一次
|
||||
* */
|
||||
@Column(name = "once")
|
||||
private Boolean once;
|
||||
|
||||
/**
|
||||
* 是否显示关闭
|
||||
* */
|
||||
@Column(name = "closeable")
|
||||
private Boolean closeable;
|
||||
|
||||
/**
|
||||
* 弹窗标题
|
||||
* */
|
||||
@Column(name = "title",length = 50)
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 弹出次数,0表无限制
|
||||
*/
|
||||
@Column(name = "times",length = 2)
|
||||
private Integer times;
|
||||
|
||||
/**
|
||||
* 0全部,1:PC,;2:h5端
|
||||
*/
|
||||
@Column(name = "device",length = 2)
|
||||
private Integer device;
|
||||
|
||||
/**
|
||||
* 弹窗内容
|
||||
* */
|
||||
@Column(name = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 弹窗背景图
|
||||
* */
|
||||
@Column(name = "bg_image")
|
||||
private String bgImage;
|
||||
|
||||
/**
|
||||
* 跳转的url
|
||||
* */
|
||||
@Column(name = "url")
|
||||
private String url;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.xboe.module.popup.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 弹出用户记录
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Entity
|
||||
@Table(name = SysConstant.TABLE_PRE+"popup_user")
|
||||
public class PopupUser extends IdEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "popup_id",length=20)
|
||||
private String popupId;
|
||||
|
||||
@Column(name = "aid",length=20)
|
||||
private String aid;
|
||||
|
||||
/**状态默认是1,表已弹出过*/
|
||||
@Column(name = "status",length=1)
|
||||
private Boolean status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.xboe.module.popup.service;
|
||||
|
||||
import com.xboe.module.popup.entity.Popup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IPopupService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 后台弹窗管理列表
|
||||
* */
|
||||
List<Popup> list(Popup popup);
|
||||
|
||||
/**
|
||||
* 查询当前用户需要弹出的
|
||||
* @param aid
|
||||
* @return
|
||||
*/
|
||||
List<Popup> findForUser(String aid,Integer device);
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* */
|
||||
void save(Popup popup);
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* */
|
||||
void update(Popup popup);
|
||||
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* */
|
||||
Popup detail(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* */
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 添加弹出了的用户
|
||||
* @param popupId
|
||||
*/
|
||||
void addUser(String aid,String popupId);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.xboe.module.popup.service.impl;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.LikeMatchMode;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.module.popup.dao.PopupDao;
|
||||
import com.xboe.module.popup.dao.PopupUserDao;
|
||||
import com.xboe.module.popup.entity.Popup;
|
||||
import com.xboe.module.popup.entity.PopupUser;
|
||||
import com.xboe.module.popup.service.IPopupService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class PopupServiceImpl implements IPopupService {
|
||||
|
||||
@Resource
|
||||
PopupDao popupDao;
|
||||
|
||||
@Resource
|
||||
PopupUserDao popupUserDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Popup> list(Popup popup) {
|
||||
QueryBuilder builder = QueryBuilder.from(Popup.class);
|
||||
if(popup!=null){
|
||||
if(popup.getStartTime()!=null){
|
||||
builder.addFilter(FieldFilters.eq("startTime",popup.getStartTime()));
|
||||
}
|
||||
if(popup.getEndTime()!=null){
|
||||
builder.addFilter(FieldFilters.eq("endTime",popup.getEndTime()));
|
||||
}
|
||||
if(popup.getLoginEd()!=null){
|
||||
builder.addFilter(FieldFilters.eq("logined",popup.getLoginEd()));
|
||||
}
|
||||
if(popup.getDaily()!=null){
|
||||
builder.addFilter(FieldFilters.eq("daily",popup.getDaily()));
|
||||
}
|
||||
if(popup.getCloseable()!=null){
|
||||
builder.addFilter(FieldFilters.eq("closeable",popup.getCloseable()));
|
||||
}
|
||||
if(StringUtil.isNotBlank(popup.getTitle())){
|
||||
builder.addFilter(FieldFilters.like("title", LikeMatchMode.ANYWHERE,popup.getTitle()));
|
||||
}
|
||||
}
|
||||
builder.addOrder(OrderCondition.desc("id"));
|
||||
List<Popup> list = popupDao.findList(builder.builder());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Popup popup) {
|
||||
popupDao.save(popup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Popup popup) {
|
||||
popupDao.update(popup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Popup detail(String id) {
|
||||
Popup popup = popupDao.get(id);
|
||||
return popup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
popupDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Popup> findForUser(String aid,Integer nodevice) {
|
||||
//根据时间查询,查询出时间内需要弹出的内容
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<Popup> list=popupDao.findList(FieldFilters.le("startTime",now),FieldFilters.ge("endTime",now),FieldFilters.ne("device",nodevice));
|
||||
List<Popup> rslist=new ArrayList<Popup>();
|
||||
for(Popup p: list) {
|
||||
if(p.getOnce()!=null && p.getOnce()) {
|
||||
//只是查询一次
|
||||
List<PopupUser> pu = popupUserDao.findList(FieldFilters.eq("aid",aid),FieldFilters.eq("popupId",p.getId()));
|
||||
if(pu.isEmpty()) {
|
||||
rslist.add(p);
|
||||
}
|
||||
}else {
|
||||
rslist.add(p);
|
||||
}
|
||||
}
|
||||
return rslist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUser(String aid,String popupId) {
|
||||
PopupUser pu=new PopupUser();
|
||||
pu.setAid(aid);
|
||||
pu.setPopupId(popupId);
|
||||
pu.setStatus(true);
|
||||
popupUserDao.save(pu);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import java.util.Map;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.module.teacher.dto.TeacherFiledVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -231,6 +232,28 @@ public class TeacherApi extends ApiBaseController {
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 教师详情
|
||||
* */
|
||||
@GetMapping("/detail-teacher")
|
||||
public JsonResponse<Map<String,Object>> detailTeacher(String id){
|
||||
if(StringUtils.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
Teacher teacher = service.get(id);
|
||||
Map<String,Object> rs=new HashMap<String,Object>();
|
||||
if(teacher!=null){
|
||||
rs.put("id",id);
|
||||
rs.put("photo",teacher.getPhoto());
|
||||
rs.put("workExperience",teacher.getWorkExperience());
|
||||
rs.put("courses",teacher.getCourses());
|
||||
rs.put("expertise",teacher.getExpertise());
|
||||
}
|
||||
|
||||
return success(rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
@@ -239,7 +262,7 @@ public class TeacherApi extends ApiBaseController {
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public JsonResponse<TeacherVo> update(@RequestBody TeacherVo teacher) {
|
||||
if (teacher == null || StringUtils.isBlank(teacher.getName())) {
|
||||
if (teacher == null) {
|
||||
return error("缺少必要参数");
|
||||
}
|
||||
try {
|
||||
@@ -250,6 +273,26 @@ public class TeacherApi extends ApiBaseController {
|
||||
return success(teacher);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param teacher
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/update-teacher")
|
||||
public JsonResponse<TeacherFiledVo> updateTeacher(@RequestBody TeacherFiledVo teacher) {
|
||||
if (teacher == null) {
|
||||
return error("缺少必要参数");
|
||||
}
|
||||
try {
|
||||
service.updateTeacher(teacher);
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
return success(teacher);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xboe.module.teacher.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TeacherFiledVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private String photo;
|
||||
|
||||
private String workExperience;
|
||||
|
||||
private String courses;
|
||||
|
||||
private String expertise;
|
||||
|
||||
}
|
||||
@@ -194,4 +194,16 @@ public class Teacher extends BaseEntity {
|
||||
@Column(name = "remark",length = 500)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 工作经历
|
||||
* */
|
||||
@Column(name = "work_experience")
|
||||
private String workExperience;
|
||||
|
||||
/**
|
||||
* 专长
|
||||
* */
|
||||
@Column(name = "expertise")
|
||||
private String expertise;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.exception.XaskException;
|
||||
import com.xboe.module.teacher.dto.TeacherFiledVo;
|
||||
import com.xboe.module.teacher.dto.TeacherSyncUpdateDto;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
import com.xboe.module.teacher.vo.TeacherQuery;
|
||||
@@ -59,6 +60,15 @@ public interface ITeacherService {
|
||||
* @throws XaskException
|
||||
*/
|
||||
void update(TeacherVo entity) throws XaskException;
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param entity
|
||||
* @throws XaskException
|
||||
*/
|
||||
void updateTeacher(TeacherFiledVo entity);
|
||||
|
||||
/*
|
||||
* 更新同步信息
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.xboe.module.teacher.dto.TeacherFiledVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -204,6 +205,17 @@ public class TeacherServiceImpl implements ITeacherService {
|
||||
// accountService.update(account);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTeacher(TeacherFiledVo entity) {
|
||||
Teacher teacher = dao.get(entity.getId());
|
||||
teacher.setPhoto(entity.getPhoto());
|
||||
teacher.setWorkExperience(entity.getWorkExperience());
|
||||
teacher.setCourses(entity.getCourses());
|
||||
teacher.setExpertise(entity.getExpertise());
|
||||
dao.update(teacher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
dao.deleteById(id);
|
||||
|
||||
@@ -15,6 +15,8 @@ import com.xboe.core.CurrentUser;
|
||||
import com.xboe.core.IAuthorizationToken;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.data.dto.UserData;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.module.teacher.entity.Teacher;
|
||||
import com.xboe.module.teacher.service.ITeacherService;
|
||||
import com.xboe.system.organization.entity.Organization;
|
||||
@@ -47,6 +49,9 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
|
||||
@Autowired
|
||||
ITeacherService teacherService;
|
||||
|
||||
@Autowired
|
||||
IOutSideDataService outsideDataService;
|
||||
|
||||
/**
|
||||
* 信息初始化
|
||||
@@ -62,6 +67,12 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
return error("账号错误,无此账号");
|
||||
}
|
||||
|
||||
// UserData userData = outsideDataService.getUserInfoByUserId(null);
|
||||
// if(userData==null) {
|
||||
// log.error("通过api获取用用户信息错误【"+getCurrent().getAccountId()+"】对应的用户");
|
||||
// return error("未能获取当前用户信息");
|
||||
// }
|
||||
|
||||
User user = userService.get(getCurrent().getAccountId());
|
||||
Organization org = null;
|
||||
String departName = "";
|
||||
@@ -78,9 +89,11 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
//检查是否是教师,并计算用户的类型,修改于220507
|
||||
Teacher t = teacherService.get(account.getId());
|
||||
int utype=1,ttype=0;
|
||||
//本地判断是否是管理员
|
||||
if(user.getUserType()!=null && user.getUserType()==3) {
|
||||
utype=3;
|
||||
}
|
||||
//判断是否是老师
|
||||
if(t!=null && (t.getDeleted()==null || !t.getDeleted())) {
|
||||
ttype=2;
|
||||
}
|
||||
@@ -94,8 +107,24 @@ public class PortalConsoleApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
|
||||
// int utype=1;//仅仅是学员
|
||||
// if(userData.getTeacher()) {
|
||||
// utype=2;
|
||||
// }
|
||||
// if(userData.getAdminType()>0) {
|
||||
// if(utype==2) {
|
||||
// utype=5;//是管理员,又是教师
|
||||
// }else {
|
||||
// utype=3;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
map.put("aid",account.getId());
|
||||
map.put("sysId",user.getSysId());
|
||||
//map.put("adminType",userData.getAdminType());//管理员类型,1表默认管理员,2表非默认管理员,0表不是管理员
|
||||
map.put("adminType",0);
|
||||
map.put("companyId",user.getCompanyId());
|
||||
map.put("name",user.getName());
|
||||
map.put("sex",user.getGender());
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -29,6 +30,9 @@ import com.xboe.core.IAuthorizationToken;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.JsonResponseStatus;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.data.dto.UserData;
|
||||
import com.xboe.data.outside.IOutSideDataService;
|
||||
import com.xboe.data.service.IDataUserSyncService;
|
||||
import com.xboe.externalinterface.system.service.IFwUserService;
|
||||
import com.xboe.system.logs.entity.SysLogLogin;
|
||||
import com.xboe.system.logs.service.ISysLogLoginService;
|
||||
@@ -63,6 +67,12 @@ public class PortalLoginApi extends ApiBaseController {
|
||||
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
|
||||
@Autowired
|
||||
IOutSideDataService outsideService;
|
||||
|
||||
@Autowired
|
||||
IDataUserSyncService userSyncService;
|
||||
|
||||
@GetMapping("/captcha")
|
||||
public JsonResponse<Map<String, String>> captcha() {
|
||||
@@ -186,7 +196,55 @@ public class PortalLoginApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新的登录处理,通过接口,同步用户数据
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/boenewlogin", method = {RequestMethod.GET,RequestMethod.POST})
|
||||
public JsonResponse<Map<String, Object>> boeNewLogin(String token) {
|
||||
try {
|
||||
if (StringUtil.isBlank(token)) {
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
||||
}
|
||||
Map<String, String> tokenInfo = authorizationToken.readToken(token);
|
||||
if (tokenInfo == null) {
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "token error");
|
||||
}
|
||||
|
||||
UserData udata=outsideService.getUserInfoByUserId(null);
|
||||
if(udata==null) {
|
||||
log.error("未获取当前登录人的用户信息");
|
||||
return wrap(JsonResponseStatus.TOKEN_NOPASS, "用户信息查询失败");
|
||||
}
|
||||
//检查本地是否存在,如果存在就更新,不存在就添加
|
||||
try {
|
||||
userSyncService.syncUserFull(udata);
|
||||
}catch(Exception exp) {
|
||||
log.error("登录同步用户错误",exp);
|
||||
}
|
||||
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
//模拟数据
|
||||
data.put("aid",udata.getId());
|
||||
data.put("uId", udata.getId());//匹配新的token中的 uId
|
||||
data.put("name", udata.getName());
|
||||
data.put("userNo", udata.getCode());
|
||||
data.put("departId", udata.getDepartId());
|
||||
data.put("userId",udata.getKid());
|
||||
|
||||
String newtoken = authorizationToken.createToken(data);
|
||||
map.put("expires_in", IAuthorizationToken.TOKEN_TIMEOUT);
|
||||
map.put("scope", "boe");
|
||||
map.put("access_token", newtoken);
|
||||
//
|
||||
return success(map);
|
||||
} catch (Exception e) {
|
||||
log.error("boe登录 错误", e);
|
||||
return error("boe登录失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* boe登录
|
||||
@@ -206,7 +264,7 @@ public class PortalLoginApi extends ApiBaseController {
|
||||
}
|
||||
Account account = null;
|
||||
if(StringUtil.isNotBlank(tokenInfo.get("aid"))){
|
||||
//检查系统用户是否存在
|
||||
//检查系统用户是否存在
|
||||
account = accountService.get(tokenInfo.get("aid"));
|
||||
}else{
|
||||
//log.error("查询用户kid【"+tokenInfo.get("userId")+"】");
|
||||
|
||||
@@ -200,34 +200,6 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
return success(rs);
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 检查是否有相应的课程学习
|
||||
// * @param cid
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value="/has",method = {RequestMethod.GET,RequestMethod.POST})
|
||||
// public JsonResponse<Map<String,Object>> has(String cid){
|
||||
// if(StringUtils.isBlank(cid)){
|
||||
// return error("无课程信息");
|
||||
// }
|
||||
// String aid=getCurrent().getAccountId();
|
||||
// StudyCourse sc=service.findByCourseIdAndAid(cid, aid);
|
||||
//
|
||||
// Map<String,Object> rs=new HashMap<String,Object>();
|
||||
// if(sc==null) {
|
||||
// //查询是否已报名,自主报名直接通过,所以此查询主要针对于报名待审核的
|
||||
// rs.put("signup",false);
|
||||
// }else {
|
||||
// rs.put("signup",true);
|
||||
// rs.put("studyId", sc.getId());//学习id
|
||||
// //查询上次学习的是什么资源。查询用户的学习情况
|
||||
// List<StudyCourseItem> items=studyService.findByStudyId(sc.getId());
|
||||
// rs.put("contents",items);
|
||||
// }
|
||||
// return success(rs);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 在打开课程详细页面的时候,调用此接口,返回学习课程信息,上次学习的位置。<br/>
|
||||
* 如果没有就返回空<br>
|
||||
@@ -318,6 +290,60 @@ public class StudyCourseApi extends ApiBaseController{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 学习完成一项课程内容,针对于所有课程内容,不只是音视频,还有scorm及其它的内容
|
||||
* @param sci
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/study-content-finish")
|
||||
public JsonResponse<String> studyContentFinish(@RequestBody StudyContentDto sci){
|
||||
|
||||
if(StringUtils.isBlank(sci.getStudyId())){
|
||||
return error("参数错误");
|
||||
}
|
||||
if(StringUtils.isBlank(sci.getContentId())){
|
||||
return error("参数错误:内容");
|
||||
}
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
CurrentUser cuser=getCurrent();
|
||||
|
||||
//下面的学习时长应该去掉了,不需要
|
||||
StudyTime st=new StudyTime();
|
||||
st.setContentId(sci.getContentId());
|
||||
st.setCourseId(sci.getCourseId());
|
||||
st.setDuration(5);//增加5秒的学习时长
|
||||
st.setEndTime(now);
|
||||
st.setStartTime(now);
|
||||
st.setStudentId(cuser.getAccountId());
|
||||
st.setStudentName(cuser.getName());
|
||||
st.setStudyId(sci.getStudyId());
|
||||
|
||||
//检查是否已存在
|
||||
StudyCourseItem item = studyService.checkHas(sci.getStudyId(),sci.getContentId());
|
||||
if(item!=null) {
|
||||
//如果记录存在,但是进度不到100,未完成情况,就更新进度,一期不会有这种情况
|
||||
if(item.getProgress()<100 && sci.getProgress()>item.getProgress()) {
|
||||
studyService.updateProcess(item.getId(),sci.getStudyId(),sci.getCourseId(), sci.getContentTotal(),sci.getProgress());
|
||||
}
|
||||
//追加学习时长
|
||||
studyService.appendStudyDuration(st);
|
||||
return success(item.getId());
|
||||
}
|
||||
|
||||
try {
|
||||
sci.setAid(cuser.getAccountId());
|
||||
sci.setAname(cuser.getName());
|
||||
studyService.saveStudyInfo(sci);
|
||||
//学习记录成功后处理
|
||||
studyService.appendStudyDuration(st);
|
||||
return success(sci.getStudyItemId());
|
||||
}catch(Exception e) {
|
||||
log.error("记录学习课程内容完成错误",e);
|
||||
return error("记录学习课程内容完成失败",e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 音视频学习保存,初始化保存学习记录.
|
||||
* 如果已经保存,就不要再保存第二次了,前端注意控制
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.xboe.school.study.dao;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.school.study.entity.StudyScorm;
|
||||
|
||||
@Repository
|
||||
public class StudyScormDao extends BaseDao<StudyScorm>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.xboe.school.study.entity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 学习scorm课程的相关内容记录
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = SysConstant.TABLE_PRE+"study_scorm")
|
||||
public class StudyScorm extends IdEntity{
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* 学习id
|
||||
* */
|
||||
@Column(name = "study_id",nullable=false,length = 20)
|
||||
private String studyId;
|
||||
|
||||
/**
|
||||
* 内容学习记录id
|
||||
*/
|
||||
@Column(name = "study_item_id",nullable=false,length = 20)
|
||||
private String studyItemId;
|
||||
|
||||
/*
|
||||
* 课程id
|
||||
* */
|
||||
@Column(name = "course_id",nullable=false,length = 20)
|
||||
private String courseId;
|
||||
|
||||
/*
|
||||
* 内容id
|
||||
* */
|
||||
@Column(name = "content_id",nullable=false,length = 20)
|
||||
private String contentId;
|
||||
|
||||
|
||||
/*
|
||||
* 学员id
|
||||
* */
|
||||
@Column(name = "student_id",nullable=false,length = 20)
|
||||
private String studentId;
|
||||
|
||||
/*
|
||||
* 学员name
|
||||
* */
|
||||
@Column(name = "student_name",length = 30)
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* sco的identifier
|
||||
*/
|
||||
@Column(name = "sco_id",length = 100)
|
||||
private String scoId;
|
||||
|
||||
/**
|
||||
* 本次sco的学习进度
|
||||
*/
|
||||
@Column(name = "progress")
|
||||
private Integer progress;
|
||||
|
||||
/**
|
||||
* 上次学习的时间点
|
||||
*/
|
||||
@Column(name = "last_time")
|
||||
private Integer lastTime;
|
||||
|
||||
|
||||
/**
|
||||
* 1表未学习,2表学习中,9表学习完成
|
||||
*/
|
||||
@Column(name = "status",length=1)
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 存储对应的jsondata
|
||||
*/
|
||||
@Column(name = "json_data",length=1,columnDefinition = "text")
|
||||
private String jsonData;
|
||||
}
|
||||
@@ -147,6 +147,8 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
builder.addFilter(FieldFilters.eqField("s.courseId","c.id"));
|
||||
LocalDateTime parse = LocalDate.parse("2022-01-01", DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
||||
builder.addFilter(FieldFilters.gt("c.publishTime",parse));
|
||||
builder.addFilter(FieldFilters.isNull("c.kid"));
|
||||
builder.addFilter(FieldFilters.gt("c.score",4.0f));
|
||||
builder.addGroupBy("s.courseId");
|
||||
LocalDateTime now=LocalDateTime.now();
|
||||
LocalDateTime localDateTime = now.plusDays(-30);
|
||||
@@ -177,7 +179,7 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
list.add(studyCourseNameDto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
log.error("查询异常",e);
|
||||
}
|
||||
return list;
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.xboe.system.whiteuser.api;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.system.whiteuser.entity.WhiteUser;
|
||||
import com.xboe.system.whiteuser.service.IWhiteUserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/xboe/sys/whiteuser")
|
||||
public class WhiteUserApi extends ApiBaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
IWhiteUserService service;
|
||||
|
||||
|
||||
@PostMapping("/codes")
|
||||
public JsonResponse<List<String>> list(String env){
|
||||
List<String> list = service.getCodes(env);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 白名单列表
|
||||
* */
|
||||
@PostMapping("/list")
|
||||
public JsonResponse<List<WhiteUser>> list(WhiteUser whiteUser){
|
||||
List<WhiteUser> list = service.list(whiteUser);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加白名单
|
||||
* */
|
||||
@PostMapping("/save")
|
||||
public JsonResponse<WhiteUser> save(@RequestBody WhiteUser whiteUser){
|
||||
if(StringUtil.isBlank(whiteUser.getCode())){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
if(StringUtil.isBlank(whiteUser.getName())){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
try {
|
||||
service.save(whiteUser);
|
||||
return success(whiteUser);
|
||||
} catch (Exception e) {
|
||||
return error("添加失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改白名单
|
||||
* */
|
||||
@PostMapping("/update")
|
||||
public JsonResponse<WhiteUser> update(@RequestBody WhiteUser whiteUser){
|
||||
if(StringUtil.isBlank(whiteUser.getCode())){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
if(StringUtil.isBlank(whiteUser.getName())){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
try {
|
||||
service.update(whiteUser);
|
||||
return success(whiteUser);
|
||||
} catch (Exception e) {
|
||||
return error("修改失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* */
|
||||
@GetMapping("/detail")
|
||||
public JsonResponse<WhiteUser> detail(String id){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
WhiteUser whiteUser = service.detail(id);
|
||||
return success(whiteUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* */
|
||||
@GetMapping("/delete")
|
||||
public JsonResponse<Boolean> delete(String id){
|
||||
if(StringUtil.isBlank(id)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
try {
|
||||
service.delete(id);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
return error("删除失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.xboe.system.whiteuser.dao;
|
||||
|
||||
import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.system.whiteuser.entity.WhiteUser;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class WhiteUserDao extends BaseDao<WhiteUser> {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.xboe.system.whiteuser.entity;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.orm.IdEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Table(name = SysConstant.TABLE_PRE+"white_user")
|
||||
public class WhiteUser extends IdEntity {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "code",length = 30)
|
||||
private String code;
|
||||
|
||||
@Column(name = "name",length = 30)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 环境
|
||||
* */
|
||||
@Column(name="environment")
|
||||
private String environment;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.xboe.system.whiteuser.service;
|
||||
|
||||
import com.xboe.system.whiteuser.entity.WhiteUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IWhiteUserService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查看现有白名单
|
||||
* */
|
||||
List<WhiteUser> list(WhiteUser whiteUser);
|
||||
|
||||
/**
|
||||
* 提取代码列表
|
||||
* @param env
|
||||
* @return
|
||||
*/
|
||||
List<String> getCodes(String env);
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* */
|
||||
void save(WhiteUser whiteUser);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* */
|
||||
void delete(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* */
|
||||
void update(WhiteUser whiteUser);
|
||||
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* */
|
||||
WhiteUser detail(String id);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.xboe.system.whiteuser.service.impl;
|
||||
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.LikeMatchMode;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.system.whiteuser.dao.WhiteUserDao;
|
||||
import com.xboe.system.whiteuser.entity.WhiteUser;
|
||||
import com.xboe.system.whiteuser.service.IWhiteUserService;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class WhiteUserServiceImpl implements IWhiteUserService {
|
||||
|
||||
@Resource
|
||||
WhiteUserDao whiteUserDao;
|
||||
|
||||
@Override
|
||||
public List<WhiteUser> list(WhiteUser whiteUser) {
|
||||
QueryBuilder builder = QueryBuilder.from(WhiteUser.class);
|
||||
if(whiteUser!=null){
|
||||
if(StringUtil.isNotBlank(whiteUser.getCode())){
|
||||
builder.addFilter(FieldFilters.eq("code",whiteUser.getCode()));
|
||||
}
|
||||
if(StringUtil.isNotBlank(whiteUser.getName())){
|
||||
builder.addFilter(FieldFilters.like("name", LikeMatchMode.ANYWHERE,whiteUser.getName()));
|
||||
}
|
||||
if(whiteUser.getEnvironment()!=null){
|
||||
builder.addFilter(FieldFilters.eq("environment",whiteUser.getEnvironment()));
|
||||
}
|
||||
}
|
||||
builder.addOrder(OrderCondition.desc("id"));
|
||||
List<WhiteUser> list = whiteUserDao.findList(builder.builder());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(WhiteUser whiteUser) {
|
||||
whiteUserDao.save(whiteUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
whiteUserDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(WhiteUser whiteUser) {
|
||||
whiteUserDao.update(whiteUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WhiteUser detail(String id) {
|
||||
WhiteUser whiteUser = whiteUserDao.get(id);
|
||||
return whiteUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCodes(String env) {
|
||||
if(StringUtils.isBlank(env)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> codes = (List<String>) whiteUserDao.findListField("code");
|
||||
return codes;
|
||||
}else {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> codes = (List<String>) whiteUserDao.findListField("code",FieldFilters.eq("environment", env));
|
||||
return codes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ xboe.local.dev=true
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=E:/Projects/BOE/10/static/temp
|
||||
xboe.upload.file.save_path=E:/Projects/BOE/10/static/upload
|
||||
xboe.upload.file.http_path=http://192.168.0.11:9090/cdn/upload
|
||||
xboe.upload.file.http_path=http://127.0.0.1:9090/cdn/upload
|
||||
|
||||
## 外部接口调用地址 旧系统机构及用户数据接口
|
||||
xboe.externalinterface.url.system=http://localhost:9091
|
||||
|
||||
@@ -37,6 +37,7 @@ xboe.old.base.url=https://u.boe.com
|
||||
|
||||
## 用户统计接口的api地址
|
||||
xboe.stat.base.url=http://127.0.0.1:9080
|
||||
xboe.server.userbasic.url=https://u.boe.com/userbasic
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
|
||||
@@ -46,6 +46,7 @@ xboe.old.base.url=https://u.boe.com
|
||||
|
||||
## 用户统计接口的api地址
|
||||
xboe.stat.base.url=http://127.0.0.1:9080
|
||||
xboe.server.userbasic.url=https://u.boe.com/userbasic
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
|
||||
@@ -49,6 +49,7 @@ xboe.old.base.url=https://u-pre.boe.com
|
||||
|
||||
## 用户统计接口的api地址
|
||||
xboe.stat.base.url=http://127.0.0.1:9080
|
||||
xboe.server.userbasic.url=https://u-pre.boe.com/userbasic
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
|
||||
@@ -21,8 +21,6 @@ public class StartRunner implements ApplicationRunner {
|
||||
@Autowired
|
||||
IModifyService service;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
//用于存放 kid=newId
|
||||
|
||||
Reference in New Issue
Block a user