Commit ea3e37ec authored by tianbo's avatar tianbo

ocr图片识别接口

parent 6dfac250
package com.yeejoin.amos.boot.module.ugp.biz.controller; package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.biz.fegin.MaasServiceFeignClient;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify; import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -128,4 +131,22 @@ public class AttachmentController extends BaseController { ...@@ -128,4 +131,22 @@ public class AttachmentController extends BaseController {
public ResponseModel<Map> selectUnit(){ public ResponseModel<Map> selectUnit(){
return ResponseHelper.buildResponse(attachmentServiceImpl.selectUnit()); return ResponseHelper.buildResponse(attachmentServiceImpl.selectUnit());
} }
@Autowired
MaasServiceFeignClient maasServiceFeignClient;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/test")
@ApiOperation(httpMethod = "Get",value="测试",notes= "测试")
public ResponseModel test(@RequestParam String urlPath) {
JSONObject param = new JSONObject();
JSONArray urls = new JSONArray();
JSONObject url = new JSONObject();
url.put("url", urlPath);
urls.add(url);
param.put("data", urls);
ResponseModel<Object> result = maasServiceFeignClient.getPatrolDangerInfo(param);
String resultStr = JSONObject.parseObject(JSONObject.toJSONString(result.getResult())).getJSONObject("result1").getJSONArray("rows").getJSONObject(0).getString("ocrResult");
return ResponseHelper.buildResponse(resultStr);
}
} }
package com.yeejoin.amos.boot.module.ugp.biz.fegin;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* 数据集成服务接口feign
*
* @author Dell
*/
@FeignClient(name = "${maas.feign.name:maas-mdm}", path = "maas", configuration =
{MultipartSupportConfig.class})
public interface MaasServiceFeignClient {
String ocrServiceId = "0a456d67-5e12-48af-8923-ccc447d4cb2b";
/**
* 获取图片识别数据
*
* @param param
* @return
*/
@RequestMapping(value = "/maas/processes/api/" + ocrServiceId, method = RequestMethod.POST)
ResponseModel<Object> getPatrolDangerInfo(@RequestBody Object param);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment