张磊磊
2023-11-01 7dcbd445ad33d7abc0689f80ba56f5b3f7e21e4d
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java
@@ -1,5 +1,6 @@
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;
@@ -8,6 +9,7 @@
import com.thhy.materials.modules.biz.helmet.mapper.HelmetMapper;
import com.thhy.materials.modules.biz.helmet.service.HelmetService;
import org.springframework.stereotype.Service;
import sun.misc.Cache;
import javax.annotation.Resource;
import java.util.HashMap;
@@ -132,4 +134,105 @@
        List<THelmetReport> helmetReports =  helmetMapper.helmetReportUser(values);
        return BasicResult.success(helmetReports);
    }
    @Override
    public void smockIn(TDataSmock tDataSmock) {
        System.out.println("参数为---"+tDataSmock.toString());
        helmetMapper.smockIn(tDataSmock);
    }
    @Override
    public BasicResult dataSmockList(Map<String, Object> values) {
        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
        PageHelper.startPage(pageNum,pageSize);
        List<TDataSmock> dataSmocks = helmetMapper.dataSmockList(values);
        PageInfo<TDataSmock> tDataSmockPageInfo = new PageInfo<>(dataSmocks);
        return BasicResult.success(tDataSmockPageInfo);
    }
    @Override
    public BasicResult dataValuesList(Map<String, Object> values) {
        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
        PageHelper.startPage(pageNum,pageSize);
        List<TDataValue> dataSmocks = helmetMapper.dataValuesList(values);
        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();
    }
}