|
@@ -12,14 +12,12 @@ import com.mokamrp.privates.entity.pangu.FosterwxTaskListHandle;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
import com.mokamrp.privates.help.Analysis;
|
|
import com.mokamrp.privates.help.Analysis;
|
|
|
import com.mokamrp.privates.interceptor.AuthUser;
|
|
import com.mokamrp.privates.interceptor.AuthUser;
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
|
|
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileTaskTimeList;
|
|
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskList;
|
|
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskSchedule;
|
|
|
|
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.*;
|
|
|
import com.mokamrp.privates.mapper.pojo.User;
|
|
import com.mokamrp.privates.mapper.pojo.User;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobileService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobileService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxTaskListService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxTaskListService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
|
|
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxTeachingVideoService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
@@ -56,6 +54,9 @@ public class FosterwxTaskListController extends BaseController<FosterwxTaskList>
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FosterwxMobileService fosterwxMobileService;
|
|
private FosterwxMobileService fosterwxMobileService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FosterwxTeachingVideoService fosterwxTeachingVideoService;
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* @fast
|
|
* @fast
|
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
@@ -142,8 +143,9 @@ public class FosterwxTaskListController extends BaseController<FosterwxTaskList>
|
|
|
@PostMapping("/import")
|
|
@PostMapping("/import")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Object uploadFile(@RequestParam Integer templateId, @RequestBody MultipartFile file, @AuthUser User authUser) {
|
|
public Object uploadFile(@RequestParam Integer templateId, @RequestBody MultipartFile file, @AuthUser User authUser) {
|
|
|
- Map<Integer, String> field = new HashMap<>(1);
|
|
|
|
|
|
|
+ Map<Integer, String> field = new HashMap<>(2);
|
|
|
field.put(0, "taskContent");
|
|
field.put(0, "taskContent");
|
|
|
|
|
+ field.put(1, "videoId|default");
|
|
|
List<Map<String, String>> row;
|
|
List<Map<String, String>> row;
|
|
|
VoltaHandle<ArrayList<Map<String, String>>> voltaRes = Analysis.analysis(file, field);
|
|
VoltaHandle<ArrayList<Map<String, String>>> voltaRes = Analysis.analysis(file, field);
|
|
|
if (voltaRes.getErr() != null) {
|
|
if (voltaRes.getErr() != null) {
|
|
@@ -165,12 +167,32 @@ public class FosterwxTaskListController extends BaseController<FosterwxTaskList>
|
|
|
i.set(num);
|
|
i.set(num);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 先检查视频id 是否存在
|
|
|
|
|
+ StringBuffer errInfo = new StringBuffer();
|
|
|
|
|
+ row.forEach(map -> {
|
|
|
|
|
+ if (null != map.get("videoId") && !map.get("videoId").isEmpty()) {
|
|
|
|
|
+ FosterwxTeachingVideo fosterwxTeachingVideo = fosterwxTeachingVideoService.getById(map.get("videoId"));
|
|
|
|
|
+ if (null == fosterwxTeachingVideo) {
|
|
|
|
|
+ errInfo.append("视频id:").append(map.get("videoId")).append("不存在").append("<br>");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (errInfo.length() > 0) {
|
|
|
|
|
+ return AjaxResult.error(errInfo.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
row.forEach(map -> {
|
|
row.forEach(map -> {
|
|
|
i.getAndIncrement();
|
|
i.getAndIncrement();
|
|
|
FosterwxTaskList fosterwxTaskList = new FosterwxTaskList();
|
|
FosterwxTaskList fosterwxTaskList = new FosterwxTaskList();
|
|
|
fosterwxTaskList.setTemplateId(templateId);
|
|
fosterwxTaskList.setTemplateId(templateId);
|
|
|
fosterwxTaskList.setTaskName("Day" + i);
|
|
fosterwxTaskList.setTaskName("Day" + i);
|
|
|
fosterwxTaskList.setTaskContent(map.get("taskContent"));
|
|
fosterwxTaskList.setTaskContent(map.get("taskContent"));
|
|
|
|
|
+ if (null != map.get("videoId") && !map.get("videoId").isEmpty()) {
|
|
|
|
|
+ FosterwxTeachingVideo fosterwxTeachingVideo = fosterwxTeachingVideoService.getById(map.get("videoId"));
|
|
|
|
|
+ fosterwxTaskList.setVideoId(fosterwxTeachingVideo.getId());
|
|
|
|
|
+ fosterwxTaskList.setVideoUrl(fosterwxTeachingVideo.getVideoUrl());
|
|
|
|
|
+ }
|
|
|
fosterwxTaskList.setDelFlg(1);
|
|
fosterwxTaskList.setDelFlg(1);
|
|
|
fosterwxTaskList.setCreateUid(authUser.getId());
|
|
fosterwxTaskList.setCreateUid(authUser.getId());
|
|
|
fosterwxTaskList.setUpdateUid(authUser.getId());
|
|
fosterwxTaskList.setUpdateUid(authUser.getId());
|