Commit 74446078 authored by root's avatar root

Merge remote-tracking branch 'origin/meiteng' into meiteng

# Conflicts:
#	src/main/java/org/rcisoft/business/bfile/service/impl/BFileServiceImpl.java
parents 9a1d1453 d86d6d20
...@@ -45,6 +45,14 @@ ...@@ -45,6 +45,14 @@
<dependencies> <dependencies>
<!--okhttp-->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.6.0</version>
</dependency>
<!--spring boot starter !!!!!!!!!!!!!!!! --> <!--spring boot starter !!!!!!!!!!!!!!!! -->
<!--spring boot web starter--> <!--spring boot web starter-->
......
package org.rcisoft.base;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
@NoArgsConstructor
public class UserInfo implements Serializable {
private static final long serialVersionUID = 1L;
private String uid;
}
...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -59,12 +60,11 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -59,12 +60,11 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiOperation(value="添加/编辑章节", notes="businessId为空时是添加方法,不为空时是修改方法") @ApiOperation(value="添加/编辑章节", notes="businessId为空时是添加方法,不为空时是修改方法")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"), @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "slId", value = "开课id", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "chapterName", value = "章节名称(1-50)", required = true, dataType = "varchar"), @ApiImplicitParam(name = "chapterName", value = "章节名称(1-50)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "pid", value = "上一级(1-50)", required = true, dataType = "varchar"), @ApiImplicitParam(name = "pid", value = "上一级(1-50)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "chapterLevel", value = "等级,1:章 2:节", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "classHour", value = "课时", required = false, dataType = "varchar"), @ApiImplicitParam(name = "classHour", value = "课时", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "experimentType", value = "实验类型,1:java单文件 2:java工程 3:html单文件 4:html工程", required = false, dataType = "varchar"), @ApiImplicitParam(name = "experimentType", value = "实验类型,1:java单文件 2:java工程 3:html单文件 4:html工程", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "lessonOrSl", value = "课程或开课;0:开课 1:课程", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "isTest", value = "1:实验 2:视频 3:PPT 4:pdf 5:资料 6试题", required = false, dataType = "varchar"), @ApiImplicitParam(name = "isTest", value = "1:实验 2:视频 3:PPT 4:pdf 5:资料 6试题", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "lessonId", value = "课程ID(课程ID和开课ID只能存在一个)", required = false, dataType = "varchar")}) @ApiImplicitParam(name = "lessonId", value = "课程ID(课程ID和开课ID只能存在一个)", required = false, dataType = "varchar")})
@PostMapping(value = "/add") @PostMapping(value = "/add")
...@@ -83,8 +83,9 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -83,8 +83,9 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar"), @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "lessonOrSl", value = "区分课程开课 0开课,1课程", required = true, dataType = "varchar")}) @ApiImplicitParam(name = "lessonOrSl", value = "区分课程开课 0开课,1课程", required = true, dataType = "varchar")})
@PostMapping(value = "/remove") @PostMapping(value = "/remove")
public Result remove(String id, String lessonOrSl) { public Result remove(HttpServletRequest request) {
PersistModel data = bChapterService.removeBChapter(id,lessonOrSl); String id = request.getParameter("businessId");
PersistModel data = bChapterService.removeBChapter(id);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
...@@ -148,16 +149,7 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -148,16 +149,7 @@ public class BChapterController extends PaginationController<BChapter> {
@GetMapping(value = "/queryBChaptersWithoutAuth") @GetMapping(value = "/queryBChaptersWithoutAuth")
public Result queryBChapters(BChapter param) { public Result queryBChapters(BChapter param) {
Map<String, Object> map = new HashedMap(); Map<String, Object> map = new HashedMap();
// String userId = UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID);
// List<SysRole> role = sysRoleRepository.queryCodeByBusinessId(userId);
// if(role.size()>=1){
// if (role.get(0).getCode().equals(RoleEnum.TEACHER.getCode()))
// map.put("RoleFlag", RoleFlagEnum.TEACHER.getFlag());
// else {
// map.put("RoleFlag", RoleFlagEnum.STUDENT.getFlag());
// map.put("scoreList", bChapterService.queryScoreListBySlIdAndStuId(param.getSlId(), userId));
// }
// }
map.put("chapterList", bChapterService.queryBChapters(param)); map.put("chapterList", bChapterService.queryBChapters(param));
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -211,21 +203,6 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -211,21 +203,6 @@ public class BChapterController extends PaginationController<BChapter> {
studentCode); studentCode);
} }
@ApiOperation(value="完成学习", notes="完成学习")
@ApiImplicitParams({@ApiImplicitParam(name = "score", value = "分数", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "slId", value = "开课ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "chapterId", value = "章节id", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "filePath", value = "文件路径", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "studentCode", value = "学生学号", required = true, dataType = "varchar")})
@PostMapping(value = "/complete")
public Result complete(ScoreInfoDTO scoreInfoDTO) throws Exception{
scoreInfoDTO.setIsComplete(IsCompleteEnum.COMPLETE.getCode());
bChapterService.updateIsComplete(scoreInfoDTO);
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
scoreInfoDTO);
}
@ApiOperation(value="根据学生ID(token判断获取)和章节ID查询该节的学习情况", notes="学习情况包括:分数、实验完成状态以及各个教学手段完成状态。") @ApiOperation(value="根据学生ID(token判断获取)和章节ID查询该节的学习情况", notes="学习情况包括:分数、实验完成状态以及各个教学手段完成状态。")
@ApiImplicitParams({ @ApiImplicitParams({
......
...@@ -18,6 +18,25 @@ import java.util.Map; ...@@ -18,6 +18,25 @@ import java.util.Map;
@Repository @Repository
public interface BChapterRepository extends BaseMapper<BChapter> { public interface BChapterRepository extends BaseMapper<BChapter> {
/**
* 根据id逻辑删除章节
* @param businessId
* @return
*/
@Update("update b_chapter set del_flag = '1' where business_id=#{businessId}")
int removeByPrimaryKey(@Param("businessId") String businessId);
/**
* 根据id更新添加视频的时长
* @param param
* @return
*/
@Update("update b_chapter set chapter_time = #{chapterTime} where business_id=#{businessId}")
int insertChapterTime(Map<String ,Object> param);
/** /**
* 根据条件查找 * 根据条件查找
* @param param * @param param
...@@ -25,13 +44,9 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -25,13 +44,9 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
*/ */
@Select("<script>select * from b_chapter " + @Select("<script>select * from b_chapter " +
"where del_flag = 0 and flag = 1 and pid = -1 " + "where del_flag = 0 and flag = 1 and pid = -1 " +
"<if test=\"slId!=null and slId != ''\">\n" +
" and sl_id = #{slId}\n" +
"</if>" +
"<if test=\"lessonId!=null and lessonId != ''\">\n" + "<if test=\"lessonId!=null and lessonId != ''\">\n" +
" and lesson_id = #{lessonId}\n" + " and lesson_id = #{lessonId}\n" +
"</if>" + "</if>" +
"and lesson_or_sl = #{lessonOrSl} " +
"order by sort asc</script>") "order by sort asc</script>")
@ResultMap(value = "SupperChildListResultMap" ) @ResultMap(value = "SupperChildListResultMap" )
List<BChapter> queryBChapters(Map<String, Object> param); List<BChapter> queryBChapters(Map<String, Object> param);
...@@ -133,7 +148,6 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -133,7 +148,6 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"FROM\n" + "FROM\n" +
"\tb_chapter t1\n" + "\tb_chapter t1\n" +
"LEFT JOIN b_r_student_chapter t2 ON t1.business_id = t2.chapter_id\n" + "LEFT JOIN b_r_student_chapter t2 ON t1.business_id = t2.chapter_id\n" +
"LEFT JOIN b_sl t3 ON t1.sl_id = t3.business_id\n" +
"LEFT JOIN b_student t4 ON t2.student_id = t4.business_id\n" + "LEFT JOIN b_student t4 ON t2.student_id = t4.business_id\n" +
"LEFT JOIN s_user t5 ON t5.login_name = t4.code\n" + "LEFT JOIN s_user t5 ON t5.login_name = t4.code\n" +
"WHERE\n" + "WHERE\n" +
...@@ -233,10 +247,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> { ...@@ -233,10 +247,8 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
@Select("<script>select DISTINCT IFNULL((select max(sort) from b_chapter where pid = #{pid} " + @Select("<script>select DISTINCT IFNULL((select max(sort) from b_chapter where pid = #{pid} " +
"and del_flag = 0 and flag = 1 " + "and del_flag = 0 and flag = 1 " +
"<if test=\"SlId !=null and SlId !=''\">AND sl_id = #{SlId} </if>" +
"<if test=\"lessonId !=null and lessonId !=''\">AND lesson_id = #{lessonId} </if>),0)+1 as sort</script>") "<if test=\"lessonId !=null and lessonId !=''\">AND lesson_id = #{lessonId} </if>),0)+1 as sort</script>")
int selectMaxSort(@Param("pid") String pid, int selectMaxSort(@Param("pid") String pid,
@Param("SlId") String SlId,
@Param("lessonId") String lessonId); @Param("lessonId") String lessonId);
@Select("<script>select * from b_chapter where sort &lt; #{sort} " + @Select("<script>select * from b_chapter where sort &lt; #{sort} " +
......
...@@ -28,10 +28,7 @@ import java.util.List; ...@@ -28,10 +28,7 @@ import java.util.List;
public class BChapter extends IdEntity<BChapter> { public class BChapter extends IdEntity<BChapter> {
private static final long serialVersionUID = -8023388256391391541L; private static final long serialVersionUID = -8023388256391391541L;
/*开课id*/
//@NotEmpty(message = "开课id必填")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String slId;
/*章节名称*/ /*章节名称*/
@NotBlank @NotBlank
@Length(min = 1,max = 50,message = "长度最小为1,最大为50") @Length(min = 1,max = 50,message = "长度最小为1,最大为50")
...@@ -53,8 +50,6 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -53,8 +50,6 @@ public class BChapter extends IdEntity<BChapter> {
//@Length(min = 1,max = 20,message = "长度最小为1,最大为15") //@Length(min = 1,max = 20,message = "长度最小为1,最大为15")
private String isTest; private String isTest;
/*课程或开课 0:开课 1:课程*/
private String lessonOrSl;
/*状态 0关闭 1开启*/ /*状态 0关闭 1开启*/
private String state; private String state;
...@@ -75,6 +70,10 @@ public class BChapter extends IdEntity<BChapter> { ...@@ -75,6 +70,10 @@ public class BChapter extends IdEntity<BChapter> {
/*章节排序*/ /*章节排序*/
private Integer sort; private Integer sort;
/*课程时长 节填 章不填*/
private String courseTime;
@Transient @Transient
private List<BChapterRepository> childList; private List<BChapterRepository> childList;
......
...@@ -61,7 +61,7 @@ public interface BChapterService{ ...@@ -61,7 +61,7 @@ public interface BChapterService{
* @param id * @param id
* @return * @return
*/ */
PersistModel removeBChapter(String id,String token); PersistModel removeBChapter(String id);
/** /**
* 打分 * 打分
...@@ -86,19 +86,12 @@ public interface BChapterService{ ...@@ -86,19 +86,12 @@ public interface BChapterService{
*/ */
void deleteScoerInfo(String chapterId, String studentCode); void deleteScoerInfo(String chapterId, String studentCode);
/**
* 更新已经完成状态
* @param scoreInfoDTO
*/
void updateIsComplete(ScoreInfoDTO scoreInfoDTO) throws Exception;
/* /*
* 根据学生ID和章节ID查询该节的学习情况 * 根据学生ID和章节ID查询该节的学习情况
* */ * */
ScoreInfoDTO getChapInfoById(ScoreInfoDTO scoreInfoDTO) throws Exception; ScoreInfoDTO getChapInfoById(ScoreInfoDTO scoreInfoDTO) throws Exception;
int addBslFormLesson(String bLseeonId, String lessonCode, String businessId);
int updateChapterState(BChapter bChapter); int updateChapterState(BChapter bChapter);
int updateAllChapterState(String slId); int updateAllChapterState(String slId);
......
...@@ -4,11 +4,13 @@ import lombok.AllArgsConstructor; ...@@ -4,11 +4,13 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.rcisoft.business.bcourse.dao.BCourseRepository;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import java.util.List;
@Entity @Entity
@Table(name = "b_course") @Table(name = "b_course")
...@@ -29,4 +31,7 @@ public class BCourse extends IdEntity<BCourse> { ...@@ -29,4 +31,7 @@ public class BCourse extends IdEntity<BCourse> {
@Transient @Transient
private String condition;//模糊查询条件 private String condition;//模糊查询条件
@Transient
private List<BCourseRepository> childList;
} }
...@@ -20,7 +20,7 @@ public interface BCourseService { ...@@ -20,7 +20,7 @@ public interface BCourseService {
PersistModel removeCourse(String id); PersistModel removeCourse(String id);
PersistModel updateCourse(BCourse bCourse); PersistModel updateCourse(BCourse bCoursee);
} }
...@@ -188,17 +188,5 @@ public class BFileController extends PaginationController<BFile> { ...@@ -188,17 +188,5 @@ public class BFileController extends PaginationController<BFile> {
@ApiOperation(value="重新转换ppt", notes="重新转换ppt")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "课程或开课的ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "'0'开课,'1'课程", required = true, dataType = "varchar")})
@GetMapping(value = "/reConversionPPTWithoutAuth")
public Result reConversionPPTWithoutAuth(String businessId, String type) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bFileService.reConversionPPT(businessId,type));
}
} }
...@@ -51,9 +51,6 @@ public class BFile extends IdEntity<BFile> { ...@@ -51,9 +51,6 @@ public class BFile extends IdEntity<BFile> {
@NotBlank @NotBlank
private String lessonId;//课程ID private String lessonId;//课程ID
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@NotBlank
private String slId;//开课ID
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@NotBlank @NotBlank
......
...@@ -57,6 +57,5 @@ public interface BFileService { ...@@ -57,6 +57,5 @@ public interface BFileService {
* @param file * @param file
*/ */
public void uploadLicense(MultipartFile file) throws IOException; public void uploadLicense(MultipartFile file) throws IOException;
public List<String> reConversionPPT(String businessId, String type);
List<String> reConversionPPT(String businessId, String type);
} }
package org.rcisoft.business.bfile.util;
import java.io.File;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncoderException;
import it.sauronsoftware.jave.MultimediaInfo;
public class GetVideoTime {
public String getVideoDuration(String path) {
// get file in specified "path"
File file = new File(path);
Encoder encoder = new Encoder();
MultimediaInfo multimediaInfo;
long totalTime = 0L;
long duration = 0L;
try {
multimediaInfo = encoder.getInfo(file);
duration = multimediaInfo.getDuration();
totalTime += duration;
} catch (EncoderException e) {
e.printStackTrace();
}
// long --> hh:mm: calculate the time manually
String time = totalTime / (3600 * 1000) + ":" + totalTime % (3600 * 1000) / (60 * 1000) + ":" + totalTime % (3600 * 1000) % (60 * 1000) / 1000;
return time;
}
public static void main(String[] args) {
String filePath = "E:\\迅雷下载\\CHS.mp4";
GetVideoTime getVideoTime = new GetVideoTime();
System.out.println( getVideoTime.getVideoDuration(filePath));
}
}
\ No newline at end of file
...@@ -50,7 +50,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -50,7 +50,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"<if test=\"param.courseType!=null and param.courseType != ''\">and bl.course_type = #{param.courseType} </if> " + "<if test=\"param.courseType!=null and param.courseType != ''\">and bl.course_type = #{param.courseType} </if> " +
"order by blp.update_date desc</script>") "order by blp.update_date desc</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryLearnBLessons(@Param("param") BLesson param,@Param("userId")String userId); List<BLesson> queryLearnBLessons(@Param("param") BLesson param, @Param("userId") String userId);
@Select("<script>select bl.*,bld.direction_id as directionId from b_lesson bl " + @Select("<script>select bl.*,bld.direction_id as directionId from b_lesson bl " +
"left join b_lesson_direction bld on bl.business_id = bld.lession_id " + "left join b_lesson_direction bld on bl.business_id = bld.lession_id " +
......
...@@ -26,7 +26,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> { ...@@ -26,7 +26,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
"<if test=\"param.lessonType!=null and param.courseType != ''\">and bl.lesson_type = #{param.lessonType} </if> " + "<if test=\"param.lessonType!=null and param.courseType != ''\">and bl.lesson_type = #{param.lessonType} </if> " +
"order by blp.update_date desc</script>") "order by blp.update_date desc</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryLearnBLessons(@Param("param") BLessonPerson param, @Param("userId")String userId); List<BLesson> queryLearnBLessons(@Param("param") BLessonPerson param, @Param("userId") String userId);
......
...@@ -133,15 +133,6 @@ public class Global { ...@@ -133,15 +133,6 @@ public class Global {
@Value("${global.path.md_file_location}") @Value("${global.path.md_file_location}")
private String MD_FILE_LOCATION; private String MD_FILE_LOCATION;
// /*登录验证秘钥*/
// @Value("${jwt.login_secert_key}")
// private String LOGIN_SECERT_KEY;
//
// @Value("${jwt.header}")
// private String JWT_HEADER;
//
// @Value("${jwt.tokenHead}")
// private String JWT_TOKEN_HEAD;
/*是否是服务器(为1代表是服务器)*/ /*是否是服务器(为1代表是服务器)*/
@Value("${global.other.is_server_linux}") @Value("${global.other.is_server_linux}")
...@@ -184,56 +175,6 @@ public class Global { ...@@ -184,56 +175,6 @@ public class Global {
private String studentCode; private String studentCode;
// /*java 单文件*/
// @Value("${global.code.java_simple}")
// private String javaSimple;
//
// /*java 工程*/
// @Value("${global.code.java_project}")
// private String javaProject;
//
// /*html 单文件*/
// @Value("${global.code.html_simple}")
// private String htmlSimple;
//
// /*html 工程*/
// @Value("${global.code.html_project}")
// private String htmlProject;
// /**
// * 容器
// */
// @Value("${lxc.lxc_prefix}")
// private String lxcPrefix;
//
// @Value("${lxc.lxc_ports}")
// private String lxcPorts;
//
// @Value("${lxc.lxc_dockerfilePath}")
// private String lxcDockerfilePath;
//
// @Value("${lxc.lxc_initPort}")
// private Integer lxcInitPort;
//
// @Value("${lxc.lxc_maxPort}")
// private Integer lxcMaxPort;
/**
* 容器时间
*/
// @Value("${lxc.lxc_minu}")
// private Integer lxcMinu;
// /*延长界限*/
// @Value("${lxc.lxc_endlineTime}")
// private Integer lxcEndlineTime;
//
// /*延长时间*/
// @Value("${lxc.lxc_delayTime}")
// private Integer lxcDelayTime;
//
// @Value("${lxc.lxc_isRemote}")
// private String lxcIsRemote;
/*libreoffice ip*/ /*libreoffice ip*/
@Value("${libreoffice.ip}") @Value("${libreoffice.ip}")
......
...@@ -27,21 +27,4 @@ public class HttpServletController { ...@@ -27,21 +27,4 @@ public class HttpServletController {
public HttpServletController() { public HttpServletController() {
} }
/**
* get token
* @return
*/
// public String getToken(){
// // 取得header
// String authHeader = request.getHeader(this.tokenHeader);
// //判断header头
// if (authHeader != null && authHeader.startsWith(tokenHead)) {
// // The part after "Bearer "
// final String authToken = authHeader.substring(tokenHead.length());
// //从jwt中获取信息,如果要缓存很多信息可以用Claims
// //String username = JwtUtil.getUsernameFromToken(authToken);
// return authToken;
// }
// return null;
// }
} }
...@@ -2,14 +2,25 @@ package org.rcisoft.core.aop; ...@@ -2,14 +2,25 @@ package org.rcisoft.core.aop;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature; import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.rcisoft.common.controller.ValidatedController;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.util.IdGen; import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.validate.ValidatedResult;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.validation.BindingResult;
import javax.rmi.CORBA.Util;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/** /**
* Created by lcy on 17/11/23. * Created by lcy on 17/11/23.
...@@ -21,10 +32,33 @@ public class CurUserAspect { ...@@ -21,10 +32,33 @@ public class CurUserAspect {
* @param joinPoint * @param joinPoint
*/ */
@Before("execution(* org.rcisoft..*.controller.*.*(..))") @Before("execution(* org.rcisoft..*.controller.*.*(..))")
public void beforeInsert(JoinPoint joinPoint){ public void beforeInsert(JoinPoint joinPoint) {
Object model = joinPoint.getArgs()[0];
if (joinPoint.getArgs().length < 2)
return;
String model = (String) joinPoint.getArgs()[0];
Signature signature = joinPoint.getSignature(); Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature; MethodSignature methodSignature = (MethodSignature) signature;
UserUtil.setUserInfo(model);
} }
// @Around("execution(* org.rcisoft..*.controller.*.*(..))")
// public Object beforeInsert(ProceedingJoinPoint joinPoint) throws Throwable{
// try {
// /*验证 长度必须大于1*/
// if(joinPoint.getArgs().length < 2)
// return joinPoint.proceed();
// /*CurUser 必须写在第一个参数里*/
// Object model = joinPoint.getArgs()[0];
// if(!(model instanceof CurUser))
// return joinPoint.proceed();
// CurUser cu = (CurUser) model;
//
// return joinPoint.proceed();
// } catch (Throwable var5) {
// throw var5;
// }
// }
} }
//package org.rcisoft.core.util; package org.rcisoft.core.util;
//
//import freemarker.template.Configuration; import freemarker.template.Configuration;
//import freemarker.template.Template; import freemarker.template.Template;
//import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
//import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
//import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
//import org.rcisoft.core.command.LxcCommand; import org.rcisoft.core.result.CommandResult;
//import org.rcisoft.core.result.CommandResult; import org.rcisoft.core.result.ResultCode;
//import org.rcisoft.core.result.ResultCode; import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component;
//import org.springframework.stereotype.Component;
// import java.io.File;
//import java.io.File; import java.io.FileWriter;
//import java.io.FileWriter; import java.util.Map;
//import java.util.Map;
// /**
///** * Created by lcy on 18/1/9.
// * Created by lcy on 18/1/9. */
// */ @Component
//@Component @Slf4j
//@Slf4j public class FreemarkerUtil {
//public class FreemarkerUtil {
// @Autowired
// @Autowired Configuration freemarkerConfiguration;
// Configuration freemarkerConfiguration;
//
// /**
// /** * 根据模板构建文件
// * 根据模板构建文件 * @param model
// * @param model * @param destPath
// * @param destPath * @param param
// * @param param */
// */ public CommandResult generatorFileFromModel(String model, String destPath, Map param){
// public CommandResult generatorFileFromModel(String model, String destPath, Map param){ CommandResult commandResult = null;
// CommandResult commandResult = null; try {
// try { if(StringUtils.isEmpty(model) && StringUtils.isEmpty(destPath)) {
// if(StringUtils.isEmpty(model) && StringUtils.isEmpty(destPath)) { log.error("目录错误 ...." + destPath);
// log.error("目录错误 ...." + destPath); commandResult = new CommandResult(ResultCode.FAIL,"目录不存在",null);
// commandResult = new CommandResult(ResultCode.FAIL,"目录不存在",null); return commandResult;
// return commandResult; }
// } File dirFile1 = new File(destPath);
// File dirFile1 = new File(destPath); File dirFile2 = new File(destPath+ "java" + File.separator );
// File dirFile2 = new File(destPath+ "java" + File.separator ); /*目录不存在*/
// /*目录不存在*/ if(!dirFile1.exists()){
// if(!dirFile1.exists()){ dirFile1.mkdirs();
// dirFile1.mkdirs(); }
// } if(!dirFile2.exists()){
// if(!dirFile2.exists()){ dirFile2.mkdirs();
// dirFile2.mkdirs(); }
// }
// if(model.equals("java")) {
// Template template = freemarkerConfiguration.getTemplate("lxc" + File.separator + model + File.separator + LxcCommand.LXC_JAVA_NAME + ".ftl"); Template template = freemarkerConfiguration.getTemplate("lxc" + File.separator + model + ".ftl"); // freeMarker template
// template.process(param,new FileWriter(new File(destPath + "java" + File.separator + LxcCommand.LXC_JAVA_NAME)));
//
//// File fromFile = new File(this.getClass().getResource("/").getPath() +"templates/lxc" + File.separator + model + File.separator + "settings.xml");
//// File toFile = new File(destPath + "java" + File.separator + "settings.xml");
//// FileUtils.copyFile(fromFile,toFile);
//
// }
//
// Template template = freemarkerConfiguration.getTemplate("lxc" + File.separator + model + ".ftl"); // freeMarker template
//
//
// template.process(param,new FileWriter(new File(destPath + LxcCommand.LXC_SETTING_NAME))); // template.process(param,new FileWriter(new File(destPath + LxcCommand.LXC_SETTING_NAME)));
// commandResult = new CommandResult(ResultCode.SUCCESS,null,null); commandResult = new CommandResult(ResultCode.SUCCESS,null,null);
// }catch (Exception e){ }catch (Exception e){
// log.error(e.getMessage()); log.error(e.getMessage());
// commandResult = new CommandResult(ResultCode.FAIL,e.getMessage(),null); commandResult = new CommandResult(ResultCode.FAIL,e.getMessage(),null);
// } }
// return commandResult; return commandResult;
// } }
//} }
package org.rcisoft.core.util; package org.rcisoft.core.util;
import org.rcisoft.base.BizCommonCheckException;
import org.rcisoft.base.UserInfo;
import org.rcisoft.business.bchapter.entity.BChapter; import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.common.util.feignDto.UserInfoDTO;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import java.util.Date;
import java.util.Map;
/** /**
* Created by lcy on 17/11/28. * Created by lcy on 17/11/28.
*/ */
public class UserUtil { public class UserUtil {
protected static ThreadLocal<UserInfo> local = new ThreadLocal<>();
public static void setUserInfo(String uid){
UserInfo userInfo = new UserInfo();
local.remove();
userInfo.setUid(uid);
local.set(userInfo);
}
public static UserInfo getLocal() {
return local.get();
}
/** /**
* 用户id * 用户id
...@@ -19,9 +39,17 @@ public class UserUtil { ...@@ -19,9 +39,17 @@ public class UserUtil {
public static void setCurrentPersistOperation(IdEntity model) { public static void setCurrentPersistOperation(IdEntity model) {
model.setCreateBy(getLocal().getUid());
model.setCreateDate(new Date());
model.setUpdateBy(getLocal().getUid());
model.setUpdateDate(new Date());
model.setCommonBusinessId();
model.setNotDeleted();
model.setStart();
} }
public static void setCurrentMergeOperation(IdEntity model) { public static void setCurrentMergeOperation(IdEntity model) {
model.setUpdateBy(getLocal().getUid());
model.setUpdateDate(new Date());
} }
} }
...@@ -52,7 +52,7 @@ public interface SysRoleService { ...@@ -52,7 +52,7 @@ public interface SysRoleService {
*/ */
PersistModel doAuthorization(String roleId, String role_menus); PersistModel doAuthorization(String roleId, String role_menus);
PersistModel doAuthorizationDept(String roleId, String role_menus, String token); PersistModel doAuthorizationDept(String roleId, String role_menus);
/** /**
* 分页查询角色 根据 userId 进行checked * 分页查询角色 根据 userId 进行checked
* @param paginationUtility * @param paginationUtility
......
...@@ -116,7 +116,7 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -116,7 +116,7 @@ public class SysRoleServiceImpl implements SysRoleService {
} }
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public PersistModel doAuthorizationDept(String roleId, String role_depts, String token) { public PersistModel doAuthorizationDept(String roleId, String role_depts) {
//删除原始权限 //删除原始权限
int line = sysRoleRepository.deleteRoleDepts(roleId); int line = sysRoleRepository.deleteRoleDepts(roleId);
//批量插入新的权限 //批量插入新的权限
......
...@@ -10,19 +10,18 @@ ...@@ -10,19 +10,18 @@
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/> <result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/> <result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/> <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="sl_id" jdbcType="VARCHAR" property="slId"/>
<result column="chapter_name" jdbcType="VARCHAR" property="chapterName"/> <result column="chapter_name" jdbcType="VARCHAR" property="chapterName"/>
<result column="chapter_level" jdbcType="INTEGER" property="chapterLevel"/> <result column="chapter_level" jdbcType="INTEGER" property="chapterLevel"/>
<result column="pid" jdbcType="VARCHAR" property="pid"/> <result column="pid" jdbcType="VARCHAR" property="pid"/>
<result column="chapter_url" jdbcType="VARCHAR" property="chapterUrl"/> <result column="chapter_url" jdbcType="VARCHAR" property="chapterUrl"/>
<result column="is_test" jdbcType="VARCHAR" property="isTest"/> <result column="is_test" jdbcType="VARCHAR" property="isTest"/>
<result column="md_file" jdbcType="LONGVARCHAR" property="mdFile"/> <result column="md_file" jdbcType="LONGVARCHAR" property="mdFile"/>
<result column="lesson_or_sl" jdbcType="VARCHAR" property="lessonOrSl"/>
<result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/> <result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/>
<result column="class_hour" jdbcType="VARCHAR" property="classHour"/> <result column="class_hour" jdbcType="VARCHAR" property="classHour"/>
<result column="state" jdbcType="VARCHAR" property="state"/> <result column="state" jdbcType="VARCHAR" property="state"/>
<result column="sort" jdbcType="INTEGER" property="sort"/> <result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="experiment_type" jdbcType="VARCHAR" property="experimentType"/> <result column="experiment_type" jdbcType="VARCHAR" property="experimentType"/>
<result column="course_time" jdbcType="VARCHAR" property="courseTime"/>
</resultMap> </resultMap>
<!--教师和管理员使用这个--> <!--教师和管理员使用这个-->
......
...@@ -15,4 +15,7 @@ ...@@ -15,4 +15,7 @@
<result column="order_by" jdbcType="VARCHAR" property="orderBy"/> <result column="order_by" jdbcType="VARCHAR" property="orderBy"/>
</resultMap> </resultMap>
<resultMap id="ChildListResultMap" type="org.rcisoft.business.bcourse.entity.BCourse" extends="BaseResultMap">
<association column="business_id" property="childList" select="org.rcisoft.business.bcourse.dao.BCourseRepository.selectCourses"></association>
</resultMap>
</mapper> </mapper>
\ No newline at end of file
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
<result column="pdf_url" jdbcType="VARCHAR" property="pdfUrl"/> <result column="pdf_url" jdbcType="VARCHAR" property="pdfUrl"/>
<result column="type" jdbcType="VARCHAR" property="type"/> <result column="type" jdbcType="VARCHAR" property="type"/>
<result column="chapter_id" jdbcType="VARCHAR" property="chapterId"/> <result column="chapter_id" jdbcType="VARCHAR" property="chapterId"/>
<result column="sl_id" jdbcType="VARCHAR" property="slId"/>
<result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/> <result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/>
</resultMap> </resultMap>
</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