|
@@ -18,6 +18,7 @@ import com.gis.mapper.SceneMapper;
|
|
import com.gis.service.CatalogService;
|
|
import com.gis.service.CatalogService;
|
|
import com.gis.service.SceneService;
|
|
import com.gis.service.SceneService;
|
|
import com.gis.service.WorkService;
|
|
import com.gis.service.WorkService;
|
|
|
|
+import lombok.Data;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.HttpResponse;
|
|
@@ -47,9 +48,8 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
@Autowired
|
|
@Autowired
|
|
WorkService workService;
|
|
WorkService workService;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ CatalogService catalogService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
ConfigConstant configConstant;
|
|
ConfigConstant configConstant;
|
|
@@ -57,8 +57,8 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
@Autowired
|
|
@Autowired
|
|
FileUtils fileUtils;
|
|
FileUtils fileUtils;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- AliyunOssUtil aliyunOssUtil;
|
|
|
|
|
|
+// @Autowired
|
|
|
|
+// AliyunOssUtil aliyunOssUtil;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -149,6 +149,28 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// @Override
|
|
|
|
+// public Result saves(List<SceneDto> params) {
|
|
|
|
+// SceneEntity entity = null;
|
|
|
|
+// for (SceneDto sceneDto : params) {
|
|
|
|
+// Long id = sceneDto.getId();
|
|
|
|
+// if (id == null) {
|
|
|
|
+// entity = new SceneEntity();
|
|
|
|
+// BeanUtils.copyProperties(sceneDto, entity);
|
|
|
|
+// this.save(entity);
|
|
|
|
+// } else {
|
|
|
|
+// entity = findById(id);
|
|
|
|
+// BeanUtils.copyProperties(sceneDto, entity);
|
|
|
|
+// entity.setUpdateTime(new Date());
|
|
|
|
+// this.update(entity);
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// return Result.success();
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Result saves(List<SceneDto> params) {
|
|
public Result saves(List<SceneDto> params) {
|
|
SceneEntity entity = null;
|
|
SceneEntity entity = null;
|
|
@@ -157,6 +179,13 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
if (id == null) {
|
|
if (id == null) {
|
|
entity = new SceneEntity();
|
|
entity = new SceneEntity();
|
|
BeanUtils.copyProperties(sceneDto, entity);
|
|
BeanUtils.copyProperties(sceneDto, entity);
|
|
|
|
+
|
|
|
|
+ // 创建分组
|
|
|
|
+ Long catalogId = sceneDto.getCatalogId();
|
|
|
|
+ if (catalogId == null) {
|
|
|
|
+ entity.setCatalogId(createCatalog(sceneDto));
|
|
|
|
+ }
|
|
|
|
+
|
|
this.save(entity);
|
|
this.save(entity);
|
|
} else {
|
|
} else {
|
|
entity = findById(id);
|
|
entity = findById(id);
|
|
@@ -170,7 +199,38 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建分组
|
|
|
|
+ * @param sceneDto
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Long createCatalog(SceneDto sceneDto) {
|
|
|
|
+ Long parentId = sceneDto.getParentId();
|
|
|
|
+ String parentName = sceneDto.getParentName();
|
|
|
|
+ Long workId = sceneDto.getWorkId();
|
|
|
|
+
|
|
|
|
+ CatalogEntity entity = new CatalogEntity();
|
|
|
|
+ entity.setName(sceneDto.getCatalogName());
|
|
|
|
+ entity.setWorkId(workId);
|
|
|
|
+ // 当父id不为空时
|
|
|
|
+ if (parentId != null) {
|
|
|
|
+ entity.setParentId(parentId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 创建父目录
|
|
|
|
+ if (parentId == null && parentName != null) {
|
|
|
|
+ CatalogEntity parentEntity = new CatalogEntity();
|
|
|
|
+ parentEntity.setWorkId(workId);
|
|
|
|
+ parentEntity.setName(parentName);
|
|
|
|
+ catalogService.save(parentEntity);
|
|
|
|
|
|
|
|
+ entity.setParentId(parentEntity.getParentId());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // 创建目录
|
|
|
|
+ catalogService.save(entity);
|
|
|
|
+ return entity.getId();
|
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<String> strFindByWorkId(Long workId, String type) {
|
|
public List<String> strFindByWorkId(Long workId, String type) {
|
|
@@ -184,9 +244,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public Result setIndex(String id, Long workId) {
|
|
public Result setIndex(String id, Long workId) {
|
|
WorkEntity entity = workService.findById(workId);
|
|
WorkEntity entity = workService.findById(workId);
|
|
@@ -214,7 +271,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
SceneEntity sceneEntity = null;
|
|
SceneEntity sceneEntity = null;
|
|
// 字符串判断需要用isNotBlank
|
|
// 字符串判断需要用isNotBlank
|
|
if (StringUtils.isNotBlank(sceneIndex)) {
|
|
if (StringUtils.isNotBlank(sceneIndex)) {
|
|
- sceneEntity = this.findById(Long.valueOf(sceneIndex));
|
|
|
|
|
|
+ sceneEntity = this.findById(Long.valueOf(sceneIndex));
|
|
}
|
|
}
|
|
return Result.success(sceneEntity);
|
|
return Result.success(sceneEntity);
|
|
}
|
|
}
|
|
@@ -416,7 +473,6 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public Result saveUseHots(UseHotsDto param) {
|
|
public Result saveUseHots(UseHotsDto param) {
|
|
Long id = param.getId();
|
|
Long id = param.getId();
|
|
@@ -431,7 +487,7 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
entity.setUseHots(jsonObject.toJSONString());
|
|
entity.setUseHots(jsonObject.toJSONString());
|
|
entity.setUpdateTime(new Date());
|
|
entity.setUpdateTime(new Date());
|
|
this.update(entity);
|
|
this.update(entity);
|
|
- return Result.success() ;
|
|
|
|
|
|
+ return Result.success();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -452,9 +508,9 @@ public class SceneServiceImpl extends IBaseServiceImpl<SceneEntity, Long> implem
|
|
// 字符串判断需要用isNotBlank
|
|
// 字符串判断需要用isNotBlank
|
|
if (StringUtils.isNotBlank(sceneIndex)) {
|
|
if (StringUtils.isNotBlank(sceneIndex)) {
|
|
Long sceneId = Long.valueOf(sceneIndex);
|
|
Long sceneId = Long.valueOf(sceneIndex);
|
|
- vo =entityMapper.findVoById(sceneId);
|
|
|
|
|
|
+ vo = entityMapper.findVoById(sceneId);
|
|
}
|
|
}
|
|
- return Result.success(vo) ;
|
|
|
|
|
|
+ return Result.success(vo);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|