xuxiuxi
2017-03-23 1c0f255b682a3ff33804f177f5936eb0624555c8
VisitFace/DemoForBsk/app/src/main/java/com/bsk/zhangbo/demoforbsk/service/VisitorTypeMng.java
@@ -10,10 +10,12 @@
import org.xutils.x;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Exchanger;
import cn.com.basic.face.discern.common.BaseCommonCallBack;
import cn.com.basic.face.discern.entity.Person;
@@ -32,8 +34,7 @@
        return instance;
    }
    public static List<String> mVisitorTypeList;
    public static Map<String, String> idMap = new HashMap<String, String>();
    public static List<String> mVisitorTypeList = new ArrayList<String>();
    public void loadAll() {
        loadVisitorTypeList();
@@ -55,15 +56,37 @@
    }
    public void add(Person person, VisitPersonType visitPersonType) {
        RequestParams params = new RequestParams(AppApi.BASEURL+AppApi.PERSON_REGISTER);
        params.addParameter("file1", new File("/storage/emulated/0/send_contact.vcf"));
        params.addParameter("file1", new File("/storage/emulated/0/text_thl.png"));
        x.http().post(params, new BaseCommonCallBack() {
            @Override
            public void success() {
                Toast.makeText(BaseApplication.getApplication(),"", Toast.LENGTH_SHORT).show();
        try {
            File path = BaseApplication.getApplication().getFilesDir();
            File f1 = new File(path, "1.txt");
            if (!f1.exists()) {
                f1.createNewFile();
            }
        });
            File f2 = new File(path, "2.txt");
            if (!f2.exists()) {
                f2.createNewFile();
            }
            FileWriter fw1 = new FileWriter(f1);
            fw1.write("test1");
            fw1.close();
            FileWriter fw2 = new FileWriter(f2);
            fw2.write("test2");
            fw2.close();
            RequestParams params = new RequestParams(AppApi.BASEURL+AppApi.PERSON_REGISTER);
            params.addBodyParameter("file1", f1);
            params.addBodyParameter("file2", f2);
            params.addParameter("name", "张三");
            x.http().post(params, new BaseCommonCallBack() {
                @Override
                public void success() {
                    Toast.makeText(BaseApplication.getApplication(),"添加成功", Toast.LENGTH_SHORT).show();
                }
            });
        }catch(Exception e) {
            e.printStackTrace();
        }
//        params.a
//        x.http().post()