|
@@ -54,7 +54,7 @@ public class TrainController extends BaseController {
|
|
|
throws Exception {
|
|
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("rolType", request.getParameter("rolType")==null?"":request.getParameter("rolType"));
|
|
|
+ params.put("roleType", request.getParameter("roleType")==null?"1":request.getParameter("roleType"));
|
|
|
params.put("module", request.getParameter("module")==null?"":request.getParameter("module"));
|
|
|
params.put("title", request.getParameter("title")==null?"":request.getParameter("title"));
|
|
|
params.put("index", request.getParameter("index")==null?"":request.getParameter("index"));
|
|
@@ -95,7 +95,6 @@ public class TrainController extends BaseController {
|
|
|
if(StringUtils.isNotEmpty(param.getId())) {
|
|
|
VideoInfo videoInfo=videoInfoService.getById(param.getId());
|
|
|
videoInfo.setDescription(param.getDescription());
|
|
|
- videoInfo.setIndes(param.getIndes());
|
|
|
videoInfo.setModule(param.getModule());
|
|
|
videoInfo.setRoleType(param.getRoleType());
|
|
|
videoInfo.setStatus(param.getStatus());
|
|
@@ -103,17 +102,39 @@ public class TrainController extends BaseController {
|
|
|
videoInfo.setUpdateTime(new Date());
|
|
|
videoInfoService.save(videoInfo);
|
|
|
}else {
|
|
|
+ Integer indes=1;
|
|
|
+ VideoInfo maxVideoInfo=videoInfoService.getVideoInfoByMaxIndes(param.getRoleType());
|
|
|
+ if(maxVideoInfo!=null) {
|
|
|
+ indes=maxVideoInfo.getIndes()+1;
|
|
|
+ }
|
|
|
+ param.setIndes(indes);
|
|
|
param.setCreateTime(new Date());
|
|
|
videoInfoService.save(param);
|
|
|
}
|
|
|
response.success();
|
|
|
return response;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping("/video/indes/update")
|
|
|
+ @ResponseBody
|
|
|
+ public Response videoIndesUpdate(Model model,String id,Integer indes) throws Exception{
|
|
|
+ Response response = new Response();
|
|
|
+ if(StringUtils.isNotEmpty(id)) {
|
|
|
+ VideoInfo videoInfo=videoInfoService.getById(id);
|
|
|
+ VideoInfo indesVideoInfo=videoInfoService.getVideoInfoByIndes(videoInfo.getRoleType(), indes);
|
|
|
+ if(indesVideoInfo!=null) {
|
|
|
+ response.failure("排序号,同端下不可重复喔,请重新填写。");
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ videoInfo.setIndes(indes);
|
|
|
+ videoInfoService.save(videoInfo);
|
|
|
+ }
|
|
|
+ response.success();
|
|
|
+ return response;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@RequestMapping("/pace/list")
|
|
|
public String paceList(Model model,
|
|
|
@RequestParam(required = false, defaultValue = "10") int pageSize,
|
|
@@ -178,12 +199,13 @@ public class TrainController extends BaseController {
|
|
|
|
|
|
@RequestMapping("/import/exam/info")
|
|
|
@ResponseBody
|
|
|
- public ResponseEntity importDeviceData(HttpServletRequest request, HttpServletResponse response,
|
|
|
+ public Response importDeviceData(HttpServletRequest request,
|
|
|
@RequestParam("file") MultipartFile file,String videoId)
|
|
|
throws Exception {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
+ Response response = new Response();
|
|
|
try {
|
|
|
VideoInfo videoInfo=videoInfoService.getById(videoId);
|
|
|
+ List<ExamInfo> oldExamInfos=examInfoService.findExamInfoByVideoId(videoId);
|
|
|
List<Map<String,String>> datas=ImLibUserController.analysisExFile(file);
|
|
|
if(datas!=null && datas.size()>0){
|
|
|
List<ExamInfo> examInfos=new ArrayList<ExamInfo>();
|
|
@@ -198,6 +220,7 @@ public class TrainController extends BaseController {
|
|
|
examInfo.setOptions(map.get("data_3"));
|
|
|
examInfo.setAnswer(map.get("data_4"));
|
|
|
examInfo.setScore(Integer.valueOf(map.get("data_5")));
|
|
|
+ examInfo.setStatus(1);
|
|
|
if(map.containsKey("data_6") && StringUtils.isNotEmpty(map.get("data_6"))) {
|
|
|
examInfo.setId(map.get("data_6"));
|
|
|
}
|
|
@@ -206,12 +229,18 @@ public class TrainController extends BaseController {
|
|
|
}
|
|
|
examInfoService.save(examInfos);
|
|
|
}
|
|
|
-
|
|
|
+ if(oldExamInfos!=null && oldExamInfos.size()>0){
|
|
|
+ for (ExamInfo examInfo : oldExamInfos) {
|
|
|
+ examInfo.setStatus(2);
|
|
|
+ }
|
|
|
+ examInfoService.save(oldExamInfos);
|
|
|
+ }
|
|
|
+ response.success();
|
|
|
} catch (Exception e) {
|
|
|
logger.error("异常", e);
|
|
|
- responseEntity.failure("导入异常:"+e.getMessage());
|
|
|
+ response.failure("导入异常:"+e.getMessage());
|
|
|
}
|
|
|
- return responseEntity;
|
|
|
+ return response;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -224,7 +253,7 @@ public class TrainController extends BaseController {
|
|
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
params.put("type", request.getParameter("type")==null?"":request.getParameter("type"));
|
|
|
- params.put("rolType", request.getParameter("rolType")==null?"":request.getParameter("rolType"));
|
|
|
+ params.put("roleType", request.getParameter("roleType")==null?"":request.getParameter("roleType"));
|
|
|
params.put("module", request.getParameter("module")==null?"":request.getParameter("module"));
|
|
|
params.put("title", request.getParameter("title")==null?"":request.getParameter("title"));
|
|
|
|
|
@@ -264,10 +293,12 @@ public class TrainController extends BaseController {
|
|
|
if(StringUtils.isNotEmpty(param.getId())) {
|
|
|
VideoFile videoFile=videoFileService.getById(param.getId());
|
|
|
videoFile.setModule(param.getModule());
|
|
|
+ videoFile.setType(param.getType());
|
|
|
videoFile.setRoleType(param.getRoleType());
|
|
|
videoFile.setStatus(param.getStatus());
|
|
|
videoFile.setTitle(param.getTitle());
|
|
|
videoFile.setFormat(param.getFormat());
|
|
|
+ videoFile.setUrl(param.getUrl());
|
|
|
videoFile.setUpdateTime(new Date());
|
|
|
videoFileService.save(videoFile);
|
|
|
}else {
|