|
|
@@ -39,6 +39,7 @@ import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.tool.ThreadUtil;
|
|
|
import com.xzjmyk.pm.activity.util.BaiduMapUtil;
|
|
|
import com.xzjmyk.pm.activity.util.CalendarUtils;
|
|
|
+import com.xzjmyk.pm.activity.util.PreferenceUtils;
|
|
|
import com.xzjmyk.pm.activity.util.TimeUtils;
|
|
|
import com.xzjmyk.pm.activity.view.crouton.Crouton;
|
|
|
import com.xzjmyk.pm.activity.view.wheel.OASigninPicker;
|
|
|
@@ -56,6 +57,9 @@ import java.util.LinkedHashMap;
|
|
|
import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import static com.umeng.socialize.utils.DeviceConfig.context;
|
|
|
+import static com.xzjmyk.pm.activity.ui.erp.activity.WebViewCommActivity.TIME;
|
|
|
+
|
|
|
/**
|
|
|
* 常量:
|
|
|
* 0x11:下拉班次数据what
|
|
|
@@ -96,6 +100,7 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
|
|
|
private long time = System.currentTimeMillis();
|
|
|
private String signinTime;
|
|
|
BdLocationHelper locationHelper = null;//
|
|
|
+ private int loginNum = 0;
|
|
|
private Handler handler = new Handler() {
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
@@ -111,6 +116,9 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
|
|
|
companyX = Double.parseDouble(jsonObject.containsKey("longitude") ? (StringUtils.isEmpty(jsonObject.getString("longitude")) ? "0" : jsonObject.getString("longitude")) : "0");
|
|
|
companyY = Double.parseDouble(jsonObject.containsKey("latitude") ? (StringUtils.isEmpty(jsonObject.getString("latitude")) ? "0" : jsonObject.getString("latitude")) : "0");
|
|
|
unoffice_mm.setText(setDistance());
|
|
|
+ if (loginNum < 3 && distance > 1000000) {
|
|
|
+ returnLogin();
|
|
|
+ }
|
|
|
} else {
|
|
|
Crouton.makeText(ct, "当前账号没有分配公司地址,请联系管理员!!");
|
|
|
}
|
|
|
@@ -140,15 +148,23 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
|
|
|
else
|
|
|
Crouton.makeText(ct, "签到失败");
|
|
|
break;
|
|
|
+ case 0x16:
|
|
|
+ //登陆成功
|
|
|
+ loadNetData(System.currentTimeMillis());
|
|
|
+ break;
|
|
|
case 0x19:
|
|
|
String str = msg.getData().getString("time");
|
|
|
signinTime = StringUtils.isEmpty(str) ? TimeUtils.f_long_2_str(time) : str;
|
|
|
break;
|
|
|
default:
|
|
|
- if ("网络未连接!".equals(message))
|
|
|
- Crouton.makeText(ct, message);
|
|
|
- else
|
|
|
- Crouton.makeText(ct, message);
|
|
|
+ Crouton.makeText(ct, message);
|
|
|
+// if ("网络未连接!".equals(message))
|
|
|
+// Crouton.makeText(ct, message);
|
|
|
+// else {
|
|
|
+// if (loginNum < 3 && distance > 1000000) {
|
|
|
+// returnLogin();
|
|
|
+// }
|
|
|
+// }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -234,6 +250,14 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
|
|
|
listener();
|
|
|
}
|
|
|
|
|
|
+ private void returnLogin() {
|
|
|
+ //TODO 重新登陆
|
|
|
+ loginNum++;
|
|
|
+ ViewUtil.ct = ct;
|
|
|
+ ViewUtil.LoginERPTask(ct, handler, 0x16);
|
|
|
+ PreferenceUtils.putLong(context, TIME, System.currentTimeMillis());
|
|
|
+ }
|
|
|
+
|
|
|
private boolean isOpenGps() {
|
|
|
LocationManager locationManager = (LocationManager) getContext().
|
|
|
getSystemService(Context.LOCATION_SERVICE);
|