1
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
*/build
|
||||
/build/
|
||||
.idea/
|
||||
.gradle/*
|
||||
*/release
|
||||
*/debug
|
||||
*/debug
|
||||
*/build/
|
||||
@@ -366,9 +366,9 @@ public class BindNumberActivity extends BaseActivity implements OnCallBackFromNe
|
||||
SharePrefUtil.saveString(ct, "provId", provId);// 省id
|
||||
SharePrefUtil.saveInt(ct, "isStar", isStar);// 是否是肝胆名医 0否 1是
|
||||
SharePrefUtil.saveInt(ct, "sex", sex);// 性别(0.男 1.女)
|
||||
SharePrefUtil.saveInt(ct, "state", state);// 审核状态( 1.待审核
|
||||
|
||||
|
||||
SharePrefUtil.saveInt(ct, "state", state);// 审核状态( 1.待审核
|
||||
|
||||
needreportSimple("login");
|
||||
addUMToken(PushAgent.getInstance(this).getRegistrationId());
|
||||
// 2.审核中3.需要补充修改资料
|
||||
// 4.再次提交审核5.拒绝 6.已通过)
|
||||
|
||||
@@ -1318,54 +1318,51 @@ public class BookDetailActivity extends BaseActivity implements
|
||||
R.color.top_title));
|
||||
buildAlert.show();
|
||||
}
|
||||
//先判断是否网络下载
|
||||
private void isNetWorkDown(){
|
||||
String message = null;
|
||||
if (CommonUtil.isNetworkAvailable(mActivity) == 1){
|
||||
message = "当前为Wifi网络,您确定下载该篇文章?";
|
||||
}else if (CommonUtil.isNetworkAvailable(mActivity) == 0){
|
||||
ToastUtil.showMessage("无网络,请检查网络连接!");
|
||||
}else {
|
||||
message = "当前为移动网络,您确定下载该篇文章?";
|
||||
|
||||
}
|
||||
buildAlert = ECAlertDialog.buildAlert(mActivity, message, "取消", "确定",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
if(mPath!=null&&mPath.contains(Constant.OldfilePath))
|
||||
{
|
||||
new Thread(networkTask3new).start();
|
||||
}
|
||||
else if (hasDownload>0){
|
||||
new Thread(networkTask3).start();
|
||||
buildAlert.dismiss();
|
||||
}else {
|
||||
if (welfareNum>0){
|
||||
useWelfareNum();
|
||||
buildAlert.dismiss();
|
||||
}else {
|
||||
isJifenDown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
buildAlert.setTitle("提示");
|
||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
buildAlert.show();
|
||||
//先判断是否网络下载
|
||||
private void isNetWorkDown(){
|
||||
int netType = CommonUtil.isNetworkAvailable(mActivity);
|
||||
if (netType == 0){
|
||||
ToastUtil.showMessage("无网络,请检查网络连接!");
|
||||
return;
|
||||
}
|
||||
if (netType == 1){
|
||||
startBookDownload();
|
||||
return;
|
||||
}
|
||||
String message = "当前为移动网络,您确定下载该篇文章?";
|
||||
buildAlert = ECAlertDialog.buildAlert(mActivity, message, "取消", "确定",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
buildAlert.dismiss();
|
||||
startBookDownload();
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("提示");
|
||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||
R.color.top_title));
|
||||
buildAlert.show();
|
||||
}
|
||||
|
||||
private void startBookDownload() {
|
||||
if(mPath!=null&&mPath.contains(Constant.OldfilePath))
|
||||
{
|
||||
new Thread(networkTask3new).start();
|
||||
}
|
||||
else if (hasDownload>0){
|
||||
new Thread(networkTask3).start();
|
||||
}else {
|
||||
if (welfareNum>0){
|
||||
useWelfareNum();
|
||||
}else {
|
||||
isJifenDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
//使用福利操作
|
||||
private void useWelfareNum() {
|
||||
|
||||
@@ -21,8 +21,9 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
@@ -124,13 +125,13 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
||||
private String cityId = "";
|
||||
private String disctictId = "";
|
||||
private boolean choosehos =false;
|
||||
private TextView my_hospital;
|
||||
private TextView my_office_phone;
|
||||
private TextView my_professional;
|
||||
private TextView my_zgzs_number;
|
||||
private TextView my_disease;
|
||||
private TextView my_name;
|
||||
private TextView my_sex;
|
||||
private TextView my_hospital;
|
||||
private EditText my_office_phone;
|
||||
private TextView my_professional;
|
||||
private EditText my_zgzs_number;
|
||||
private TextView my_disease;
|
||||
private EditText my_name;
|
||||
private TextView my_sex;
|
||||
private TextView my_office_name;
|
||||
private int checkNum = 0; // 记录选中的条目数量
|
||||
private ECAlertDialog buildAlert;
|
||||
@@ -173,30 +174,30 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
||||
|
||||
my_photo = view.findViewById(R.id.my_photo);// 头像
|
||||
|
||||
ll_my_name = (LinearLayout) view.findViewById(R.id.ll_my_name);// 姓名
|
||||
my_name = (TextView) view.findViewById(R.id.my_name);// 姓名
|
||||
|
||||
ll_my_sex = (LinearLayout) view.findViewById(R.id.ll_my_sex);// sex
|
||||
my_sex = (TextView) view.findViewById(R.id.my_sex);// sex
|
||||
|
||||
ll_my_hospital = (LinearLayout) view.findViewById(R.id.ll_my_hospital);// 医院
|
||||
my_hospital = (TextView) view.findViewById(R.id.my_hospital);// 医院名称
|
||||
ll_my_photo=(LinearLayout) view.findViewById(R.id.ll_my_photo);
|
||||
ll_my_office_name = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_office_name);// 工作室
|
||||
my_office_name = (TextView) view.findViewById(R.id.my_office_name);// 工作室名称
|
||||
|
||||
ll_my_office_phone = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_office_phone);// 工作室电话
|
||||
my_office_phone = (TextView) view.findViewById(R.id.my_office_phone);// 工作室
|
||||
|
||||
ll_my_professional = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_professional);// 职业职称
|
||||
my_professional = (TextView) view.findViewById(R.id.my_professional);// 职业职称
|
||||
|
||||
ll_my_zgzs_number = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_zgzs_number);// 医师资格证号码
|
||||
my_zgzs_number = (TextView) view.findViewById(R.id.my_zgzs_number);// 医师资格证号码
|
||||
ll_my_name = (LinearLayout) view.findViewById(R.id.ll_my_name);// 姓名
|
||||
my_name = (EditText) view.findViewById(R.id.my_name);// 姓名
|
||||
|
||||
ll_my_sex = (LinearLayout) view.findViewById(R.id.ll_my_sex);// sex
|
||||
my_sex = (TextView) view.findViewById(R.id.my_sex);// sex
|
||||
|
||||
ll_my_hospital = (LinearLayout) view.findViewById(R.id.ll_my_hospital);// 医院
|
||||
my_hospital = (TextView) view.findViewById(R.id.my_hospital);// 医院名称
|
||||
ll_my_photo=(LinearLayout) view.findViewById(R.id.ll_my_photo);
|
||||
ll_my_office_name = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_office_name);// 工作室
|
||||
my_office_name = (TextView) view.findViewById(R.id.my_office_name);// 工作室名称
|
||||
|
||||
ll_my_office_phone = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_office_phone);// 工作室电话
|
||||
my_office_phone = (EditText) view.findViewById(R.id.my_office_phone);// 工作室
|
||||
|
||||
ll_my_professional = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_professional);// 职业职称
|
||||
my_professional = (TextView) view.findViewById(R.id.my_professional);// 职业职称
|
||||
|
||||
ll_my_zgzs_number = (LinearLayout) view
|
||||
.findViewById(R.id.ll_my_zgzs_number);// 医师资格证号码
|
||||
my_zgzs_number = (EditText) view.findViewById(R.id.my_zgzs_number);// 医师资格证号码
|
||||
|
||||
ll_upload_certificateImg = (LinearLayout) view
|
||||
.findViewById(R.id.ll_upload_certificateImg);// 医师资格证图片
|
||||
@@ -489,17 +490,47 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
||||
/**
|
||||
* 设置资料各项点击事件
|
||||
*/
|
||||
private void setInfoClick(boolean b) {
|
||||
ll_my_photo.setEnabled(b);
|
||||
ll_my_name.setEnabled(b);
|
||||
ll_my_sex.setEnabled(b);
|
||||
ll_my_hospital.setEnabled(b);
|
||||
ll_my_office_name.setEnabled(b);
|
||||
ll_my_office_phone.setEnabled(b);
|
||||
ll_my_professional.setEnabled(b);
|
||||
ll_my_zgzs_number.setEnabled(b);
|
||||
ll_upload_certificateImg.setEnabled(b);
|
||||
ll_my_disease.setEnabled(b);
|
||||
private void setInfoClick(boolean b) {
|
||||
ll_my_photo.setEnabled(b);
|
||||
ll_my_name.setEnabled(b);
|
||||
if (my_name != null) {
|
||||
my_name.setEnabled(b);
|
||||
my_name.setFocusable(b);
|
||||
my_name.setFocusableInTouchMode(b);
|
||||
}
|
||||
ll_my_sex.setEnabled(b);
|
||||
ll_my_hospital.setEnabled(b);
|
||||
ll_my_office_name.setEnabled(b);
|
||||
ll_my_office_phone.setEnabled(b);
|
||||
if (my_office_phone != null) {
|
||||
my_office_phone.setEnabled(b);
|
||||
my_office_phone.setFocusable(b);
|
||||
my_office_phone.setFocusableInTouchMode(b);
|
||||
}
|
||||
ll_my_professional.setEnabled(b);
|
||||
ll_my_zgzs_number.setEnabled(b);
|
||||
if (my_zgzs_number != null) {
|
||||
my_zgzs_number.setEnabled(b);
|
||||
my_zgzs_number.setFocusable(b);
|
||||
my_zgzs_number.setFocusableInTouchMode(b);
|
||||
}
|
||||
ll_upload_certificateImg.setEnabled(b);
|
||||
ll_my_disease.setEnabled(b);
|
||||
}
|
||||
|
||||
private void focusInlineEdit(EditText editText) {
|
||||
if (editText == null || !editText.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
editText.requestFocus();
|
||||
CharSequence text = editText.getText();
|
||||
if (text != null) {
|
||||
editText.setSelection(text.length());
|
||||
}
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm != null) {
|
||||
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
|
||||
}
|
||||
}
|
||||
|
||||
// 弹出对话框
|
||||
@@ -556,50 +587,56 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
||||
// 为了验证是不是上一个用户
|
||||
String mobile = SharePrefUtil.getString(ct, Constant.SP_IS_FIRST_NAME,
|
||||
Constant.mobile, "");// 手机号
|
||||
switch (v.getId()) {
|
||||
case R.id.ll_my_name:// 姓名
|
||||
showEditPopuWindows(my_name, 1);
|
||||
break;
|
||||
case R.id.ll_my_sex:// 性别
|
||||
pwSexOptions.showAtLocation(my_sex, Gravity.BOTTOM, 0, 0);
|
||||
break;
|
||||
case R.id.ll_my_hospital:// 医院
|
||||
// 设置适配器
|
||||
// listView.setAdapter(new MyListAdapter(my_hospital,
|
||||
// hospitalList));
|
||||
// // 弹出popuwindow框
|
||||
// setPopupWindow(my_hospital);
|
||||
// 先选择者城市再选择医院
|
||||
startActivityForResult(new Intent(LoginSetInfoActivity.this,ChoosehospitalActivity.class),333);
|
||||
// pwCityOptions.showAtLocation(my_hospital, Gravity.BOTTOM, 0, 0);
|
||||
// showPwOptions("请选择医院", hospitalListItems, hospitalListUuidItems,
|
||||
// my_hospital, 1);
|
||||
break;
|
||||
case R.id.ll_my_office_name:// 科室
|
||||
showPwOptions("请选择科室", officeListItems, officeListUuidItems,
|
||||
my_office_name, 2);
|
||||
break;
|
||||
case R.id.ll_my_office_phone:// 科室电话
|
||||
showEditPopuWindows(my_office_phone, 2);
|
||||
break;
|
||||
case R.id.ll_my_professional:// 职称
|
||||
showPwOptions("请选择职称", professionalListItems,
|
||||
professionalUuidListItems, my_professional, 3);
|
||||
break;
|
||||
case R.id.ll_my_zgzs_number:// 资格证号
|
||||
showEditPopuWindows(my_zgzs_number, 3);
|
||||
break;
|
||||
case R.id.ll_upload_certificateImg:// 资格证图片
|
||||
save(mobile);
|
||||
Intent intent = new Intent(ct, SelectedPhotoActivity.class);
|
||||
intent.putExtra("isConstraint", true);// 是否等比例裁剪
|
||||
startActivityForResult(intent, TO_SELECT_PHOTO);
|
||||
// 进入退出动画
|
||||
overridePendingTransition(R.anim.timepicker_anim_enter_bottom,
|
||||
R.anim.timepicker_anim_exit_bottom);
|
||||
break;
|
||||
case R.id.ll_my_disease:// 专长
|
||||
showDiseasePop(my_disease);
|
||||
switch (v.getId()) {
|
||||
case R.id.ll_my_name:// 姓名
|
||||
focusInlineEdit(my_name);
|
||||
break;
|
||||
case R.id.ll_my_sex:// 性别
|
||||
hideSoftKeyboard();
|
||||
pwSexOptions.showAtLocation(my_sex, Gravity.BOTTOM, 0, 0);
|
||||
break;
|
||||
case R.id.ll_my_hospital:// 医院
|
||||
hideSoftKeyboard();
|
||||
// 设置适配器
|
||||
// listView.setAdapter(new MyListAdapter(my_hospital,
|
||||
// hospitalList));
|
||||
// // 弹出popuwindow框
|
||||
// setPopupWindow(my_hospital);
|
||||
// 先选择者城市再选择医院
|
||||
startActivityForResult(new Intent(LoginSetInfoActivity.this,ChoosehospitalActivity.class),333);
|
||||
// pwCityOptions.showAtLocation(my_hospital, Gravity.BOTTOM, 0, 0);
|
||||
// showPwOptions("请选择医院", hospitalListItems, hospitalListUuidItems,
|
||||
// my_hospital, 1);
|
||||
break;
|
||||
case R.id.ll_my_office_name:// 科室
|
||||
hideSoftKeyboard();
|
||||
showPwOptions("请选择科室", officeListItems, officeListUuidItems,
|
||||
my_office_name, 2);
|
||||
break;
|
||||
case R.id.ll_my_office_phone:// 科室电话
|
||||
focusInlineEdit(my_office_phone);
|
||||
break;
|
||||
case R.id.ll_my_professional:// 职称
|
||||
hideSoftKeyboard();
|
||||
showPwOptions("请选择职称", professionalListItems,
|
||||
professionalUuidListItems, my_professional, 3);
|
||||
break;
|
||||
case R.id.ll_my_zgzs_number:// 资格证号
|
||||
focusInlineEdit(my_zgzs_number);
|
||||
break;
|
||||
case R.id.ll_upload_certificateImg:// 资格证图片
|
||||
hideSoftKeyboard();
|
||||
save(mobile);
|
||||
Intent intent = new Intent(ct, SelectedPhotoActivity.class);
|
||||
intent.putExtra("isConstraint", true);// 是否等比例裁剪
|
||||
startActivityForResult(intent, TO_SELECT_PHOTO);
|
||||
// 进入退出动画
|
||||
overridePendingTransition(R.anim.timepicker_anim_enter_bottom,
|
||||
R.anim.timepicker_anim_exit_bottom);
|
||||
break;
|
||||
case R.id.ll_my_disease:// 专长
|
||||
hideSoftKeyboard();
|
||||
showDiseasePop(my_disease);
|
||||
break;
|
||||
case R.id.btn_skip_info:// 跳过
|
||||
handleSkipOrBack(mobile);
|
||||
@@ -1037,13 +1074,13 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
||||
ToastUtil.showToast("科室不为空");
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(officePhone)) {
|
||||
ToastUtil.showToast("科室电话不为空");
|
||||
return;
|
||||
}
|
||||
if (officePhone.equals("请输入科室电话")) {
|
||||
ToastUtil.showToast("请输入正确的科室电话");
|
||||
return;
|
||||
if (TextUtils.isEmpty(officePhone)) {
|
||||
ToastUtil.showToast("科室电话不为空");
|
||||
return;
|
||||
}
|
||||
if (officePhone.equals("请输入科室电话") || officePhone.length() < 10) {
|
||||
ToastUtil.showToast("请输入正确的科室电话");
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(etProfessionalName)) {
|
||||
ToastUtil.showToast("职称不为空");
|
||||
|
||||
@@ -309,14 +309,17 @@ public class BaseApplication extends Application {
|
||||
// CrashHandler.getInstance().init(getApplicationContext());
|
||||
// }
|
||||
|
||||
// 注册Activity生命周期回调,用于跟踪当前resumed的Activity
|
||||
// 注册Activity生命周期回调,用于跟踪当前resumed的Activity并在退后台时上报缓存画像埋点
|
||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
private int startedActivityCount = 0;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
startedActivityCount++;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -334,6 +337,10 @@ public class BaseApplication extends Application {
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
startedActivityCount = Math.max(0, startedActivityCount - 1);
|
||||
if (startedActivityCount == 0 && activity != null && !activity.isChangingConfigurations()) {
|
||||
startReport(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1527,10 +1527,15 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
||||
* @param context
|
||||
* @param type 操作类型 整型数据 ---1登入系统 2退出系统 3专家客户端在手机前台运行 4.专家客户端在手机后台运行 void
|
||||
*/
|
||||
public static void foreBack(Context context, int type) {
|
||||
if (type==2){
|
||||
type =4;
|
||||
}
|
||||
public static void foreBack(Context context, int type) {
|
||||
if (type==2){
|
||||
type =4;
|
||||
}
|
||||
if (type == 4 && context != null) {
|
||||
Intent reportIntent = new Intent(context, ReportService.class);
|
||||
reportIntent.putExtra("report_token", Constant.Repotr_token);
|
||||
context.startService(reportIntent);
|
||||
}
|
||||
String uuid = SharePrefUtil.getString(context, Constant.uuid, "");
|
||||
RequestParams params = new RequestParams();//封装参数
|
||||
params.addBodyParameter("expertUuid", uuid);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package cn.shangyu.gdxzExpert.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -606,16 +607,20 @@ public abstract class BaseFragment extends Fragment {
|
||||
reportBeans.add(rbens);
|
||||
startReport(reportBeans);
|
||||
}
|
||||
public void startReport(List<reportBean> list)
|
||||
{
|
||||
Intent intent = new Intent(getActivity(), ReportService.class);
|
||||
if(list!=null)
|
||||
{
|
||||
intent.putExtra("report_list", (Serializable) list);
|
||||
|
||||
}
|
||||
intent.putExtra("report_token", Constant.Repotr_token);
|
||||
getActivity().startService(intent);
|
||||
public void startReport(List<reportBean> list)
|
||||
{
|
||||
Context targetContext = getActivity() != null ? getActivity() : UIUtils.getContext();
|
||||
if (targetContext == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(targetContext, ReportService.class);
|
||||
if(list!=null)
|
||||
{
|
||||
intent.putExtra("report_list", (Serializable) list);
|
||||
|
||||
}
|
||||
intent.putExtra("report_token", Constant.Repotr_token);
|
||||
targetContext.startService(intent);
|
||||
}
|
||||
public void needreportSimple(String name)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,9 @@ public class LogoutHelper {
|
||||
SharePrefUtil.clear(UIUtils.getContext(), "isLogin");
|
||||
startReport(null);
|
||||
|
||||
// Constant.Repotr_token="";
|
||||
Constant.Repotr_token = "";
|
||||
Constant.Report_userId = "";
|
||||
Constant.Repotr_app_key = "";
|
||||
// SharePrefUtil.clear(UIUtils.getContext(), SharePrefUtil.getString(UIUtils.getContext(), Constant.SP_IS_FIRST_NAME,
|
||||
// Constant.mobile, "") + "my_provinceId");
|
||||
// SharePrefUtil.clear(UIUtils.getContext(), SharePrefUtil.getString(UIUtils.getContext(), Constant.SP_IS_FIRST_NAME,
|
||||
|
||||
+3
-17
@@ -1808,23 +1808,9 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
|
||||
case R.id.tv_exchange:
|
||||
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
|
||||
String netWorkTypeName = getNetWorkTypeName(VideoDetailPolyvPlayerActivity.this);
|
||||
if ("NETWORK_WIFI".equals(netWorkTypeName)){
|
||||
if ("点击下载".equals(tv_exchange.getText().toString())){
|
||||
buildAlert = ECAlertDialog.buildAlert(VideoDetailPolyvPlayerActivity.this,"当前为Wifi网络,确定下载?", "取消", "确定",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
buildAlert.dismiss();
|
||||
}
|
||||
}, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
videoDown();
|
||||
}
|
||||
});
|
||||
buildAlert.setTitle("温馨提示");
|
||||
buildAlert.show();
|
||||
if ("NETWORK_WIFI".equals(netWorkTypeName)){
|
||||
if ("点击下载".equals(tv_exchange.getText().toString())){
|
||||
videoDown();
|
||||
}else if("视频缓存中".equals(tv_exchange.getText().toString())){
|
||||
Intent intent1 = new Intent(VideoDetailPolyvPlayerActivity.this, PolyvDownloadActivity.class);
|
||||
intent1.putExtra("isStarting",true);
|
||||
|
||||
@@ -21,7 +21,9 @@ import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import cn.shangyu.gdxzExpert.BuildConfig;
|
||||
import cn.shangyu.gdxzExpert.BuildConfig;
|
||||
import cn.shangyu.gdxzExpert.utils.Constant;
|
||||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||||
|
||||
public class CommUtil {
|
||||
// public static String userId="";
|
||||
@@ -79,10 +81,22 @@ public class CommUtil {
|
||||
Log.d("saveListToFile",file.getAbsolutePath());
|
||||
try {
|
||||
FileOutputStream fos=new FileOutputStream(file,true);//设置为true,继续原文件写入
|
||||
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos))) {
|
||||
for (reportBean item : list) {
|
||||
writer.write(gson.toJson(item));
|
||||
writer.newLine(); // 每个布尔值后写入一个新行
|
||||
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"))) {
|
||||
for (reportBean item : list) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtil.isEmpty(item.getUser_id()) && !StringUtil.isEmpty(Constant.Report_userId)) {
|
||||
item.setUser_id(Constant.Report_userId);
|
||||
}
|
||||
if (StringUtil.isEmpty(item.getApp_key()) && !StringUtil.isEmpty(Constant.Repotr_app_key)) {
|
||||
item.setApp_key(Constant.Repotr_app_key);
|
||||
}
|
||||
if (StringUtil.isEmpty(item.getNetwork_carrier()) && !StringUtil.isEmpty(CommUtil.getCarrierName)) {
|
||||
item.setNetwork_carrier(CommUtil.getCarrierName);
|
||||
}
|
||||
writer.write(gson.toJson(item));
|
||||
writer.newLine(); // 每个布尔值后写入一个新行
|
||||
}
|
||||
writer.close();
|
||||
fos.close();
|
||||
@@ -104,35 +118,64 @@ public class CommUtil {
|
||||
basePath += "/";
|
||||
}
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(zipFile);
|
||||
ZipOutputStream zos = new ZipOutputStream(fos)) {
|
||||
|
||||
File[] files = folderToZip.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
String filePath = file.getPath().replace("\\", "/");
|
||||
String entryName = filePath.substring(basePath.length());
|
||||
if (file.isDirectory()) {
|
||||
// 添加文件夹条目
|
||||
zos.putNextEntry(new ZipEntry(entryName + "/"));
|
||||
zos.closeEntry();
|
||||
// 递归地压缩子文件夹
|
||||
zipFolderCorrected(file, zipFile, basePath);
|
||||
} else {
|
||||
// 添加文件条目并写入文件内容
|
||||
zos.putNextEntry(new ZipEntry(entryName));
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) >= 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try (FileOutputStream fos = new FileOutputStream(zipFile);
|
||||
ZipOutputStream zos = new ZipOutputStream(fos)) {
|
||||
zipFolderInternal(folderToZip, zos, basePath);
|
||||
}
|
||||
}
|
||||
|
||||
private static void zipFolderInternal(File currentFolder, ZipOutputStream zos, String basePath) throws IOException {
|
||||
File[] files = currentFolder.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
String filePath = file.getPath().replace("\\", "/");
|
||||
String entryName = filePath.substring(basePath.length());
|
||||
if (file.isDirectory()) {
|
||||
zos.putNextEntry(new ZipEntry(entryName + "/"));
|
||||
zos.closeEntry();
|
||||
zipFolderInternal(file, zos, basePath);
|
||||
} else {
|
||||
zos.putNextEntry(new ZipEntry(entryName));
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) >= 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将待打包的 upload.txt 合并移动到 uploading/upload.txt 快照目录中,
|
||||
* 避免上传期间产生的新埋点丢失或上传成功后被误删。
|
||||
*/
|
||||
public static void mergeFileToUploading(File srcFile, File destFile) throws IOException {
|
||||
if (srcFile == null || !srcFile.exists() || srcFile.length() == 0) {
|
||||
return;
|
||||
}
|
||||
File parentDir = destFile.getParentFile();
|
||||
if (parentDir != null && !parentDir.exists()) {
|
||||
parentDir.mkdirs();
|
||||
}
|
||||
if (!destFile.exists()) {
|
||||
if (srcFile.renameTo(destFile)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
try (FileInputStream fis = new FileInputStream(srcFile);
|
||||
FileOutputStream fos = new FileOutputStream(destFile, true)) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int length;
|
||||
while ((length = fis.read(buffer)) >= 0) {
|
||||
fos.write(buffer, 0, length);
|
||||
}
|
||||
fos.flush();
|
||||
}
|
||||
srcFile.delete();
|
||||
}
|
||||
public static void deleteFile( String ReportFileZip,String name,String folderPath)
|
||||
{
|
||||
|
||||
@@ -24,9 +24,12 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import cn.shangyu.gdxzExpert.bean.TimestampBean;
|
||||
import cn.shangyu.gdxzExpert.http.HttpHelper;
|
||||
@@ -47,17 +50,26 @@ public class ReportService extends Service {
|
||||
|
||||
public ReportService() {
|
||||
}
|
||||
private static final ExecutorService REPORT_EXECUTOR = Executors.newSingleThreadExecutor();
|
||||
private static final List<reportBean> PENDING_BEFORE_TOKEN_LIST = new ArrayList<>();
|
||||
/** 普通浏览埋点攒批阈值(满 20 条自动打包上传) */
|
||||
private static final int BATCH_UPLOAD_THRESHOLD = 20;
|
||||
|
||||
public String ReportFile;
|
||||
public String ReportUploadingDir;
|
||||
public String ReportFileZip;
|
||||
public String report_token="";
|
||||
List<reportBean> list;
|
||||
public volatile String report_token = "";
|
||||
private volatile boolean isFetchingToken = false;
|
||||
|
||||
// public String FileUrl="https://dev-event.igandan.com/v1/eventLog/upload";//测试环境
|
||||
// public String FileUrl="https://event.igandan.com/v1/eventLog/upload";//正式环境
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
ReportFile=getBaseContext().getExternalFilesDir("").getAbsolutePath()+"/gdxz/report/zip";
|
||||
ReportFileZip=getBaseContext().getExternalFilesDir("").getAbsolutePath()+"/gdxz/report/";
|
||||
String basePath = getBaseContext().getExternalFilesDir("").getAbsolutePath();
|
||||
ReportFile = basePath + "/gdxz/report/zip";
|
||||
ReportUploadingDir = basePath + "/gdxz/report/uploading";
|
||||
ReportFileZip = basePath + "/gdxz/report/";
|
||||
// if("true".equals(CommUtil.isFirstRun))
|
||||
// {
|
||||
// CommUtil.isFirstRun="false";
|
||||
@@ -102,160 +114,250 @@ public class ReportService extends Service {
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
report_token=intent.getStringExtra("report_token");
|
||||
if(report_token==""||report_token==null)
|
||||
{
|
||||
if (intent == null) {
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
else if(intent.getSerializableExtra("report_list")==null)
|
||||
{
|
||||
if(checkReport())
|
||||
{
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
zipFile();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
return START_NOT_STICKY;
|
||||
final String incomingToken = intent.getStringExtra("report_token");
|
||||
if (!StringUtil.isEmpty(incomingToken)) {
|
||||
report_token = incomingToken;
|
||||
} else if (!StringUtil.isEmpty(Constant.Repotr_token)) {
|
||||
report_token = Constant.Repotr_token;
|
||||
}
|
||||
list = (List<reportBean>) intent.getSerializableExtra("report_list");
|
||||
CommUtil.totalreport+= list.size();
|
||||
final List<reportBean> incomingList = (List<reportBean>) intent.getSerializableExtra("report_list");
|
||||
|
||||
// 在新线程或异步任务中执行文件上传
|
||||
new Thread(new Runnable() {
|
||||
REPORT_EXECUTOR.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
writeReport();
|
||||
// uploadFile(filePath);
|
||||
// // 上传完成后,可以停止服务或发送广播通知其他组件
|
||||
// stopSelf(); // 或者使用广播通知
|
||||
handleReportCommand(incomingList);
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
public void writeReport()
|
||||
{
|
||||
// if(2>1)
|
||||
// {
|
||||
// CommUtil.deleteFile(ReportFileZip,"output.zip",ReportFile);
|
||||
// return;
|
||||
// }
|
||||
if( "true".equals(CommUtil.isReoprtingNow))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Log.d("okhttp","CommUtil.totalreport "+ CommUtil.totalreport);
|
||||
if(CommUtil.totalreport>99&&checkReport())
|
||||
{
|
||||
|
||||
private String getActiveUuid() {
|
||||
String uuid = SharePrefUtil.getString(UIUtils.getContext(), Constant.uuid, "");
|
||||
if (StringUtil.isEmpty(uuid)) {
|
||||
uuid = LogoutHelper.addUMTokenuuid;
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
private void handleReportCommand(List<reportBean> incomingList) {
|
||||
if (!StringUtil.isEmpty(Constant.Repotr_token)) {
|
||||
report_token = Constant.Repotr_token;
|
||||
}
|
||||
|
||||
// Token 尚未就绪时:若用户已登录,先暂存到内存队列并自动请求 Token,避免刚登录/冷启动的埋点丢失
|
||||
if (StringUtil.isEmpty(report_token)) {
|
||||
if (incomingList != null && !incomingList.isEmpty() && !StringUtil.isEmpty(getActiveUuid())) {
|
||||
PENDING_BEFORE_TOKEN_LIST.addAll(incomingList);
|
||||
initReport(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Token 已就绪:先把之前暂存的埋点补齐 user_id/app_key 并落盘
|
||||
boolean pendingHasImmediate = flushPendingBeforeTokenList();
|
||||
|
||||
if (incomingList == null) {
|
||||
if (checkReport()) {
|
||||
zipFile();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!incomingList.isEmpty()) {
|
||||
writeReport(incomingList, pendingHasImmediate);
|
||||
} else if (pendingHasImmediate && checkReport()) {
|
||||
zipFile();
|
||||
}
|
||||
else{
|
||||
CommUtil.saveListToFile(list,ReportFile,"upload",ReportFileZip);
|
||||
}
|
||||
|
||||
}
|
||||
public void zipFile()
|
||||
{
|
||||
CommUtil.isReoprtingNow="true";
|
||||
File folderToZip = new File(ReportFile);
|
||||
File zipFile = new File(ReportFileZip,"outputandroid.zip");
|
||||
|
||||
private boolean flushPendingBeforeTokenList() {
|
||||
if (!PENDING_BEFORE_TOKEN_LIST.isEmpty()) {
|
||||
boolean hasImmediate = shouldFlushImmediately(PENDING_BEFORE_TOKEN_LIST);
|
||||
CommUtil.saveListToFile(PENDING_BEFORE_TOKEN_LIST, ReportFile, "upload", ReportFileZip);
|
||||
CommUtil.totalreport += PENDING_BEFORE_TOKEN_LIST.size();
|
||||
PENDING_BEFORE_TOKEN_LIST.clear();
|
||||
return hasImmediate;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否包含高优先级关键业务事件(登录、签到、支付/积分兑换、文献下载、修改资料、收藏、分享等),
|
||||
* 关键事件落盘后立即触发打包上传,保证实时性。
|
||||
*/
|
||||
private boolean shouldFlushImmediately(List<reportBean> beanList) {
|
||||
if (beanList == null || beanList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (reportBean item : beanList) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
if (!StringUtil.isEmpty(item.getEvent_val())) {
|
||||
return true;
|
||||
}
|
||||
String eventName = item.getEvent_nickname();
|
||||
if ("login".equals(eventName)
|
||||
|| "signin".equals(eventName)
|
||||
|| "magazine_donwload".equals(eventName)
|
||||
|| "modify".equals(eventName)
|
||||
|| "collect".equals(eventName)
|
||||
|| "share".equals(eventName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void writeReport(List<reportBean> currentList) {
|
||||
writeReport(currentList, false);
|
||||
}
|
||||
|
||||
public void writeReport(List<reportBean> currentList, boolean forceImmediate) {
|
||||
// 始终先把当前批次写入本地 upload.txt,避免触发阈值那条埋点丢失或上传期间新埋点丢失
|
||||
CommUtil.saveListToFile(currentList, ReportFile, "upload", ReportFileZip);
|
||||
CommUtil.totalreport += currentList.size();
|
||||
Log.d("okhttp", "CommUtil.totalreport " + CommUtil.totalreport);
|
||||
|
||||
boolean immediate = forceImmediate || shouldFlushImmediately(currentList);
|
||||
if ((immediate || CommUtil.totalreport >= BATCH_UPLOAD_THRESHOLD) && checkReport()) {
|
||||
zipFile();
|
||||
}
|
||||
}
|
||||
|
||||
public void zipFile() {
|
||||
if ("true".equals(CommUtil.isReoprtingNow)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
File pendingFile = new File(ReportFile, "upload.txt");
|
||||
File uploadingFile = new File(ReportUploadingDir, "upload.txt");
|
||||
// 将待上传的 upload.txt 合并迁移至隔离目录 uploading/upload.txt,避免上传期间新写入的数据被混入或误删
|
||||
CommUtil.mergeFileToUploading(pendingFile, uploadingFile);
|
||||
CommUtil.totalreport = 0;
|
||||
|
||||
if (!uploadingFile.exists() || uploadingFile.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CommUtil.isReoprtingNow = "true";
|
||||
File folderToZip = new File(ReportUploadingDir);
|
||||
File zipFile = new File(ReportFileZip, "outputandroid.zip");
|
||||
CommUtil.zipFolderCorrected(folderToZip, zipFile, folderToZip.getPath());
|
||||
uploadFile();
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void uploadFile() {
|
||||
|
||||
Map<String, String> headers=new HashMap<>();
|
||||
headers.put("Content-Type","multipart/form-data");
|
||||
headers.put("Tag-Access",report_token);
|
||||
// Log.d("okhttp","report_token"+report_token);
|
||||
File zipFile = new File(ReportFileZip,"outputandroid.zip");
|
||||
public void uploadFile() {
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("Content-Type", "multipart/form-data");
|
||||
headers.put("Tag-Access", report_token);
|
||||
File zipFile = new File(ReportFileZip, "outputandroid.zip");
|
||||
if (!zipFile.exists() || zipFile.length() == 0) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
return;
|
||||
}
|
||||
OkHttpUtils
|
||||
.post()
|
||||
.url(Url.FileUrl)
|
||||
.headers(headers)
|
||||
.addFile("file", "outputandroid.zip", zipFile)//
|
||||
|
||||
// .file(zipFile)
|
||||
|
||||
.addFile("file", "outputandroid.zip", zipFile)
|
||||
.build()
|
||||
.execute(new StringCallback() {
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Exception e, int id) {
|
||||
Log.d("okhttp",e+"e");
|
||||
CommUtil.isReoprtingNow="false";
|
||||
CommUtil.totalreport=0;
|
||||
Log.d("okhttp", e + "e");
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(String response, int id) {
|
||||
Log.d("okhttp",response+"responseoutput");
|
||||
CommUtil.isReoprtingNow="false";
|
||||
|
||||
JSONObject jsonObject= null;
|
||||
Log.d("okhttp", response + "responseoutput");
|
||||
try {
|
||||
jsonObject = new JSONObject(response);
|
||||
if("30007".equals(jsonObject.optString("code")))
|
||||
{
|
||||
initReport();
|
||||
}
|
||||
else if("200".equals(jsonObject.optString("code")))
|
||||
{
|
||||
CommUtil.deleteFile(ReportFileZip,"outputandroid.zip",ReportFile);
|
||||
// CommUtil.isReoprtingNow="false";
|
||||
CommUtil.totalreport=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// CommUtil.isReoprtingNow="false";
|
||||
CommUtil.totalreport=0;
|
||||
JSONObject jsonObject = new JSONObject(response);
|
||||
String code = jsonObject.optString("code");
|
||||
if ("30007".equals(code)) {
|
||||
initReport(true);
|
||||
} else if ("200".equals(code)) {
|
||||
REPORT_EXECUTOR.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 仅清理已上传成功的快照目录 ReportUploadingDir,保留上传期间新写入 ReportFile 的数据
|
||||
CommUtil.deleteFile(ReportFileZip, "outputandroid.zip", ReportUploadingDir);
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
if (CommUtil.totalreport >= BATCH_UPLOAD_THRESHOLD && checkReport()) {
|
||||
zipFile();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
public Boolean checkReport()
|
||||
{
|
||||
File folderToZip = new File(ReportFile);
|
||||
if(folderToZip.exists())
|
||||
{
|
||||
return true;
|
||||
|
||||
public Boolean checkReport() {
|
||||
File pendingFile = new File(ReportFile, "upload.txt");
|
||||
File uploadingFile = new File(ReportUploadingDir, "upload.txt");
|
||||
return (pendingFile.exists() && pendingFile.length() > 0)
|
||||
|| (uploadingFile.exists() && uploadingFile.length() > 0);
|
||||
}
|
||||
|
||||
public void initReport() {
|
||||
initReport(true);
|
||||
}
|
||||
|
||||
public void initReport(final boolean retryUploadAfterToken) {
|
||||
if (isFetchingToken) {
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
String uuid = getActiveUuid();
|
||||
if (StringUtil.isEmpty(uuid)) {
|
||||
if (retryUploadAfterToken) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
}
|
||||
return;
|
||||
}
|
||||
isFetchingToken = true;
|
||||
Map<String, String> map = new HashMap<>();
|
||||
sendJsonPostParamtoNetSignMD5(Url.getTagToken, map, retryUploadAfterToken);
|
||||
}
|
||||
public void initReport()
|
||||
{
|
||||
|
||||
Map<String,String> map = new HashMap<>();
|
||||
sendJsonPostParamtoNetSignMD5(Url.getTagToken,map);
|
||||
public void sendJsonPostParamtoNetSignMD5(final String postUrl, final Map<String, String> param, final boolean retryUploadAfterToken) {
|
||||
|
||||
|
||||
}
|
||||
public void sendJsonPostParamtoNetSignMD5(final String postUrl, final Map<String, String> param) {
|
||||
|
||||
HttpHelper.loadData(HttpRequest.HttpMethod.GET, Url.getTimestamp,null, new RequestCallBack<String>() {
|
||||
HttpHelper.loadData(HttpRequest.HttpMethod.GET, Url.getTimestamp, null, new RequestCallBack<String>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResponseInfo<String> info) {
|
||||
String uuid = SharePrefUtil.getString(UIUtils.getContext(), Constant.uuid, "");
|
||||
if(StringUtil.isEmpty(uuid))
|
||||
{
|
||||
uuid= LogoutHelper.addUMTokenuuid;
|
||||
String uuid = getActiveUuid();
|
||||
if (StringUtil.isEmpty(uuid)) {
|
||||
isFetchingToken = false;
|
||||
if (retryUploadAfterToken) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
}
|
||||
return;
|
||||
}
|
||||
param.put("user_uuid", uuid);
|
||||
TimestampBean bean = GsonTools.fromGsonToBean(info.result, TimestampBean.class);
|
||||
if (bean == null) {
|
||||
isFetchingToken = false;
|
||||
if (retryUploadAfterToken) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
}
|
||||
return;
|
||||
}
|
||||
param.put("timestamp", bean.getTimestamp());
|
||||
param.put("client_type", "A");
|
||||
param.put("version", UpdateVersionUtils.getVersionName());
|
||||
@@ -265,45 +367,58 @@ public class ReportService extends Service {
|
||||
Gson gson = new Gson();
|
||||
String params = gson.toJson(param);
|
||||
byte[] data;
|
||||
boolean tokenRefreshed = false;
|
||||
try {
|
||||
String sign = SignUtil.getSign(param);
|
||||
LogUtil.i("params = "+params.toString());
|
||||
LogUtil.i("params = " + params.toString());
|
||||
data = params.getBytes(encoding);
|
||||
URL url = new URL(postUrl);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setDoOutput(true);
|
||||
conn.setRequestProperty("Content-Type","application/json");
|
||||
conn.setRequestProperty("sign",sign);
|
||||
conn.setRequestProperty("Content-Length",String.valueOf(data.length));
|
||||
conn.setRequestProperty("Content-Type", "application/json");
|
||||
conn.setRequestProperty("sign", sign);
|
||||
conn.setRequestProperty("Content-Length", String.valueOf(data.length));
|
||||
conn.setConnectTimeout(5 * 1000);
|
||||
OutputStream outStream = conn.getOutputStream();
|
||||
outStream.write(data);
|
||||
outStream.flush();
|
||||
outStream.close();
|
||||
int ssss=conn.getResponseCode() ;
|
||||
int ssss = conn.getResponseCode();
|
||||
if (ssss == 200) {
|
||||
InputStream inStream = conn.getInputStream();
|
||||
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
|
||||
String string = new String(result);
|
||||
LogUtil.i("result = " + result);
|
||||
JSONObject jsonObject111 = new JSONObject(string);
|
||||
if ("200".equals(jsonObject111.optString("code"))&&!jsonObject111.isNull("data")) {
|
||||
Constant.Report_userId= jsonObject111.optJSONObject("data").optString("userId");
|
||||
Constant.Repotr_token=jsonObject111.optJSONObject("data").optString("token");
|
||||
Constant.Repotr_app_key=jsonObject111.optJSONObject("data").optString("appKey");
|
||||
report_token=Constant.Repotr_token;
|
||||
// Log.d("okhttp","report_token666"+report_token);
|
||||
uploadFile();
|
||||
JSONObject jsonObject111 = new JSONObject(result);
|
||||
if ("200".equals(jsonObject111.optString("code")) && !jsonObject111.isNull("data")) {
|
||||
Constant.Report_userId = jsonObject111.optJSONObject("data").optString("userId");
|
||||
Constant.Repotr_token = jsonObject111.optJSONObject("data").optString("token");
|
||||
Constant.Repotr_app_key = jsonObject111.optJSONObject("data").optString("appKey");
|
||||
report_token = Constant.Repotr_token;
|
||||
tokenRefreshed = true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.e("提交失败,请重试 = "+e.getMessage());
|
||||
|
||||
// TODO Auto-generated catch block
|
||||
LogUtil.e("提交失败,请重试 = " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
isFetchingToken = false;
|
||||
if (tokenRefreshed) {
|
||||
if (retryUploadAfterToken) {
|
||||
uploadFile();
|
||||
}
|
||||
REPORT_EXECUTOR.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean hasImmediate = flushPendingBeforeTokenList();
|
||||
if (!retryUploadAfterToken && (hasImmediate || CommUtil.totalreport >= BATCH_UPLOAD_THRESHOLD) && checkReport()) {
|
||||
zipFile();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (retryUploadAfterToken) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
@@ -312,7 +427,10 @@ public class ReportService extends Service {
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException arg0, String arg1) {
|
||||
|
||||
isFetchingToken = false;
|
||||
if (retryUploadAfterToken) {
|
||||
CommUtil.isReoprtingNow = "false";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -60,10 +60,17 @@
|
||||
style="@style/InfoLeftStyle"
|
||||
android:text="姓名" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/my_name"
|
||||
style="@style/InfoRightStyle"
|
||||
android:hint="请输入姓名" />
|
||||
<EditText
|
||||
android:id="@+id/my_name"
|
||||
style="@style/InfoRightStyle"
|
||||
android:layout_width="200dp"
|
||||
android:background="@null"
|
||||
android:drawableRight="@null"
|
||||
android:hint="请输入姓名"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textPersonName"
|
||||
android:maxLength="20"
|
||||
android:textCursorDrawable="@drawable/color_cursor" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -132,10 +139,17 @@
|
||||
style="@style/InfoLeftStyle"
|
||||
android:text="科室电话" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/my_office_phone"
|
||||
style="@style/InfoRightStyle"
|
||||
android:hint="请输入所在科室的电话" />
|
||||
<EditText
|
||||
android:id="@+id/my_office_phone"
|
||||
style="@style/InfoRightStyle"
|
||||
android:layout_width="200dp"
|
||||
android:background="@null"
|
||||
android:drawableRight="@null"
|
||||
android:hint="请输入所在科室的电话"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="phone"
|
||||
android:maxLength="20"
|
||||
android:textCursorDrawable="@drawable/color_cursor" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -168,11 +182,17 @@
|
||||
style="@style/InfoLeftStyle"
|
||||
android:text="执业医师证编号" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/my_zgzs_number"
|
||||
style="@style/InfoRightStyle"
|
||||
android:layout_width="160dp"
|
||||
android:hint="请输入执业医师证编号" />
|
||||
<EditText
|
||||
android:id="@+id/my_zgzs_number"
|
||||
style="@style/InfoRightStyle"
|
||||
android:layout_width="180dp"
|
||||
android:background="@null"
|
||||
android:drawableRight="@null"
|
||||
android:hint="请输入执业医师证编号"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="30"
|
||||
android:textCursorDrawable="@drawable/color_cursor" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -650,7 +650,7 @@ code + .copy-button {
|
||||
<script type="text/javascript">
|
||||
function configurationCacheProblems() { return (
|
||||
// begin-report-data
|
||||
{"diagnostics":[{"problem":[{"text":"Java compilation warning"}],"severity":"WARNING","problemDetails":[{"text":"警告: [options] 源值 8 已过时,将在未来发行版中删除"}],"contextualLabel":"源值 8 已过时,将在未来发行版中删除","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-warn-option-obsolete-source","displayName":"Java compilation warning"}]},{"problem":[{"text":"Java compilation warning"}],"severity":"WARNING","problemDetails":[{"text":"警告: [options] 目标值 8 已过时,将在未来发行版中删除"}],"contextualLabel":"目标值 8 已过时,将在未来发行版中删除","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-warn-option-obsolete-target","displayName":"Java compilation warning"}]},{"problem":[{"text":"Java compilation warning"}],"severity":"WARNING","problemDetails":[{"text":"警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。"}],"contextualLabel":"要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-warn-option-obsolete-suppression","displayName":"Java compilation warning"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\activity\\MainActivity.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 某些输入文件使用或覆盖了已过时的 API。"}],"contextualLabel":"某些输入文件使用或覆盖了已过时的 API。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-deprecated-plural","displayName":"Java compilation note"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\activity\\MainActivity.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。"}],"contextualLabel":"有关详细信息, 请使用 -Xlint:deprecation 重新编译。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-deprecated-recompile","displayName":"Java compilation note"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\base\\BaseActivity.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 某些输入文件使用了未经检查或不安全的操作。"}],"contextualLabel":"某些输入文件使用了未经检查或不安全的操作。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-unchecked-plural","displayName":"Java compilation note"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\base\\BaseActivity.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。"}],"contextualLabel":"有关详细信息, 请使用 -Xlint:unchecked 重新编译。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-unchecked-recompile","displayName":"Java compilation note"}]}],"problemsReport":{"totalProblemCount":7,"buildName":"expert-app-2","requestedTasks":":app:assembleDebug","documentationLink":"https://docs.gradle.org/8.11.1/userguide/problems-report.html","documentationLinkCaption":"Problem report"}}
|
||||
{"diagnostics":[{"problem":[{"text":"Java compilation warning"}],"severity":"WARNING","problemDetails":[{"text":"警告: [options] 源值 8 已过时,将在未来发行版中删除"}],"contextualLabel":"源值 8 已过时,将在未来发行版中删除","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-warn-option-obsolete-source","displayName":"Java compilation warning"}]},{"problem":[{"text":"Java compilation warning"}],"severity":"WARNING","problemDetails":[{"text":"警告: [options] 目标值 8 已过时,将在未来发行版中删除"}],"contextualLabel":"目标值 8 已过时,将在未来发行版中删除","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-warn-option-obsolete-target","displayName":"Java compilation warning"}]},{"problem":[{"text":"Java compilation warning"}],"severity":"WARNING","problemDetails":[{"text":"警告: [options] 要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。"}],"contextualLabel":"要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-warn-option-obsolete-suppression","displayName":"Java compilation warning"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\application\\BaseApplication.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 某些输入文件使用或覆盖了已过时的 API。"}],"contextualLabel":"某些输入文件使用或覆盖了已过时的 API。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-deprecated-plural","displayName":"Java compilation note"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\application\\BaseApplication.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。"}],"contextualLabel":"有关详细信息, 请使用 -Xlint:deprecation 重新编译。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-deprecated-recompile","displayName":"Java compilation note"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\base\\BaseActivity.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 某些输入文件使用了未经检查或不安全的操作。"}],"contextualLabel":"某些输入文件使用了未经检查或不安全的操作。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-unchecked-plural","displayName":"Java compilation note"}]},{"locations":[{"path":"D:\\projects\\android_projects\\expert-app-2\\app\\src\\main\\java\\cn\\shangyu\\gdxzExpert\\base\\BaseActivity.java"}],"problem":[{"text":"Java compilation note"}],"severity":"ADVICE","problemDetails":[{"text":"注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。"}],"contextualLabel":"有关详细信息, 请使用 -Xlint:unchecked 重新编译。","problemId":[{"name":"java","displayName":"Java compilation"},{"name":"compilation","displayName":"Compilation"},{"name":"compiler-note-unchecked-recompile","displayName":"Java compilation note"}]}],"problemsReport":{"totalProblemCount":7,"buildName":"expert-app-2","requestedTasks":":app:assembleDebug","documentationLink":"https://docs.gradle.org/8.11.1/userguide/problems-report.html","documentationLinkCaption":"Problem report"}}
|
||||
// end-report-data
|
||||
);}
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -16,4 +16,4 @@ android.enableJetifier=true
|
||||
android.nonFinalResIds=false
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M"
|
||||
org.gradle.java.home=E:\\App\\java\\OpenJDK17U-jdk_x64_windows_hotspot_17.0.17_10\\jdk-17.0.17+10
|
||||
# org.gradle.java.home=E:\\App\\java\\OpenJDK17U-jdk_x64_windows_hotspot_17.0.17_10\\jdk-17.0.17+10
|
||||
|
||||
Reference in New Issue
Block a user