| | |
| | | package cn.com.basic.face.service.sync.up;
|
| | |
|
| | | import android.widget.Toast;
|
| | |
|
| | | import org.xutils.http.RequestParams;
|
| | | import org.xutils.x;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.FileWriter;
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | | import cn.com.basic.face.discern.common.BaseCommonCallBack;
|
| | | import cn.com.basic.face.discern.common.SqliteSqlBean;
|
| | | import cn.com.basic.face.discern.entity.Visit;
|
| | | import cn.com.basic.face.discern.query.item.OfflineVisitItem;
|
| | | import cn.com.basic.face.fragment.CheckInFragment;
|
| | | import cn.com.basic.face.service.sqlite.CheckInDao;
|
| | | import cn.com.basic.face.util.AppApi;
|
| | | import cn.com.basic.face.util.SqliteSqlUtil;
|
| | |
|
| | | public class CheckInUpSync extends BaseSync {
|
| | |
|
| | | @Override
|
| | | public void doSync() {
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean hasMore() {
|
| | | return false;
|
| | | }
|
| | |
|
| | | public static CheckInUpSync instance = new CheckInUpSync();
|
| | |
|
| | |
| | | return instance;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void doSync() {
|
| | | try {
|
| | |
|
| | | RequestParams params = new RequestParams();
|
| | |
|
| | | List<OfflineVisitItem> offlineVisitItems = CheckInDao.getInstance().readOfflineVisitItemFromLocal();
|
| | | for (OfflineVisitItem item : offlineVisitItems) {
|
| | | params.setUri(AppApi.BASE_URL +AppApi.VISIT_ADD);
|
| | | params.addBodyParameter(Visit.FieldNames.deviceCompanyId, BaseApplication.getInstance().getAndroidDevice().getCompanyId());
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | @Override
|
| | | public void success() {
|
| | | SqliteSqlUtil.insert(getExtraList(SqliteSqlBean.class));
|
| | | Toast.makeText(BaseApplication.getInstance(),"添加成功", Toast.LENGTH_SHORT).show();
|
| | | CheckInFragment.getInstance().resetForm();
|
| | | // if (visitReasonId == null || "".equals(visitReasonId)) {
|
| | | // DictionaryMng.getInstance().loadVisitReasonList();
|
| | | // }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
|
| | | /*
|
| | | RequestParams params = new RequestParams();
|
| | | File path = BaseApplication.getInstance().getFilesDir();
|
| | | File rawSurveillancePhotoFile = new File(path, "rawSurveillancePhoto_attender");
|
| | | if (!rawSurveillancePhotoFile.exists()) {
|
| | | rawSurveillancePhotoFile.createNewFile();
|
| | | }
|
| | | File f0 = new File(path, "f0");
|
| | | if (!f0.exists()) {
|
| | | f0.createNewFile();
|
| | | }
|
| | | File surveillancePhotoFile = new File(path, "surveillancePhoto_attender");
|
| | | if (!surveillancePhotoFile.exists()) {
|
| | | surveillancePhotoFile.createNewFile();
|
| | | }
|
| | | File uploadCustomPhotoFile = new File(path, "uploadCustomPhoto_attender");
|
| | | if (!uploadCustomPhotoFile.exists()) {
|
| | | uploadCustomPhotoFile.createNewFile();
|
| | | }
|
| | | File idCardPhotoFile = new File(path, "idCardPhoto_attender");
|
| | | if (!idCardPhotoFile.exists()) {
|
| | | idCardPhotoFile.createNewFile();
|
| | | }
|
| | |
|
| | | FileWriter fw0 = new FileWriter(f0);
|
| | | fw0.write("test1");
|
| | | fw0.close();
|
| | | params.setUri(AppApi.BASE_URL +AppApi.ATTENDER_REGISTER_ADD);
|
| | | params.addBodyParameter("f0", f0);
|
| | | params.addBodyParameter("rawSurveillancePhoto", rawSurveillancePhotoFile);
|
| | | params.addBodyParameter("surveillancePhoto", surveillancePhotoFile);
|
| | | params.addBodyParameter("uploadCustomPhoto", uploadCustomPhotoFile);
|
| | | params.addBodyParameter("idCardPhoto", idCardPhotoFile);
|
| | | params.addBodyParameter("deviceCompanyId", BaseApplication.getInstance().getAndroidDevice().getCompanyId());
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | @Override
|
| | | public void success() {
|
| | | SqliteSqlUtil.insert(getExtraList(SqliteSqlBean.class));
|
| | | sync();
|
| | | }
|
| | | });*/
|
| | | }catch(Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean hasMore() {
|
| | | return CheckInDao.getInstance().hasOfflineCheckInData();
|
| | | }
|
| | |
|
| | | }
|