package com.cloud.retrieve.controller;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONObject;
|
import com.cloud.common.utils.RestTemplateUtil;
|
import com.cloud.model.common.Result;
|
import com.cloud.retrieve.model.TaskUserPend;
|
import com.cloud.retrieve.utils.EnumStr;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.MediaType;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RestController;
|
|
@RequestMapping("/data/api-r")
|
@RestController
|
public class JoinController {
|
|
@Autowired
|
private EnumStr enumStr;
|
@Autowired
|
private RestTemplateUtil restTemplateUtil;
|
|
@RequestMapping(value = "addFromRetrieve",method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
public Result addFromRetrieve(@RequestBody TaskUserPend taskUserPend){
|
try{
|
JSONObject paramMap = new JSONObject();
|
if(taskUserPend.getIdCard()!=null && taskUserPend.getIdCard()!=""){
|
paramMap.put("idCard",taskUserPend.getIdCard());
|
}
|
if(taskUserPend.getDbInfos()!=null && taskUserPend.getDbInfos()!=""){
|
paramMap.put("dbInfos",JSON.toJSONString(taskUserPend.getDbInfos()));
|
}
|
paramMap.put("imgUrl", taskUserPend.getImgUrl());
|
paramMap.put("featureBase64",taskUserPend.getFeatureBase64());
|
|
String post = restTemplateUtil.postImg(enumStr.getJoinControl(), paramMap, MediaType.APPLICATION_JSON_UTF8,String.class, false );
|
JSONObject jsonMap = JSONObject.parseObject(post);
|
String code = jsonMap.get("code").toString();
|
if(code.equals("0")){
|
return Result.custom("检索添加人员成功!",200,true,null);
|
}else{
|
return Result.custom("检索添加人员失败!",1,false,null);
|
}
|
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
return Result.custom("检索添加人员失败!",1,false,null);
|
}
|
|
|
|
|
}
|