Browse Source

上传乱码未解决

FANGLH 8 years ago
parent
commit
eca0fd9792

+ 12 - 3
app_modular/appme/src/main/java/com/uas/appme/pedometer/utils/StepUtils.java

@@ -7,6 +7,7 @@ import com.common.LogUtil;
 import com.common.config.BaseConfig;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
+import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.core.app.MyApplication;
 import com.core.utils.CommonUtil;
@@ -52,11 +53,13 @@ public class StepUtils {
         httpClient.Api().send(new HttpClient.Builder()
                 .url("appUUsteps")
                 .add("map", map)
+//                .header("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
                 .add("token", MyApplication.getInstance().mAccessToken)
                 .method(Method.POST)
                 .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
+                if (o == null) return;
                 LogUtil.prinlnLongMsg("appUUsteps", o.toString() + "");
             }
         }));
@@ -71,11 +74,16 @@ public class StepUtils {
     public static void canUnloadToRemote(String s) {
         PersonalStepBean mPersonalStepBean = new PersonalStepBean();
         mPersonalStepBean = JSON.parseObject(s.toString(), PersonalStepBean.class);
-        if (mPersonalStepBean == null) return;
-        int remoteSteps = CommonUtil.getNumByString(mPersonalStepBean.getWeekSteps().get(mPersonalStepBean.getWeekSteps().size() - 1).getAs_uusteps());
         String CURRENT_DATE = TimeUtil.getCurrentDate();
         StepDataDao stepDataDao = new StepDataDao(MyApplication.getInstance());
         StepEntity stepEntity = stepDataDao.getCurDataByDate(CURRENT_DATE);
+
+        if (mPersonalStepBean == null || ListUtils.isEmpty(mPersonalStepBean.getWeekSteps())) {
+            doSaveLocalStepsToHttps(stepEntity);
+            return;
+        }
+        int remoteSteps = CommonUtil.getNumByString(mPersonalStepBean.getWeekSteps().get(mPersonalStepBean.getWeekSteps().size() - 1).getAs_uusteps());
+
         try {
             if (stepEntity == null) {
 //                stepEntity = new StepEntity();
@@ -91,7 +99,7 @@ public class StepUtils {
                 intent.putExtra("remoteSteps", remoteSteps);
                 BaseConfig.getContext().sendBroadcast(intent);
                 LogUtil.prinlnLongMsg("stepDb.update","sendLocalBroadcast");
-            } else if (remoteSteps < CommonUtil.getNumByString(stepEntity.getSteps())) {
+            } else if (remoteSteps <= CommonUtil.getNumByString(stepEntity.getSteps())) {
                 doSaveLocalStepsToHttps(stepEntity);
             }
         } catch (Exception e) {
@@ -132,6 +140,7 @@ public class StepUtils {
                 .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
+                if (o == null) return;
                 LogUtil.prinlnLongMsg("appSteps", o.toString());
                 canUnloadToRemote(o.toString());
             }

+ 1 - 1
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/NewStepActivity.java

@@ -271,7 +271,7 @@ public class NewStepActivity extends BaseActivity implements Handler.Callback {
         stepEntityList.addAll(stepDataDao.getAllDatas());
         // TODO: 在这里获取历史记录条数,当条数达到7条或以上时,显示更多历史记录
 //        if (stepEntityList.size() >= 7) {
-            steps_history_ll.setVisibility(View.VISIBLE);
+//            steps_history_ll.setVisibility(View.VISIBLE);
 //        }else {
 //            steps_history_ll.setVisibility(View.GONE);
 //        }

+ 2 - 0
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/PersonalPageActivity.java

@@ -110,6 +110,7 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
                 .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
+                if (o == null) return;
                 LogUtil.prinlnLongMsg("appSteps", o.toString());
                 mPersonalStepBean = JSON.parseObject(o.toString(),PersonalStepBean.class);
                 showStepsInfo();
@@ -172,6 +173,7 @@ public class PersonalPageActivity extends BaseActivity implements View.OnClickLi
                 .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
+                if (o == null) return;
                 LogUtil.prinlnLongMsg("appUUSet", o.toString());
                 setResult(0x02);
                 finish();

+ 2 - 0
app_modular/appme/src/main/java/com/uas/appme/pedometer/view/UURanking.java

@@ -127,6 +127,8 @@ public class UURanking extends BaseActivity implements View.OnClickListener {
                 .build(),new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
+                if (o == null) return;
+
                 LogUtil.prinlnLongMsg("appStepsrank", o.toString()+"");
                 try {
                     mStepsRankingBean = JSON.parseObject(o.toString(),StepsRankingBean.class);

+ 2 - 2
version.gradle

@@ -11,8 +11,8 @@ ext {
             minSdkVersion    : 9,
             targetSdkVersion : 24,
             javaVersion      : JavaVersion.VERSION_1_8,
-            versionCode      : 116,
-            versionName      : '5.9.4',
+            versionCode      : 117,
+            versionName      : '5.9.5',
     ]
 
     depsVersion = [