15 changed files with 309 additions and 147 deletions
			
			
		@ -0,0 +1,21 @@
					 | 
				
			||||
package com.hnac.hzims.bigmodel.api.wrapper; | 
				
			||||
 | 
				
			||||
import com.hnac.hzims.bigmodel.api.dto.SyncDTO; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
import java.util.stream.Collectors; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @Author: huangxing | 
				
			||||
 * @Date: 2024/08/20 09:23 | 
				
			||||
 * @Describe 对象转换为同步对象基础类 | 
				
			||||
 */ | 
				
			||||
public abstract class BaseSyncWrapper<O,S extends SyncDTO> { | 
				
			||||
 | 
				
			||||
    public abstract S convert(O obj); | 
				
			||||
 | 
				
			||||
    public List<S> listVO(List<O> list) { | 
				
			||||
        return list.stream().map(this::convert).collect(Collectors.toList()); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -1,4 +1,4 @@
					 | 
				
			||||
package com.hnac.hzims.bigmodel.business.control; | 
				
			||||
package com.hnac.hzims.bigmodel.business.controller; | 
				
			||||
 | 
				
			||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; | 
				
			||||
import com.hnac.hzims.bigmodel.business.service.DataSourceService; | 
				
			||||
@ -0,0 +1,21 @@
					 | 
				
			||||
package com.hnac.hzims.bigmodel.business.wrapper; | 
				
			||||
 | 
				
			||||
import com.hnac.hzims.bigmodel.api.dto.CanvasSyncDTO; | 
				
			||||
import com.hnac.hzims.bigmodel.api.wrapper.BaseSyncWrapper; | 
				
			||||
import com.hnac.hzinfo.sdk.v5.scada.vo.CanvasVO; | 
				
			||||
import lombok.AllArgsConstructor; | 
				
			||||
import org.springframework.stereotype.Component; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @Author: huangxing | 
				
			||||
 * @Date: 2024/08/20 16:49 | 
				
			||||
 */ | 
				
			||||
@Component | 
				
			||||
@AllArgsConstructor | 
				
			||||
public class CanvasSyncWrapper extends BaseSyncWrapper<CanvasVO, CanvasSyncDTO> { | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public CanvasSyncDTO convert(CanvasVO obj) { | 
				
			||||
        return null; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,20 @@
					 | 
				
			||||
package com.hnac.hzims.bigmodel.configuration; | 
				
			||||
 | 
				
			||||
import org.springframework.context.annotation.Bean; | 
				
			||||
import org.springframework.context.annotation.Configuration; | 
				
			||||
import org.springframework.web.reactive.function.client.WebClient; | 
				
			||||
import reactor.core.publisher.Mono; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @Author: huangxing | 
				
			||||
 * @Date: 2024/08/21 15:22 | 
				
			||||
 */ | 
				
			||||
@Configuration | 
				
			||||
public class WeaviateConfig { | 
				
			||||
 | 
				
			||||
    @Bean | 
				
			||||
    public WebClient weaviateClient() { | 
				
			||||
        return WebClient.create("http://192.168.60.16:9992"); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,40 @@
					 | 
				
			||||
package com.hnac.hzims.bigmodel.maintenance.entity; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||
import io.swagger.annotations.ApiModel; | 
				
			||||
import io.swagger.annotations.ApiModelProperty; | 
				
			||||
import lombok.Data; | 
				
			||||
import lombok.EqualsAndHashCode; | 
				
			||||
import org.springblade.core.tenant.mp.TenantEntity; | 
				
			||||
 | 
				
			||||
import java.io.Serializable; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @Author: huangxing | 
				
			||||
 * @Date: 2024/08/21 08:33 | 
				
			||||
 */ | 
				
			||||
@Data | 
				
			||||
@EqualsAndHashCode | 
				
			||||
@ApiModel(value = "同步向量库基础配置",description = "同步向量库基础配置") | 
				
			||||
@TableName("") | 
				
			||||
public class SyncPropertyEntity extends TenantEntity implements Serializable { | 
				
			||||
 | 
				
			||||
    @ApiModelProperty("配置编号") | 
				
			||||
    private String code; | 
				
			||||
 | 
				
			||||
    @ApiModelProperty("数据源") | 
				
			||||
    private String datasource; | 
				
			||||
 | 
				
			||||
    @ApiModelProperty("数据源名称") | 
				
			||||
    private String datasourceName; | 
				
			||||
 | 
				
			||||
    @ApiModelProperty("数据库表名") | 
				
			||||
    private String tableName; | 
				
			||||
 | 
				
			||||
    @ApiModelProperty("向量数据库表名,由小写字母以及_组成") | 
				
			||||
    private String vectorTableName; | 
				
			||||
 | 
				
			||||
    @ApiModelProperty("表描述") | 
				
			||||
    private String tableDesc; | 
				
			||||
 | 
				
			||||
} | 
				
			||||
@ -0,0 +1,38 @@
					 | 
				
			||||
package com.hnac.hzims.operational.station.wrapper; | 
				
			||||
 | 
				
			||||
import com.hnac.hzims.bigmodel.api.dto.VideoSyncDTO; | 
				
			||||
import com.hnac.hzims.bigmodel.api.wrapper.BaseSyncWrapper; | 
				
			||||
import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; | 
				
			||||
import com.hnac.hzims.operational.station.service.IStationService; | 
				
			||||
import com.hnac.hzims.operational.station.vo.StationVO; | 
				
			||||
import lombok.AllArgsConstructor; | 
				
			||||
import lombok.NoArgsConstructor; | 
				
			||||
import org.springblade.core.tool.utils.BeanUtil; | 
				
			||||
import org.springblade.core.tool.utils.SpringUtil; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.stereotype.Component; | 
				
			||||
 | 
				
			||||
import java.util.Optional; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @Author: huangxing | 
				
			||||
 * @Date: 2024/08/20 11:21 | 
				
			||||
 */ | 
				
			||||
@Component | 
				
			||||
@AllArgsConstructor | 
				
			||||
public class VideoSyncWrapper extends BaseSyncWrapper<StationVideoTypeEntity, VideoSyncDTO> { | 
				
			||||
 | 
				
			||||
    private final IStationService stationService; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public VideoSyncDTO convert(StationVideoTypeEntity entity) { | 
				
			||||
        VideoSyncDTO videoSyncDTO = BeanUtil.copy(entity,VideoSyncDTO.class); | 
				
			||||
        StationVO station = stationService.getStationByCode(entity.getStationId()); | 
				
			||||
        String stationName = Optional.ofNullable(station).map(StationVO::getName).orElse(""); | 
				
			||||
        videoSyncDTO.setId(String.valueOf(entity.getId())); | 
				
			||||
        videoSyncDTO.setItemId(String.valueOf(entity.getId())); | 
				
			||||
        videoSyncDTO.setStationName(stationName); | 
				
			||||
        videoSyncDTO.setItemName(stationName + " " + videoSyncDTO.getName()); | 
				
			||||
        return videoSyncDTO; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue