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.Param3032;
|
import com.fzzy.igds.domain.GatewaySer;
|
import com.fzzy.igds.service.FileService;
|
import com.ruoyi.common.utils.StringUtils;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.stereotype.Component;
|
import javax.annotation.Resource;
|
|
/**
|
* @Description 出入库抓图解析
|
* @Author CZT
|
* @Date 2026/1/7 11:09
|
*/
|
@Slf4j
|
@Component
|
public class ApiV1Service3032 {
|
|
@Resource
|
private FileService fileService;
|
|
/**
|
* @param req
|
* @param gatewaySer
|
* @return
|
*/
|
public ApiV1Resp<Object> analysis(ApiV1Req<JSONObject> req, GatewaySer gatewaySer) {
|
|
//转化为对象
|
Param3032 param = JSONObject.parseObject(req.getData().toString(), Param3032.class);
|
|
if (null == param || StringUtils.isBlank(param.getFileName()) || StringUtils.isEmpty(param.getImgBase64())) {
|
return ApiV1Resp.error("抓拍信息为空,不解析!", req);
|
}
|
|
step1(param);
|
|
return ApiV1Resp.success(null, req);
|
|
}
|
|
/**
|
* 异步解析
|
*
|
* @param param
|
*/
|
@Async
|
public void step1(Param3032 param) {
|
|
|
//base64转化为图片保存
|
String savePath = fileService.getFileSavePath("INOUT");
|
String fileName = param.getFileName();
|
String filePath = savePath + fileName;
|
fileService.baseImg2Disk(filePath, param.getImgBase64());
|
|
log.info("质押监管接口V1,3032接口解析完成");
|
}
|
|
}
|