Commit c35c0e15 by yangliang

修改足迹接口调用方式

parent 6fc591b0
......@@ -60,7 +60,7 @@ public class SwCjController {
@RequestMapping("/saveSwSjXx")
@ResponseBody
private Map<String, String> saveSwSjXx(HttpServletRequest request,TbStSw tbStSw,BufferedReader br) {
System.out.println("接收声纹信息:"+tbStSw.getRybh());
System.out.println("开始接收声纹信息:");
Map<String,String> map = new HashMap<>();
//body部分
String inputLine;
......@@ -76,6 +76,7 @@ public class SwCjController {
JSONObject object = JSONObject.parseObject(str);
if(object!=null&&!"".equals(object)){
tbStSw.setRybh((String) object.get("rybh"));
System.out.println("声纹信息人员编号:"+tbStSw.getRybh());
tbStSw.setXm((String)object.get("xm"));
tbStSw.setGmsfhm((String)object.get("gmsfhm"));
String ypsjStr = (String)object.get("ypsjStr");
......@@ -92,13 +93,14 @@ public class SwCjController {
tbStSw.setFyfs((String)object.get("fyfs"));
tbStSw.setXd((String)object.get("xd"));
tbStSw.setHyfy((String)object.get("hyfy"));
tbStSw.setLrrPolicemanid(object.get("lrrPolicemanid").toString());
tbStSw.setLrrPolicemanid((String)object.get("lrrPolicemanid"));
try {
tbStSw.setYpsj(URLDecoder.decode(ypsjStr).getBytes("ISO-8859-1"));
tbStSw.setSwsj(URLDecoder.decode(swsjStr).getBytes("ISO-8859-1"));
} catch (Exception e) {
}
}else{
System.out.println("接收声纹信息为空!");
try {
tbStSw.setYpsj(URLDecoder.decode(tbStSw.getYpsjStr()).getBytes("ISO-8859-1"));
tbStSw.setSwsj(URLDecoder.decode(tbStSw.getSwsjStr()).getBytes("ISO-8859-1"));
......@@ -113,15 +115,16 @@ public class SwCjController {
map.put("code","1");
map.put("msg","人员编号不能为空!");
System.out.println("人员编号不能为空!");
//return map;
return map;
}
if(StringUtils.isEmpty(tbStSw.getXm()) ){
//失败
map.put("code","1");
map.put("msg","姓名不能为空!");
System.out.println("姓名不能为空!");
//return map;
return map;
}
/*
if(tbStSw.getSwsjStr() == null || tbStSw.getSwsjStr().length() == 0 ){
//失败
map.put("code","1");
......@@ -129,7 +132,12 @@ public class SwCjController {
System.out.println("声纹数据不能为空!");
//return map;
}else{
System.out.println("声纹数据路径"+tbStSw.getSwsjStr());
String rybhstr = tbStSw.getRybh();
String savePath = "/personphoto/" + rybhstr.substring(rybhstr.length() - 10, rybhstr.length() - 4) + "/" + rybhstr.substring(rybhstr.length() - 3, rybhstr.length());
Param param = paramService.getParamById("0100");
String zplj = param.getParamvalue();
String filePath = zplj;
filePath = filePath + savePath;
tbStSw.setWjlj(tbStSw.getSwsjStr());
File filejia = new File(tbStSw.getSwsjStr());
if (filejia.exists()) {
......@@ -169,51 +177,42 @@ public class SwCjController {
}
}
}
/*
if(StringUtils.isEmpty(tbStSw.getZsc()) ){
//失败
map.put("code","1");
map.put("msg","音频总时长不能为空!");
System.out.println("音频总时长不能为空!");
//return map;
}
*/
if(StringUtils.isEmpty(tbStSw.getCjcd()) ){
//失败
map.put("code","1");
map.put("msg","采集场地不能为空!");
System.out.println("采集场地不能为空!");
//return map;
}
if(StringUtils.isEmpty(tbStSw.getXxzldf()) ){
//失败
map.put("code","1");
map.put("msg","信息质量不能为空!");
System.out.println("信息质量不能为空!");
//return map;
}
if(StringUtils.isEmpty(tbStSw.getLyyz()) ){
//失败
map.put("code","1");
map.put("msg","录音语种不能为空!");
System.out.println("录音语种不能为空!");
//return map;
}
if(StringUtils.isEmpty(tbStSw.getLrrPolicemanid()) ){
*/
if(tbStSw.getYpsj() == null || tbStSw.getYpsj().length == 0 ){
//失败
map.put("code","1");
map.put("msg","采集人警号不能为空!");
System.out.println("采集人警号不能为空!");
//return map;
tbStSw.setLrdwdm("460000000000");
tbStSw.setLrr("admin");
map.put("msg","音频数据不能为空!");
System.out.println("音频数据不能为空!");
return map;
}else{
User user = (User) request.getSession().getAttribute("User");
//录入人相关信息
tbStSw.setLrr(dicItemService.queryNameByCode(tbStSw.getLrrPolicemanid(),"CODE_JY"));
tbStSw.setLrdwdm("460000000000");
String rybhstr = tbStSw.getRybh();
int swcnt = swCjService.getSwSjXxCnt(rybhstr);
//List<TbStSw> tbStSws = swCjService.getSwSjXxList(rybhstr);
String savePath = "/personphoto/" + rybhstr.substring(rybhstr.length() - 10, rybhstr.length() - 4) + "/" + rybhstr.substring(rybhstr.length() - 3, rybhstr.length());
Param param = paramService.getParamById("0100");
String zplj = param.getParamvalue();
String filePath = zplj;
filePath = filePath + savePath;
File filejia0 = new File(filePath);
if (!filejia0.exists()) {
filejia0.mkdir();
}
String paths = "";
if(swcnt>=0){
paths = filePath + "/"+ rybhstr+ "_voice" + swcnt + ".wav";
}else{
paths = filePath + "/"+ rybhstr + "_voice" + "0.wav";
}
File filejia1 = new File(paths);
try {
filejia1.createNewFile();
boolean flg = GenerateImage(tbStSw.getYpsj(),paths);
tbStSw.setWjlj(paths);
} catch (IOException e) {
e.printStackTrace();
}
}
//生成信息主键编号
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
tbStSw.setXxzjbh(uuid);
......
......@@ -391,7 +391,7 @@ public class FileUtils {
HttpPost httpPost = new HttpPost(url);
// 设置请求和传输超时时间
RequestConfig requestConfig = RequestConfig.custom()
.setSocketTimeout(4000).setConnectTimeout(4000).build();
.setSocketTimeout(20000).setConnectTimeout(20000).build();
httpPost.setConfig(requestConfig);
try {
if (null != jsonParam) {
......
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