| | |
| | |
|
| | | import java.io.File;
|
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | | import cn.com.basic.face.base.Config;
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.query.item.OfflineAttenderRegisterItem;
|
| | | import cn.com.basic.face.discern.query.item.OfflineVisitorRegisterItem;
|
| | | import cn.com.basic.face.discern.query.item.UnknownQueryItem;
|
| | |
| | | * @return
|
| | | */
|
| | | public boolean add(OfflineVisitorRegisterItem item) {
|
| | | String sql =
|
| | | "INSERT INTO offline_visitor_register (\n" +
|
| | | " visitor_id,\n" +
|
| | | String sql = "INSERT INTO register (\n" +
|
| | | " register_id,\n" +
|
| | | " username,\n" +
|
| | | " mobile_phone,\n" +
|
| | | " name_en,\n" +
|
| | | " gender_id,\n" +
|
| | | " identity_type_id,\n" +
|
| | | " country_id,\n" +
|
| | | " visitor_type_id,\n" +
|
| | | " province,\n" +
|
| | | " city,\n" +
|
| | | " birthday,\n" +
|
| | | " tel,\n" +
|
| | | " mobile_phone,\n" +
|
| | | " identity_type_id,\n" +
|
| | | " identify_num,\n" +
|
| | | " company_id,\n" +
|
| | | " birthday,\n" +
|
| | | " department_id,\n" +
|
| | | " post_id,\n" +
|
| | | " remark,\n" +
|
| | | " warning,\n" +
|
| | | " id_card_photo,\n" +
|
| | | " upload_custom_photo,\n" +
|
| | | " surveillance_photo,\n" +
|
| | | " surveillance_photo_id,\n" +
|
| | | " visitor_type_id,\n" +
|
| | | " authentication,\n" +
|
| | | " id_card_head_photo,\n" +
|
| | | " attender_type_id,\n" +
|
| | | " card_number,\n" +
|
| | | " update_time,\n" +
|
| | | " is_synchron,\n" +
|
| | | " device_company_id,\n" +
|
| | | " raw_surveillance_photo_path,\n" +
|
| | | " raw_surveillance_photo_width,\n" +
|
| | | " raw_surveillance_photo_height,\n" +
|
| | | " surveillance_photo_path,\n" +
|
| | | " upload_custom_photo_path,\n" +
|
| | | " id_card_photo_path,\n" +
|
| | | " create_time\n" +
|
| | | ")\n" +
|
| | | "VALUES\n" +
|
| | | " (\n" +
|
| | | " null,\n" +
|
| | | " '"+item.getUsername()+"',\n" +
|
| | | " '"+item.getMobilePhone()+"',\n" +
|
| | | " '"+item.getGenderId()+"',\n" +
|
| | | " '"+item.getIdentityTypeId()+"',\n" +
|
| | | " '"+item.getCountryId()+"',\n" +
|
| | | " '"+item.getVisitorTypeId()+"',\n" +
|
| | | " '"+item.getIdentifyNum()+"',\n" +
|
| | | " '"+item.getCompanyId()+"',\n" +
|
| | | " '"+item.getBirthday()+"',\n" +
|
| | | " '"+item.getRemark()+"',\n" +
|
| | | " '"+item.getRawSurveillancePhotoPath()+"',\n" +
|
| | | " '"+item.getRawSurveillancePhotoWidth()+"',\n" +
|
| | | " '"+item.getRawSurveillancePhotoHeight()+"',\n" +
|
| | | " '"+item.getSurveillancePhotoPath()+"',\n" +
|
| | | " '"+item.getUploadCustomPhotoPath()+"',\n" +
|
| | | " '"+item.getIdCardPhotoPath()+"',\n" +
|
| | | " '"+item.getCreateTime()+"'\n" +
|
| | | " )";
|
| | | SQLiteDatabase db = Config.sqlMap.getDb();
|
| | | db.beginTransaction();
|
| | | db.execSQL(sql);
|
| | | db.endTransaction();
|
| | | " '"+item.getVisitorId()+"', "+
|
| | | " '"+item.getUsername()+"', "+
|
| | | " '', "+
|
| | | " '"+item.getGenderId()+"', "+
|
| | | " '"+item.getCountryId()+"', "+
|
| | | " '', "+
|
| | | " '', "+
|
| | | " '"+item.getBirthday()+"', "+
|
| | | " '', "+
|
| | | " '"+item.getMobilePhone()+"', "+
|
| | | " '"+item.getIdentityTypeId()+"', "+
|
| | | " '"+item.getIdentifyNum()+"', "+
|
| | | " '"+item.getCompanyId()+"', "+
|
| | | " null, "+
|
| | | " null, "+
|
| | | " '"+item.getRemark()+"', "+
|
| | | " '', "+
|
| | | " '"+item.getIdCardPhotoPath()+"', "+
|
| | | " '"+item.getUploadCustomPhotoPath()+"', "+
|
| | | " '"+item.getSurveillancePhotoPath()+"', "+
|
| | | " null, "+
|
| | | " '"+item.getVisitorTypeId()+"', "+
|
| | | " '', "+
|
| | | " '"+item.getIdCardPhotoPath()+"', "+
|
| | | " null, "+
|
| | | " '', "+
|
| | | " null, "+
|
| | | " 'N', "+
|
| | | " '"+ BaseApplication.getInstance().getAndroidDevice().getCompanyId()+"', "+
|
| | | " '"+item.getRawSurveillancePhotoPath()+"', "+
|
| | | " '"+item.getRawSurveillancePhotoWidth()+"', "+
|
| | | " '"+item.getRawSurveillancePhotoHeight()+"', "+
|
| | | " '"+item.getCreateTime()+"')";
|
| | | MainActivity.getInstance().db.execSQL(sql);
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | OfflineVisitorRegisterItem item = null;
|
| | | String sql =
|
| | | "SELECT\n" +
|
| | | " a.visitor_id,\n" +
|
| | | " a.register_id,\n" +
|
| | | " a.username,\n" +
|
| | | " a.mobile_phone,\n" +
|
| | | " a.name_en,\n" +
|
| | | " a.gender_id,\n" +
|
| | | " a.identity_type_id,\n" +
|
| | | " a.country_id,\n" +
|
| | | " a.visitor_type_id,\n" +
|
| | | " a.province,\n" +
|
| | | " a.city,\n" +
|
| | | " a.birthday,\n" +
|
| | | " a.tel,\n" +
|
| | | " a.mobile_phone,\n" +
|
| | | " a.identity_type_id,\n" +
|
| | | " a.identify_num,\n" +
|
| | | " a.company_id,\n" +
|
| | | " a.birthday,\n" +
|
| | | " a.department_id,\n" +
|
| | | " a.post_id,\n" +
|
| | | " a.remark,\n" +
|
| | | " a.raw_surveillance_photo_path,\n" +
|
| | | " a.raw_surveillance_photo_width,\n" +
|
| | | " a.raw_surveillance_photo_height,\n" +
|
| | | " a.surveillance_photo_path,\n" +
|
| | | " a.upload_custom_photo_path,\n" +
|
| | | " a.id_card_photo_path,\n" +
|
| | | " a.create_time\n" +
|
| | | " a.warning,\n" +
|
| | | " a.id_card_photo,\n" +
|
| | | " a.upload_custom_photo,\n" +
|
| | | " a.surveillance_photo,\n" +
|
| | | " a.surveillance_photo_id,\n" +
|
| | | " a.visitor_type_id,\n" +
|
| | | " a.authentication,\n" +
|
| | | " a.id_card_head_photo,\n" +
|
| | | " a.attender_type_id,\n" +
|
| | | " a.card_number,\n" +
|
| | | " a.update_time,\n" +
|
| | | " a.is_synchron,\n" +
|
| | | " a.device_company_id\n" +
|
| | | "FROM\n" +
|
| | | " offline_visitor_register a";
|
| | | SQLiteDatabase db = Config.sqlMap.getDb();
|
| | | db.beginTransaction();
|
| | | Cursor c = db.rawQuery(sql, new String[]{});
|
| | | " register a\n" +
|
| | | "WHERE\n" +
|
| | | " 1 = 1\n" +
|
| | | "AND a.is_synchron = 'N'";
|
| | | Cursor c = MainActivity.getInstance().db.rawQuery(sql, new String[]{});
|
| | | if (c.moveToFirst()) {
|
| | | item = new OfflineVisitorRegisterItem();
|
| | | item.setVisitorId(c.getString(c.getColumnIndex("visitor_id")));
|
| | | item.setVisitorId(c.getString(c.getColumnIndex("register_id")));
|
| | | item.setUsername(c.getString(c.getColumnIndex("username")));
|
| | | item.setMobilePhone(c.getString(c.getColumnIndex("mobile_phone")));
|
| | | item.setGenderId(c.getString(c.getColumnIndex("gender_id")));
|
| | |
| | | item.setCompanyId(c.getString(c.getColumnIndex("company_id")));
|
| | | item.setBirthday(c.getString(c.getColumnIndex("birthday")));
|
| | | item.setRemark(c.getString(c.getColumnIndex("remark")));
|
| | | item.setSurveillancePhotoPath(c.getString(c.getColumnIndex("surveillance_photo")));
|
| | | item.setUploadCustomPhotoPath(c.getString(c.getColumnIndex("upload_custom_photo")));
|
| | | item.setIdCardPhotoPath(c.getString(c.getColumnIndex("id_card_head_photo")));
|
| | |
|
| | | item.setCreateTime(c.getString(c.getColumnIndex("create_time")));
|
| | | item.setRawSurveillancePhotoPath(c.getString(c.getColumnIndex("raw_surveillance_photo_path")));
|
| | | item.setRawSurveillancePhotoWidth(c.getString(c.getColumnIndex("raw_surveillance_photo_width")));
|
| | | item.setRawSurveillancePhotoHeight(c.getString(c.getColumnIndex("raw_surveillance_photo_height")));
|
| | | item.setSurveillancePhotoPath(c.getString(c.getColumnIndex("surveillance_photo_path")));
|
| | | item.setUploadCustomPhotoPath(c.getString(c.getColumnIndex("upload_custom_photo_path")));
|
| | | item.setIdCardPhotoPath(c.getString(c.getColumnIndex("id_card_photo_path")));
|
| | | item.setCreateTime(c.getString(c.getColumnIndex("create_time")));
|
| | | }
|
| | | c.close();
|
| | | db.endTransaction();
|
| | | return item;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | public void removeOfflineVisitorRegister(OfflineVisitorRegisterItem item) {
|
| | | try {
|
| | | String sql = "delete from offline_visitor_register where visitor_id='"+item.getVisitorId()+"'";
|
| | | String sql = "delete from register where visitor_id='"+item.getVisitorId()+"' AND a.is_synchron = 'N'";
|
| | | SQLiteDatabase db = Config.sqlMap.getDb();
|
| | | db.beginTransaction();
|
| | | db.execSQL(sql);
|