干燥机配套车间生产管理系统/云平台服务端
bsw215583320
2024-03-06 0f54bc965f577e0926daff40c3929d658ce31378
提交测试代码
已添加2个文件
56 ■■■■■ 文件已修改
jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/AiTest.java
对比新文件
@@ -0,0 +1,27 @@
package com.lanbao;
import ai.djl.modality.Classifications;
import org.jeecg.modules.dry.util.HerbUtil;
import org.junit.Test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;
public class AiTest {
    @Test
    public void test() {
        try {
            String img = "E:\\testImg\\szp1.jpg";
            HerbUtil herbUtil = new HerbUtil();
            File file = new File(img);
            InputStream is = new FileInputStream(file);
            List<Classifications.Classification> predict = herbUtil.predict(is);
            System.out.println(predict);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
jeecg-module-dry/jeecg-module-dry-start/src/main/test/java/com/lanbao/SocketTest.java
对比新文件
@@ -0,0 +1,29 @@
package com.lanbao;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.dry.vo.SocketMsgVo;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.nio.channels.SocketChannel;
public class SocketTest {
    public static void main(String[] args) {
        try {
            Socket socket = new Socket("192.168.2.6", 1115);
            ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
            SocketMsgVo msgVo = new SocketMsgVo();
            msgVo.setCode("1");
            msgVo.setMsg("1111");
            oos.writeObject(JSONObject.toJSONString(msgVo));
            oos.close();
            socket.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}