dengsixing 3 dienas atpakaļ
vecāks
revīzija
3717df13ed

+ 51 - 0
src/main/java/com/fdkankan/contro/entity/RelocationBatch.java

@@ -0,0 +1,51 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 重定位批次表
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Getter
+@Setter
+@TableName("t_relocation_batch")
+public class RelocationBatch implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 重定位场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 0-排队中,1-计算中,2-已完成
+     */
+    @TableField("status")
+    private Integer status;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+
+}

+ 72 - 0
src/main/java/com/fdkankan/contro/entity/RelocationBatchDetail.java

@@ -0,0 +1,72 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Getter
+@Setter
+@TableName("t_relocation_batch_detail")
+public class RelocationBatchDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("batch_id")
+    private Long batchId;
+
+    /**
+     * 重定位场景码
+     */
+    @TableField("num")
+    private String num;
+
+    /**
+     * 全景图场景码
+     */
+    @TableField("pan_num")
+    private String panNum;
+
+    /**
+     * 图片key
+     */
+    @TableField("img_key")
+    private String imgKey;
+
+    /**
+     * 图片本地存储名称
+     */
+    @TableField("file_name")
+    private String fileName;
+
+    /**
+     * 图片 bucket
+     */
+    @TableField("bucket")
+    private String bucket;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+
+}

+ 51 - 0
src/main/java/com/fdkankan/contro/entity/RelocationInit.java

@@ -0,0 +1,51 @@
+package com.fdkankan.contro.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Getter
+@Setter
+@TableName("t_relocation_init")
+public class RelocationInit implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @TableField("num")
+    private String num;
+
+    @TableField("pan_num")
+    private String panNum;
+
+    /**
+     * 0-等待推送,1-已推送
+     */
+    @TableField("status")
+    private Integer status;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A", delval = "I")
+    private String recStatus;
+
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/IRelocationBatchDetailMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.RelocationBatchDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Mapper
+public interface IRelocationBatchDetailMapper extends BaseMapper<RelocationBatchDetail> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/IRelocationBatchMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.RelocationBatch;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 重定位批次表 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Mapper
+public interface IRelocationBatchMapper extends BaseMapper<RelocationBatch> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/contro/mapper/IRelocationInitMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.contro.mapper;
+
+import com.fdkankan.contro.entity.RelocationInit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Mapper
+public interface IRelocationInitMapper extends BaseMapper<RelocationInit> {
+
+}

+ 21 - 0
src/main/java/com/fdkankan/contro/service/IRelocationBatchDetailService.java

@@ -0,0 +1,21 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.RelocationBatchDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+public interface IRelocationBatchDetailService extends IService<RelocationBatchDetail> {
+
+    List<RelocationBatchDetail> listByBatchId(Long batchId);
+
+
+}

+ 19 - 0
src/main/java/com/fdkankan/contro/service/IRelocationBatchService.java

@@ -0,0 +1,19 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.RelocationBatch;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 重定位批次表 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+public interface IRelocationBatchService extends IService<RelocationBatch> {
+
+    void relocationControl();
+
+    void relocationControlHandler(RelocationBatch relocationBatch);
+}

+ 19 - 0
src/main/java/com/fdkankan/contro/service/IRelocationInitService.java

@@ -0,0 +1,19 @@
+package com.fdkankan.contro.service;
+
+import com.fdkankan.contro.entity.RelocationInit;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+public interface IRelocationInitService extends IService<RelocationInit> {
+
+    void pushInit(RelocationInit relocationInit);
+
+    void relocationInit();
+}

+ 27 - 0
src/main/java/com/fdkankan/contro/service/impl/RelocationBatchDetailServiceImpl.java

@@ -0,0 +1,27 @@
+package com.fdkankan.contro.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.contro.entity.RelocationBatchDetail;
+import com.fdkankan.contro.mapper.IRelocationBatchDetailMapper;
+import com.fdkankan.contro.service.IRelocationBatchDetailService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Service
+public class RelocationBatchDetailServiceImpl extends ServiceImpl<IRelocationBatchDetailMapper, RelocationBatchDetail> implements IRelocationBatchDetailService {
+
+    @Override
+    public List<RelocationBatchDetail> listByBatchId(Long batchId) {
+        return this.list(new LambdaQueryWrapper<RelocationBatchDetail>().eq(RelocationBatchDetail::getBatchId, batchId));
+    }
+}

+ 84 - 0
src/main/java/com/fdkankan/contro/service/impl/RelocationBatchServiceImpl.java

@@ -0,0 +1,84 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.contro.entity.RelocationBatch;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.entity.ScenePlusExt;
+import com.fdkankan.contro.mapper.IRelocationBatchMapper;
+import com.fdkankan.contro.service.IRelocationBatchService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.contro.service.IScenePlusExtService;
+import com.fdkankan.contro.service.IScenePlusService;
+import com.fdkankan.rabbitmq.bean.BuildSceneCallMessage;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 重定位批次表 服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Slf4j
+@Service
+public class RelocationBatchServiceImpl extends ServiceImpl<IRelocationBatchMapper, RelocationBatch> implements IRelocationBatchService {
+
+    @Value("${queue.modeling.sx-relocation-pre:sx-relocation-pre}")
+    private String queueModelingPre;
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Resource
+    private RabbitMqProducer mqProducer;
+
+    @Override
+    public void relocationControl() {
+        List<RelocationBatch> list = this.list(new LambdaQueryWrapper<RelocationBatch>().eq(RelocationBatch::getStatus, 0));
+        if(CollUtil.isNotEmpty(list)){
+            return;
+        }
+        for (RelocationBatch relocationBatch : list) {
+            try {
+                List<RelocationBatch> buildingList= this.list(new LambdaQueryWrapper<RelocationBatch>().eq(RelocationBatch::getNum, relocationBatch.getNum()).eq(RelocationBatch::getStatus, 1));
+                if(CollUtil.isNotEmpty(buildingList)){
+                    continue;
+                }
+                this.relocationControlHandler(relocationBatch);
+            }catch (Exception e){
+                log.error("重定位调度失败,num:{}, batchId:{}", relocationBatch.getNum(), relocationBatch.getId(), e);
+            }
+        }
+
+    }
+
+    @Override
+    public void relocationControlHandler(RelocationBatch relocationBatch) {
+        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(relocationBatch.getNum());
+        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+        String path = scenePlusExt.getDataSource() + "_relocation";
+        BuildSceneCallMessage buildSceneMessage = new BuildSceneCallMessage();
+        buildSceneMessage.setSceneNum(relocationBatch.getNum());
+        buildSceneMessage.setBizType("relocation");
+        buildSceneMessage.setPath(path);
+        buildSceneMessage.setCameraType("14");
+        Map<String, Object> ext = new HashMap<>();
+        ext.put("batchId", relocationBatch.getId());
+        buildSceneMessage.setExt(ext);
+        mqProducer.sendByWorkQueue(queueModelingPre, buildSceneMessage);
+        relocationBatch.setStatus(1);
+        relocationBatch.setUpdateTime(null);
+        this.updateById(relocationBatch);
+    }
+}

+ 70 - 0
src/main/java/com/fdkankan/contro/service/impl/RelocationInitServiceImpl.java

@@ -0,0 +1,70 @@
+package com.fdkankan.contro.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.common.constant.SceneStatus;
+import com.fdkankan.contro.entity.RelocationInit;
+import com.fdkankan.contro.entity.ScenePlus;
+import com.fdkankan.contro.mapper.IRelocationInitMapper;
+import com.fdkankan.contro.service.IRelocationInitService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.contro.service.IScenePlusService;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-09-09
+ */
+@Service
+public class RelocationInitServiceImpl extends ServiceImpl<IRelocationInitMapper, RelocationInit> implements IRelocationInitService {
+
+    @Value("${queue.modeling.relocation.relocation-scene-init:relocation-scene-init}")
+    private String queueRelocationSceneInit;
+    @Resource
+    private RabbitMqProducer mqProducer;
+    @Autowired
+    private IScenePlusService scenePlusService;
+
+    @Override
+    public void pushInit(RelocationInit relocationInit) {
+        ScenePlus sx = scenePlusService.getScenePlusByNum(relocationInit.getNum());
+        if(sx.getSceneStatus() != SceneStatus.NO_DISPLAY.code() && sx.getSceneStatus() != SceneStatus.SUCCESS.code()){
+            return;
+        }
+        ScenePlus panNum = scenePlusService.getScenePlusByNum(relocationInit.getPanNum());
+        if(panNum.getSceneStatus() != SceneStatus.NO_DISPLAY.code() && panNum.getSceneStatus() != SceneStatus.SUCCESS.code()){
+            return;
+        }
+        Map<String, String> map = new HashMap<>();
+        map.put("sxNum", relocationInit.getNum());
+        map.put("qjkkNum",relocationInit.getPanNum());
+        mqProducer.sendByWorkQueue(queueRelocationSceneInit, map);
+
+        relocationInit.setStatus(1);
+        relocationInit.setUpdateTime(null);
+        this.updateById(relocationInit);
+    }
+
+    @Override
+    public void relocationInit() {
+        List<RelocationInit> list = this.list(new LambdaQueryWrapper<RelocationInit>().eq(RelocationInit::getStatus, 0));
+        if(CollUtil.isNotEmpty(list)){
+            return;
+        }
+        for (RelocationInit relocationInit : list) {
+            this.pushInit(relocationInit);
+        }
+    }
+}

+ 5 - 0
src/main/resources/mapper/contro/RelocationBatchDetailMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.contro.mapper.IRelocationBatchDetailMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/contro/RelocationBatchMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.contro.mapper.IRelocationBatchMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/contro/RelocationInitMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.contro.mapper.IRelocationInitMapper">
+
+</mapper>