|
@@ -1,7 +1,19 @@
|
|
package com.iotechn.unimall.admin.api.tourism.impl;
|
|
package com.iotechn.unimall.admin.api.tourism.impl;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.iotechn.unimall.data.dto.DistinguishView;
|
|
|
|
+import org.apache.http.HttpEntity;
|
|
|
|
+import org.apache.http.HttpResponse;
|
|
|
|
+import org.apache.http.NameValuePair;
|
|
|
|
+import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
|
|
+import org.apache.http.client.methods.HttpPost;
|
|
|
|
+import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
|
+import org.apache.http.message.BasicNameValuePair;
|
|
|
|
+import org.apache.http.util.EntityUtils;
|
|
import org.apache.ibatis.session.RowBounds;
|
|
import org.apache.ibatis.session.RowBounds;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -134,7 +146,51 @@ public class ProductManagementServiceImpl implements IProductManagementService{
|
|
public ProductManagement get(Long id) throws ServiceException {
|
|
public ProductManagement get(Long id) throws ServiceException {
|
|
return productManagementMapper.selectById(id);
|
|
return productManagementMapper.selectById(id);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public DistinguishView personShibie(String personImageFront) throws ServiceException {
|
|
|
|
+ String appcode = "2d59bfa794994f5f94d1d98b7b5bd102";
|
|
|
|
+ //API产品路径
|
|
|
|
+ String requestUrl = "https://personcard.market.alicloudapi.com/ai_market/ai_ocr_universal/shen_fen_zheng/ch/v1";
|
|
|
|
+ //阿里云APPCODE
|
|
|
|
+ DistinguishView distinguishView = new DistinguishView();
|
|
|
|
+ CloseableHttpClient httpClient = null;
|
|
|
|
+ try {
|
|
|
|
+ httpClient = HttpClients.createDefault();
|
|
|
|
+ List<NameValuePair> params = new ArrayList<NameValuePair>();
|
|
|
|
+ //启用URL方式进行识别
|
|
|
|
+ //内容数据类型是图像文件URL链接
|
|
|
|
+ params.add(new BasicNameValuePair("IMAGE", personImageFront));
|
|
|
|
+ params.add(new BasicNameValuePair("IMAGE_TYPE", "1"));
|
|
|
|
+
|
|
|
|
+ // 创建一个HttpPost实例
|
|
|
|
+ HttpPost httpPost = new HttpPost(requestUrl);
|
|
|
|
+ httpPost.addHeader("Authorization", "APPCODE " + appcode);
|
|
|
|
+ httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
|
|
+
|
|
|
|
+ // 设置请求参数
|
|
|
|
+ httpPost.setEntity(new UrlEncodedFormEntity(params, "utf-8"));
|
|
|
|
+
|
|
|
|
+ // 发送POST请求
|
|
|
|
+ HttpResponse execute = httpClient.execute(httpPost);
|
|
|
|
+
|
|
|
|
+ // 获取状态码
|
|
|
|
+ int statusCode = execute.getStatusLine().getStatusCode();
|
|
|
|
+ System.out.println(statusCode);
|
|
|
|
+
|
|
|
|
+ // 获取结果
|
|
|
|
+ HttpEntity entity = execute.getEntity();
|
|
|
|
+ String body = EntityUtils.toString(entity);
|
|
|
|
+ System.out.println(body);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
|
+ distinguishView.setRecPersonNo(jsonObject.getJSONObject("身份证识别实体信息").getJSONObject("身份证人像面实体信息").getString("身份证号"));
|
|
|
|
+ return distinguishView;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public String export(Long commonId,String mainBody,String shopNames,String coverImage,String province,String city,String area,String location,String detailedAddress,String serviceDescription,String nickname,String phone,String realname,String personNo,String personImageFront,String personImageBack,String businessLicense,String status,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
public String export(Long commonId,String mainBody,String shopNames,String coverImage,String province,String city,String area,String location,String detailedAddress,String serviceDescription,String nickname,String phone,String realname,String personNo,String personImageFront,String personImageBack,String businessLicense,String status,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
Wrapper<ProductManagement> wrapper = new EntityWrapper<ProductManagement>();
|
|
Wrapper<ProductManagement> wrapper = new EntityWrapper<ProductManagement>();
|