xuxiuxi
2017-04-11 257bc68fa55f55951c1cf8b7de4045039d27d64e


git-svn-id: http://192.168.1.226/svn/proxy@413 454eff88-639b-444f-9e54-f578c98de674
3个文件已修改
220 ■■■■■ 已修改文件
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/CheckInMng.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/PhoneCallMng.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java
@@ -2,9 +2,11 @@
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Base64;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -32,6 +34,8 @@
import org.xutils.http.RequestParams;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Date;
@@ -72,6 +76,10 @@
    private static final int fragment_register_update_photo_ = 2;
    private static final int fragment_register_id_card_photo_ = 3;
    private Bitmap fragment_register_choose_photo_img;
    private Bitmap fragment_register_update_photo_img;
    private Bitmap fragment_register_id_card_photo_img;
    private static RegisterFragment instance = new RegisterFragment();
    public static RegisterFragment getInstance() {
@@ -89,74 +97,98 @@
    public void fragment_register_add_click(View v) {
        RequestParams params = new RequestParams();
        String name = fragment_register_name.getValue();
        if (name.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "姓名不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_name.requestFocus();
            return;
//        String name = fragment_register_name.getValue();
//        if (name.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "姓名不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_name.requestFocus();
//            return;
//        }
//        String phone = fragment_register_phone.getValue();
//        if (phone.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "电话不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_phone.requestFocus();
//            return;
//        }
//        String gender = fragment_register_gender.getValue();
//        if (gender.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "性别不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_gender.callOnClick();
//            return;
//        }
//        String id_class = fragment_register_id_class.getValue();
//        if (id_class.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "证件类型不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_id_class.callOnClick();
//            return;
//        }
//        String country = fragment_register_country.getValue();
//        if (country.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "国籍不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_country.callOnClick();
//            return;
//        }
//        String id_num = fragment_register_id_num.getValue();
//        if (id_num.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "证件编号不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_id_num.requestFocus();
//            return;
//        }
//        String birthday = fragment_register_birthday.getValue();
//        if (birthday.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "出生日期不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_birthday.callOnClick();
//            return;
//        }
//        String company = fragment_register_company.getValue();
//        if (company.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "公司名称不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_company.requestFocus();
//            return;
//        }
//        String remark = fragment_register_remark.getValue();
//        if (remark.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "备注不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_remark.requestFocus();
//            return;
//        }
//        String visitor_class = fragment_register_visitor_class.getValue();
//        if (visitor_class.trim().length() <= 0) {
//            Toast.makeText(MainActivity.getInstance(), "访客类型不能为空", Toast.LENGTH_SHORT).show();
//            fragment_register_visitor_class.callOnClick();
//            return;
//        }
//        params.addBodyParameter(Register.FieldNames.username, name);
//        params.addBodyParameter(Register.FieldNames.mobilePhone, phone);
//        params.addBodyParameter(Register.FieldNames.genderId, DictionaryMng.getInstance().getId(gender));
//        params.addBodyParameter(Register.FieldNames.identityTypeId, DictionaryMng.getInstance().getId(id_class));
//        params.addBodyParameter(Register.FieldNames.countryId, DictionaryMng.getInstance().getId(country));
//        params.addBodyParameter(Register.FieldNames.identifyNum, id_num);
//        params.addBodyParameter(Register.FieldNames.companyId, company);
//        params.addBodyParameter(Register.FieldNames.birthday, birthday);
        if (fragment_register_choose_photo_img != null) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            fragment_register_choose_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            byte[] imageBytes = byteArrayOutputStream.toByteArray();
            String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
            params.addBodyParameter("choosePhoto", encodedImage);
        }
        String phone = fragment_register_phone.getValue();
        if (phone.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "电话不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_phone.requestFocus();
            return;
        if (fragment_register_update_photo_img != null) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            fragment_register_update_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            byte[] imageBytes = byteArrayOutputStream.toByteArray();
            String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
            params.addBodyParameter("uploadPhoto", encodedImage);
        }
        String gender = fragment_register_gender.getValue();
        if (gender.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "性别不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_gender.callOnClick();
            return;
        if (fragment_register_id_card_photo_img != null) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            fragment_register_id_card_photo_img.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
            byte[] imageBytes = byteArrayOutputStream.toByteArray();
            String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
            params.addBodyParameter("idPhoto", encodedImage);
        }
        String id_class = fragment_register_id_class.getValue();
        if (id_class.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "证件类型不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_id_class.callOnClick();
            return;
        }
        String country = fragment_register_country.getValue();
        if (country.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "国籍不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_country.callOnClick();
            return;
        }
        String id_num = fragment_register_id_num.getValue();
        if (id_num.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "证件编号不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_id_num.requestFocus();
            return;
        }
        String birthday = fragment_register_birthday.getValue();
        if (birthday.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "出生日期不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_birthday.callOnClick();
            return;
        }
        String company = fragment_register_company.getValue();
        if (company.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "公司名称不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_company.requestFocus();
            return;
        }
        String remark = fragment_register_remark.getValue();
        if (remark.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "备注不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_remark.requestFocus();
            return;
        }
        String visitor_class = fragment_register_visitor_class.getValue();
        if (visitor_class.trim().length() <= 0) {
            Toast.makeText(MainActivity.getInstance(), "访客类型不能为空", Toast.LENGTH_SHORT).show();
            fragment_register_visitor_class.callOnClick();
            return;
        }
        params.addBodyParameter(Register.FieldNames.username, name);
        params.addBodyParameter(Register.FieldNames.mobilePhone, phone);
        params.addBodyParameter(Register.FieldNames.genderId, DictionaryMng.getInstance().getId(gender));
        params.addBodyParameter(Register.FieldNames.identityTypeId, DictionaryMng.getInstance().getId(id_class));
        params.addBodyParameter(Register.FieldNames.countryId, DictionaryMng.getInstance().getId(country));
        params.addBodyParameter(Register.FieldNames.identifyNum, id_num);
        params.addBodyParameter(Register.FieldNames.companyId, company);
        params.addBodyParameter(Register.FieldNames.birthday, birthday);
        RegisterMng.getInstance().add(params);
    }
@@ -169,7 +201,8 @@
            try {
                Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);
                fragment_register_choose_photo.setImageBitmap(bitmap);
            } catch (IOException e) {
                fragment_register_choose_photo_img = bitmap;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
@@ -178,7 +211,8 @@
            try {
                Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);
                fragment_register_update_photo.setImageBitmap(bitmap);
            } catch (IOException e) {
                fragment_register_update_photo_img = bitmap;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
@@ -187,7 +221,8 @@
            try {
                Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), uri);
                fragment_register_id_card_photo.setImageBitmap(bitmap);
            } catch (IOException e) {
                fragment_register_id_card_photo_img = bitmap;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/CheckInMng.java
@@ -3,6 +3,7 @@
import android.widget.Toast;
import cn.com.basic.face.base.BaseApplication;
import cn.com.basic.face.discern.query.item.PhoneCallQueryItem;
import cn.com.basic.face.fragment.CheckInFragment;
import cn.com.basic.face.util.AppApi;
@@ -56,8 +57,11 @@
                for (int i = 0; i < list.size(); i++) {
                    CheckInQueryItem item = list.get(i);
                    if (isSortByDept) {
                        name = CharacterParser.getInstance().getSelling(item.getDeptName()).substring(0, 1);
                        if (item.getDeptName() != null && item.getDeptName().length() > 0) {
                            name = CharacterParser.getInstance().getSelling(item.getDeptName()).substring(0, 1);
                        }
                    } else {
                        if (item.getUsername() != null && item.getUsername().length() > 0)
                        name = CharacterParser.getInstance().getSelling(item.getUsername()).substring(0, 1);
                    }
                    if (!name.equals(prev)) {
@@ -83,18 +87,27 @@
                    String dept1Name = t1.getDeptName()==null?"":t1.getDeptName();
                    String dept2Name = t2.getDeptName()==null?"":t2.getDeptName();
                    if(!dept1Name.equals(dept2Name)) {
                        String dept1Name_a = CharacterParser.getInstance().getSelling(dept1Name).toLowerCase();
                        String dept1Name_b = CharacterParser.getInstance().getSelling(dept2Name).toLowerCase();
                        String dept1Name_a = dept1Name.trim();
                        String dept1Name_b = dept2Name.trim();
                        if (dept1Name_a.length() > 0 && dept1Name_b.length() > 0) {
                            dept1Name_a = CharacterParser.getInstance().getSelling(dept1Name).toLowerCase();
                            dept1Name_b = CharacterParser.getInstance().getSelling(dept2Name).toLowerCase();
                        }
                        return dept1Name_a.compareTo(dept1Name_b);
                    }
                }
                String name1 = t1.getUsername()==null?"":t1.getUsername();
                String name2 = t2.getUsername()==null?"":t2.getUsername();
                String dept1Name_a = CharacterParser.getInstance().getSelling(name1).toLowerCase();
                String dept1Name_b = CharacterParser.getInstance().getSelling(name2).toLowerCase();
                String dept1Name_a = name1.trim();
                String dept1Name_b = name2.trim();
                if (dept1Name_a.length() > 0 && dept1Name_b.length() > 0) {
                    dept1Name_a = CharacterParser.getInstance().getSelling(name1).toLowerCase();
                    dept1Name_b = CharacterParser.getInstance().getSelling(name2).toLowerCase();
                }
                return dept1Name_a.compareTo(dept1Name_b);
            }
        });
    }
}
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/PhoneCallMng.java
@@ -28,7 +28,7 @@
        x.http().post(params, new BaseCommonCallBack() {
            public void success() {
                List<PhoneCallQueryItem> list = getList(PhoneCallQueryItem.class);
                //sort(list, isSortByDept);
                sort(list, isSortByDept);
                List allItems = new ArrayList();
                String name = "";
                String prev = "";
@@ -36,9 +36,13 @@
                    PhoneCallQueryItem item = list.get(i);
                    try {
                        if (isSortByDept) {
                            //name = CharacterParser.getInstance().getSelling(item.getDeptName()).substring(0, 1);
                            if (item.getDeptName() != null && item.getDeptName().length() > 0) {
                                name = CharacterParser.getInstance().getSelling(item.getDeptName()).substring(0, 1);
                            }
                        } else {
                            //name = CharacterParser.getInstance().getSelling(item.getUsername()).substring(0, 1);
                            if (item.getUsername() != null && item.getUsername().length() > 0) {
                                name = CharacterParser.getInstance().getSelling(item.getUsername()).substring(0, 1);
                            }
                        }
                    } catch (Exception e) {
@@ -62,15 +66,23 @@
                    String dept1Name = t1.getDeptName()==null?"":t1.getDeptName();
                    String dept2Name = t2.getDeptName()==null?"":t2.getDeptName();
                    if(!dept1Name.equals(dept2Name)) {
                        String dept1Name_a = CharacterParser.getInstance().getSelling(dept1Name).toLowerCase();
                        String dept1Name_b = CharacterParser.getInstance().getSelling(dept2Name).toLowerCase();
                        String dept1Name_a = dept1Name.trim();
                        String dept1Name_b = dept2Name.trim();
                        if (dept1Name_a.length() > 0 && dept1Name_b.length() > 0) {
                            dept1Name_a = CharacterParser.getInstance().getSelling(dept1Name).toLowerCase();
                            dept1Name_b = CharacterParser.getInstance().getSelling(dept2Name).toLowerCase();
                        }
                        return dept1Name_a.compareTo(dept1Name_b);
                    }
                }
                String name1 = t1.getUsername()==null?"":t1.getUsername();
                String name2 = t2.getUsername()==null?"":t2.getUsername();
                String dept1Name_a = CharacterParser.getInstance().getSelling(name1).toLowerCase();
                String dept1Name_b = CharacterParser.getInstance().getSelling(name2).toLowerCase();
                String dept1Name_a = name1.trim();
                String dept1Name_b = name2.trim();
                if (dept1Name_a.length() > 0 && dept1Name_b.length() > 0) {
                    dept1Name_a = CharacterParser.getInstance().getSelling(name1).toLowerCase();
                    dept1Name_b = CharacterParser.getInstance().getSelling(name2).toLowerCase();
                }
                return dept1Name_a.compareTo(dept1Name_b);
            }
        });