|
@@ -0,0 +1,63 @@
|
|
|
+package com.backendsys.modules.crt.service.impl;
|
|
|
+
|
|
|
+import com.backendsys.exception.CustException;
|
|
|
+import com.backendsys.modules.crt.dao.CrtDramaProjectDao;
|
|
|
+import com.backendsys.modules.crt.dao.CrtDramaProjectStoryboardDao;
|
|
|
+import com.backendsys.modules.crt.entity.CrtDramaProject;
|
|
|
+import com.backendsys.modules.crt.entity.CrtDramaProjectStoryboard;
|
|
|
+import com.backendsys.modules.crt.service.CrtDramaProjectStoryboardService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class CrtDramaProjectStoryboardServiceImpl implements CrtDramaProjectStoryboardService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CrtDramaProjectDao crtDramaProjectDao;
|
|
|
+ @Autowired
|
|
|
+ private CrtDramaProjectStoryboardDao crtDramaProjectStoryboardDao;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建分镜
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> createStoryboard(CrtDramaProject crtDramaProject) {
|
|
|
+
|
|
|
+ Long user_id = crtDramaProject.getUser_id();
|
|
|
+ Long drama_project_id = crtDramaProject.getDrama_project_id();
|
|
|
+ Integer episode_num = crtDramaProject.getEpisode_num();
|
|
|
+ Integer sort = 1;
|
|
|
+
|
|
|
+ // 判断 项目 是否存在
|
|
|
+ LambdaQueryWrapper<CrtDramaProject> wrapperDramaProject = new LambdaQueryWrapper<>();
|
|
|
+ wrapperDramaProject.eq(CrtDramaProject::getId, drama_project_id);
|
|
|
+ Boolean is_exist_project = crtDramaProjectDao.exists(wrapperDramaProject);
|
|
|
+ if (!is_exist_project) throw new CustException("项目不存在");
|
|
|
+
|
|
|
+ // 判断 (项目ID + 集数) 是否存在,如果存在则不能创建
|
|
|
+ LambdaQueryWrapper<CrtDramaProjectStoryboard> wrapperStoryboard = new LambdaQueryWrapper<>();
|
|
|
+ wrapperStoryboard.eq(CrtDramaProjectStoryboard::getDrama_project_id, drama_project_id);
|
|
|
+ wrapperStoryboard.eq(CrtDramaProjectStoryboard::getEpisode_num, episode_num);
|
|
|
+ Boolean is_exist_storyboard = crtDramaProjectStoryboardDao.exists(wrapperStoryboard);
|
|
|
+ if (is_exist_storyboard) throw new CustException("该项目集数已存在,请勿重复创建");
|
|
|
+
|
|
|
+ // [DB] 创建分镜
|
|
|
+ CrtDramaProjectStoryboard entity = new CrtDramaProjectStoryboard();
|
|
|
+ entity.setUser_id(user_id);
|
|
|
+ entity.setDrama_project_id(drama_project_id);
|
|
|
+ entity.setEpisode_num(episode_num);
|
|
|
+ entity.setSort(sort);
|
|
|
+ crtDramaProjectStoryboardDao.insert(entity);
|
|
|
+
|
|
|
+ Map<String, Object> resp = new LinkedHashMap<>();
|
|
|
+ resp.put("drama_project_id", drama_project_id);
|
|
|
+ resp.put("drama_project_storyboard_id", entity.getId());
|
|
|
+ resp.put("drama_project_storyboard_episode_num", episode_num);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|