getocrcode
This commit is contained in:
parent
04b8cded95
commit
d3e82bb53d
|
|
@ -156,4 +156,28 @@ public class HttpHelper {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不带鉴权的请求
|
||||||
|
* @param url
|
||||||
|
* @param JSONBody
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String sendHttpPostForToken(String url, String JSONBody) throws Exception {
|
||||||
|
System.err.println("JSONBody-=========:" + JSONBody);
|
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
|
HttpPost httpPost = new HttpPost(url);
|
||||||
|
httpPost.addHeader("Content-Type", "application/json");
|
||||||
|
httpPost.setEntity(new StringEntity(JSONBody));
|
||||||
|
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||||
|
// System.out.println(response.getStatusLine().getStatusCode() + "\n");
|
||||||
|
HttpEntity entity = response.getEntity();
|
||||||
|
String responseContent = EntityUtils.toString(entity, "UTF-8");
|
||||||
|
// System.out.println(responseContent);
|
||||||
|
response.close();
|
||||||
|
httpClient.close();
|
||||||
|
return responseContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.material.repair.controller;
|
package com.bonus.material.repair.controller;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.utils.HttpHelper;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.core.web.controller.BaseController;
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
|
@ -7,6 +8,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.material.repair.domain.*;
|
import com.bonus.material.repair.domain.*;
|
||||||
|
import com.bonus.material.repair.domain.vo.OCRBean;
|
||||||
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
import com.bonus.material.repair.domain.vo.RepairDeviceSummaryVo;
|
||||||
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
import com.bonus.material.repair.domain.vo.RepairDeviceVO;
|
||||||
import com.bonus.material.repair.domain.vo.RepairInputDetailsVo;
|
import com.bonus.material.repair.domain.vo.RepairInputDetailsVo;
|
||||||
|
|
@ -19,7 +21,8 @@ import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
@ -200,4 +203,36 @@ public class RepairController extends BaseController {
|
||||||
List<RepairInputDetailsVo> list = service.getRepairedDetailList(dto);
|
List<RepairInputDetailsVo> list = service.getRepairedDetailList(dto);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取Ocr code")
|
||||||
|
@RequestMapping(value = "getOcrCode", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public JSONObject getOcrCode(OCRBean o) {
|
||||||
|
String url = "http://10.138.55.102:10000/api_gqj/pre";
|
||||||
|
JSONObject js = null;
|
||||||
|
try {
|
||||||
|
String jsonStr = JSONObject.toJSONString(o);
|
||||||
|
String data = "{\"code\": \"fack_code\"}"; //HttpHelper.sendHttpPostForToken(url, jsonStr);
|
||||||
|
js = JSONObject.parseObject(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return js;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// String url = "http://10.138.55.102:10000/api_gqj/pre";
|
||||||
|
// JSONObject js = null;
|
||||||
|
// try {
|
||||||
|
// OCRBean o = new OCRBean();
|
||||||
|
// String jsonStr = JSONObject.toJSONString(o);
|
||||||
|
// String data = "{\"code\": \"fack_code\"}"; //HttpHelper.sendHttpPostForToken(url, jsonStr);
|
||||||
|
// js = JSONObject.parseObject(data);
|
||||||
|
// System.out.println(js);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.bonus.material.repair.domain.vo;
|
||||||
|
|
||||||
|
public class OCRBean {
|
||||||
|
|
||||||
|
private String image;
|
||||||
|
private String jiju_type;
|
||||||
|
private String auth_lic;
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
public String getJiju_type() {
|
||||||
|
return jiju_type;
|
||||||
|
}
|
||||||
|
public void setJiju_type(String jiju_type) {
|
||||||
|
this.jiju_type = jiju_type;
|
||||||
|
}
|
||||||
|
public String getAuth_lic() {
|
||||||
|
return auth_lic;
|
||||||
|
}
|
||||||
|
public void setAuth_lic(String auth_lic) {
|
||||||
|
this.auth_lic = auth_lic;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue