iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java
@@ -82,67 +82,4 @@ baseMapper.delete(new QueryWrapper<ChannelModBusTagEntity>().eq("device", name)); } // /** // * 导入Tag // * // * @param device // * @param file // * @throws Exception // */ // @Override // @Transactional(rollbackFor = Exception.class) // public void importTag(String device, MultipartFile file) throws Exception { // try { // String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); // String fileName = UUID.randomUUID().toString() + suffix; // String path = uploadDir + fileName; // file.transferTo(new File(path)); // // XSSFWorkbook hssfWorkbook = new XSSFWorkbook(new FileInputStream(path)); // XSSFSheet sheet = hssfWorkbook.getSheetAt(0); // int lastRowNum = sheet.getLastRowNum(); // log.info("最后一行:" + lastRowNum); // int lastCellNum = 6; // List<ChannelModBusTagEntity> dangerList = new ArrayList<>(); // for (int i = 1; i <= lastRowNum; i++) { // XSSFRow row = sheet.getRow(i); // for (int j = row.getFirstCellNum(); j < lastCellNum; j++) { // row.getCell(j).setCellType(CellType.STRING); // } // ChannelModBusTagEntity tagEntity = new ChannelModBusTagEntity(); // tagEntity.setId(UUID.randomUUID().toString()); // tagEntity.setTagName(row.getCell(1).getStringCellValue()); // tagEntity.setDataType(row.getCell(2).getStringCellValue()); // tagEntity.setEnabled(true); // tagEntity.setFormat(""); // tagEntity.setDevice(device); // tagEntity.setSamplingRate(0); // row.getCell(4).setCellType(CellType.STRING); // System.out.println(row.getCell(3).getStringCellValue()); // if(row.getCell(3).getStringCellValue().equals("1")){ // tagEntity.setAddress(String.format("1%04d",Integer.parseInt(row.getCell(4).getStringCellValue()))); // }else if(row.getCell(3).getStringCellValue().equals("3")){ // tagEntity.setAddress(String.format("4%04d",Integer.parseInt(row.getCell(4).getStringCellValue()))); // } // tagEntity.setTagDesc(row.getCell(5).getStringCellValue()); // dangerList.add(tagEntity); // } // if (CollectionUtils.isEmpty(dangerList)) { // return; // } // //getBaseMapper().insertList(dangerList); // dangerList.forEach(item -> { // try { // getBaseMapper().insert(item); // } catch (Exception ex) { // log.warn("插入异常:" + item.getTagName()); // } // }); // } catch (Exception ex) { // ex.printStackTrace(); // log.warn("导入失败!"); // throw ex; // } // } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java
@@ -1,5 +1,6 @@ package com.iailab.module.data.channel.opcda.service.impl; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -17,7 +18,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -92,7 +92,7 @@ } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void importTag(String serverId, MultipartFile file) throws Exception { try { String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/service/impl/ChannelOPCUATagServiceImpl.java
@@ -1,5 +1,6 @@ package com.iailab.module.data.channel.opcua.service.impl; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -17,7 +18,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -93,7 +93,7 @@ } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void importTag(String device, MultipartFile file) throws Exception { try { String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -1,6 +1,7 @@ package com.iailab.module.data.point.service.impl; import com.alibaba.fastjson.JSONArray; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.iailab.framework.common.pojo.PageResult; @@ -20,7 +21,6 @@ import com.iailab.module.data.point.vo.DaPointPageReqVO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; @@ -90,7 +90,7 @@ } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void add(DaPointDTO dataPoint) { DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(dataPoint, DaPointEntity.class); daPointEntity.setId(UUID.randomUUID().toString()); @@ -113,7 +113,7 @@ } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void update(DaPointDTO dataPoint) { DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(dataPoint, DaPointEntity.class); daPointEntity.setUpdateTime(new Date()); @@ -130,7 +130,7 @@ } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void delete(String[] ids) { daPointDao.deleteBatchIds(Arrays.asList(ids)); daMeasurePointService.deleteByPoint(ids);