liuxiaolong
2019-05-06 0bc4f4c791437b39b8c30624f5c21f8c855dc61d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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);
    }
 
 
 
 
}