package com.dcsoft.system.face.service.impl;

import com.dcsoft.system.face.service.IAlgoService;
import com.dcsoft.system.utils.HttpUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 用户管理 服务层处理
 *
 * @author xueyi
 */
@Service
public class AlgoServiceImpl implements IAlgoService {


    @Value("${uni.faceUrl}")
    public String uniUrl;


/*    //检测图片
    public String judgeImage(String admitGuids){
        String url=uniUrl+"/algo/wrapper/judgeImage";
        Map<String, Object> paramMap=new HashMap<String, Object>();
        paramMap.put("imageDataBase64",admitGuids);
        String response= HttpUtil.postData(url,null,paramMap);
        return response;
    }*/

    //提取特征值
    public String getFeature(String imageDataUrl){
        String url=uniUrl+"/algo/wrapper/getFeature";
        Map<String, Object> paramMap=new HashMap<String, Object>();
        paramMap.put("faceBoxReq","{'xMax': 0,'xMin': 0,'yMax': 0,'yMin': 0}");
        paramMap.put("featureVersion",0);
        paramMap.put("imageDataUrl",imageDataUrl);
        String response= HttpUtil.postData(url,null,paramMap);
        return response;
    }

    //图片压缩
    public String getSimpleImage(String admitGuids){
        String url=uniUrl+"/algo/wrapper/getSimpleImage";
        Map<String, Object> headMap=new HashMap<String, Object>();
        Map<String, Object> paramMap=new HashMap<String, Object>();
        paramMap.put("admitGuids",admitGuids);
        String response= HttpUtil.postData(url,headMap,paramMap);
        return response;
    }
}
