perf: 优化异步导入速度,增加数据库sql

haikang
huangfeng 1 year ago
parent 361d394f02
commit b153a2d99f

@ -23,3 +23,44 @@ CREATE TABLE `icd_config_type_inst` (
`inst` varchar(45) NOT NULL COMMENT '实例',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='ICD配置类型实例表';
CREATE TABLE `n_103_point` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`npoint_id` int(11) DEFAULT NULL COMMENT '监测装置属性点ID',
`sensor_103_id` int(11) DEFAULT NULL COMMENT '103和sensor表的关联ID',
`sadr` varchar(45) DEFAULT NULL COMMENT '信息体地址',
`item_no` varchar(45) DEFAULT NULL COMMENT '条目号',
`paramindex` varchar(200) DEFAULT NULL COMMENT '61850对象参引',
`part_name` varchar(200) DEFAULT NULL COMMENT '名称后半部分',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='103和point表的关联';
CREATE TABLE `n_103_sensor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nsensor_id` int(11) DEFAULT NULL COMMENT '监测装置ID',
`grp_no` int(11) DEFAULT NULL COMMENT '组号',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='103和sensor表的关联';
CREATE TABLE `n_point` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sensor_id` int(11) DEFAULT NULL COMMENT '监测装置ID',
`field` varchar(45) DEFAULT NULL COMMENT '对应tablename表的字段名',
`field_desc` varchar(200) DEFAULT NULL COMMENT '对应tablename表的字段名称描述',
`point_id` int(11) DEFAULT NULL COMMENT '对应的点位编号',
`type` int(11) DEFAULT NULL COMMENT '点位类型 1:遥信 2:遥测',
PRIMARY KEY (`id`),
KEY `idxField` (`sensor_id`,`field`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='监测装置属性点表';
CREATE TABLE `n_sensor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(200) DEFAULT NULL COMMENT '名称',
`phase` varchar(45) DEFAULT NULL COMMENT '相别',
`table_name` varchar(45) DEFAULT NULL COMMENT '表名',
`sensor_code` varchar(45) DEFAULT NULL COMMENT '传感器的唯一标识',
`equipment_code` varchar(45) DEFAULT NULL COMMENT '被监测设备的唯一标识',
`dev_id` int(11) DEFAULT NULL COMMENT '装置ID',
`status` int(11) DEFAULT '1' COMMENT '状态 1-正常 0-删除',
`zsb_id` int(11) DEFAULT NULL,
`icd_id` int(11) DEFAULT NULL COMMENT '关联icd表中的id',
PRIMARY KEY (`id`),
KEY `idxSensor` (`sensor_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='监测装置表';

@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@ -13,6 +14,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringBootApplication
@EnableCaching
@EnableAsync
public class CacBackendApplication {
@Bean(name = "passwordEncoder")

@ -19,7 +19,7 @@ import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "n_point")
@Table(name = "n_103_point")
@ApiModel("装置点表")
public class N103Point {

@ -9,6 +9,7 @@ import com.xydl.cac.service.N103PointService;
import com.xydl.cac.service.N103SensorService;
import com.xydl.cac.service.NSensorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -28,6 +29,7 @@ public class N103SensorServiceImpl implements N103SensorService {
N103PointService n103PointService;
@Async
@Override
public void importFrom(Collection<N103Sensor> collection) {
for (N103Sensor item : collection) {

Loading…
Cancel
Save