1
This commit is contained in:
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
*/build
|
/build/
|
||||||
.idea/
|
.idea/
|
||||||
.gradle/*
|
.gradle/*
|
||||||
*/release
|
*/release
|
||||||
*/debug
|
*/debug
|
||||||
|
*/build/
|
||||||
@@ -368,7 +368,7 @@ public class BindNumberActivity extends BaseActivity implements OnCallBackFromNe
|
|||||||
SharePrefUtil.saveInt(ct, "sex", sex);// 性别(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());
|
addUMToken(PushAgent.getInstance(this).getRegistrationId());
|
||||||
// 2.审核中3.需要补充修改资料
|
// 2.审核中3.需要补充修改资料
|
||||||
// 4.再次提交审核5.拒绝 6.已通过)
|
// 4.再次提交审核5.拒绝 6.已通过)
|
||||||
|
|||||||
@@ -1320,53 +1320,50 @@ public class BookDetailActivity extends BaseActivity implements
|
|||||||
}
|
}
|
||||||
//先判断是否网络下载
|
//先判断是否网络下载
|
||||||
private void isNetWorkDown(){
|
private void isNetWorkDown(){
|
||||||
String message = null;
|
int netType = CommonUtil.isNetworkAvailable(mActivity);
|
||||||
if (CommonUtil.isNetworkAvailable(mActivity) == 1){
|
if (netType == 0){
|
||||||
message = "当前为Wifi网络,您确定下载该篇文章?";
|
|
||||||
}else if (CommonUtil.isNetworkAvailable(mActivity) == 0){
|
|
||||||
ToastUtil.showMessage("无网络,请检查网络连接!");
|
ToastUtil.showMessage("无网络,请检查网络连接!");
|
||||||
}else {
|
return;
|
||||||
message = "当前为移动网络,您确定下载该篇文章?";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (netType == 1){
|
||||||
|
startBookDownload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String message = "当前为移动网络,您确定下载该篇文章?";
|
||||||
buildAlert = ECAlertDialog.buildAlert(mActivity, message, "取消", "确定",
|
buildAlert = ECAlertDialog.buildAlert(mActivity, message, "取消", "确定",
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
buildAlert.dismiss();
|
buildAlert.dismiss();
|
||||||
}
|
}
|
||||||
}, new DialogInterface.OnClickListener() {
|
}, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
buildAlert.dismiss();
|
||||||
// TODO Auto-generated method stub
|
startBookDownload();
|
||||||
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.setTitle("提示");
|
||||||
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
buildAlert.setTitleColor(mActivity.getResources().getColor(
|
||||||
R.color.top_title));
|
R.color.top_title));
|
||||||
buildAlert.show();
|
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() {
|
private void useWelfareNum() {
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.widget.AdapterView.OnItemClickListener;
|
|||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.EditText;
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@@ -125,11 +126,11 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
private String disctictId = "";
|
private String disctictId = "";
|
||||||
private boolean choosehos =false;
|
private boolean choosehos =false;
|
||||||
private TextView my_hospital;
|
private TextView my_hospital;
|
||||||
private TextView my_office_phone;
|
private EditText my_office_phone;
|
||||||
private TextView my_professional;
|
private TextView my_professional;
|
||||||
private TextView my_zgzs_number;
|
private EditText my_zgzs_number;
|
||||||
private TextView my_disease;
|
private TextView my_disease;
|
||||||
private TextView my_name;
|
private EditText my_name;
|
||||||
private TextView my_sex;
|
private TextView my_sex;
|
||||||
private TextView my_office_name;
|
private TextView my_office_name;
|
||||||
private int checkNum = 0; // 记录选中的条目数量
|
private int checkNum = 0; // 记录选中的条目数量
|
||||||
@@ -174,7 +175,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
my_photo = view.findViewById(R.id.my_photo);// 头像
|
my_photo = view.findViewById(R.id.my_photo);// 头像
|
||||||
|
|
||||||
ll_my_name = (LinearLayout) view.findViewById(R.id.ll_my_name);// 姓名
|
ll_my_name = (LinearLayout) view.findViewById(R.id.ll_my_name);// 姓名
|
||||||
my_name = (TextView) view.findViewById(R.id.my_name);// 姓名
|
my_name = (EditText) view.findViewById(R.id.my_name);// 姓名
|
||||||
|
|
||||||
ll_my_sex = (LinearLayout) view.findViewById(R.id.ll_my_sex);// sex
|
ll_my_sex = (LinearLayout) view.findViewById(R.id.ll_my_sex);// sex
|
||||||
my_sex = (TextView) view.findViewById(R.id.my_sex);// sex
|
my_sex = (TextView) view.findViewById(R.id.my_sex);// sex
|
||||||
@@ -188,7 +189,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
|
|
||||||
ll_my_office_phone = (LinearLayout) view
|
ll_my_office_phone = (LinearLayout) view
|
||||||
.findViewById(R.id.ll_my_office_phone);// 工作室电话
|
.findViewById(R.id.ll_my_office_phone);// 工作室电话
|
||||||
my_office_phone = (TextView) view.findViewById(R.id.my_office_phone);// 工作室
|
my_office_phone = (EditText) view.findViewById(R.id.my_office_phone);// 工作室
|
||||||
|
|
||||||
ll_my_professional = (LinearLayout) view
|
ll_my_professional = (LinearLayout) view
|
||||||
.findViewById(R.id.ll_my_professional);// 职业职称
|
.findViewById(R.id.ll_my_professional);// 职业职称
|
||||||
@@ -196,7 +197,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
|
|
||||||
ll_my_zgzs_number = (LinearLayout) view
|
ll_my_zgzs_number = (LinearLayout) view
|
||||||
.findViewById(R.id.ll_my_zgzs_number);// 医师资格证号码
|
.findViewById(R.id.ll_my_zgzs_number);// 医师资格证号码
|
||||||
my_zgzs_number = (TextView) view.findViewById(R.id.my_zgzs_number);// 医师资格证号码
|
my_zgzs_number = (EditText) view.findViewById(R.id.my_zgzs_number);// 医师资格证号码
|
||||||
|
|
||||||
ll_upload_certificateImg = (LinearLayout) view
|
ll_upload_certificateImg = (LinearLayout) view
|
||||||
.findViewById(R.id.ll_upload_certificateImg);// 医师资格证图片
|
.findViewById(R.id.ll_upload_certificateImg);// 医师资格证图片
|
||||||
@@ -492,16 +493,46 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
private void setInfoClick(boolean b) {
|
private void setInfoClick(boolean b) {
|
||||||
ll_my_photo.setEnabled(b);
|
ll_my_photo.setEnabled(b);
|
||||||
ll_my_name.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_sex.setEnabled(b);
|
||||||
ll_my_hospital.setEnabled(b);
|
ll_my_hospital.setEnabled(b);
|
||||||
ll_my_office_name.setEnabled(b);
|
ll_my_office_name.setEnabled(b);
|
||||||
ll_my_office_phone.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_professional.setEnabled(b);
|
||||||
ll_my_zgzs_number.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_upload_certificateImg.setEnabled(b);
|
||||||
ll_my_disease.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 弹出对话框
|
// 弹出对话框
|
||||||
private void showAlertTips(String message) {
|
private void showAlertTips(String message) {
|
||||||
buildAlert = ECAlertDialog.buildAlert(ct, message,
|
buildAlert = ECAlertDialog.buildAlert(ct, message,
|
||||||
@@ -558,12 +589,14 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
Constant.mobile, "");// 手机号
|
Constant.mobile, "");// 手机号
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.ll_my_name:// 姓名
|
case R.id.ll_my_name:// 姓名
|
||||||
showEditPopuWindows(my_name, 1);
|
focusInlineEdit(my_name);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_my_sex:// 性别
|
case R.id.ll_my_sex:// 性别
|
||||||
|
hideSoftKeyboard();
|
||||||
pwSexOptions.showAtLocation(my_sex, Gravity.BOTTOM, 0, 0);
|
pwSexOptions.showAtLocation(my_sex, Gravity.BOTTOM, 0, 0);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_my_hospital:// 医院
|
case R.id.ll_my_hospital:// 医院
|
||||||
|
hideSoftKeyboard();
|
||||||
// 设置适配器
|
// 设置适配器
|
||||||
// listView.setAdapter(new MyListAdapter(my_hospital,
|
// listView.setAdapter(new MyListAdapter(my_hospital,
|
||||||
// hospitalList));
|
// hospitalList));
|
||||||
@@ -576,20 +609,23 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
// my_hospital, 1);
|
// my_hospital, 1);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_my_office_name:// 科室
|
case R.id.ll_my_office_name:// 科室
|
||||||
|
hideSoftKeyboard();
|
||||||
showPwOptions("请选择科室", officeListItems, officeListUuidItems,
|
showPwOptions("请选择科室", officeListItems, officeListUuidItems,
|
||||||
my_office_name, 2);
|
my_office_name, 2);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_my_office_phone:// 科室电话
|
case R.id.ll_my_office_phone:// 科室电话
|
||||||
showEditPopuWindows(my_office_phone, 2);
|
focusInlineEdit(my_office_phone);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_my_professional:// 职称
|
case R.id.ll_my_professional:// 职称
|
||||||
|
hideSoftKeyboard();
|
||||||
showPwOptions("请选择职称", professionalListItems,
|
showPwOptions("请选择职称", professionalListItems,
|
||||||
professionalUuidListItems, my_professional, 3);
|
professionalUuidListItems, my_professional, 3);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_my_zgzs_number:// 资格证号
|
case R.id.ll_my_zgzs_number:// 资格证号
|
||||||
showEditPopuWindows(my_zgzs_number, 3);
|
focusInlineEdit(my_zgzs_number);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_upload_certificateImg:// 资格证图片
|
case R.id.ll_upload_certificateImg:// 资格证图片
|
||||||
|
hideSoftKeyboard();
|
||||||
save(mobile);
|
save(mobile);
|
||||||
Intent intent = new Intent(ct, SelectedPhotoActivity.class);
|
Intent intent = new Intent(ct, SelectedPhotoActivity.class);
|
||||||
intent.putExtra("isConstraint", true);// 是否等比例裁剪
|
intent.putExtra("isConstraint", true);// 是否等比例裁剪
|
||||||
@@ -599,6 +635,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
R.anim.timepicker_anim_exit_bottom);
|
R.anim.timepicker_anim_exit_bottom);
|
||||||
break;
|
break;
|
||||||
case R.id.ll_my_disease:// 专长
|
case R.id.ll_my_disease:// 专长
|
||||||
|
hideSoftKeyboard();
|
||||||
showDiseasePop(my_disease);
|
showDiseasePop(my_disease);
|
||||||
break;
|
break;
|
||||||
case R.id.btn_skip_info:// 跳过
|
case R.id.btn_skip_info:// 跳过
|
||||||
@@ -1041,7 +1078,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
|
|||||||
ToastUtil.showToast("科室电话不为空");
|
ToastUtil.showToast("科室电话不为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (officePhone.equals("请输入科室电话")) {
|
if (officePhone.equals("请输入科室电话") || officePhone.length() < 10) {
|
||||||
ToastUtil.showToast("请输入正确的科室电话");
|
ToastUtil.showToast("请输入正确的科室电话");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,14 +309,17 @@ public class BaseApplication extends Application {
|
|||||||
// CrashHandler.getInstance().init(getApplicationContext());
|
// CrashHandler.getInstance().init(getApplicationContext());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 注册Activity生命周期回调,用于跟踪当前resumed的Activity
|
// 注册Activity生命周期回调,用于跟踪当前resumed的Activity并在退后台时上报缓存画像埋点
|
||||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||||
|
private int startedActivityCount = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityStarted(Activity activity) {
|
public void onActivityStarted(Activity activity) {
|
||||||
|
startedActivityCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -334,6 +337,10 @@ public class BaseApplication extends Application {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityStopped(Activity activity) {
|
public void onActivityStopped(Activity activity) {
|
||||||
|
startedActivityCount = Math.max(0, startedActivityCount - 1);
|
||||||
|
if (startedActivityCount == 0 && activity != null && !activity.isChangingConfigurations()) {
|
||||||
|
startReport(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1531,6 +1531,11 @@ public abstract class BaseActivity extends AppCompatActivity implements
|
|||||||
if (type==2){
|
if (type==2){
|
||||||
type =4;
|
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, "");
|
String uuid = SharePrefUtil.getString(context, Constant.uuid, "");
|
||||||
RequestParams params = new RequestParams();//封装参数
|
RequestParams params = new RequestParams();//封装参数
|
||||||
params.addBodyParameter("expertUuid", uuid);
|
params.addBodyParameter("expertUuid", uuid);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package cn.shangyu.gdxzExpert.base;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -608,14 +609,18 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
public void startReport(List<reportBean> list)
|
public void startReport(List<reportBean> list)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(getActivity(), ReportService.class);
|
Context targetContext = getActivity() != null ? getActivity() : UIUtils.getContext();
|
||||||
|
if (targetContext == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Intent intent = new Intent(targetContext, ReportService.class);
|
||||||
if(list!=null)
|
if(list!=null)
|
||||||
{
|
{
|
||||||
intent.putExtra("report_list", (Serializable) list);
|
intent.putExtra("report_list", (Serializable) list);
|
||||||
|
|
||||||
}
|
}
|
||||||
intent.putExtra("report_token", Constant.Repotr_token);
|
intent.putExtra("report_token", Constant.Repotr_token);
|
||||||
getActivity().startService(intent);
|
targetContext.startService(intent);
|
||||||
}
|
}
|
||||||
public void needreportSimple(String name)
|
public void needreportSimple(String name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ public class LogoutHelper {
|
|||||||
SharePrefUtil.clear(UIUtils.getContext(), "isLogin");
|
SharePrefUtil.clear(UIUtils.getContext(), "isLogin");
|
||||||
startReport(null);
|
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,
|
// SharePrefUtil.clear(UIUtils.getContext(), SharePrefUtil.getString(UIUtils.getContext(), Constant.SP_IS_FIRST_NAME,
|
||||||
// Constant.mobile, "") + "my_provinceId");
|
// Constant.mobile, "") + "my_provinceId");
|
||||||
// SharePrefUtil.clear(UIUtils.getContext(), SharePrefUtil.getString(UIUtils.getContext(), Constant.SP_IS_FIRST_NAME,
|
// SharePrefUtil.clear(UIUtils.getContext(), SharePrefUtil.getString(UIUtils.getContext(), Constant.SP_IS_FIRST_NAME,
|
||||||
|
|||||||
+1
-15
@@ -1810,21 +1810,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
|
|||||||
String netWorkTypeName = getNetWorkTypeName(VideoDetailPolyvPlayerActivity.this);
|
String netWorkTypeName = getNetWorkTypeName(VideoDetailPolyvPlayerActivity.this);
|
||||||
if ("NETWORK_WIFI".equals(netWorkTypeName)){
|
if ("NETWORK_WIFI".equals(netWorkTypeName)){
|
||||||
if ("点击下载".equals(tv_exchange.getText().toString())){
|
if ("点击下载".equals(tv_exchange.getText().toString())){
|
||||||
buildAlert = ECAlertDialog.buildAlert(VideoDetailPolyvPlayerActivity.this,"当前为Wifi网络,确定下载?", "取消", "确定",
|
videoDown();
|
||||||
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();
|
|
||||||
}else if("视频缓存中".equals(tv_exchange.getText().toString())){
|
}else if("视频缓存中".equals(tv_exchange.getText().toString())){
|
||||||
Intent intent1 = new Intent(VideoDetailPolyvPlayerActivity.this, PolyvDownloadActivity.class);
|
Intent intent1 = new Intent(VideoDetailPolyvPlayerActivity.this, PolyvDownloadActivity.class);
|
||||||
intent1.putExtra("isStarting",true);
|
intent1.putExtra("isStarting",true);
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import java.util.zip.ZipEntry;
|
|||||||
import java.util.zip.ZipOutputStream;
|
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 class CommUtil {
|
||||||
// public static String userId="";
|
// public static String userId="";
|
||||||
@@ -79,8 +81,20 @@ public class CommUtil {
|
|||||||
Log.d("saveListToFile",file.getAbsolutePath());
|
Log.d("saveListToFile",file.getAbsolutePath());
|
||||||
try {
|
try {
|
||||||
FileOutputStream fos=new FileOutputStream(file,true);//设置为true,继续原文件写入
|
FileOutputStream fos=new FileOutputStream(file,true);//设置为true,继续原文件写入
|
||||||
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos))) {
|
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"))) {
|
||||||
for (reportBean item : list) {
|
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.write(gson.toJson(item));
|
||||||
writer.newLine(); // 每个布尔值后写入一个新行
|
writer.newLine(); // 每个布尔值后写入一个新行
|
||||||
}
|
}
|
||||||
@@ -106,34 +120,63 @@ public class CommUtil {
|
|||||||
|
|
||||||
try (FileOutputStream fos = new FileOutputStream(zipFile);
|
try (FileOutputStream fos = new FileOutputStream(zipFile);
|
||||||
ZipOutputStream zos = new ZipOutputStream(fos)) {
|
ZipOutputStream zos = new ZipOutputStream(fos)) {
|
||||||
|
zipFolderInternal(folderToZip, zos, basePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File[] files = folderToZip.listFiles();
|
private static void zipFolderInternal(File currentFolder, ZipOutputStream zos, String basePath) throws IOException {
|
||||||
if (files != null) {
|
File[] files = currentFolder.listFiles();
|
||||||
for (File file : files) {
|
if (files != null) {
|
||||||
String filePath = file.getPath().replace("\\", "/");
|
for (File file : files) {
|
||||||
String entryName = filePath.substring(basePath.length());
|
String filePath = file.getPath().replace("\\", "/");
|
||||||
if (file.isDirectory()) {
|
String entryName = filePath.substring(basePath.length());
|
||||||
// 添加文件夹条目
|
if (file.isDirectory()) {
|
||||||
zos.putNextEntry(new ZipEntry(entryName + "/"));
|
zos.putNextEntry(new ZipEntry(entryName + "/"));
|
||||||
zos.closeEntry();
|
zos.closeEntry();
|
||||||
// 递归地压缩子文件夹
|
zipFolderInternal(file, zos, basePath);
|
||||||
zipFolderCorrected(file, zipFile, basePath);
|
} else {
|
||||||
} else {
|
zos.putNextEntry(new ZipEntry(entryName));
|
||||||
// 添加文件条目并写入文件内容
|
try (FileInputStream fis = new FileInputStream(file)) {
|
||||||
zos.putNextEntry(new ZipEntry(entryName));
|
byte[] buffer = new byte[1024];
|
||||||
try (FileInputStream fis = new FileInputStream(file)) {
|
int length;
|
||||||
byte[] buffer = new byte[1024];
|
while ((length = fis.read(buffer)) >= 0) {
|
||||||
int length;
|
zos.write(buffer, 0, length);
|
||||||
while ((length = fis.read(buffer)) >= 0) {
|
|
||||||
zos.write(buffer, 0, length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
zos.closeEntry();
|
|
||||||
}
|
}
|
||||||
|
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)
|
public static void deleteFile( String ReportFileZip,String name,String folderPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,12 @@ import java.io.InputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import cn.shangyu.gdxzExpert.bean.TimestampBean;
|
import cn.shangyu.gdxzExpert.bean.TimestampBean;
|
||||||
import cn.shangyu.gdxzExpert.http.HttpHelper;
|
import cn.shangyu.gdxzExpert.http.HttpHelper;
|
||||||
@@ -47,17 +50,26 @@ public class ReportService extends Service {
|
|||||||
|
|
||||||
public ReportService() {
|
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 ReportFile;
|
||||||
|
public String ReportUploadingDir;
|
||||||
public String ReportFileZip;
|
public String ReportFileZip;
|
||||||
public String report_token="";
|
public volatile String report_token = "";
|
||||||
List<reportBean> list;
|
private volatile boolean isFetchingToken = false;
|
||||||
|
|
||||||
// public String FileUrl="https://dev-event.igandan.com/v1/eventLog/upload";//测试环境
|
// public String FileUrl="https://dev-event.igandan.com/v1/eventLog/upload";//测试环境
|
||||||
// public String FileUrl="https://event.igandan.com/v1/eventLog/upload";//正式环境
|
// public String FileUrl="https://event.igandan.com/v1/eventLog/upload";//正式环境
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
ReportFile=getBaseContext().getExternalFilesDir("").getAbsolutePath()+"/gdxz/report/zip";
|
String basePath = getBaseContext().getExternalFilesDir("").getAbsolutePath();
|
||||||
ReportFileZip=getBaseContext().getExternalFilesDir("").getAbsolutePath()+"/gdxz/report/";
|
ReportFile = basePath + "/gdxz/report/zip";
|
||||||
|
ReportUploadingDir = basePath + "/gdxz/report/uploading";
|
||||||
|
ReportFileZip = basePath + "/gdxz/report/";
|
||||||
// if("true".equals(CommUtil.isFirstRun))
|
// if("true".equals(CommUtil.isFirstRun))
|
||||||
// {
|
// {
|
||||||
// CommUtil.isFirstRun="false";
|
// CommUtil.isFirstRun="false";
|
||||||
@@ -102,160 +114,250 @@ public class ReportService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
report_token=intent.getStringExtra("report_token");
|
if (intent == null) {
|
||||||
if(report_token==""||report_token==null)
|
|
||||||
{
|
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
else if(intent.getSerializableExtra("report_list")==null)
|
final String incomingToken = intent.getStringExtra("report_token");
|
||||||
{
|
if (!StringUtil.isEmpty(incomingToken)) {
|
||||||
if(checkReport())
|
report_token = incomingToken;
|
||||||
{
|
} else if (!StringUtil.isEmpty(Constant.Repotr_token)) {
|
||||||
new Thread(new Runnable() {
|
report_token = Constant.Repotr_token;
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
zipFile();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
return START_NOT_STICKY;
|
|
||||||
}
|
}
|
||||||
list = (List<reportBean>) intent.getSerializableExtra("report_list");
|
final List<reportBean> incomingList = (List<reportBean>) intent.getSerializableExtra("report_list");
|
||||||
CommUtil.totalreport+= list.size();
|
|
||||||
|
|
||||||
// 在新线程或异步任务中执行文件上传
|
REPORT_EXECUTOR.execute(new Runnable() {
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
writeReport();
|
handleReportCommand(incomingList);
|
||||||
// uploadFile(filePath);
|
|
||||||
// // 上传完成后,可以停止服务或发送广播通知其他组件
|
|
||||||
// stopSelf(); // 或者使用广播通知
|
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
return START_NOT_STICKY;
|
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();
|
zipFile();
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
CommUtil.saveListToFile(list,ReportFile,"upload",ReportFileZip);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void zipFile()
|
|
||||||
{
|
private boolean flushPendingBeforeTokenList() {
|
||||||
CommUtil.isReoprtingNow="true";
|
if (!PENDING_BEFORE_TOKEN_LIST.isEmpty()) {
|
||||||
File folderToZip = new File(ReportFile);
|
boolean hasImmediate = shouldFlushImmediately(PENDING_BEFORE_TOKEN_LIST);
|
||||||
File zipFile = new File(ReportFileZip,"outputandroid.zip");
|
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 {
|
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());
|
CommUtil.zipFolderCorrected(folderToZip, zipFile, folderToZip.getPath());
|
||||||
uploadFile();
|
uploadFile();
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
|
CommUtil.isReoprtingNow = "false";
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void uploadFile() {
|
|
||||||
|
|
||||||
Map<String, String> headers=new HashMap<>();
|
public void uploadFile() {
|
||||||
headers.put("Content-Type","multipart/form-data");
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("Tag-Access",report_token);
|
headers.put("Content-Type", "multipart/form-data");
|
||||||
// Log.d("okhttp","report_token"+report_token);
|
headers.put("Tag-Access", report_token);
|
||||||
File zipFile = new File(ReportFileZip,"outputandroid.zip");
|
File zipFile = new File(ReportFileZip, "outputandroid.zip");
|
||||||
|
if (!zipFile.exists() || zipFile.length() == 0) {
|
||||||
|
CommUtil.isReoprtingNow = "false";
|
||||||
|
return;
|
||||||
|
}
|
||||||
OkHttpUtils
|
OkHttpUtils
|
||||||
.post()
|
.post()
|
||||||
.url(Url.FileUrl)
|
.url(Url.FileUrl)
|
||||||
.headers(headers)
|
.headers(headers)
|
||||||
.addFile("file", "outputandroid.zip", zipFile)//
|
.addFile("file", "outputandroid.zip", zipFile)
|
||||||
|
|
||||||
// .file(zipFile)
|
|
||||||
|
|
||||||
.build()
|
.build()
|
||||||
.execute(new StringCallback() {
|
.execute(new StringCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Call call, Exception e, int id) {
|
public void onError(Call call, Exception e, int id) {
|
||||||
Log.d("okhttp",e+"e");
|
Log.d("okhttp", e + "e");
|
||||||
CommUtil.isReoprtingNow="false";
|
CommUtil.isReoprtingNow = "false";
|
||||||
CommUtil.totalreport=0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(String response, int id) {
|
public void onResponse(String response, int id) {
|
||||||
Log.d("okhttp",response+"responseoutput");
|
Log.d("okhttp", response + "responseoutput");
|
||||||
CommUtil.isReoprtingNow="false";
|
|
||||||
|
|
||||||
JSONObject jsonObject= null;
|
|
||||||
try {
|
try {
|
||||||
jsonObject = new JSONObject(response);
|
JSONObject jsonObject = new JSONObject(response);
|
||||||
if("30007".equals(jsonObject.optString("code")))
|
String code = jsonObject.optString("code");
|
||||||
{
|
if ("30007".equals(code)) {
|
||||||
initReport();
|
initReport(true);
|
||||||
}
|
} else if ("200".equals(code)) {
|
||||||
else if("200".equals(jsonObject.optString("code")))
|
REPORT_EXECUTOR.execute(new Runnable() {
|
||||||
{
|
@Override
|
||||||
CommUtil.deleteFile(ReportFileZip,"outputandroid.zip",ReportFile);
|
public void run() {
|
||||||
// CommUtil.isReoprtingNow="false";
|
// 仅清理已上传成功的快照目录 ReportUploadingDir,保留上传期间新写入 ReportFile 的数据
|
||||||
CommUtil.totalreport=0;
|
CommUtil.deleteFile(ReportFileZip, "outputandroid.zip", ReportUploadingDir);
|
||||||
}
|
CommUtil.isReoprtingNow = "false";
|
||||||
else
|
if (CommUtil.totalreport >= BATCH_UPLOAD_THRESHOLD && checkReport()) {
|
||||||
{
|
zipFile();
|
||||||
// CommUtil.isReoprtingNow="false";
|
}
|
||||||
CommUtil.totalreport=0;
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
CommUtil.isReoprtingNow = "false";
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
CommUtil.isReoprtingNow = "false";
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public Boolean checkReport()
|
|
||||||
{
|
public Boolean checkReport() {
|
||||||
File folderToZip = new File(ReportFile);
|
File pendingFile = new File(ReportFile, "upload.txt");
|
||||||
if(folderToZip.exists())
|
File uploadingFile = new File(ReportUploadingDir, "upload.txt");
|
||||||
{
|
return (pendingFile.exists() && pendingFile.length() > 0)
|
||||||
return true;
|
|| (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<>();
|
public void sendJsonPostParamtoNetSignMD5(final String postUrl, final Map<String, String> param, final boolean retryUploadAfterToken) {
|
||||||
sendJsonPostParamtoNetSignMD5(Url.getTagToken,map);
|
|
||||||
|
|
||||||
|
HttpHelper.loadData(HttpRequest.HttpMethod.GET, Url.getTimestamp, null, new RequestCallBack<String>() {
|
||||||
}
|
|
||||||
public void sendJsonPostParamtoNetSignMD5(final String postUrl, final Map<String, String> param) {
|
|
||||||
|
|
||||||
HttpHelper.loadData(HttpRequest.HttpMethod.GET, Url.getTimestamp,null, new RequestCallBack<String>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ResponseInfo<String> info) {
|
public void onSuccess(ResponseInfo<String> info) {
|
||||||
String uuid = SharePrefUtil.getString(UIUtils.getContext(), Constant.uuid, "");
|
String uuid = getActiveUuid();
|
||||||
if(StringUtil.isEmpty(uuid))
|
if (StringUtil.isEmpty(uuid)) {
|
||||||
{
|
isFetchingToken = false;
|
||||||
uuid= LogoutHelper.addUMTokenuuid;
|
if (retryUploadAfterToken) {
|
||||||
|
CommUtil.isReoprtingNow = "false";
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
param.put("user_uuid", uuid);
|
param.put("user_uuid", uuid);
|
||||||
TimestampBean bean = GsonTools.fromGsonToBean(info.result, TimestampBean.class);
|
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("timestamp", bean.getTimestamp());
|
||||||
param.put("client_type", "A");
|
param.put("client_type", "A");
|
||||||
param.put("version", UpdateVersionUtils.getVersionName());
|
param.put("version", UpdateVersionUtils.getVersionName());
|
||||||
@@ -265,45 +367,58 @@ public class ReportService extends Service {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String params = gson.toJson(param);
|
String params = gson.toJson(param);
|
||||||
byte[] data;
|
byte[] data;
|
||||||
|
boolean tokenRefreshed = false;
|
||||||
try {
|
try {
|
||||||
String sign = SignUtil.getSign(param);
|
String sign = SignUtil.getSign(param);
|
||||||
LogUtil.i("params = "+params.toString());
|
LogUtil.i("params = " + params.toString());
|
||||||
data = params.getBytes(encoding);
|
data = params.getBytes(encoding);
|
||||||
URL url = new URL(postUrl);
|
URL url = new URL(postUrl);
|
||||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
conn.setRequestMethod("POST");
|
conn.setRequestMethod("POST");
|
||||||
conn.setDoOutput(true);
|
conn.setDoOutput(true);
|
||||||
conn.setRequestProperty("Content-Type","application/json");
|
conn.setRequestProperty("Content-Type", "application/json");
|
||||||
conn.setRequestProperty("sign",sign);
|
conn.setRequestProperty("sign", sign);
|
||||||
conn.setRequestProperty("Content-Length",String.valueOf(data.length));
|
conn.setRequestProperty("Content-Length", String.valueOf(data.length));
|
||||||
conn.setConnectTimeout(5 * 1000);
|
conn.setConnectTimeout(5 * 1000);
|
||||||
OutputStream outStream = conn.getOutputStream();
|
OutputStream outStream = conn.getOutputStream();
|
||||||
outStream.write(data);
|
outStream.write(data);
|
||||||
outStream.flush();
|
outStream.flush();
|
||||||
outStream.close();
|
outStream.close();
|
||||||
int ssss=conn.getResponseCode() ;
|
int ssss = conn.getResponseCode();
|
||||||
if (ssss == 200) {
|
if (ssss == 200) {
|
||||||
InputStream inStream = conn.getInputStream();
|
InputStream inStream = conn.getInputStream();
|
||||||
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
|
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
|
||||||
String string = new String(result);
|
|
||||||
LogUtil.i("result = " + result);
|
LogUtil.i("result = " + result);
|
||||||
JSONObject jsonObject111 = new JSONObject(string);
|
JSONObject jsonObject111 = new JSONObject(result);
|
||||||
if ("200".equals(jsonObject111.optString("code"))&&!jsonObject111.isNull("data")) {
|
if ("200".equals(jsonObject111.optString("code")) && !jsonObject111.isNull("data")) {
|
||||||
Constant.Report_userId= jsonObject111.optJSONObject("data").optString("userId");
|
Constant.Report_userId = jsonObject111.optJSONObject("data").optString("userId");
|
||||||
Constant.Repotr_token=jsonObject111.optJSONObject("data").optString("token");
|
Constant.Repotr_token = jsonObject111.optJSONObject("data").optString("token");
|
||||||
Constant.Repotr_app_key=jsonObject111.optJSONObject("data").optString("appKey");
|
Constant.Repotr_app_key = jsonObject111.optJSONObject("data").optString("appKey");
|
||||||
report_token=Constant.Repotr_token;
|
report_token = Constant.Repotr_token;
|
||||||
// Log.d("okhttp","report_token666"+report_token);
|
tokenRefreshed = true;
|
||||||
uploadFile();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.e("提交失败,请重试 = "+e.getMessage());
|
LogUtil.e("提交失败,请重试 = " + e.getMessage());
|
||||||
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} 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();
|
}.start();
|
||||||
@@ -312,7 +427,10 @@ public class ReportService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(HttpException arg0, String arg1) {
|
public void onFailure(HttpException arg0, String arg1) {
|
||||||
|
isFetchingToken = false;
|
||||||
|
if (retryUploadAfterToken) {
|
||||||
|
CommUtil.isReoprtingNow = "false";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -60,10 +60,17 @@
|
|||||||
style="@style/InfoLeftStyle"
|
style="@style/InfoLeftStyle"
|
||||||
android:text="姓名" />
|
android:text="姓名" />
|
||||||
|
|
||||||
<TextView
|
<EditText
|
||||||
android:id="@+id/my_name"
|
android:id="@+id/my_name"
|
||||||
style="@style/InfoRightStyle"
|
style="@style/InfoRightStyle"
|
||||||
android:hint="请输入姓名" />
|
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>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -132,10 +139,17 @@
|
|||||||
style="@style/InfoLeftStyle"
|
style="@style/InfoLeftStyle"
|
||||||
android:text="科室电话" />
|
android:text="科室电话" />
|
||||||
|
|
||||||
<TextView
|
<EditText
|
||||||
android:id="@+id/my_office_phone"
|
android:id="@+id/my_office_phone"
|
||||||
style="@style/InfoRightStyle"
|
style="@style/InfoRightStyle"
|
||||||
android:hint="请输入所在科室的电话" />
|
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>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -168,11 +182,17 @@
|
|||||||
style="@style/InfoLeftStyle"
|
style="@style/InfoLeftStyle"
|
||||||
android:text="执业医师证编号" />
|
android:text="执业医师证编号" />
|
||||||
|
|
||||||
<TextView
|
<EditText
|
||||||
android:id="@+id/my_zgzs_number"
|
android:id="@+id/my_zgzs_number"
|
||||||
style="@style/InfoRightStyle"
|
style="@style/InfoRightStyle"
|
||||||
android:layout_width="160dp"
|
android:layout_width="180dp"
|
||||||
android:hint="请输入执业医师证编号" />
|
android:background="@null"
|
||||||
|
android:drawableRight="@null"
|
||||||
|
android:hint="请输入执业医师证编号"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="30"
|
||||||
|
android:textCursorDrawable="@drawable/color_cursor" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ code + .copy-button {
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function configurationCacheProblems() { return (
|
function configurationCacheProblems() { return (
|
||||||
// begin-report-data
|
// 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
|
// end-report-data
|
||||||
);}
|
);}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
+1
-1
@@ -16,4 +16,4 @@ android.enableJetifier=true
|
|||||||
android.nonFinalResIds=false
|
android.nonFinalResIds=false
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M"
|
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