Commit 8261dfba authored by YangZhaoJun1's avatar YangZhaoJun1

获取智评分数接口

parent c917cb3a
...@@ -266,7 +266,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -266,7 +266,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"LEFT JOIN b_r_student_chapter bsc on bc.business_id = bsc.chapter_id\n" + "LEFT JOIN b_r_student_chapter bsc on bc.business_id = bsc.chapter_id\n" +
"LEFT JOIN b_student bs on bsc.student_id = bs.business_id\n" + "LEFT JOIN b_student bs on bsc.student_id = bs.business_id\n" +
"LEFT JOIN s_user su on su.login_name = bs.`code` \n" + "LEFT JOIN s_user su on su.login_name = bs.`code` \n" +
"where bc.business_id = #{chapterId}</script>") "where bc.business_id = #{chapterId} and bsc.score = '-1'</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BChapter> queryBchapterStudentById(String chapterId); List<BChapter> queryBchapterStudentById(String chapterId);
......
...@@ -253,4 +253,17 @@ public class BCodeController extends PaginationController { ...@@ -253,4 +253,17 @@ public class BCodeController extends PaginationController {
} }
} }
@ApiImplicitParams({@ApiImplicitParam(name = "slId", value = "开课Id", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "chapterId", value = "章节Id", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "studentCode", value = "学号", required = true, dataType = "varchar")})
@ApiOperation(value="获取智评分数", notes="获取智评分数")
@GetMapping(value = "/getIntelligenceScore")
public Result getIntelligenceScore(String slId, String chapterId, String studentCode){
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCodeServiceImpl.getIntelligenceScore(slId,chapterId,studentCode));
}
} }
...@@ -51,4 +51,6 @@ public interface BCodeService { ...@@ -51,4 +51,6 @@ public interface BCodeService {
* @return * @return
*/ */
CommandResult stopExam(String userId); CommandResult stopExam(String userId);
int getIntelligenceScore(String slId, String chapterId, String studentCode);
} }
...@@ -4,10 +4,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -4,10 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.rcisoft.business.bchapter.dao.BChapterRepository; import org.rcisoft.business.bchapter.dao.BChapterRepository;
import org.rcisoft.business.bchapter.entity.BChapter; import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.bcode.model.BCodeFile; import org.rcisoft.business.bcode.model.*;
import org.rcisoft.business.bcode.model.BCodeLxc;
import org.rcisoft.business.bcode.model.CodeType;
import org.rcisoft.business.bcode.model.StudentFile;
import org.rcisoft.business.bcode.service.BCodeLxcService; import org.rcisoft.business.bcode.service.BCodeLxcService;
import org.rcisoft.business.bcode.service.BCodeService; import org.rcisoft.business.bcode.service.BCodeService;
import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository; import org.rcisoft.business.brslstudent.dao.BRSlStudentRepository;
...@@ -25,6 +22,7 @@ import org.rcisoft.core.service.RcRedisService; ...@@ -25,6 +22,7 @@ import org.rcisoft.core.service.RcRedisService;
import org.rcisoft.core.service.SerializationUtils; import org.rcisoft.core.service.SerializationUtils;
import org.rcisoft.core.util.IdGen; import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.ZipCompress; import org.rcisoft.core.util.ZipCompress;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -54,7 +52,7 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -54,7 +52,7 @@ public class BCodeServiceImpl implements BCodeService {
private BRSlStudentRepository brSlStudentRepository; private BRSlStudentRepository brSlStudentRepository;
@Autowired @Autowired
private BStudentRepository bStudentRepository; private SysUserMapper sysUserMapper;
@Autowired @Autowired
private BSlRepository bSlRepository; private BSlRepository bSlRepository;
...@@ -336,6 +334,14 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -336,6 +334,14 @@ public class BCodeServiceImpl implements BCodeService {
} }
/**
* 导出作业
* @param slId
* @param studentId
* @param type
* @param slCode
* @return
*/
@Override @Override
public String exportFiles(String slId, String studentId, String type, String slCode) { public String exportFiles(String slId, String studentId, String type, String slCode) {
String compressPath = ""; String compressPath = "";
...@@ -423,6 +429,12 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -423,6 +429,12 @@ public class BCodeServiceImpl implements BCodeService {
} }
/**
* 压缩文件
* @param compressPath
* @return
* @throws IOException
*/
private String compressFiles(String compressPath) throws IOException { private String compressFiles(String compressPath) throws IOException {
String zipFile = ""; String zipFile = "";
...@@ -447,6 +459,12 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -447,6 +459,12 @@ public class BCodeServiceImpl implements BCodeService {
} }
/**
* 查看所有学生代码
* @param slId
* @param chapterId
* @return
*/
@Override @Override
public List<StudentFile> queryAllStudentCode(String slId, String chapterId){ public List<StudentFile> queryAllStudentCode(String slId, String chapterId){
List<StudentFile> studentFiles = new ArrayList<>(); List<StudentFile> studentFiles = new ArrayList<>();
...@@ -550,4 +568,37 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -550,4 +568,37 @@ public class BCodeServiceImpl implements BCodeService {
return new CommandResult(ResultCode.FAIL,"未开启实验",null); return new CommandResult(ResultCode.FAIL,"未开启实验",null);
} }
/**
* 获取智评分数
* @param slId
* @param chapterId
* @param studentCode
* @return
*/
@Override
public int getIntelligenceScore(String slId, String chapterId, String studentCode) {
int score = 0;
try {
BChapter bChapter = bChapterRepository.selectOne(new BChapter(chapterId));
String sutId = sysUserMapper.queryUserIdByLoginName(studentCode);
String codeType = global.getCOURSE_CODE_LOCATION();
if (bChapter.getExperimentType().equals("2") || bChapter.getExperimentType().equals("4")) {
codeType = global.getCOURSE_PROJECT_LOCATION();
}
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ global.getCOURSE_LOCATION() + File.separator
+ global.getSL_LOCATION() + File.separator
+ slId + File.separator
+ chapterId + File.separator
+ codeType + File.separator
+ sutId + File.separator;
score = IntellEvaluation.IntellEvaluation(filePath, studentCode, bChapter.getExperimentType());
}catch (Exception e) {
e.printStackTrace();
}
return score;
}
} }
...@@ -258,7 +258,7 @@ public class BFileServiceImpl implements BFileService { ...@@ -258,7 +258,7 @@ public class BFileServiceImpl implements BFileService {
String outputFile = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator String outputFile = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ newPath + uploadFileName + ".pdf"; + newPath + uploadFileName + ".pdf";
PptToPdf pptToPdf = new PptToPdf(); PptToPdf pptToPdf = new PptToPdf();
pptToPdf.pptToPdf(inputFile,outputFile); //pptToPdf.pptToPdf(inputFile,outputFile);
} }
bFile.setVideoName(name+ "." +uploadFileSuffix);//文件名 bFile.setVideoName(name+ "." +uploadFileSuffix);//文件名
......
package org.rcisoft.core.util; package org.rcisoft.core.util;
import com.artofsolving.jodconverter.DocumentConverter;
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
import org.artofsolving.jodconverter.OfficeDocumentConverter; import org.artofsolving.jodconverter.OfficeDocumentConverter;
import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
import org.artofsolving.jodconverter.office.OfficeManager; import org.artofsolving.jodconverter.office.OfficeManager;
...@@ -8,13 +12,15 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,13 +12,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.ConnectException;
/** /**
* Created by Administrator on 2018/1/19. * Created by Administrator on 2018/1/19.
*/ */
public class PptToPdf { public class PptToPdf {
@Autowired /*@Autowired
private Global global; private Global global;
private static OfficeManager officeManager; private static OfficeManager officeManager;
...@@ -57,11 +63,50 @@ public class PptToPdf { ...@@ -57,11 +63,50 @@ public class PptToPdf {
officeManager.stop(); officeManager.stop();
} }
System.out.println("关闭office转换成功!"); System.out.println("关闭office转换成功!");
} }*/
/*public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String path = "C:/Users/Administrator/Desktop/"; String path = "C:/Users/Administrator/Desktop/";
PptToPdf opc = new PptToPdf(); PptToPdf opc = new PptToPdf();
opc.pptToPdf(path+"abc.pptx", path+"1.pdf"); opc.office2PDF(path+"abc.pptx", path+"1.pdf");
}*/ }
public static int office2PDF(String sourceFile, String destFile) throws FileNotFoundException {
try {
File inputFile = new File(sourceFile);
if (!inputFile.exists()) {
return -1;// 找不到源文件, 则返回-1
}
// 如果目标路径不存在, 则新建该路径
File outputFile = new File(destFile);
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(
"192.168.1.130", 10202);
connection.connect();
// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(
connection);
converter.convert(inputFile, outputFile);
// close the connection
connection.disconnect();
return 0;
} catch (ConnectException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return 1;
}
} }
...@@ -58,4 +58,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -58,4 +58,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Update("update s_user set password = #{password} where login_name = #{userCode} and del_flag = 0 and flag = 1") @Update("update s_user set password = #{password} where login_name = #{userCode} and del_flag = 0 and flag = 1")
int resetPassword( @Param("userCode") String userCode, @Param("password") String password); int resetPassword( @Param("userCode") String userCode, @Param("password") String password);
@Select("<script>select business_id from s_user where login_name = #{studentCode} and del_flag = 0 and flag = 1</script>")
String queryUserIdByLoginName(String studentCode);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment