| | |
| | | package com.fzzy.igds.api.v1.service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.igds.api.v1.data.ApiV1Req; |
| | | import com.fzzy.igds.api.v1.data.ApiV1Resp; |
| | | import com.fzzy.igds.api.v1.data.Param3030; |
| | | import com.fzzy.igds.api.v1.data.Param3031; |
| | | import com.fzzy.igds.constant.WarnStatus; |
| | | import com.fzzy.igds.domain.EventInfo; |
| | | import com.fzzy.igds.domain.GatewaySer; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.igds.domain.SnapRecord; |
| | | import com.fzzy.igds.service.EventInfoService; |
| | | import com.fzzy.igds.service.FileService; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.ruoyi.common.config.FrameworkConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | * @Author CZT |
| | | * @Date 2026/1/7 11:09 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class ApiV1Service3031 { |
| | | |
| | |
| | | * @param gatewaySer |
| | | * @return |
| | | */ |
| | | public ApiV1Resp<Object> analysis(ApiV1Req<JSONObject> req, GatewaySer gatewaySer) throws Exception { |
| | | public ApiV1Resp<Object> analysis(ApiV1Req<Object> req, GatewaySer gatewaySer) throws Exception { |
| | | |
| | | //转化为对象 |
| | | List<Param3031> list = JSONObject.parseArray(req.getData().toString(), Param3031.class); |
| | | List<Param3031> list = JSONObject.parseArray(JSONObject.toJSONString(req.getData()), Param3031.class); |
| | | |
| | | if(null == list || list.isEmpty()){ |
| | | if (null == list || list.isEmpty()) { |
| | | return ApiV1Resp.error("抓拍信息为空,不解析!", req); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 异步解析 |
| | | * |
| | | * @param list |
| | | */ |
| | | @Async |
| | |
| | | info.setType(param.getType()); |
| | | info.setLevel(param.getLevel()); |
| | | info.setInfo(param.getInfo()); |
| | | info.setTime(DateUtils.parseDate(param.getTime(),"yyyy-MM-dd HH:mm:ss")); |
| | | info.setTime(DateUtils.parseDate(param.getTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | info.setTags(param.getTags()); |
| | | |
| | | |
| | | //base64转化为图片保存 |
| | | String savePath = fileService.getFileSavePath("EVENT"); |
| | | String fileName = ContextUtil.UUID() + ".jpg"; |
| | | String filePath = savePath+fileName; |
| | | String filePath = savePath + fileName; |
| | | fileService.baseImg2Disk(filePath, param.getImgBase64()); |
| | | |
| | | //设置保存图片路径 |
| | |
| | | eventInfoService.addData(info); |
| | | } |
| | | |
| | | log.info("质押监管接口V1,3031接口解析完成"); |
| | | |
| | | } |
| | | |
| | | } |