|
@@ -12,6 +12,8 @@ import com.persagy.labsl.Opts
|
|
|
import com.persagy.labsl.domain.*
|
|
|
import com.persagy.labsl.mapper.GraphMapper
|
|
|
import com.persagy.labsl.service.*
|
|
|
+import com.persagy.labsl.services.AttachObjectIdsServices
|
|
|
+import com.persagy.labsl.services.MarkersService
|
|
|
import com.persagy.labsl.utils.IdUtils
|
|
|
import com.persagy.service.models.enums.SResponseType
|
|
|
import com.persagy.service.models.requests.SCreateRequest
|
|
@@ -50,6 +52,8 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
|
|
|
lateinit var relationPubService: RelationPubService
|
|
|
@Autowired
|
|
|
lateinit var anchorPubService: AnchorPubService
|
|
|
+ @Autowired
|
|
|
+ lateinit var attachObjectIdsService: AttachObjectIdsService
|
|
|
/**
|
|
|
* 创建草稿图
|
|
|
* @author : lijie
|
|
@@ -473,6 +477,144 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
|
|
|
updateBatchById(CollUtil.newArrayList(request.content))
|
|
|
return sBaseResponse
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 更新已发布图形
|
|
|
+ * @author : lijie
|
|
|
+ * Update By 2022/6/7 17:57
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ override fun pubUpdateLogic(request: SUpdateRequest<GraphPubEntity>): SBaseResponse {
|
|
|
+ val sBaseResponse = SBaseResponse(SResponseType.success)
|
|
|
+ if (request.content.isNullOrEmpty()){
|
|
|
+ return sBaseResponse
|
|
|
+ }
|
|
|
+ for (content in request.content!!) {
|
|
|
+ val entity = list(Wrappers.lambdaQuery(GraphEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(Opts.projectId),GraphEntity::projectId, Opts.projectId!!)
|
|
|
+ .eq(StrUtil.isNotBlank(content.categoryId),GraphEntity::categoryId, content.categoryId!!)
|
|
|
+ .eq(StrUtil.isNotBlank(content.name),GraphEntity::name, content.name!!))
|
|
|
+ if (CollUtil.isNotEmpty(entity)) {
|
|
|
+ sBaseResponse.result = SResponseType.failure
|
|
|
+ sBaseResponse.message = "图名称已经存在"
|
|
|
+ return sBaseResponse
|
|
|
+ }
|
|
|
+ val entity1 = graphPubService.list(Wrappers.lambdaQuery(GraphPubEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(Opts.projectId),GraphPubEntity::projectId, Opts.projectId!!)
|
|
|
+ .eq(StrUtil.isNotBlank(content.categoryId),GraphPubEntity::categoryId, content.categoryId!!)
|
|
|
+ .eq(StrUtil.isNotBlank(content.name),GraphPubEntity::name, content.name!!))
|
|
|
+ if (CollUtil.isNotEmpty(entity1)) {
|
|
|
+ sBaseResponse.result = SResponseType.failure
|
|
|
+ sBaseResponse.message = "同一分类下已发布图名称已存在"
|
|
|
+ return sBaseResponse
|
|
|
+ }
|
|
|
+ }
|
|
|
+ graphPubService.updateBatchById(CollUtil.newArrayList(request.content))
|
|
|
+ return sBaseResponse
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 恢复图形
|
|
|
+ * @author : lijie
|
|
|
+ * Update By 2022/6/7 18:07
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ override fun recoveryLogic(graphs: GraphEntity): SBaseResponse {
|
|
|
+ /** 项目 id */
|
|
|
+ graphs.projectId = Opts.projectId
|
|
|
+ /** 查询图 */
|
|
|
+ val graph = getOne(Wrappers.lambdaQuery(GraphEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(Opts.projectId),GraphEntity::projectId,Opts.projectId!!)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.id),GraphEntity::id,graphs.id!!)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.graphId),GraphEntity::graphId,graphs.graphId!!))
|
|
|
+ if (ObjectUtil.isNull(graph)){
|
|
|
+ return SBaseResponse(SResponseType.success)
|
|
|
+ }
|
|
|
+ /** 图对象不为空 */
|
|
|
+ /** 查询 */
|
|
|
+ val markersList = markerService.list(Wrappers.lambdaQuery(MarkerEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.id!!),MarkerEntity::id,graphs.id!!)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.graphId!!),MarkerEntity::graphId,graphs.graphId))
|
|
|
+ /** 查询 */
|
|
|
+ val nodeList = nodeService.list(Wrappers.lambdaQuery(NodeEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.id!!),NodeEntity::id,graphs.id!!)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.graphId!!),NodeEntity::graphId,graphs.graphId))
|
|
|
+ /** 查询 */
|
|
|
+ val anchorList = anchorService.list(Wrappers.lambdaQuery(AnchorEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.id!!),AnchorEntity::id,graphs.id!!)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.graphId!!),AnchorEntity::graphId,graphs.graphId))
|
|
|
+ /** 查询 */
|
|
|
+ val attachObjectIdsList = attachObjectIdsService.list(Wrappers.lambdaQuery(AttachObjectIdsEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.id!!),AttachObjectIdsEntity::id,graphs.id!!)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.graphId!!),AttachObjectIdsEntity::graphId,graphs.graphId))
|
|
|
+ /** 查询 */
|
|
|
+ val relationList = relationService.list(Wrappers.lambdaQuery(RelationEntity::class.java)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.id!!),RelationEntity::id,graphs.id!!)
|
|
|
+ .eq(StrUtil.isNotBlank(graphs.graphId!!),RelationEntity::graphId,graphs.graphId))
|
|
|
+ /** 清除草稿箱数据 */
|
|
|
+ delOldDataTwo(graphs)
|
|
|
+ /** 草稿箱标志 */
|
|
|
+ graph?.state = 1
|
|
|
+ /** 更新 */
|
|
|
+ updateById(graph)
|
|
|
+ /** 列表不为空 */
|
|
|
+ if (!markersList.isNullOrEmpty()){
|
|
|
+ /** 遍历列表 */
|
|
|
+ for (markers in markersList){
|
|
|
+ /** 草稿箱标志 */
|
|
|
+ markers?.state = 1
|
|
|
+ }
|
|
|
+ markerService.updateBatchById(markersList)
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 列表不为空 */
|
|
|
+ if (!nodeList.isNullOrEmpty()){
|
|
|
+ /** 遍历列表 */
|
|
|
+ for (node in nodeList){
|
|
|
+ /** 回收站标志 */
|
|
|
+ node?.state = 1
|
|
|
+ }
|
|
|
+ nodeService.updateBatchById(nodeList)
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 列表不为空 */
|
|
|
+ if (!anchorList.isNullOrEmpty()){
|
|
|
+ /** 遍历列表 */
|
|
|
+ for (anchor in anchorList){
|
|
|
+ /** 草稿箱标志 */
|
|
|
+ anchor?.state = 1
|
|
|
+ }
|
|
|
+ anchorService.updateBatchById(anchorList)
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 列表不为空 */
|
|
|
+ if (!attachObjectIdsList.isNullOrEmpty()){
|
|
|
+ /** 遍历列表 */
|
|
|
+ for (attachObjectIds in attachObjectIdsList){
|
|
|
+ /** 草稿箱标志 */
|
|
|
+ attachObjectIds?.state = 1
|
|
|
+ }
|
|
|
+ attachObjectIdsService.updateBatchById(attachObjectIdsList)
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 列表不为空 */
|
|
|
+ if (!relationList.isNullOrEmpty()){
|
|
|
+ /** 遍历列表 */
|
|
|
+ for (relation in relationList){
|
|
|
+ /** 回收站标志 */
|
|
|
+ relation?.state = 1
|
|
|
+ }
|
|
|
+ relationService.updateBatchById(relationList)
|
|
|
+ }
|
|
|
+ /** 返回操作状态 */
|
|
|
+ return SBaseResponse(SResponseType.success)
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 根据id删除图形
|
|
|
+ * @author : lijie
|
|
|
+ * Update By 2022/6/7 18:51
|
|
|
+ */
|
|
|
+ override fun deleteByKeysListLogic(idList: ArrayList<GraphEntity>): SBaseResponse {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 清除已发布的老数据
|
|
@@ -636,6 +778,38 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
|
|
|
anchorWrapper.eq(StrUtil.isNotBlank(graph.graphId),AnchorEntity::graphId,graph.graphId)
|
|
|
anchorService.remove(anchorWrapper)
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 清除草稿箱以前数据
|
|
|
+ *
|
|
|
+ * @param graph 图对象
|
|
|
+ */
|
|
|
+ private fun delOldDataTwo(graph: GraphEntity) {
|
|
|
+ val graphWrapper= KtQueryWrapper(GraphEntity())
|
|
|
+ val nodeWrapper=KtQueryWrapper(NodeEntity())
|
|
|
+ val markerWrapper=KtQueryWrapper(MarkerEntity())
|
|
|
+ val relationWrapper=KtQueryWrapper(RelationEntity())
|
|
|
+ val anchorWrapper=KtQueryWrapper(AnchorEntity())
|
|
|
+ graphWrapper.eq(StrUtil.isNotBlank(graph.projectId),GraphEntity::projectId,graph.projectId!!)
|
|
|
+ graphWrapper.eq(StrUtil.isNotBlank(graph.id),GraphEntity::id,graph.id!!)
|
|
|
+ graphWrapper.eq(StrUtil.isNotBlank(graph.graphId),GraphEntity::graphId,graph.graphId)
|
|
|
+ graphWrapper.eq(GraphEntity::state,1)
|
|
|
+ remove(graphWrapper)
|
|
|
+ nodeWrapper.eq(StrUtil.isNotBlank(graph.id),NodeEntity::id,graph.id!!)
|
|
|
+ nodeWrapper.eq(StrUtil.isNotBlank(graph.graphId),NodeEntity::graphId,graph.graphId)
|
|
|
+ nodeWrapper.eq(NodeEntity::state,1)
|
|
|
+ nodeService.remove(nodeWrapper)
|
|
|
+ markerWrapper.eq(StrUtil.isNotBlank(graph.id),MarkerEntity::id,graph.id!!)
|
|
|
+ markerWrapper.eq(StrUtil.isNotBlank(graph.graphId),MarkerEntity::graphId,graph.graphId)
|
|
|
+ markerWrapper.eq(MarkerEntity::state,1)
|
|
|
+ markerService.remove(markerWrapper)
|
|
|
+ relationWrapper.eq(StrUtil.isNotBlank(graph.id),RelationEntity::id,graph.id!!)
|
|
|
+ relationWrapper.eq(StrUtil.isNotBlank(graph.graphId),RelationEntity::graphId,graph.graphId)
|
|
|
+ relationWrapper.eq(RelationEntity::state,1)
|
|
|
+ relationService.remove(relationWrapper)
|
|
|
+ anchorWrapper.eq(StrUtil.isNotBlank(graph.id),AnchorEntity::id,graph.id!!)
|
|
|
+ anchorWrapper.eq(StrUtil.isNotBlank(graph.graphId),AnchorEntity::graphId,graph.graphId)
|
|
|
+ anchorWrapper.eq(AnchorEntity::state,1)
|
|
|
+ anchorService.remove(anchorWrapper)
|
|
|
+ }
|
|
|
|
|
|
}
|