Преглед на файлове

0821 添加base64记录,修改组件查询

caizm преди 3 седмици
родител
ревизия
aeec63567d

+ 26 - 0
generated/com/miniframe/generate/comm/es/D_ES1001_ROWS_COMS_RECODE.java

@@ -165,4 +165,30 @@ public class D_ES1001_ROWS_COMS_RECODE extends BaseMapModel implements Serializa
 	public String getCode() {
 		return this.code;
 	}
+	int ptcom;//连接点数
+	/**
+	 *连接点数
+	 */
+	public void setPtcom(int ptcom) {
+		this.ptcom=ptcom;
+	}
+	/**
+	 *连接点数
+	 */
+	public int getPtcom() {
+		return this.ptcom;
+	}
+	String ptsite;//连接点位置
+	/**
+	 *连接点位置
+	 */
+	public void setPtsite(String ptsite) {
+		this.ptsite=ptsite;
+	}
+	/**
+	 *连接点位置
+	 */
+	public String getPtsite() {
+		return this.ptsite;
+	}
 }

+ 2 - 0
generated/validator/resources_d_es1001_rows_coms_recodeForm_validator.properties

@@ -10,4 +10,6 @@ d_es1001_rows_coms_recode.flag = \u662F\u5426\u542F\u7528
 d_es1001_rows_coms_recode.idCode = \u7EC4\u4EF6id\u7F16\u7801\u5982CN\u7B49
 d_es1001_rows_coms_recode.type = \u5B50\u7C7Brigid
 d_es1001_rows_coms_recode.code = \u7EC4\u4EF6\u7F16\u7801Pipe
+d_es1001_rows_coms_recode.ptcom = \u8FDE\u63A5\u70B9\u6570
+d_es1001_rows_coms_recode.ptsite = \u8FDE\u63A5\u70B9\u4F4D\u7F6E
 d_es1001_rows_coms_recodeForm = true

+ 2 - 0
generated/validator/resources_d_es1001_rows_coms_recodeForm_validator_zh_CN.properties

@@ -10,4 +10,6 @@ d_es1001_rows_coms_recode.flag = \u662F\u5426\u542F\u7528
 d_es1001_rows_coms_recode.idCode = \u7EC4\u4EF6id\u7F16\u7801\u5982CN\u7B49
 d_es1001_rows_coms_recode.type = \u5B50\u7C7Brigid
 d_es1001_rows_coms_recode.code = \u7EC4\u4EF6\u7F16\u7801Pipe
+d_es1001_rows_coms_recode.ptcom = \u8FDE\u63A5\u70B9\u6570
+d_es1001_rows_coms_recode.ptsite = \u8FDE\u63A5\u70B9\u4F4D\u7F6E
 d_es1001_rows_coms_recodeForm = true

+ 2 - 0
src/main/java/com/miniframe/bisiness/es/ES1001Service.java

@@ -57,6 +57,8 @@ public class ES1001Service extends ES1001BaseModel implements ExecProcessFlow {
 					cr.setIdCode(c.getIdCode());
 					cr.setType(c.getType());
 					cr.setCode(c.getCode());
+					cr.setPtcom(c.getPtcom());
+					cr.setPtsite(c.getPtsite());
 					comrs.add(cr);
 				}
 			}

+ 1 - 1
src/main/java/com/miniframe/dbtransfer/FileBase64DbTransfer.java

@@ -5,7 +5,7 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
-import com.miniframe.model.system.FileBase64;
+import com.miniframe.model.es.FileBase64;
 
 /**
  * 实体列表,“FILE_BASE64”数据库数据转化逻辑处理(重新生成不覆盖)。

+ 92 - 0
src/test/java/com/miniframe/base64Test.java

@@ -0,0 +1,92 @@
+package com.miniframe;
+
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.model.es.EsCom;
+import com.miniframe.model.es.FileBase64;
+import com.miniframe.model.es.dao.EsComMapper;
+import com.miniframe.model.es.dao.FileBase64Mapper;
+import com.miniframe.model.system.dao.SysFileMapper;
+import com.miniframe.tools.ali.Data;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 删除filebase64记录,重新从本地读取并存储
+ */
+@SpringBootTest
+public class base64Test {
+    @Autowired
+    private FileBase64Mapper fileBase64Mapper;
+    @Autowired
+    private EsComMapper esComMapper;
+    @Autowired
+    private SysFileMapper sysFileMapper;
+    @Test
+    public void test() throws Exception {
+        List<EsCom> esComList = esComMapper.selectAll();
+        List<String> stringList = new ArrayList<>();
+        //在escom表中查找image编号
+        for (EsCom esCom : esComList) {
+            String image = esCom.getImage();
+        if(image!=null&&!image.equals("")&&!image.isEmpty()){
+            stringList.add(image);
+            }
+        }
+        //去重
+        List<String> stringList1 = stringList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+//        System.out.println(stringList1);
+        //在sys_file表中查找文件名
+        List<String> filenameList = new ArrayList<>();
+        for(String str :  stringList1){
+            filenameList.add(sysFileMapper.selectByPrimaryKey(str).getFilename());
+        }
+
+        for(int i=0;i<filenameList.size();i++){
+            FileBase64  fileBase64 = new FileBase64();
+            fileBase64.setFbId(stringList1.get(i)+getFilePrefix(filenameList.get(i)));
+            fileBase64.setFileBase64(convertToBase64("C:\\Users\\Administrator\\Desktop\\fsdownload\\"+filenameList.get(i)));
+            fileBase64.setFilename(filenameList.get(i));
+            fileBase64.setMime(getFileExtension(filenameList.get(i)));
+            fileBase64.setCreateTime(new Date());
+            fileBase64.setUpdateTime(new Date());
+            fileBase64.setRemark("");
+            fileBase64Mapper.insert(fileBase64);
+        }
+    }
+    //转base64
+    public static String convertToBase64(String filePath) throws Exception {
+        // 读取图片文件字节
+        byte[] fileContent = Files.readAllBytes(Paths.get(filePath));
+
+        // 使用Base64编码器进行编码
+        String baseStr =  Base64.getEncoder().encodeToString(fileContent);
+        return "data:image/png;base64,"+baseStr;
+    }
+
+    //取后缀
+    public String getFileExtension(String fileName) {
+        Path path = Paths.get(fileName);
+        String fullFileName = path.getFileName().toString();
+        int dotIndex = fullFileName.lastIndexOf('.');
+        return (dotIndex == -1) ? "" : fullFileName.substring(dotIndex + 1);
+    }
+    //取前缀
+    public static String getFilePrefix(String fileName) {
+        Path path = Paths.get(fileName);
+        String fullFileName = path.getFileName().toString();
+        int dotIndex = fullFileName.lastIndexOf('.');
+        return (dotIndex > 0) ? fullFileName.substring(0, dotIndex) : fullFileName;
+    }
+}

+ 3 - 1
系统设计/通信设计/通讯报文/es(无锡发动机)/报文体/ES1001_D(组件查询).csv

@@ -14,4 +14,6 @@
 1.3.9,flag,是否启用,int,,,,,,,,,,,
 1.3.10,idCode,组件id编码 如 C N 等,string,,,,,,,,,,,
 1.3.11,type,子类 rigid,string,,,,,,,,,,,
-1.3.12,code,组件编码 Pipe,string,,,,,,,,,,,
+1.3.12,code,组件编码 Pipe,string,,,,,,,,,,,
+1.3.13,ptcom,连接点数,int,,,,,,,,,,,
+1.3.14,ptsite,连接点位置,string,,,,,,,,,,,