Browse Source

增加时间选择器,完成人员信息、人脸提交到服务器并保存到本地,部门、网点数据获取并保存到本地,访客签到、签离逻辑处理

ifengouy 2 years ago
parent
commit
1f10ef3c26
30 changed files with 1571 additions and 220 deletions
  1. 5 1
      app/build.gradle
  2. 1 0
      app/src/main/AndroidManifest.xml
  3. 31 9
      app/src/main/java/com/sunwin/visitorapp/activity/HomeAc.java
  4. 116 0
      app/src/main/java/com/sunwin/visitorapp/activity/VisitSignActivity.java
  5. 196 49
      app/src/main/java/com/sunwin/visitorapp/activity/VisitorRegisterAc.java
  6. 65 0
      app/src/main/java/com/sunwin/visitorapp/adapter/DepartmentAdapter.java
  7. 65 0
      app/src/main/java/com/sunwin/visitorapp/adapter/NetInfoAdapter.java
  8. 70 0
      app/src/main/java/com/sunwin/visitorapp/adapter/VisitSignAdapter.java
  9. 48 9
      app/src/main/java/com/sunwin/visitorapp/db/DatabaseManager.java
  10. 328 0
      app/src/main/java/com/sunwin/visitorapp/db/UserInfoModel.java
  11. 1 0
      app/src/main/java/com/sunwin/visitorapp/face/IdCardReadCallback.java
  12. 39 3
      app/src/main/java/com/sunwin/visitorapp/fragment/HomeFr.java
  13. 76 0
      app/src/main/java/com/sunwin/visitorapp/fragment/VisitSignFragment.java
  14. 4 1
      app/src/main/java/com/sunwin/visitorapp/model/DepartmentResult.java
  15. 85 0
      app/src/main/java/com/sunwin/visitorapp/model/NetInfo.java
  16. 23 0
      app/src/main/java/com/sunwin/visitorapp/net/ApiService.java
  17. 10 0
      app/src/main/java/com/sunwin/visitorapp/net/CommonRequest.java
  18. 65 1
      app/src/main/java/com/sunwin/visitorapp/service/PullDataService.java
  19. 7 1
      app/src/main/java/com/sunwin/visitorapp/utils/BitmapUtils.java
  20. 3 1
      app/src/main/java/com/sunwin/visitorapp/utils/Constant.java
  21. 211 144
      app/src/main/res/layout/ac_visitor_register.xml
  22. 68 0
      app/src/main/res/layout/activity_visit_sign.xml
  23. 1 1
      app/src/main/res/layout/adapter_card.xml
  24. 9 0
      app/src/main/res/layout/adapter_spinner.xml
  25. 20 0
      app/src/main/res/layout/adapter_visit_sign.xml
  26. 4 0
      app/src/main/res/layout/fragment_home.xml
  27. 20 0
      app/src/main/res/layout/fragment_visit_sign.xml
  28. BIN
      app/src/main/res/mipmap-xhdpi/visit_sign_face.png
  29. BIN
      app/src/main/res/mipmap-xhdpi/visit_sign_idcard.png
  30. BIN
      app/src/main/res/mipmap-xhdpi/visit_sign_qrcode.png

+ 5 - 1
app/build.gradle

@@ -11,7 +11,7 @@ android {
         targetSdkVersion 26
         versionCode 1
         versionName "1.0"
-
+        multiDexEnabled true
         vectorDrawables.useSupportLibrary = true
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
@@ -72,4 +72,8 @@ dependencies {
     implementation 'com.ljx.rxlife3:rxlife-rxjava:3.0.0' //管理RxJava3生命周期,页面销毁,关闭请求
     // Okhttp库
 //    implementation 'com.google.code.gson:gson:2.8.5'
+    implementation('com.jzxiang.pickerview:TimePickerDialog:1.0.1') {
+        exclude group: 'com.android.support'
+    }
+    implementation 'com.android.support:appcompat-v7:28.0.0'
 }

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -36,6 +36,7 @@
         <activity android:name=".activity.VisitorRegisterAc" />
         <activity android:name=".activity.SettingAc" />
         <activity android:name=".activity.NoCardRegActivity" />
+        <activity android:name=".activity.VisitSignActivity" />
 
         <service
             android:name=".service.PullDataService"

+ 31 - 9
app/src/main/java/com/sunwin/visitorapp/activity/HomeAc.java

@@ -12,7 +12,7 @@ import com.sunwin.visitorapp.R;
 import com.sunwin.visitorapp.fragment.HomeFr;
 import com.sunwin.visitorapp.utils.Constant;
 
-public class HomeAc extends BaseActivity {
+public class HomeAc extends BaseActivity implements View.OnClickListener {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -20,29 +20,25 @@ public class HomeAc extends BaseActivity {
         setContentView(R.layout.activity_home);
 
 
-        findViewById(R.id.ImageSetting).setOnClickListener(v -> startActivity(new Intent(mContext,SettingAc.class)));
+        findViewById(R.id.ImageSetting).setOnClickListener(v -> startActivity(new Intent(mContext, SettingAc.class)));
 
         FragmentManager fragmentManager = getSupportFragmentManager();
-        FragmentTransaction fragmentTransaction =fragmentManager.beginTransaction();
+        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
         //添加fragment
         fragmentTransaction.add(R.id.FragmentView, new HomeFr());
 
         fragmentTransaction.commit();
         fragmentManager.executePendingTransactions();
 
+        findViewById(R.id.MenuItemRegister).setOnClickListener(this);
+
         findViewById(R.id.MenuItemRegister).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                Intent intent = new Intent(HomeAc.this, VisitorRegActivity.class);
-                intent.putExtra(Constant.IIntentValue.ISLOGINUSER, true);
-                startActivity(intent);
             }
         });
 
 
-
-
-
     }
 
     @Override
@@ -50,4 +46,30 @@ public class HomeAc extends BaseActivity {
         super.onResume();
 
     }
+
+    @Override
+    public void onClick(View view) {
+        Intent intent = null;
+        switch (view.getId()) {
+            case R.id.MenuItemRecord://记录
+                break;
+            case R.id.MenuItemSign://签到
+                intent = new Intent(this, VisitSignActivity.class);
+                intent.putExtra(Constant.IIntentValue.VISIT_TYPE, 1);
+                startActivity(intent);
+                break;
+            case R.id.MenuItemRegister://登记
+                intent = new Intent(this, VisitorRegActivity.class);
+                intent.putExtra(Constant.IIntentValue.ISLOGINUSER, true);
+                startActivity(intent);
+                break;
+            case R.id.MenuItemLeave://签离
+                intent = new Intent(this, VisitSignActivity.class);
+                intent.putExtra(Constant.IIntentValue.VISIT_TYPE, 2);
+                startActivity(intent);
+                break;
+            case R.id.MenuItemCheck://核验
+                break;
+        }
+    }
 }

+ 116 - 0
app/src/main/java/com/sunwin/visitorapp/activity/VisitSignActivity.java

@@ -0,0 +1,116 @@
+package com.sunwin.visitorapp.activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.sunwin.visitorapp.BaseActivity;
+import com.sunwin.visitorapp.BaseApplication;
+import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.db.DatabaseManager;
+import com.sunwin.visitorapp.db.UserInfoModel;
+import com.sunwin.visitorapp.face.CameraPreviewData;
+import com.sunwin.visitorapp.face.IDCardReaderUtil;
+import com.sunwin.visitorapp.face.IdCardReadCallback;
+import com.sunwin.visitorapp.model.OpenDoorByFaceNetResultInfo;
+import com.sunwin.visitorapp.service.PullDataService;
+import com.sunwin.visitorapp.utils.Constant;
+import com.sunwin.visitorapp.utils.LogUtil;
+import com.sunwin.visitorapp.view.FaceDetecterView;
+
+import java.util.List;
+
+/**
+ * 访客签到/签离
+ */
+public class VisitSignActivity extends BaseActivity implements IdCardReadCallback, FaceDetecterView.Listener {
+    private TextView mTvDate;
+    private LinearLayout mLlIdCardReg;
+    private FaceDetecterView mFaceDetecterView;
+
+    private int visitSignType;
+    private IDCardReaderUtil idCardReaderUtil;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_visit_sign);
+        initialData();
+        initView();
+        PullDataService.enqueueWork(this, new Intent());
+    }
+
+    private void initialData() {
+        visitSignType = getIntent().getIntExtra(Constant.IIntentValue.VISIT_SIGN_TYPE, 1);
+    }
+
+    private void initView() {
+        mTvDate = (TextView) findViewById(R.id.tv_date);
+        mLlIdCardReg = (LinearLayout) findViewById(R.id.ll_id_card_reg);
+        mFaceDetecterView = findViewById(R.id.faceDetecterView);
+        mLlIdCardReg.setVisibility(visitSignType == 1 ? View.VISIBLE : View.GONE);
+        mFaceDetecterView.setVisibility(visitSignType == 2 ? View.VISIBLE : View.GONE);
+        if (visitSignType == 1) {
+            idCardReaderUtil = new IDCardReaderUtil(mContext, this);
+            idCardReaderUtil.startRead();
+        } else if (visitSignType == 2) {
+            mFaceDetecterView.config(mContext, this);
+        }
+    }
+
+
+    /**
+     * 读取身份证回调
+     */
+    @Override
+    public void onIdNumRead(String idNum) {
+        LogUtil.e(TAG, "idNum = " + idNum);
+        updataUserInfoByIdNum(idNum);
+
+    }
+
+    private void updataUserInfoByIdNum(String idNum) {
+        List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().query(UserInfoModel.class, "idNum", idNum);
+        if (userInfoModels.size() > 0) {
+            UserInfoModel infoModel = userInfoModels.get(0);
+            infoModel.setState(2);
+            int update = DatabaseManager.getInstance().update(infoModel);
+            LogUtil.e(TAG, "update = " + update);
+        }
+    }
+
+    /**
+     * ------------------FaceDetecterView.Listener 开始------------------------------
+     */
+    @Override
+    public void detectedFace() {
+
+    }
+
+    @Override
+    public void detectedUser(OpenDoorByFaceNetResultInfo openDoorByFaceNetResultInfo) {
+        BaseApplication.getSystemTTS().playText("识别成功");
+        String person_code = openDoorByFaceNetResultInfo.getPerson_code();
+        List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().query(UserInfoModel.class, "personCode", person_code);
+        if (userInfoModels.size() > 0) {
+            UserInfoModel infoModel = userInfoModels.get(0);
+            infoModel.setState(2);
+            int update = DatabaseManager.getInstance().update(infoModel);
+            LogUtil.e(TAG, "update = " + update);
+        } else {
+
+        }
+    }
+
+    @Override
+    public void detecterFail(String st) {
+
+    }
+
+    @Override
+    public void takePic(CameraPreviewData data) {
+
+    }
+}

+ 196 - 49
app/src/main/java/com/sunwin/visitorapp/activity/VisitorRegisterAc.java

@@ -3,7 +3,7 @@ package com.sunwin.visitorapp.activity;
 import android.os.Bundle;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
+import android.widget.AdapterView;
 import android.widget.EditText;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
@@ -12,26 +12,37 @@ import android.widget.TextView;
 
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.request.RequestOptions;
-import com.nostra13.universalimageloader.core.ImageLoader;
+import com.jzxiang.pickerview.TimePickerDialog;
+import com.jzxiang.pickerview.data.Type;
+import com.jzxiang.pickerview.listener.OnDateSetListener;
 import com.sunwin.visitorapp.BaseActivity;
 import com.sunwin.visitorapp.R;
-import com.sunwin.visitorapp.model.UploadRecordResultInfo;
+import com.sunwin.visitorapp.adapter.DepartmentAdapter;
+import com.sunwin.visitorapp.adapter.NetInfoAdapter;
+import com.sunwin.visitorapp.db.DatabaseManager;
+import com.sunwin.visitorapp.db.UserInfoModel;
+import com.sunwin.visitorapp.model.DepartmentResult;
+import com.sunwin.visitorapp.model.NetInfo;
 import com.sunwin.visitorapp.net.ApiService;
 import com.sunwin.visitorapp.net.BaseRsult;
+import com.sunwin.visitorapp.net.CommonRequest;
 import com.sunwin.visitorapp.net.RetrofitUtil;
-import com.sunwin.visitorapp.utils.AppUtil;
+import com.sunwin.visitorapp.utils.BitmapUtils;
 import com.sunwin.visitorapp.utils.Constant;
-import com.sunwin.visitorapp.utils.ConvertUtil;
+import com.sunwin.visitorapp.utils.LogUtil;
 import com.sunwin.visitorapp.utils.TimeUtils;
+import com.sunwin.visitorapp.utils.ToastUtils;
 import com.sunwin.visitorapp.view.UINav;
 
+import java.util.List;
+
 import okhttp3.MediaType;
 import okhttp3.RequestBody;
 import retrofit2.Call;
 import retrofit2.Callback;
 import retrofit2.Response;
 
-public class VisitorRegisterAc extends BaseActivity implements View.OnClickListener {
+public class VisitorRegisterAc extends BaseActivity implements View.OnClickListener, OnDateSetListener, AdapterView.OnItemSelectedListener {
 
     private String currentFacePath;//人脸照片
     private UINav mUINav;
@@ -44,35 +55,52 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
     private EditText mComeReason;
     private EditText mEditCompany;
     private EditText mEditCarPlate;
-    private EditText mEditVisitTimeBegin;
-    private EditText mEditVisitTimeEnd;
+    private TextView mEditVisitTimeBegin;
+    private TextView mEditVisitTimeEnd;
     private EditText mEditVisitNumber;
     private EditText mEditVisitPeopleCount;
     private EditText mEditICCode;
     private LinearLayout mViewFormVisitorBy;
     private EditText mEditByVisitPeople;
-    private EditText mEditByVisitDepartment;
+    private Spinner mEditByVisitDepartment;
     private TextView mTextButtonSure;
+    private TimePickerDialog timePickerDialog;
+    private long tenYears = 10L * 365 * 1000 * 60 * 60 * 24L;
+    private int dateLabel;
+    private List<DepartmentResult> mDepartmentList;
+    private List<NetInfo> mNetInfoList;
+    private Spinner sp_net;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.ac_visitor_register);
+        mDepartmentList = DatabaseManager.getInstance().getQueryAll(DepartmentResult.class);
+        mNetInfoList = DatabaseManager.getInstance().getQueryAll(NetInfo.class);
+
 
         currentFacePath = getIntent().getStringExtra(Constant.IIntentValue.CURRENTFACEPATH);
         UINav uiNav = findViewById(R.id.UINav);
         uiNav.setData(this, "访客登记");
+        initView();
 
         ViewGroup form = findViewById(R.id.ViewForm);
-        setFormEnable(form, false);
+//        setFormEnable(form, false);
         //数据绑定自定义下拉布局文件,并且为每列设置下拉列布局,相当Listview
-        String[] ctype = new String[]{"全部", "电影", "美食", "旅游"};
-        ArrayAdapter<String> adpter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, ctype);
-        adpter.setDropDownViewResource(android.R.layout.simple_spinner_item);
 
+//        String[] ctype = new String[]{"全部", "电影", "美食", "旅游"};
+//        ArrayAdapter<DepartmentResult> adpter = new ArrayAdapter<DepartmentResult>(this, android.R.layout.simple_spinner_item, mDepartmentList);
+//        adpter.setDropDownViewResource(android.R.layout.simple_spinner_item);
 
+        DepartmentAdapter adapter = new DepartmentAdapter(this, mDepartmentList);
+        mEditByVisitDepartment.setAdapter(adapter);
+
+        NetInfoAdapter netInfoAdapter = new NetInfoAdapter(this, mNetInfoList);
+        sp_net.setAdapter(netInfoAdapter);
+
+        mEditByVisitDepartment.setOnItemSelectedListener(this);
+        sp_net.setOnItemSelectedListener(this);
 
-        initView();
     }
 
 
@@ -100,85 +128,143 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
         mViewForm = (LinearLayout) findViewById(R.id.ViewForm);
         mViewFormVisitor = (LinearLayout) findViewById(R.id.ViewFormVisitor);
         mEditPhone = (EditText) findViewById(R.id.EditPhone);
-        mComeReason =  findViewById(R.id.comeReason);
+        mComeReason = findViewById(R.id.comeReason);
         mEditCompany = (EditText) findViewById(R.id.EditCompany);
         mEditCarPlate = (EditText) findViewById(R.id.EditCarPlate);
-        mEditVisitTimeBegin = (EditText) findViewById(R.id.EditVisitTimeBegin);
-        mEditVisitTimeEnd = (EditText) findViewById(R.id.EditVisitTimeEnd);
+        mEditVisitTimeBegin =  findViewById(R.id.EditVisitTimeBegin);
+        mEditVisitTimeEnd =  findViewById(R.id.EditVisitTimeEnd);
         mEditVisitNumber = (EditText) findViewById(R.id.EditVisitNumber);
         mEditVisitPeopleCount = (EditText) findViewById(R.id.EditVisitPeopleCount);
         mEditICCode = (EditText) findViewById(R.id.EditICCode);
         mViewFormVisitorBy = (LinearLayout) findViewById(R.id.ViewFormVisitorBy);
         mEditByVisitPeople = (EditText) findViewById(R.id.EditByVisitPeople);
-        mEditByVisitDepartment = (EditText) findViewById(R.id.EditByVisitDepartment);
+        mEditByVisitDepartment = findViewById(R.id.EditByVisitDepartment);
         findViewById(R.id.TextButtonSure).setOnClickListener(this);
 
-       showHead(currentFacePath,mImageVisitorPhoto);
+        mEditVisitTimeBegin.setOnClickListener(this);
+        mEditVisitTimeEnd.setOnClickListener(this);
+
+        showHead(currentFacePath, mImageVisitorPhoto);
+        sp_net = findViewById(R.id.sp_net);
     }
-    private void showHead(String path,ImageView iv_head) {
+
+    private void showHead(String path, ImageView iv_head) {
         //显示头像
         RequestOptions options = new RequestOptions().placeholder(R.mipmap.icon_head).error(R.mipmap.icon_head).override(160, 160);
         Glide.with(mContext).load(path).apply(options).into(iv_head);
     }
+
     @Override
     public void onClick(View view) {
         switch (view.getId()) {
             case R.id.TextButtonSure:
                 submit();
                 break;
+            case R.id.EditVisitTimeBegin:
+                dateLabel = view.getId();
+                showTimePickDialog();
+                break;
+            case R.id.EditVisitTimeEnd:
+                dateLabel = view.getId();
+                showTimePickDialog();
+                break;
         }
     }
 
     private void submit() {
+        loadingDialog.showLoadingDialog("");
+
         String phone = mEditPhone.getText().toString().trim();
         String idNum = mTextVisitorIdCode.getText().toString().trim();
         String name = mTextVisitorName.getText().toString().trim();
         String cardNum = mEditICCode.getText().toString().trim();
-        String comeReason = mComeReason.getText().toString().trim();
-        String company = mEditCompany.getText().toString().trim();
+
         String carPlate = mEditCarPlate.getText().toString().trim();
         String startTime = mEditVisitTimeBegin.getText().toString().trim();
         String endTime = mEditVisitTimeEnd.getText().toString().trim();
         String visitNum = mEditVisitNumber.getText().toString().trim();
         String visitPeopleNum = mEditVisitPeopleCount.getText().toString().trim();
         String theVisitPerson = mEditByVisitPeople.getText().toString().trim();
-        String theVisitDpt = mEditByVisitDepartment.getText().toString().trim();
-
-
-        UploadRecordResultInfo.Request parms = new UploadRecordResultInfo.Request();
-//        parms.setTime(TimeUtils.stampToTime(System.currentTimeMillis()));
-//        parms.setDeviceId(AppUtil.getDeviceId());
-//        parms.setInout_flag(1);
-//        parms.setCardNo(cardNum);
-//        parms.setPersonId(resultInfo.getPersonId());
-//
-//        parms.setDeptId(resultInfo.getDepartmentId());
-//        parms.setCategoryId(resultInfo.getCategoryId());
-//        parms.setPersonName(name);
-//        parms.setPersonCode(idNum);
-//        parms.setType();//4刷身份证通过 //6访客通过
-//
-//        parms.setThreshold("70");//
-//        parms.setTemperature("37");
-//        String imaCode = ConvertUtil.bitmapToBase64(ImageLoader.getInstance().loadImageSync(resultInfo.getImageUrl()));
-//        parms.setImgCode(imaCode);
-//        if (!StringUtils.isEmpty(resultInfo.getImageUrl2())) {
-//            String imaCode2 = ConvertUtil.bitmapToBase64(ImageLoader.getInstance().loadImageSync(resultInfo.getImageUrl2()));
-//            parms.setImgCode2(imaCode2);
-//        }
+
+        String comeReason = mComeReason.getText().toString().trim();
+        String company = mEditCompany.getText().toString().trim();
+
+        idNum = "330101199011112580";
+        UserInfoModel infoModel = new UserInfoModel();
+        infoModel.setPhone(phone);
+        infoModel.setVisitorLpCode(carPlate);
+        infoModel.setPostDate(startTime);
+        infoModel.setLostDate(endTime);
+        infoModel.setCardNo(cardNum);
+        infoModel.setIdNum(idNum);
+        infoModel.setStatus(-2);
+        infoModel.setType(2);
+        infoModel.setPersonName(name);
+        infoModel.setDeptId(deptNo+"");
+        infoModel.setCategoryId(categoryId);
+
 
         ApiService apiService = RetrofitUtil.getApiService();
         MediaType textType = MediaType.parse("text/plain");
-        final RequestBody requestBody = RequestBody.create(textType, RetrofitUtil.bean2Json(parms));
-        Call<BaseRsult<String>> call = apiService.uploadRecord(requestBody);
+        final RequestBody requestBody = RequestBody.create(textType, RetrofitUtil.bean2Json(infoModel));
+        Call<BaseRsult<String>> call = apiService.saveOrUpdatePersonInfo(requestBody);
         call.enqueue(new Callback<BaseRsult<String>>() {
             @Override
             public void onResponse(Call<BaseRsult<String>> call, Response<BaseRsult<String>> response) {
                 try {
                     if (response.body() == null) {
+                        ToastUtils.showToast("保存失败");
+                        loadingDialog.dismissLoadingDialog();
                         return;
                     }
                     int code = response.body().getCode();
+                    LogUtil.e(TAG, "--code--" + code);
+                    if (code == 0) {
+                        String result = response.body().getResult();
+                        addFace(currentFacePath, result);
+                        //存入数据库
+                        long insert = DatabaseManager.getInstance().insert(infoModel);
+                        LogUtil.e(TAG, "存入用户" + insert);
+                    } else {
+                        loadingDialog.dismissLoadingDialog();
+                        ToastUtils.showToast("保存失败");
+                    }
+
+                } catch (Exception e) {
+
+                }
+            }
+
+            @Override
+            public void onFailure(Call<BaseRsult<String>> call, Throwable t) {
+                ToastUtils.showToast("保存失败");
+                loadingDialog.dismissLoadingDialog();
+            }
+        });
+    }
+
+
+    private void addFace(String filePath, String personId) {
+        ApiService apiService = RetrofitUtil.getApiService();
+        MediaType textType = MediaType.parse("text/plain");
+        String s = BitmapUtils.scaleBitmap(filePath);
+        CommonRequest request = new CommonRequest();
+        request.setImgCode(s);
+        request.setPersonId(personId);
+
+        final RequestBody requestBody = RequestBody.create(textType, RetrofitUtil.bean2Json(request));
+        Call<BaseRsult> call = apiService.addFaceByCode(requestBody);
+        call.enqueue(new Callback<BaseRsult>() {
+            @Override
+            public void onResponse(Call<BaseRsult> call, Response<BaseRsult> response) {
+                try {
+                    loadingDialog.dismissLoadingDialog();
+
+                    if (response.body() == null) {
+                        return;
+                    }
+                    int code = response.body().getCode();
+                    LogUtil.e(TAG, "--code--" + code);
                     if (code == 0) {
 
                     } else {
@@ -191,11 +277,72 @@ public class VisitorRegisterAc extends BaseActivity implements View.OnClickListe
             }
 
             @Override
-            public void onFailure(Call<BaseRsult<String>> call, Throwable t) {
+            public void onFailure(Call<BaseRsult> call, Throwable t) {
+                loadingDialog.dismissLoadingDialog();
 
             }
         });
     }
 
+    /**
+     * 底部弹出时间选择框
+     */
+    private void showTimePickDialog() {
+        if (timePickerDialog == null) {
+            timePickerDialog = new TimePickerDialog.Builder()
+                    .setCallBack(this)
+                    .setCancelStringId("取消")
+                    .setSureStringId("确定")
+                    .setTitleStringId("设置日期时间")
+                    .setYearText("年")
+                    .setMonthText("月")
+                    .setDayText("日")
+                    .setCyclic(false)
+                    .setMinMillseconds(System.currentTimeMillis() - tenYears)
+                    .setMaxMillseconds(System.currentTimeMillis())
+                    .setCurrentMillseconds(System.currentTimeMillis())
+                    .setThemeColor(getResources().getColor(R.color.timepicker_dialog_bg))
+                    .setType(Type.YEAR_MONTH_DAY)
+                    .setWheelItemTextNormalColor(getResources().getColor(R.color.timetimepicker_default_text_color))
+                    .setWheelItemTextSelectorColor(getResources().getColor(R.color.black))
+                    .setWheelItemTextSize(12)
+                    .build();
+        }
+        timePickerDialog.show(getSupportFragmentManager(), "all");
+    }
+
+    @Override
+    public void onDateSet(TimePickerDialog timePickerView, long millseconds) {
+        String dateTime = TimeUtils.stampToDate(millseconds);
+        switch (dateLabel) {
+            case R.id.EditVisitTimeBegin:
+                mEditVisitTimeBegin.setText(dateTime);
+                break;
+            case R.id.EditVisitTimeEnd:
+                mEditVisitTimeEnd.setText(dateTime);
+                break;
+        }
+    }
+
+    String categoryId;
+    int deptNo;
+
+    @Override
+    public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
+        switch (adapterView.getId()) {
+            case R.id.EditByVisitDepartment:
+                DepartmentResult departmentResult = mDepartmentList.get(i);
+                categoryId = departmentResult.getCategoryId();
+                break;
+            case R.id.sp_net:
+                NetInfo netInfo = mNetInfoList.get(i);
+                deptNo = netInfo.getId();
+                break;
+        }
+    }
+
+    @Override
+    public void onNothingSelected(AdapterView<?> adapterView) {
 
+    }
 }

+ 65 - 0
app/src/main/java/com/sunwin/visitorapp/adapter/DepartmentAdapter.java

@@ -0,0 +1,65 @@
+package com.sunwin.visitorapp.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.model.DepartmentResult;
+
+import java.util.List;
+
+public class DepartmentAdapter extends BaseAdapter {
+
+    private final LayoutInflater inflater;
+    private List<DepartmentResult> mList;
+    private Context mContext;
+
+    public DepartmentAdapter(Context pContext, List<DepartmentResult> pList) {
+        this.mContext = pContext;
+        this.mList = pList;
+        inflater = LayoutInflater.from(pContext);
+    }
+
+    @Override
+    public int getCount() {
+        return mList.size();
+    }
+
+    @Override
+    public Object getItem(int position) {
+        return mList.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int i, View convertView, ViewGroup viewGroup) {
+        ViewHolder holder = null;
+        if (convertView == null) {
+            convertView = inflater.inflate(R.layout.adapter_spinner, viewGroup, false);
+            holder = new ViewHolder(convertView);
+            convertView.setTag(holder);
+        } else {
+            holder = (ViewHolder) convertView.getTag();
+        }
+        holder.tv.setText(mList.get(i).getCategoryName());
+        return convertView;
+    }
+
+    public static class ViewHolder {
+        public TextView tv;
+
+        public ViewHolder(View rootView) {
+            this.tv = rootView.findViewById(R.id.tv);
+        }
+
+    }
+}

+ 65 - 0
app/src/main/java/com/sunwin/visitorapp/adapter/NetInfoAdapter.java

@@ -0,0 +1,65 @@
+package com.sunwin.visitorapp.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.model.DepartmentResult;
+import com.sunwin.visitorapp.model.NetInfo;
+
+import java.util.List;
+
+public class NetInfoAdapter extends BaseAdapter {
+
+    private final LayoutInflater inflater;
+    private List<NetInfo> mList;
+    private Context mContext;
+
+    public NetInfoAdapter(Context pContext, List<NetInfo> pList) {
+        this.mContext = pContext;
+        this.mList = pList;
+        inflater = LayoutInflater.from(pContext);
+    }
+
+    @Override
+    public int getCount() {
+        return mList.size();
+    }
+
+    @Override
+    public Object getItem(int position) {
+        return mList.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int i, View convertView, ViewGroup viewGroup) {
+        ViewHolder holder = null;
+        if (convertView == null) {
+            convertView = inflater.inflate(R.layout.adapter_spinner, viewGroup, false);
+            holder = new ViewHolder(convertView);
+            convertView.setTag(holder);
+        } else {
+            holder = (ViewHolder) convertView.getTag();
+        }
+        holder.tv.setText(mList.get(i).getDeptName());
+        return convertView;
+    }
+
+    public static class ViewHolder {
+        public TextView tv;
+
+        public ViewHolder(View rootView) {
+            this.tv = rootView.findViewById(R.id.tv);
+        }
+
+    }
+}

+ 70 - 0
app/src/main/java/com/sunwin/visitorapp/adapter/VisitSignAdapter.java

@@ -0,0 +1,70 @@
+package com.sunwin.visitorapp.adapter;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.sunwin.visitorapp.BaseApplication;
+import com.sunwin.visitorapp.R;
+
+import java.util.List;
+
+public class VisitSignAdapter extends BaseAdapter {
+    LayoutInflater inflater;
+    private List<String> itemList;
+    private List<Integer> iconRes;
+
+    public VisitSignAdapter(List<String> itemList, List<Integer> iconRes) {
+        this.itemList = itemList;
+        this.iconRes = iconRes;
+        inflater = LayoutInflater.from(BaseApplication.getInstance());
+    }
+
+
+    @Override
+    public int getCount() {
+        return itemList.size();
+    }
+
+    @Override
+    public Object getItem(int position) {
+        return itemList.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        ViewHolder holder = null;
+        if (convertView == null) {
+            convertView = inflater.inflate(R.layout.adapter_card, parent, false);
+            holder = new ViewHolder(convertView);
+            convertView.setTag(holder);
+        } else {
+            holder = (ViewHolder) convertView.getTag();
+        }
+
+        holder.item_desc.setText(itemList.get(position));
+        holder.item_icon.setImageResource(iconRes.get(position));
+
+        return convertView;
+    }
+
+
+    public static class ViewHolder {
+        public ImageView item_icon;
+        public TextView item_desc;
+
+        public ViewHolder(View rootView) {
+            this.item_icon = rootView.findViewById(R.id.item_icon);
+            this.item_desc = rootView.findViewById(R.id.item_desc);
+        }
+
+    }
+}

+ 48 - 9
app/src/main/java/com/sunwin/visitorapp/db/DatabaseManager.java

@@ -1,8 +1,11 @@
 package com.sunwin.visitorapp.db;
 
 import com.litesuits.orm.LiteOrm;
+import com.litesuits.orm.db.assit.QueryBuilder;
 import com.sunwin.visitorapp.BaseApplication;
+import com.sunwin.visitorapp.model.NetInfo;
 
+import java.util.ArrayList;
 import java.util.List;
 
 public class DatabaseManager {
@@ -11,7 +14,7 @@ public class DatabaseManager {
     private static DatabaseManager ourInstance = new DatabaseManager();
 
     private DatabaseManager() {
-        liteOrm = LiteOrm.newCascadeInstance( BaseApplication.getInstance() , dbName ) ;
+        liteOrm = LiteOrm.newCascadeInstance(BaseApplication.getInstance(), dbName);
     }
 
     public static DatabaseManager getInstance() {
@@ -20,6 +23,7 @@ public class DatabaseManager {
 
     /**
      * 插入一条记录
+     *
      * @param t
      */
     public <T> long insert(T t) {
@@ -28,6 +32,7 @@ public class DatabaseManager {
 
     /**
      * 插入所有记录
+     *
      * @param list
      */
     public <T> void insertAll(List<T> list) {
@@ -36,6 +41,7 @@ public class DatabaseManager {
 
     /**
      * 查询所有
+     *
      * @param cla
      * @return
      */
@@ -43,6 +49,20 @@ public class DatabaseManager {
         return liteOrm.query(cla);
     }
 
+    public static <T> ArrayList<T> queryAllOrder(Class<T> cla) {
+        return liteOrm.query(new QueryBuilder(cla).orderBy("updateTime"));
+    }
+
+    public static NetInfo queryNetInfo(int departmentId) {
+
+        final ArrayList<NetInfo> list = liteOrm.query(new QueryBuilder(NetInfo.class).whereEquals("id", departmentId));
+        if (list == null || list.size() == 0) {
+            return null;
+        }
+        return list.get(0);
+    }
+
+
     /**
      * 查询  某字段 等于 Value的值
      * @param cla
@@ -69,35 +89,54 @@ public class DatabaseManager {
 
     /**
      * 删除一个数据
+     *
      * @param t
      * @param <T>
      */
-    public <T> void delete( T t){
-        liteOrm.delete( t ) ;
+    public <T> void delete(T t) {
+        liteOrm.delete(t);
     }
 
     /**
      * 删除一个表
+     *
      * @param cla
      * @param <T>
      */
-    public <T> void delete( Class<T> cla ){
-        liteOrm.delete( cla ) ;
+    public <T> void delete(Class<T> cla) {
+        liteOrm.delete(cla);
     }
 
     /**
      * 删除集合中的数据
+     *
      * @param list
      * @param <T>
      */
-    public <T> void deleteList( List<T> list ){
-        liteOrm.delete( list ) ;
+    public <T> void deleteList(List<T> list) {
+        liteOrm.delete(list);
     }
 
     /**
      * 删除数据库
      */
-    public void deleteDatabase(){
-        liteOrm.deleteDatabase() ;
+    public void deleteDatabase() {
+        liteOrm.deleteDatabase();
+    }
+
+    /**
+     * 修改数据
+     */
+    public <T> int update(T t) {
+        return liteOrm.update(t);
+    }
+
+
+    /**
+     * 查询 某字段 等于 Value的值
+     */
+    public <T> List<T> query(Class<T> cla, String key, String value) {
+        return liteOrm.query(new QueryBuilder<T>(cla)
+                .whereEquals(key, value));
     }
 }

+ 328 - 0
app/src/main/java/com/sunwin/visitorapp/db/UserInfoModel.java

@@ -0,0 +1,328 @@
+package com.sunwin.visitorapp.db;
+
+import com.litesuits.orm.db.annotation.PrimaryKey;
+import com.litesuits.orm.db.annotation.Table;
+import com.litesuits.orm.db.enums.AssignType;
+
+@Table("user_table")
+public class UserInfoModel {
+    @PrimaryKey(AssignType.BY_MYSELF)
+    private String personId;
+    private String openid;// 绑定微信公众号的openid
+    private String proOpenid;// 绑定微信小程序的openid
+
+    private String personCode;
+    private String personName;
+    private String postDate;
+    private String lostDate;
+
+    private int status;//默认0,修改1,删除-1,待审核-2,审核未通过-3
+
+    private int state;//1 预约 2在访 3签离
+
+    public int getState() {
+        return state;
+    }
+
+    public void setState(int state) {
+        this.state = state;
+    }
+
+    private long updateTime;
+
+    private String idNum;
+    private int sex; //0女,1男
+    private String birthday;
+    private String phone;
+    private String email;
+
+    private String deptId;//网点ID,关联dept表
+    private String deviceId;//设备ID,关联device表
+
+    private String cardNo;    //卡号
+    private String note;     //备注
+
+    private int type;     //入库类型(0:页面添加;1:批量导入;2:设备申请录入)
+    private int userId; //绑定的系统登录账号id
+    private String pwd;     //人员密码
+
+    public String getPersonId() {
+        return personId;
+    }
+
+    public void setPersonId(String personId) {
+        this.personId = personId;
+    }
+
+    public String getOpenid() {
+        return openid;
+    }
+
+    public void setOpenid(String openid) {
+        this.openid = openid;
+    }
+
+    public String getProOpenid() {
+        return proOpenid;
+    }
+
+    public void setProOpenid(String proOpenid) {
+        this.proOpenid = proOpenid;
+    }
+
+    public String getPersonCode() {
+        return personCode;
+    }
+
+    public void setPersonCode(String personCode) {
+        this.personCode = personCode;
+    }
+
+    public String getPersonName() {
+        return personName;
+    }
+
+    public void setPersonName(String personName) {
+        this.personName = personName;
+    }
+
+    public String getPostDate() {
+        return postDate;
+    }
+
+    public void setPostDate(String postDate) {
+        this.postDate = postDate;
+    }
+
+    public String getLostDate() {
+        return lostDate;
+    }
+
+    public void setLostDate(String lostDate) {
+        this.lostDate = lostDate;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public long getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(long updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getIdNum() {
+        return idNum;
+    }
+
+    public void setIdNum(String idNum) {
+        this.idNum = idNum;
+    }
+
+    public int getSex() {
+        return sex;
+    }
+
+    public void setSex(int sex) {
+        this.sex = sex;
+    }
+
+    public String getBirthday() {
+        return birthday;
+    }
+
+    public void setBirthday(String birthday) {
+        this.birthday = birthday;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(String deptId) {
+        this.deptId = deptId;
+    }
+
+    public String getDeviceId() {
+        return deviceId;
+    }
+
+    public void setDeviceId(String deviceId) {
+        this.deviceId = deviceId;
+    }
+
+    public String getCardNo() {
+        return cardNo;
+    }
+
+    public void setCardNo(String cardNo) {
+        this.cardNo = cardNo;
+    }
+
+    public String getNote() {
+        return note;
+    }
+
+    public void setNote(String note) {
+        this.note = note;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public int getUserId() {
+        return userId;
+    }
+
+    public void setUserId(int userId) {
+        this.userId = userId;
+    }
+
+    public String getPwd() {
+        return pwd;
+    }
+
+    public void setPwd(String pwd) {
+        this.pwd = pwd;
+    }
+
+    public String getJsId() {
+        return jsId;
+    }
+
+    public void setJsId(String jsId) {
+        this.jsId = jsId;
+    }
+
+    public int getJsStatus() {
+        return jsStatus;
+    }
+
+    public void setJsStatus(int jsStatus) {
+        this.jsStatus = jsStatus;
+    }
+
+    public int getJsUploadflag() {
+        return jsUploadflag;
+    }
+
+    public void setJsUploadflag(int jsUploadflag) {
+        this.jsUploadflag = jsUploadflag;
+    }
+
+    public String getComposeId() {
+        return composeId;
+    }
+
+    public void setComposeId(String composeId) {
+        this.composeId = composeId;
+    }
+
+    public int getTag() {
+        return tag;
+    }
+
+    public void setTag(int tag) {
+        this.tag = tag;
+    }
+
+    public String getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(String categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public String getDeviceIdfrom() {
+        return deviceIdfrom;
+    }
+
+    public void setDeviceIdfrom(String deviceIdfrom) {
+        this.deviceIdfrom = deviceIdfrom;
+    }
+
+    public String getInoutRuleId() {
+        return inoutRuleId;
+    }
+
+    public void setInoutRuleId(String inoutRuleId) {
+        this.inoutRuleId = inoutRuleId;
+    }
+
+    public String getCardNo2() {
+        return cardNo2;
+    }
+
+    public void setCardNo2(String cardNo2) {
+        this.cardNo2 = cardNo2;
+    }
+
+    public Integer getIsUse() {
+        return isUse;
+    }
+
+    public void setIsUse(Integer isUse) {
+        this.isUse = isUse;
+    }
+
+    public String getInLpCode() {
+        return inLpCode;
+    }
+
+    public void setInLpCode(String inLpCode) {
+        this.inLpCode = inLpCode;
+    }
+
+    public String getVisitorLpCode() {
+        return visitorLpCode;
+    }
+
+    public void setVisitorLpCode(String visitorLpCode) {
+        this.visitorLpCode = visitorLpCode;
+    }
+
+    private String jsId;     //对接吉首工地:吉首人员标志
+    private int jsStatus;    //对接吉首工地使用(0:吉首系统不存在;1:吉首系统已存在)
+    private int jsUploadflag; //对接吉首使用(0:该人员的照片未上传;1:该人的照片已上传)
+
+    private String composeId;   //所属分组
+    private int tag;            //批量导入的部门标识
+    private String categoryId;   //人员部门
+    private String deviceIdfrom;   //申请设备,设备源
+    private String inoutRuleId;   //进出的规则
+
+    private String cardNo2;// 第二张卡, 胁迫卡
+
+    private Integer isUse;//是否可用  0:禁用   1:可用
+    private String inLpCode;
+    private String visitorLpCode;
+}

+ 1 - 0
app/src/main/java/com/sunwin/visitorapp/face/IdCardReadCallback.java

@@ -3,5 +3,6 @@ package com.sunwin.visitorapp.face;
 import android.graphics.Bitmap;
 
 public interface IdCardReadCallback {
+    /**运行在子线程*/
     void onIdNumRead(String idNum);
 }

+ 39 - 3
app/src/main/java/com/sunwin/visitorapp/fragment/HomeFr.java

@@ -4,22 +4,58 @@ import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
 
+import com.sunwin.visitorapp.BaseFragment;
 import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.db.DatabaseManager;
+import com.sunwin.visitorapp.db.UserInfoModel;
 
-public class HomeFr extends Fragment {
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class HomeFr extends BaseFragment {
 
     private View root;
+    private ImageView mImageHome;
+    private TextView mTvTodayReg;
+    private TextView mTvOnVisit;
+    private TextView mTvLeave;
+
     @Nullable
     @Override
     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 
-        if(root==null)root = inflater.inflate(R.layout.fragment_home,container,false);
+        if (root == null) {
+            root = inflater.inflate(R.layout.fragment_home, container, false);
+        }
 
         return root;
     }
+
+    @Override
+    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        initView(view);
+        initData();
+    }
+
+    private void initData() {
+        List<UserInfoModel> userInfoModels = DatabaseManager.getInstance().getQueryAll(UserInfoModel.class);
+        if (userInfoModels != null & userInfoModels.size() > 0) {
+
+        }
+    }
+
+    private void initView(View view) {
+        mImageHome = view.findViewById(R.id.ImageHome);
+        mTvTodayReg = view.findViewById(R.id.tv_today_reg);
+        mTvOnVisit = view.findViewById(R.id.tv_on_visit);
+        mTvLeave = view.findViewById(R.id.tv_leave);
+    }
 }

+ 76 - 0
app/src/main/java/com/sunwin/visitorapp/fragment/VisitSignFragment.java

@@ -0,0 +1,76 @@
+package com.sunwin.visitorapp.fragment;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import com.sunwin.visitorapp.BaseFragment;
+import com.sunwin.visitorapp.R;
+import com.sunwin.visitorapp.adapter.VisitSignAdapter;
+import com.sunwin.visitorapp.view.MyGridView;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+
+public class VisitSignFragment extends BaseFragment implements AdapterView.OnItemClickListener {
+    private MyGridView mGridview;
+    private ArrayList<String> itemList;
+    private ArrayList<Integer> iconList;
+
+    @Nullable
+    @Override
+    public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
+        View view = inflater.inflate(R.layout.fragment_visit_sign, container, false);
+
+
+        return view;
+    }
+
+    @Override
+    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        initView(view);
+        initData();
+    }
+
+
+    private void initData() {
+        itemList = new ArrayList<>();
+        iconList = new ArrayList<>();
+        itemList.add("身份证");
+        itemList.add("人脸");
+        itemList.add("二维码");
+        iconList.add(R.mipmap.visit_sign_idcard);
+        iconList.add(R.mipmap.visit_sign_face);
+        iconList.add(R.mipmap.visit_sign_qrcode);
+       /* if (isLoginUser) {
+            itemList.add("驾驶证");
+            iconList.add(R.mipmap.visitor_reg_default);
+        }*/
+    }
+
+    private void initView(@NotNull View view) {
+        mGridview = view.findViewById(R.id.gridview);
+        VisitSignAdapter mAdapter = new VisitSignAdapter(itemList, iconList);
+        mGridview.setAdapter(mAdapter);
+        mGridview.setOnItemClickListener(this);
+    }
+
+    @Override
+    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+        switch (i) {
+            case 0:
+                break;
+            case 1:
+                break;
+            case 2:
+                break;
+        }
+    }
+}

+ 4 - 1
app/src/main/java/com/sunwin/visitorapp/model/DepartmentResult.java

@@ -1,9 +1,11 @@
 package com.sunwin.visitorapp.model;
 
+import com.litesuits.orm.db.annotation.PrimaryKey;
 import com.litesuits.orm.db.annotation.Table;
+import com.litesuits.orm.db.enums.AssignType;
 
 @Table("depart_table")
-public class DepartmentResult{
+public class DepartmentResult {
 
     /**
      * categoryCode : DANGWEI
@@ -14,6 +16,7 @@ public class DepartmentResult{
      */
 
     private String categoryCode;
+    @PrimaryKey(AssignType.BY_MYSELF)
     private String categoryId;
     private String categoryName;
     private int status;

+ 85 - 0
app/src/main/java/com/sunwin/visitorapp/model/NetInfo.java

@@ -0,0 +1,85 @@
+package com.sunwin.visitorapp.model;
+
+public class NetInfo {
+    /**
+     * id : 1
+     * deptNo : SW001
+     * deptName : 赛为智能股份有限公司
+     * parentId : 0
+     * level : 0
+     * note :
+     */
+
+    private int id;
+    private String deptNo;
+    private String deptName;
+    private int parentId;
+    private int level;
+    private String note;
+    int status;
+    long updateTime;
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public long getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(long updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getDeptNo() {
+        return deptNo;
+    }
+
+    public void setDeptNo(String deptNo) {
+        this.deptNo = deptNo;
+    }
+
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
+    public int getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(int parentId) {
+        this.parentId = parentId;
+    }
+
+    public int getLevel() {
+        return level;
+    }
+
+    public void setLevel(int level) {
+        this.level = level;
+    }
+
+    public String getNote() {
+        return note;
+    }
+
+    public void setNote(String note) {
+        this.note = note;
+    }
+}

+ 23 - 0
app/src/main/java/com/sunwin/visitorapp/net/ApiService.java

@@ -1,6 +1,7 @@
 package com.sunwin.visitorapp.net;
 
 import com.sunwin.visitorapp.model.DepartmentResult;
+import com.sunwin.visitorapp.model.NetInfo;
 
 import java.util.List;
 
@@ -16,9 +17,31 @@ public interface ApiService {
     Call<BaseRsult<String>> uploadRecord(@Body RequestBody body);
 
     /**
+     * saveOrUpdatePersonInfo新增或修改人员信息;Person对象,personId不为空为更新否则新增
+     */
+    @POST("saveOrUpdatePersonInfo")
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    Call<BaseRsult<String>> saveOrUpdatePersonInfo(@Body RequestBody body);
+
+    /**
+     * /addFaceByCode;添加人脸,参数personId, imgCode 图片base64码;
+     */
+    @POST("addFaceByCode")
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    Call<BaseRsult> addFaceByCode(@Body RequestBody body);
+
+    /**
      * 获取所有部门
      */
     @POST("syncCategorys")
     @Headers({"Content-Type: application/json", "Accept: application/json"})
     Call<BaseRsult<List<DepartmentResult>>> getDepartments(@Body RequestBody body);
+
+
+    /**
+     * 获取网点信息
+     */
+    @POST("queryDeptInfos")
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    Call<BaseRsult<List<NetInfo>>> getAllNets(@Body RequestBody body);
 }

+ 10 - 0
app/src/main/java/com/sunwin/visitorapp/net/CommonRequest.java

@@ -6,6 +6,16 @@ public class CommonRequest { private long time;
 
     private String personId;//人员id ,
     private String cardNo;//卡号
+
+    public String getImgCode() {
+        return imgCode;
+    }
+
+    public void setImgCode(String imgCode) {
+        this.imgCode = imgCode;
+    }
+
+    private String imgCode;//卡号
     private int type;//卡号
 
 

+ 65 - 1
app/src/main/java/com/sunwin/visitorapp/service/PullDataService.java

@@ -8,16 +8,19 @@ import androidx.core.app.JobIntentService;
 
 import com.sunwin.visitorapp.db.DatabaseManager;
 import com.sunwin.visitorapp.model.DepartmentResult;
+import com.sunwin.visitorapp.model.NetInfo;
 import com.sunwin.visitorapp.net.ApiService;
 import com.sunwin.visitorapp.net.BaseRsult;
 import com.sunwin.visitorapp.net.CommonRequest;
 import com.sunwin.visitorapp.net.RetrofitUtil;
 import com.sunwin.visitorapp.utils.AppUtil;
+import com.sunwin.visitorapp.utils.Constant;
 import com.sunwin.visitorapp.utils.LogUtil;
 import com.sunwin.visitorapp.utils.SharePrefenceUtils;
 
 import org.jetbrains.annotations.NotNull;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import okhttp3.MediaType;
@@ -45,6 +48,7 @@ public class PullDataService extends JobIntentService {
 
     private void getDataFromNet() {
         getDepartments();
+        getNets();
     }
 
     private void getDepartments() {
@@ -77,7 +81,7 @@ public class PullDataService extends JobIntentService {
                         SharePrefenceUtils.putLong("categorys_refreshTime", list.get(list.size() - 1).getUpdateTime());
                     }
                 } catch (Exception e) {
-
+                    e.printStackTrace();
                 }
             }
 
@@ -87,4 +91,64 @@ public class PullDataService extends JobIntentService {
             }
         });
     }
+
+    /**
+     * 获取 所有网点
+     */
+    private void getNets() {
+        final ArrayList<NetInfo> netInfos = DatabaseManager.getInstance().queryAllOrder(NetInfo.class);
+        long time = 0;
+        if (netInfos != null && netInfos.size() > 0) {
+            time = netInfos.get(0).getUpdateTime();
+        }
+        MediaType textType = MediaType.parse("text/plain");
+        RequestBody requestBody = RequestBody.create(textType, RetrofitUtil.bean2Json(new CommonRequest(time, 100,AppUtil.getDeviceId())));
+
+        ApiService apiService = RetrofitUtil.getApiService();
+        Call<BaseRsult<List<NetInfo>>> call = apiService.getAllNets(requestBody);
+        call.enqueue(new Callback<BaseRsult<List<NetInfo>>>() {
+            @Override
+            public void onResponse(Call<BaseRsult<List<NetInfo>>> call, Response<BaseRsult<List<NetInfo>>> response) {
+                try {
+                    if (response.body() == null) {
+                        return;
+                    }
+                    if (response.body().getCode() != 0) {
+                        return;
+                    }
+
+                    ArrayList<NetInfo> list = (ArrayList<NetInfo>) response.body().getResult();
+                    if (list != null && list.size() > 0) {
+
+                        for (NetInfo resultBean : list) {
+                            if (resultBean.getStatus() == 0 || resultBean.getStatus() == 1) {
+                                if (netInfos != null && netInfos.size() > 0) {
+                                    NetInfo firstDepart = netInfos.get(0);
+                                    //确保只会有一个所诉部门
+                                    if (firstDepart != null && resultBean.getId() != firstDepart.getId()) {
+                                        DatabaseManager.getInstance().delete(firstDepart);
+                                    }
+                                }
+                                DatabaseManager.getInstance().insert(resultBean);
+
+                            } else if (resultBean.getStatus() == -1) {
+                                NetInfo departmentModel = DatabaseManager.getInstance().queryNetInfo(resultBean.getId());
+                                if (departmentModel != null) {
+                                   DatabaseManager.getInstance().delete(departmentModel);
+                                }
+                            }
+                            SharePrefenceUtils.putLong("department_refreshTime", list.get(list.size() - 1).getUpdateTime());
+                        }
+                    }
+                } catch (Exception e) {
+
+                }
+            }
+
+            @Override
+            public void onFailure(Call<BaseRsult<List<NetInfo>>> call, Throwable t) {
+
+            }
+        });
+    }
 }

+ 7 - 1
app/src/main/java/com/sunwin/visitorapp/utils/BitmapUtils.java

@@ -35,6 +35,7 @@ import android.util.Log;
 import android.view.View;
 
 import com.guo.android_extend.java.ExtByteArrayOutputStream;
+import com.nostra13.universalimageloader.core.ImageLoader;
 
 import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
@@ -1592,5 +1593,10 @@ public class BitmapUtils {
 
         return "file://" + dirPath + fileName + ".jpg";
     }
-
+    public static String scaleBitmap(String screenShotPath) {
+        Bitmap bitmap = decodeImage(screenShotPath);
+        bitmap = BitmapUtils.scaleBitmap(bitmap, 100, 100);
+        String face_image = ConvertUtil.bitmapToBase64(bitmap);
+        return face_image;
+    }
 }

+ 3 - 1
app/src/main/java/com/sunwin/visitorapp/utils/Constant.java

@@ -17,7 +17,7 @@ public class Constant {
 
     public static int isUse = SharePrefenceUtils.getInt("isUse", 1);
 
-    public static String BASE_HOST = "http://192.168.31.7:8080/";//正式服务器
+    public static String BASE_HOST = "http://192.168.31.48:8080/";//服务器
     public static final String SWBINDIR = "/sdcard/models";
     public static final String SWRECODE = "/sdcard/swRecode";
 
@@ -45,6 +45,8 @@ public class Constant {
     public interface IIntentValue {
         String CURRENTFACEPATH = "currentFacePath";
         String ISLOGINUSER = "isLoginUser";
+        String VISIT_SIGN_TYPE = "visitSignType";//1,身份证,2 人脸
+        String VISIT_TYPE = "visitType";//1,签到,2 签离
     }
 
     public interface NumerValue {

+ 211 - 144
app/src/main/res/layout/ac_visitor_register.xml

@@ -1,355 +1,422 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tool="http://schemas.android.com/tools"
     xmlns:tools="http://schemas.android.com/tools"
-    android:focusableInTouchMode="true"
-    android:focusable="true"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:background="@drawable/login_button_normal"
+    android:focusable="true"
+    android:focusableInTouchMode="true"
     android:orientation="vertical">
 
     <com.sunwin.visitorapp.view.UINav
         android:id="@+id/UINav"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        android:layout_height="wrap_content" />
 
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="0dp"
-        android:orientation="horizontal"
         android:layout_weight="1"
-        android:paddingVertical="20dp"
+        android:orientation="horizontal"
         android:paddingHorizontal="30dp"
-        >
+        android:paddingVertical="20dp">
+
         <LinearLayout
-            android:background="@drawable/card_white"
-            android:layout_weight="1"
-            android:layout_margin="20dp"
             android:layout_width="0dp"
             android:layout_height="match_parent"
+            android:layout_margin="20dp"
+            android:layout_weight="1"
+            android:background="@drawable/card_white"
             android:gravity="center"
             android:orientation="vertical">
 
             <TextView
-                android:text="访客信息"
+                style="@style/StyleTextLarge"
                 android:layout_marginVertical="5dp"
-                style="@style/StyleTextLarge"/>
+                android:text="访客信息" />
 
             <ImageView
                 android:id="@+id/ImageVisitorPhoto"
+                android:layout_width="160dp"
+                android:layout_height="160dp"
                 android:layout_margin="10dp"
                 android:background="@color/white"
-                android:scaleType="fitCenter"
-                android:layout_width="160dp"
-                android:layout_height="160dp"/>
+                android:scaleType="fitCenter" />
+
             <TextView
                 android:id="@+id/TextVisitorName"
-                tools:text="访客名称"
+                style="@style/StyleTextLarge"
                 android:layout_marginVertical="5dp"
-                style="@style/StyleTextLarge"/>
+                tools:text="访客名称" />
+
             <TextView
-                android:text="身份证号"
+                style="@style/StyleTextLarge"
                 android:layout_marginVertical="5dp"
-                style="@style/StyleTextLarge"/>
+                android:text="身份证号" />
+
             <TextView
                 android:id="@+id/TextVisitorIdCode"
-                tools:text="code"
+                style="@style/StyleTextContent"
                 android:layout_marginVertical="5dp"
-                style="@style/StyleTextContent"/>
+                tools:text="code" />
         </LinearLayout>
+
         <LinearLayout
             android:id="@+id/ViewForm"
-            android:background="@drawable/card_white"
-            android:layout_weight="2"
-            android:layout_margin="20dp"
             android:layout_width="0dp"
             android:layout_height="match_parent"
+            android:layout_margin="20dp"
+            android:layout_weight="2"
+            android:background="@drawable/card_white"
             android:orientation="vertical">
 
             <TextView
                 style="@style/StyleTextLarge"
-                android:padding="10dp"
                 android:layout_width="match_parent"
-                android:textAlignment="center"
+                android:padding="10dp"
                 android:text="完善访客信息"
-                />
+                android:textAlignment="center" />
+
             <TextView
                 style="@style/StyleTextContent"
-                android:paddingVertical="5dp"
                 android:paddingHorizontal="15dp"
-                android:text="访客信息"
-                />
+                android:paddingVertical="5dp"
+                android:text="访客信息" />
+
             <LinearLayout
                 android:id="@+id/ViewFormVisitor"
-                android:orientation="vertical"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:paddingVertical="10dp"
-                android:paddingHorizontal="30dp">
+                android:orientation="vertical"
+                android:paddingHorizontal="30dp"
+                android:paddingVertical="10dp">
+
                 <LinearLayout
-                    android:orientation="horizontal"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="手机号码"
-                            />
+                            android:text="手机号码" />
+
                         <EditText
                             android:id="@+id/EditPhone"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
                     </LinearLayout>
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="来访事由"
-                            />
-                        <EditText
-                            style="@style/StyleInputContent"
+                            android:text="来访事由" />
 
+                        <EditText
                             android:id="@+id/comeReason"
-                            android:layout_weight="2"
+
+                            style="@style/StyleInputContent"
                             android:layout_width="0dp"
-                            android:layout_height="match_parent"/>
+                            android:layout_height="match_parent"
+                            android:layout_weight="2" />
                     </LinearLayout>
                 </LinearLayout>
+
                 <LinearLayout
-                    android:orientation="horizontal"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="公司信息"
-                            />
+                            android:text="公司信息" />
+
                         <EditText
                             android:id="@+id/EditCompany"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
                     </LinearLayout>
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="车牌信息"
-                            />
+                            android:text="车牌信息" />
+
                         <EditText
                             android:id="@+id/EditCarPlate"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
                     </LinearLayout>
                 </LinearLayout>
+
                 <LinearLayout
-                    android:orientation="horizontal"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="来访时间"
-                            />
-                        <EditText
+                            android:text="来访时间" />
+
+                        <TextView
                             android:id="@+id/EditVisitTimeBegin"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
+
                         <TextView
                             style="@style/StyleTextContent"
-                            android:textAlignment="center"
                             android:layout_width="0dp"
                             android:layout_weight="1"
                             android:text="至"
-                            />
-                        <EditText
+                            android:textAlignment="center" />
+
+                        <TextView
                             android:id="@+id/EditVisitTimeEnd"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
                     </LinearLayout>
                 </LinearLayout>
+
                 <LinearLayout
-                    android:orientation="horizontal"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal"
+                        android:visibility="gone">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="通行次数"
-                            />
+                            android:text="通行次数" />
+
                         <EditText
                             android:id="@+id/EditVisitNumber"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
                     </LinearLayout>
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="随行人数"
-                            />
+                            android:text="随行人数" />
+
                         <EditText
                             android:id="@+id/EditVisitPeopleCount"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
                     </LinearLayout>
                 </LinearLayout>
+
                 <LinearLayout
-                    android:orientation="horizontal"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="IC卡"
-                            />
+                            android:text="IC卡" />
+
                         <EditText
                             android:id="@+id/EditICCode"
-                            android:layout_weight="5"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="5" />
                     </LinearLayout>
 
                 </LinearLayout>
             </LinearLayout>
+
             <TextView
                 style="@style/StyleTextContent"
-                android:paddingVertical="5dp"
                 android:paddingHorizontal="15dp"
-                android:text="被访人员信息"
-                />
+                android:paddingVertical="5dp"
+                android:text="被访人员信息" />
+
             <LinearLayout
                 android:id="@+id/ViewFormVisitorBy"
-                android:orientation="vertical"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:paddingVertical="10dp"
-                android:paddingHorizontal="30dp">
+                android:orientation="vertical"
+                android:paddingHorizontal="30dp"
+                android:paddingVertical="10dp">
+
                 <LinearLayout
-                    android:orientation="horizontal"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="被访员工"
-                            />
+                            android:text="被访员工" />
+
                         <EditText
                             android:id="@+id/EditByVisitPeople"
-                            android:layout_weight="2"
-                            android:layout_width="0dp"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:layout_weight="2" />
                     </LinearLayout>
+
                     <LinearLayout
-                        android:orientation="horizontal"
-                        android:layout_weight="1"
                         android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
                         android:gravity="center_vertical"
-                        android:layout_height="match_parent">
+                        android:orientation="horizontal">
+
                         <TextView
                             style="@style/StyleTextContent"
                             android:layout_width="0dp"
                             android:layout_weight="1"
-                            android:text="被访部门"
-                            />
-                        <EditText
+                            android:text="被访部门" />
+
+                        <Spinner
                             android:id="@+id/EditByVisitDepartment"
-                            android:layout_weight="2"
+                            style="@style/StyleInputContent"
+                            android:layout_width="0dp"
+                            android:layout_height="40dp"
+                            android:layout_weight="2" />
+                    </LinearLayout>
+                </LinearLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
+                        android:gravity="center_vertical"
+                        android:orientation="horizontal">
+
+                        <TextView
+                            style="@style/StyleTextContent"
                             android:layout_width="0dp"
+                            android:layout_weight="1"
+                            android:text="授权设备" />
+
+                        <Spinner
+                            android:id="@+id/sp_net"
                             style="@style/StyleInputContent"
-                            android:layout_height="wrap_content"/>
+                            android:layout_width="0dp"
+                            android:layout_height="40dp"
+                            android:layout_weight="2" />
+                    </LinearLayout>
+
+                    <LinearLayout
+                        android:layout_width="0dp"
+                        android:layout_height="match_parent"
+                        android:layout_weight="1"
+                        android:gravity="center_vertical"
+                        android:orientation="horizontal">
+
                     </LinearLayout>
                 </LinearLayout>
             </LinearLayout>
+
             <TextView
                 android:id="@+id/TextButtonSure"
-                android:layout_gravity="center_horizontal"
                 style="@style/ButtonPrimary"
+                android:layout_width="match_parent"
 
+                android:layout_gravity="center_horizontal"
                 android:layout_marginHorizontal="100dp"
-                android:layout_width="match_parent"
-                android:textAlignment="center"
                 android:layout_marginTop="20dp"
                 android:text="提交"
-                />
+                android:textAlignment="center" />
         </LinearLayout>
     </LinearLayout>
 </LinearLayout>

+ 68 - 0
app/src/main/res/layout/activity_visit_sign.xml

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@mipmap/bg_app"
+    android:orientation="vertical">
+
+    <include layout="@layout/title_layout" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginLeft="80dp"
+        android:layout_marginTop="50dp"
+        android:layout_marginRight="80dp"
+        android:layout_marginBottom="40dp"
+        android:orientation="horizontal">
+
+        <LinearLayout
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:background="@color/color_efeeee"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:paddingTop="20dp"
+            android:paddingBottom="20dp">
+
+            <ImageView
+                android:layout_width="180dp"
+                android:layout_height="180dp"
+                android:src="@mipmap/ic_launcher" />
+
+            <TextClock
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="15dp"
+                android:text="fadsgadgadsg"
+                android:textColor="@color/color_333333"
+                android:textSize="@dimen/sp_25" />
+
+            <TextView
+                android:id="@+id/tv_date"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="15dp"
+                android:text="2022-8-26"
+                android:textColor="@color/color_333333"
+                android:textSize="@dimen/sp_20" />
+        </LinearLayout>
+
+        <FrameLayout
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_marginLeft="40dp"
+            android:layout_weight="2"
+            android:background="@color/color_efeeee"
+            android:orientation="horizontal"
+            android:padding="50dp">
+
+
+          <include layout="@layout/fragment_id_card_reg"/>
+        </FrameLayout>
+
+    </LinearLayout>
+
+</LinearLayout>

+ 1 - 1
app/src/main/res/layout/adapter_card.xml

@@ -16,6 +16,6 @@
     <TextView
         android:id="@+id/item_desc"
         style="@style/Home_Menu_Item_Label"
-        android:text="访客记录" />/>
+        android:text="访客记录" />
 
 </LinearLayout>

+ 9 - 0
app/src/main/res/layout/adapter_spinner.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/tv"
+    style="?android:attr/spinnerItemStyle"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:ellipsize="marquee"
+    android:singleLine="true"
+    android:textAlignment="inherit" />

+ 20 - 0
app/src/main/res/layout/adapter_visit_sign.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    android:orientation="vertical">
+
+    <ImageView
+        android:id="@+id/item_icon"
+        style="@style/Home_Menu_Item_Icon"
+        android:src="@mipmap/visit_sign_idcard"/>
+
+
+    <TextView
+        android:id="@+id/item_desc"
+        style="@style/Home_Menu_Item_Label"
+        android:text="身份证" />
+
+</LinearLayout>

+ 4 - 0
app/src/main/res/layout/fragment_home.xml

@@ -22,6 +22,7 @@
             android:background="@drawable/card_white"
             style="@style/Home_Welcome_Item_View">
             <TextView
+                android:id="@+id/tv_today_reg"
                 style="@style/Home_Welcome_Item_Number"
                 android:text="0"/>
             <TextView
@@ -32,9 +33,11 @@
             android:background="@drawable/card_white"
             style="@style/Home_Welcome_Item_View">
             <TextView
+                android:id="@+id/tv_on_visit"
                 style="@style/Home_Welcome_Item_Number"
                 android:text="0"/>
             <TextView
+
                 style="@style/Home_Welcome_Item_Label"
                 android:text="在访人员"/>
         </LinearLayout>
@@ -42,6 +45,7 @@
             android:background="@drawable/card_white"
             style="@style/Home_Welcome_Item_View">
             <TextView
+                android:id="@+id/tv_leave"
                 style="@style/Home_Welcome_Item_Number"
                 android:text="0"/>
             <TextView

+ 20 - 0
app/src/main/res/layout/fragment_visit_sign.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <com.sunwin.visitorapp.view.MyGridView
+        android:id="@+id/gridview"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="120dp"
+        android:layout_marginRight="120dp"
+        android:horizontalSpacing="60dp"
+        android:numColumns="3"
+        android:overScrollMode="never"
+        android:paddingBottom="10dp"
+        android:scrollbars="none"
+        android:verticalSpacing="5dp" />
+</LinearLayout>

BIN
app/src/main/res/mipmap-xhdpi/visit_sign_face.png


BIN
app/src/main/res/mipmap-xhdpi/visit_sign_idcard.png


BIN
app/src/main/res/mipmap-xhdpi/visit_sign_qrcode.png