Commit f8c322b0 authored by YangZhaoJun1's avatar YangZhaoJun1

解决bug,增加106服务器的配置文件

parent e7a0c25d
...@@ -633,14 +633,16 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -633,14 +633,16 @@ public class BArrangeServiceImpl implements BArrangeService {
//复制章节及文件目录 //复制章节及文件目录
chapterService.addBslFormLesson(null,sl.getLessonCode(), sl.getBusinessId()); chapterService.addBslFormLesson(null,sl.getLessonCode(), sl.getBusinessId());
} }
BSubtask bSubtask = new BSubtask(subTaskId,"5");
bSubtaskRepository.updateByPrimaryKeySelective(bSubtask);//将子任务状态置为已开课
bTermRepository.MaxSlCodeByTermCode(termCode,String.valueOf(maxSlCode));//将该学期的开课序号存入
bDirectionRepository.insertList(bLessonDirections);//批量插入课程方向
//批量插入
result =bSlRepository.insertList(sls);
} }
BSubtask bSubtask = new BSubtask(subTaskId,"5");
bSubtaskRepository.updateByPrimaryKeySelective(bSubtask);//将子任务状态置为已开课
bTermRepository.MaxSlCodeByTermCode(termCode,String.valueOf(maxSlCode));//将该学期的开课序号存入
bDirectionRepository.insertList(bLessonDirections);//批量插入课程方向
//批量插入
result =bSlRepository.insertList(sls);
//查询此排课下是否还存在没有开课的子任务 //查询此排课下是否还存在没有开课的子任务
//int count = bSubtaskRepository.judgeSubtask(arrangeId); //int count = bSubtaskRepository.judgeSubtask(arrangeId);
//如果没有状态不为5的子任务,则设定此排课任务完成 //如果没有状态不为5的子任务,则设定此排课任务完成
......
...@@ -294,7 +294,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -294,7 +294,7 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
@Update("<script>update b_r_student_chapter " + @Update("<script>update b_r_student_chapter " +
"set score = #{score}," + "set score = #{score}," +
"automatic = '0', " + "automatic = '0' " +
"where student_id = #{studentId} " + "where student_id = #{studentId} " +
"and chapter_id = #{chapterId}</script>") "and chapter_id = #{chapterId}</script>")
int remark(@Param("chapterId") String chapterId, @Param("studentId") String studentId, @Param("score") String score); int remark(@Param("chapterId") String chapterId, @Param("studentId") String studentId, @Param("score") String score);
...@@ -326,15 +326,15 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -326,15 +326,15 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
String queryStuIdByCode(String code); String queryStuIdByCode(String code);
@Update("<script>update b_r_student_chapter set \n" + /*@Update("<script>update b_r_student_chapter <trim prefix=\"set\" suffixOverrides=\",\"> " +
"<if test=\"pptFinish !=null and pptFinish != ''\"> ppt_finish = '1', </if>" + "<if test=\"pptFinish !=null and pptFinish != ''\"> ppt_finish = '1', </if>" +
"<if test=\"pdfFinish !=null and pdfFinish != '' \"> pdf_finish = '1', </if>" + "<if test=\"pdfFinish !=null and pdfFinish != '' \"> pdf_finish = '1', </if>" +
"<if test=\"videoFinish !=null and videoFinish != ''\"> video_finish = '1', </if>" + "<if test=\"videoFinish !=null and videoFinish != ''\"> video_finish = '1', </if>" +
"<if test=\"paperFinish !=null and paperFinish != ''\"> paper_finish = '1', </if>" + "<if test=\"paperFinish !=null and paperFinish != ''\"> paper_finish = '1', </if>" +
"<if test=\"isComplete !=null and isComplete != ''\"> is_complete = #{isComplete}, </if>" + "<if test=\"isComplete !=null and isComplete != ''\"> is_complete = #{isComplete}, </if>" +
"<if test=\"automatic !=null and automatic != ''\"> automatic = #{automatic}, </if>" + "<if test=\"automatic !=null and automatic != ''\"> automatic = #{automatic}, </if>" +
"<if test=\"score !=null and score != ''\"> score = #{score} </if>" + "<if test=\"score !=null and score != ''\"> score = #{score}, </if>" +
"where student_id = #{studentId} and chapter_id = #{chapterId} </script>") "</trim> where student_id = #{studentId} and chapter_id = #{chapterId} </script>")*/
int updateToFinish(ScoreInfoDTO scoreInfoDTO); int updateToFinish(ScoreInfoDTO scoreInfoDTO);
@Select(" SELECT business_id AS businessId\n" + @Select(" SELECT business_id AS businessId\n" +
......
...@@ -73,6 +73,7 @@ public class BCodeLxcServiceImpl implements BCodeLxcService { ...@@ -73,6 +73,7 @@ public class BCodeLxcServiceImpl implements BCodeLxcService {
port = this.getIdleWithPorts(ports,port,maxPort); port = this.getIdleWithPorts(ports,port,maxPort);
logger.info("<port>:"+port); logger.info("<port>:"+port);
//portSSH = this.getIdleWithPorts(ports,portSSH,maxPortSSH); //portSSH = this.getIdleWithPorts(ports,portSSH,maxPortSSH);
logger.info("<nowPort>:"+port);
portSSH = port + 10000; portSSH = port + 10000;
logger.info("<portSSH>:"+portSSH); logger.info("<portSSH>:"+portSSH);
} }
......
...@@ -188,14 +188,18 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -188,14 +188,18 @@ public class BCodeServiceImpl implements BCodeService {
else if(null != lxc){ else if(null != lxc){
/*容器参数*/ /*容器参数*/
param.put("port", lxc.getContainerPort()); param.put("port", lxc.getContainerPort());
if(examCode.equals(global.getJavaProject()))
param.put("sshPort", lxc.getContainerPort()+10000);
else
param.put("sshPort", "");
param.put("endTime",lxc.getShutdownDate().getTime()); param.put("endTime",lxc.getShutdownDate().getTime());
} }
/*开启容器*/ /*开启容器*/
else else
this.startLxc(param,lxc); this.startLxc(param,lxc,examCode);
} }
else else
this.startLxc(param,lxc); this.startLxc(param,lxc,examCode);
try{ try{
File simplePath = new File(path); File simplePath = new File(path);
BCodeFile simpleCodeFile = null; BCodeFile simpleCodeFile = null;
...@@ -224,7 +228,7 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -224,7 +228,7 @@ public class BCodeServiceImpl implements BCodeService {
* @param param * @param param
* @param lxc * @param lxc
*/ */
private void startLxc(Map param,BCodeLxc lxc){ private void startLxc(Map param,BCodeLxc lxc,String examCode){
CommandResult result = bCodeLxcServiceImpl.startBCodeLxc(lxc); CommandResult result = bCodeLxcServiceImpl.startBCodeLxc(lxc);
/*启动失败*/ /*启动失败*/
if(null == result || !result.isSuccess()){ if(null == result || !result.isSuccess()){
...@@ -232,6 +236,10 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -232,6 +236,10 @@ public class BCodeServiceImpl implements BCodeService {
throw new ServiceException(400,result.getMessage()); throw new ServiceException(400,result.getMessage());
} }
param.put("port", lxc.getContainerPort()); param.put("port", lxc.getContainerPort());
if(examCode.equals(global.getJavaProject()))
param.put("sshPort", lxc.getContainerPort()+10000);
else
param.put("sshPort", "");
param.put("endTime",lxc.getShutdownDate().getTime()); param.put("endTime",lxc.getShutdownDate().getTime());
} }
...@@ -588,6 +596,7 @@ public class BCodeServiceImpl implements BCodeService { ...@@ -588,6 +596,7 @@ public class BCodeServiceImpl implements BCodeService {
public CommandResult stopExam(String userId) { public CommandResult stopExam(String userId) {
BCodeLxc lxc = null; BCodeLxc lxc = null;
/*容器是否已启动*/ /*容器是否已启动*/
log.info("userId:+++++++++++++"+userId);
byte[] results = rcRedisServiceImpl.getBytes(global.getLxcPrefix() + "_" + userId); byte[] results = rcRedisServiceImpl.getBytes(global.getLxcPrefix() + "_" + userId);
if(null != results) { if(null != results) {
lxc = SerializationUtils.deserializer(results, BCodeLxc.class); lxc = SerializationUtils.deserializer(results, BCodeLxc.class);
......
package org.rcisoft.business.bgrade.dao; package org.rcisoft.business.bgrade.dao;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bgrade.entity.BGrade; import org.rcisoft.business.bgrade.entity.BGrade;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
...@@ -44,5 +46,17 @@ public interface BGradeRepository extends BaseMapper<BGrade> { ...@@ -44,5 +46,17 @@ public interface BGradeRepository extends BaseMapper<BGrade> {
+ "limit 5</script>") + "limit 5</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BGrade> queryFirstFiveBGrades(BGrade bGrade); List<BGrade> queryFirstFiveBGrades(BGrade bGrade);
@Delete("delete from b_grade")
int deleteAll();
@Insert("<script>INSERT INTO b_grade" +
"(create_date,update_date,create_by,update_by,remarks,del_flag,flag,business_id," +
"code,name)VALUES" +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" +
"( #{item.createDate},#{item.updateDate},#{item.createBy},#{item.updateBy},#{item.remarks},#{item.delFlag}," +
"#{item.flag},#{item.businessId},#{item.code},#{item.name})" +
"</foreach></script>")
int insertList(List<BGrade> newGrades);
} }
...@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -109,19 +110,40 @@ public class BGradeServiceImpl implements BGradeService { ...@@ -109,19 +110,40 @@ public class BGradeServiceImpl implements BGradeService {
public List<BGrade> queryFirstFiveBGrades(BGrade bGrade) { public List<BGrade> queryFirstFiveBGrades(BGrade bGrade) {
bGrade.setStart(); bGrade.setStart();
bGrade.setNotDeleted(); bGrade.setNotDeleted();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
Date date = new Date(); Date date = new Date();
String nowYear = sdf.format(date); String nowYear = sdf.format(date);
int code = Integer.parseInt(nowYear);
//是否满足5个年级,不满足的话删除全部,然后插入近5年的年级
List<BGrade> grades;
grades = bGradeRepository.queryFirstFiveBGrades(bGrade);
if(grades.size()<5){
bGradeRepository.deleteAll();
List<BGrade> newGrades = new ArrayList<>();
for(int i=0;i<5;i++){
BGrade grade = new BGrade();
grade.setName(String.valueOf(code-i)+"级");
grade.setCode(String.valueOf(code-i));
UserUtil.setCurrentPersistOperation(grade);
newGrades.add(grade);
}
bGradeRepository.insertList(newGrades);
}
//查询是否有本年的年级 //查询是否有本年的年级
List<BGrade> bGrades = bGradeRepository.queryBGradeByNowYear(nowYear); // List<BGrade> bGrades = bGradeRepository.queryBGradeByNowYear(nowYear);
if(bGrades.size()<1){//没有就新增 String nowYearCode = grades.get(0).getCode();
if(!nowYearCode.equals(nowYear)){//没有就新增
BGrade grade = new BGrade(); BGrade grade = new BGrade();
grade.setCode(nowYear); grade.setCode(nowYear);
grade.setName(nowYear+"级"); grade.setName(nowYear+"级");
UserUtil.setCurrentPersistOperation(grade); UserUtil.setCurrentPersistOperation(grade);
bGradeRepository.insertSelective(grade); bGradeRepository.insertSelective(grade);
} }
return bGradeRepository.queryFirstFiveBGrades(bGrade); grades = bGradeRepository.queryFirstFiveBGrades(bGrade);
return grades;
} }
} }
server:
port: 8081
context-path: /edu #ContextPath must start with '/' and not end with '/'
tomcat:
max-threads: 300
#uri-encoding: UTF-8
#logging:
# level:
# root: INFO
# org.springframework.web: DEBUG
druid:
url: jdbc:mysql://edu2_mysql:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: 123456
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
mybatis:
mapper-locations: classpath:mapper/**/**/*.xml
mapper:
mappers:
- org.rcisoft.core.base.BaseMapper
not-empty: false
identity: MYSQL
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
spring:
jackson:
default-property-inclusion: non_null
date-format: yyyy-MM-dd
time-zone: GMT+8
http:
# encoding:
# force: true
# charset: UTF-8
# enabled: true
multipart:
enabled: true
max-file-size: 500Mb
max-request-size: 1000Mb
mvc:
throw-exception-if-no-handler-found: true
resources:
add-mappings: false
redis:
host: edu2_redis
port: 6379
pool:
max-idle: 50
max-active: 1000
min-idle: 5
max-wait: -1
database: 0
password: ''
timeout: 3600
freemarker:
charset: UTF-8
suffix: .ftl
template-loader-path: classpath:/templates/
lxc:
lxc_prefix: lessonLxc
lxc_ports: lxcPorts
lxc_dockerfilePath: /eduLxc
lxc_initPort: 20001
lxc_maxPort: 30000
lxc_minu: 30
lxc_isRemote: 1
lxc_endlineTime: 10
lxc_delayTime: 30
springfox:
documentation:
swagger:
v2:
path: /api-docs
jwt:
header: Authorization
secret: mySecret
expiration: 604800
tokenHead: "Bearer "
login_secert_key: "base64EncodedSecretKey"
route:
authentication:
path: "/login"
refresh: "/refresh"
register: "/register"
global:
default_location:
course: /default/course.jpg
student: /default/student.png
teacher: /default/teacher.png
carousel: /default/carousel.jpg
lk:
publicalias: publiccert
storePwd: rcrtcyedu2
subject: edu2
licPath: /lk/license.lic
pubPath: /lk/publicCerts.store
password:
default: 123456
min_password: 6
max_password: 16
path:
base_upload_server_location: /working/resource/eduServer/
physical_upload_server_location: /working/dockervolume/edu2_data_ubuntu/eduServer
course_location: course
lesson_location: lesson
sl_location: sl
freemarker_location: /freemarker
image_location: /upload
video_location: video
temp_location: temp
file_location: file
ppt_location: ppt
pdf_location: pdf
cut_pdf_location: cutPdf
excel_template_location: excel-template/
cource_logo_location: /course/logo
images_location: /images
lanch_logo_location: /lanch/logo
md_file_location: mdFiles
che_def_template_location: /WEB-INF/classes/che-def-jsonfile/java-mysql.json
che_project_init_location: /working/dockervolume/chedir/project
cource_code_location: code
cource_project_location: project
student_code_location: studentCode
xml_location: /xmlTemp
other:
server_url: http://106.2.3.134:10180/eduServer
is_server_linux: 1
max_code_length: 15
open_office_home: D:/oppenOffice/openOffice
cut_pdf_num: 30
code:
admin: ROLE_1001
teacher: ROLE_1002
student: ROLE_1003
java: '001'
html: '002'
java_simple: '0001'
java_project: '0002'
html_simple: '1001'
html_project: '1002'
serverLxc:
ip: 106.2.13.29
username: root
password: isoftxunda29
libreoffice:
ip: edu2_libre
port: 8997
\ No newline at end of file
...@@ -100,4 +100,19 @@ ...@@ -100,4 +100,19 @@
from b_chapter bc from b_chapter bc
where bc.pid = #{pid} order by bc.sort where bc.pid = #{pid} order by bc.sort
</select> </select>
<update id="updateToFinish" parameterType="org.rcisoft.business.bchapter.dto.ScoreInfoDTO">
update b_r_student_chapter
<trim prefix="set" suffixOverrides=",">
<if test="pptFinish !=null and pptFinish != ''"> ppt_finish = '1',</if>
<if test="pdfFinish !=null and pdfFinish != '' "> pdf_finish = '1',</if>
<if test="videoFinish !=null and videoFinish != ''"> video_finish = '1',</if>
<if test="paperFinish !=null and paperFinish != ''"> paper_finish = '1',</if>
<if test="isComplete !=null and isComplete != ''"> is_complete = #{isComplete},</if>
<if test="automatic !=null and automatic != ''"> automatic = #{automatic}, </if>
<if test="score !=null and score != ''"> score = #{score},</if>
</trim>
where student_id = #{studentId} and chapter_id = #{chapterId}
</update>
</mapper> </mapper>
\ No newline at end of file
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