张磊磊
2023-11-08 2b2d292c1a274aa95aab8c2ac20530e54a503923
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java
@@ -1,10 +1,12 @@
package com.thhy.materials.modules.biz.helmet.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.helmet.entity.*;
import com.thhy.materials.modules.biz.helmet.entity.dto.ReportNumDto;
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.springframework.stereotype.Service;
@@ -112,10 +114,10 @@
    }
    @Override
    public BasicResult dataValueInsert(Map<String, Object> values) {
    public BasicResult dataValueIn(Map<String, Object> values) {
        helmetMapper.dataValueInsert(values);
        helmetMapper.dataValueIn(values);
        return BasicResult.success();
    }
@@ -135,9 +137,9 @@
    }
    @Override
    public void smockInsert(TDataSmock tDataSmock) {
    public void smockIn(TDataSmock tDataSmock) {
        System.out.println("参数为---"+tDataSmock.toString());
        helmetMapper.smockInsert(tDataSmock);
        helmetMapper.smockIn(tDataSmock);
    }
    @Override
@@ -159,4 +161,95 @@
        PageInfo<TDataValue> tDataValuePageInfo = new PageInfo<>(dataSmocks);
        return BasicResult.success(tDataValuePageInfo);
    }
    @Override
    public BasicResult dataBox(JSONObject result) {
        Integer type = Integer.valueOf(result.get("type").toString());
        TDataAi tDataAi = new TDataAi();
        //公共参数
        tDataAi.setType(type);
        tDataAi.setTypeName(result.get("typeName").toString());
        tDataAi.setRtspUrl(result.getString("rtspUrl"));
        tDataAi.setBoxId(Integer.valueOf(result.get("boxId").toString()));
        tDataAi.setBoxName(result.get("boxName").toString());
        tDataAi.setDeviceName(result.get("deviceName").toString());
        tDataAi.setDeviceId(result.get("deviceId").toString());
        tDataAi.setEnterName(result.get("enterName").toString());
        tDataAi.setEnterCode(result.get("enterCode").toString());
        //图片上传
        //上边缺少图片处理
        tDataAi.setSignTime(result.get("signTime").toString());
        tDataAi.setChannelNo(result.get("channelNo").toString());
        tDataAi.setX(result.getIntValue("x"));
        tDataAi.setY(result.getIntValue("y"));
        tDataAi.setW(result.getIntValue("w"));
        tDataAi.setH(result.getIntValue("h"));
        if(type==1){//人脸
            tDataAi.setAge(result.getIntValue("age"));
            tDataAi.setGender(result.getIntValue("gender"));
            tDataAi.setGlasses(result.getIntValue("glasses"));
            tDataAi.setMask(result.getIntValue("mask"));
            //人脸照片 base64 (需要解密)
            tDataAi.setCertifiedAvatarUrl(result.getString("certifiedAvatarURL"));
            tDataAi.setFaceId(result.getIntValue("faceId"));
            tDataAi.setPersonType(result.getIntValue("personType"));
            tDataAi.setFaceMaxSorce(result.getString("faceMaxSorce"));
            tDataAi.setPersonName(result.getString("personName"));
        }else if(type==2){//人体
        }else if(type==3){//车辆
            tDataAi.setLicensePlateNumber(result.getString("licensePlateNumber"));
            tDataAi.setIllegalParking(result.getIntValue("illegalParking"));
        }else if(type==4){//电动车
            tDataAi.setEBike(result.getIntValue("eBike"));
        }else if(type==5){//烟火
            tDataAi.setSmoke(result.getIntValue("smoke"));
            tDataAi.setFire(result.getIntValue("fire"));
        }else if(type==6){//离岗
            tDataAi.setIsExist(result.getIntValue("isExist"));
        }else if(type==8){//灭火器
            tDataAi.setExt(result.getIntValue("ext"));
        }else if(type==10){//油罐车
            tDataAi.setTanker(result.getIntValue("tanker"));
        }else if(type==16){//睡岗
            //
        } else if(type==23){//杂物堆积
            tDataAi.setSudire(result.getIntValue("sudire"));
        }else if(type==24){//摄像头遮挡
            tDataAi.setCover(result.getIntValue("cover"));
        }else if(type==26){//消防通道占用
            tDataAi.setFireControl(result.getIntValue("fireControl"));
        }
        helmetMapper.dataBox(tDataAi);
        return BasicResult.success();
    }
    @Override
    public BasicResult dataAIList(Map<String, Object> values) {
        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
        PageHelper.startPage(pageNum,pageSize);
        List<TDataAi> tDataAis = helmetMapper.dataAIList(values);
        PageInfo<TDataAi> tDataAiPageInfo = new PageInfo<>(tDataAis);
        return BasicResult.success(tDataAiPageInfo);
    }
    @Override
    public BasicResult dataAIType() {
        List<TypeName> typeNames = helmetMapper.dataAIType();
        return BasicResult.success(typeNames);
    }
}