|
@@ -1,10 +1,11 @@
|
|
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.*;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.iotechn.unimall.data.dto.DistinguishView;
|
|
import com.iotechn.unimall.data.dto.DistinguishView;
|
|
|
|
+import com.iotechn.unimall.data.util.HttpUtils;
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.NameValuePair;
|
|
import org.apache.http.NameValuePair;
|
|
@@ -27,7 +28,6 @@ import com.iotechn.unimall.data.mapper.ProductManagementMapper;
|
|
import com.iotechn.unimall.data.domain.ProductManagement;
|
|
import com.iotechn.unimall.data.domain.ProductManagement;
|
|
import com.iotechn.unimall.admin.api.tourism.IProductManagementService;
|
|
import com.iotechn.unimall.admin.api.tourism.IProductManagementService;
|
|
import com.iotechn.unimall.data.model.Page;
|
|
import com.iotechn.unimall.data.model.Page;
|
|
-import java.util.Date;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -191,6 +191,44 @@ public class ProductManagementServiceImpl implements IProductManagementService{
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public DistinguishView speechRecognition(String voiceMessage) throws ServiceException {
|
|
|
|
+ String host = "https://audio.market.alicloudapi.com";
|
|
|
|
+ String path = "/audioshort";
|
|
|
|
+ String method = "POST";
|
|
|
|
+ String appcode = "2d59bfa794994f5f94d1d98b7b5bd102";
|
|
|
|
+ Map<String, String> headers = new HashMap<String, String>();
|
|
|
|
+ //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
|
|
|
+ headers.put("Authorization", "APPCODE " + appcode);
|
|
|
|
+ //根据API的要求,定义相对应的Content-Type
|
|
|
|
+ headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
|
|
+ Map<String, String> querys = new HashMap<String, String>();
|
|
|
|
+ Map<String, String> bodys = new HashMap<String, String>();
|
|
|
|
+ bodys.put("format", "m4a");
|
|
|
|
+ bodys.put("src", voiceMessage);
|
|
|
|
+ bodys.put("type", "zh-fast");
|
|
|
|
+ try {
|
|
|
|
+ HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
|
|
|
+ String body = EntityUtils.toString(response.getEntity());
|
|
|
|
+ System.out.println(body);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(body);
|
|
|
|
+ JSONArray jsonArray = jsonObject.getJSONArray("msg");
|
|
|
|
+ DistinguishView distinguishView = new DistinguishView();
|
|
|
|
+ if(jsonArray!= null && jsonArray.size() >0){
|
|
|
|
+ String text = jsonArray.getString(0).replace("。","");
|
|
|
|
+ distinguishView.setText(text);
|
|
|
|
+ System.out.println(text);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ distinguishView.setText("未识别成功!");
|
|
|
|
+ }
|
|
|
|
+ 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>();
|