张晓波
2023-12-12 2bd6a932ddab51fff3185bf38435b4508203203c
Merge branch 'master' of http://111.30.93.211:10101/r/supipe
已修改4个文件
57 ■■■■ 文件已修改
hd/pipe/materialsManage/pom.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/pom.xml
@@ -83,6 +83,18 @@
            <artifactId>pipegps</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.csource</groupId>
            <artifactId>fastdfs-client-java</artifactId>
            <version>1.30-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <repositories>
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java
@@ -4,9 +4,11 @@
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.helmet.service.HelmetService;
import org.apache.ibatis.annotations.Mapper;
import org.csource.common.MyException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Map;
@RestController
@@ -82,7 +84,7 @@
    }
    //AI边缘盒子   数据接收
    @PostMapping("/dataBox")
    public BasicResult dataBox(@RequestBody String message){
    public BasicResult dataBox(@RequestBody String message) throws IOException, MyException {
        /** 将String转换为JSON **/
        JSONObject result= JSONObject.parseObject(message);
        System.out.println("--------接收的参数为 :---------------"+result);
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java
@@ -3,7 +3,9 @@
import com.alibaba.fastjson.JSONObject;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.helmet.entity.*;
import org.csource.common.MyException;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -49,7 +51,7 @@
    BasicResult dataValuesList(Map<String, Object> values);
    BasicResult dataBox(JSONObject result);
    BasicResult dataBox(JSONObject result) throws IOException, MyException;
    BasicResult dataAIList(Map<String, Object> values);
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java
@@ -1,6 +1,7 @@
package com.thhy.materials.modules.biz.helmet.service.impl;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.FilenameUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.general.common.BasicResult;
@@ -9,20 +10,28 @@
import com.thhy.materials.modules.biz.helmet.entity.dto.TypeName;
import com.thhy.materials.modules.biz.helmet.mapper.HelmetMapper;
import com.thhy.materials.modules.biz.helmet.service.HelmetService;
import org.csource.common.MyException;
import org.csource.common.NameValuePair;
import org.csource.fastdfs.StorageClient;
import org.springframework.stereotype.Service;
import sun.misc.Cache;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class HelmetServiceImpl implements HelmetService {
    @Resource
    private HelmetMapper helmetMapper;
    @Resource
    private StorageClient storageClient;
    @Override
    public List<THelmetDevice> helmetServiceList() {
@@ -163,7 +172,7 @@
    }
    @Override
    public BasicResult dataBox(JSONObject result) {
    public BasicResult dataBox(JSONObject result) throws IOException, MyException {
        Integer type = Integer.valueOf(result.get("type").toString());
@@ -179,9 +188,25 @@
        tDataAi.setEnterName(result.get("enterName").toString());
        tDataAi.setEnterCode(result.get("enterCode").toString());
        //图片上传
        //ByteArrayInputStream bais = null;
        byte[] bytes = Base64.getDecoder().decode(result.get("signAvatar").toString());
        //构建字节数组输入流
        //bais = new ByteArrayInputStream(bytes);
//        BufferedImage bufferedImage = ImageIO.read(bais);
//        //通过ImageIO把字节数组输入流转为BufferedImage
//        //构建文件
//        File imageFile = new File(imageFileName);
        NameValuePair[] nv = new NameValuePair[2];
        nv[0] = new NameValuePair("name","ai报警图片");
        nv[1] = new NameValuePair("uploadTime",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        String[] paths = storageClient.upload_file(bytes, "jpg",nv);
        String p1 = paths[0];
        String p2 = paths[1];
        String path = p1+"/"+p2;
        //上边缺少图片处理
        tDataAi.setSignTime(result.get("signTime").toString());
        tDataAi.setSignAvatar(path);
        tDataAi.setSignBigAvatar(result.get("signBigAvatar").toString());
        tDataAi.setChannelNo(result.get("channelNo").toString());
        tDataAi.setX(result.getIntValue("x"));
        tDataAi.setY(result.getIntValue("y"));