Compare commits

29 Commits
Author SHA1 Message Date
haomingming ddb5d0020b 9 2026-11-04 13:58:47 +08:00
haomingming 685f52cd0d 9 2026-11-04 11:01:43 +08:00
admin f08d303bed 2 2026-11-04 10:53:58 +08:00
haomingming 9e3b52c8ca 9 2026-11-04 10:49:47 +08:00
haomingming cf4ca685f6 添加接口统一拦截码3800 跳登录页面 2026-11-04 10:38:23 +08:00
admin 98072d2615 2 2026-11-03 16:55:37 +08:00
admin 1a0923ac96 Merge branch 'dev' of https://gitea.igandanyiyuan.com/admin/expert-app into dev 2026-11-03 16:53:11 +08:00
admin f3b8aab27b 1 2026-11-03 16:53:06 +08:00
admin fc1bb2179d 1 2026-11-03 16:50:01 +08:00
haomingming fd9b814450 2 2026-11-03 16:45:18 +08:00
admin 5add3d381c 1 2026-11-03 15:43:54 +08:00
haomingming a2c9e7a60d 2 2026-11-03 15:38:24 +08:00
haomingming 868624069a 2 2026-11-03 15:26:38 +08:00
haomingming 67fab86f35 2 2026-11-03 15:05:57 +08:00
haomingming 6b06c77f42 2 2026-11-03 14:04:36 +08:00
haomingming b8f7f2985b 1 2026-11-03 14:00:28 +08:00
admin 1d159b040a 430 2026-11-03 13:58:06 +08:00
haomingming 5b442b25ec 3 2026-11-03 13:17:22 +08:00
haomingming fdf660ad4b 3 2026-11-03 13:09:03 +08:00
haomingming 24f53cce85 3 2026-11-03 12:16:38 +08:00
haomingming 403ae65786 3 2026-11-03 12:07:32 +08:00
haomingming 60f6781f6e 3 2026-11-03 11:48:00 +08:00
haomingming 8f8b48ff03 3 2026-11-03 11:39:27 +08:00
haomingming 4425d79fcf 3 2026-11-03 11:32:42 +08:00
haomingming a12e39b781 3 2026-11-03 11:10:38 +08:00
haomingming 4ae19c6045 2 2026-11-03 10:44:43 +08:00
admin ff1f7e9f8b 更改首页接口 2026-11-03 10:32:30 +08:00
haomingming 66dc13bc03 1 2026-11-03 10:13:08 +08:00
haomingming 7401819afb 未登录可先进入首页浏览、触发敏感功能再登录 2026-11-03 09:52:02 +08:00
49 changed files with 1840 additions and 1348 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
*/build
/build/
.idea/
.gradle/*
*/release
*/debug
*/build/
local.properties
+2 -2
View File
@@ -29,8 +29,8 @@ android {
minSdkVersion 21
// targetSdkVersion > 32 需要处理照片权限的问题
targetSdkVersion 32
versionCode 429
versionName "4.2.9"
versionCode 430
versionName "4.3.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
multiDexEnabled true
ndk {
+2 -2
View File
@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="cn.shangyu.gdxzExpert"
android:versionCode="429"
android:versionName="4.2.9">
android:versionCode="430"
android:versionName="4.3.0">
<uses-sdk tools:overrideLibrary="com.huawei.android.hms.base,com.huawei.android.hms.push" />
<uses-feature
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,5 +1,5 @@
<hbuilder version="1.9.9.80110" debug="false" syncDebug ="false">
<!--<hbuilder version="1.9.9.80110" debug="false" syncDebug ="true">-->
<!--<hbuilder version="1.9.9.80110" debug="false" syncDebug ="false">-->
<hbuilder version="1.9.9.80110" debug="false" syncDebug ="true">
<apps>
<app appid="unimp" appver="1.0"/>
</apps>
@@ -175,6 +175,7 @@ public class BindNumberActivity extends BaseActivity implements OnCallBackFromNe
Log.d("LoginTAG", "获取token成功:" + s);
// mPhoneNumberAuthHelper.hideLoginLoading();
// mPhoneNumberAuthHelper.quitLoginPage();
mPhoneNumberAuthHelper.quitLoginPage();
getResultWithToken(tokenRet.getToken());
}
@@ -368,7 +369,7 @@ public class BindNumberActivity extends BaseActivity implements OnCallBackFromNe
SharePrefUtil.saveInt(ct, "sex", sex);// 性别(0.男 1.女)
SharePrefUtil.saveInt(ct, "state", state);// 审核状态( 1.待审核
needreportSimple("login");
addUMToken(PushAgent.getInstance(this).getRegistrationId());
// 2.审核中3.需要补充修改资料
// 4.再次提交审核5.拒绝 6.已通过)
@@ -384,25 +385,32 @@ public class BindNumberActivity extends BaseActivity implements OnCallBackFromNe
}
public void getYunxin(JSONObject objs) throws JSONException {
String yx_accid =objs.getString("YX_accid");
String yx_token =objs.getString("YX_token");
String yx_accid = objs.optString("YX_accid", "");
String yx_token = objs.optString("YX_token", "");
SharePrefUtil.saveString(ct, Constant.yx_accid, yx_accid);
SharePrefUtil.saveString(ct, Constant.yx_token, yx_token);
}
public void getLoginInfo(int state,JSONObject objs) throws JSONException {
if (mPhoneNumberAuthHelper != null) {
mPhoneNumberAuthHelper.hideLoginLoading();
mPhoneNumberAuthHelper.quitLoginPage();
}
getYunxin(objs);
Log.d("LoginTAG","state "+state);
if (state != 6) {
// 需要完善资料,跳转到完善资料页面
// ToastUtil.showToast("登录成功,请完善资料");
// 启动登录设置信息界面
Log.d("LoginTAG","state1 "+state);
cn.shangyu.gdxzExpert.base.AppManager.getAppManager().finishActivity(LoginNewActivity.class);
Intent intent = new Intent(this, LoginSetInfoActivity.class);
intent.putExtra("checkInfo", checkInfo);
intent.putExtra("state", state);
startActivity(intent);
closeProgressDialog();
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, false);
Constant.islogout = 2;
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
this.finish();
} else {
getYunxin(objs);
@@ -422,6 +430,10 @@ public class BindNumberActivity extends BaseActivity implements OnCallBackFromNe
};
private void doLauncherAction() {
if (mPhoneNumberAuthHelper != null) {
mPhoneNumberAuthHelper.hideLoginLoading();
mPhoneNumberAuthHelper.quitLoginPage();
}
closeProgressDialog();
// ( 1.待审核 2.审核中 3.需要补充修改资料 4.再次提交审核 5.拒绝
@@ -437,7 +449,15 @@ public class BindNumberActivity extends BaseActivity implements OnCallBackFromNe
// {
intent.setClass(this, MainActivity.class);
// }
Constant.islogout = 2;
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
cn.shangyu.gdxzExpert.base.AppManager.getAppManager().finishActivity(LoginNewActivity.class);
intent.putExtra("launcher_from", 1);
if (MainActivity.mMainActivity == null || MainActivity.mMainActivity.isFinishing() || MainActivity.mMainActivity.isDestroyed()) {
startActivity(intent);
}
finish();
if (false)
startActivity(intent);
Constant.islogout = 2;
@@ -1320,52 +1320,49 @@ public class BookDetailActivity extends BaseActivity implements
}
//先判断是否网络下载
private void isNetWorkDown(){
String message = null;
if (CommonUtil.isNetworkAvailable(mActivity) == 1){
message = "当前为Wifi网络,您确定下载该篇文章?";
}else if (CommonUtil.isNetworkAvailable(mActivity) == 0){
int netType = CommonUtil.isNetworkAvailable(mActivity);
if (netType == 0){
ToastUtil.showMessage("无网络,请检查网络连接!");
}else {
message = "当前为移动网络,您确定下载该篇文章?";
return;
}
if (netType == 1){
startBookDownload();
return;
}
String 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) {
buildAlert.dismiss();
startBookDownload();
}
});
buildAlert.setTitle("提示");
buildAlert.setTitleColor(mActivity.getResources().getColor(
R.color.top_title));
buildAlert.show();
}
// TODO Auto-generated method stub
private void 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.setTitleColor(mActivity.getResources().getColor(
R.color.top_title));
buildAlert.show();
}
//使用福利操作
private void useWelfareNum() {
@@ -407,6 +407,7 @@ public class CourseUrlDetailActivity extends BaseActivity implements
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId();
if (id == R.id.ll_yuan_download) {
if (!UIUtils.checkLoginAndJump(this)) return;
if (freeRecord > 0 || welfareNum>0) {
showDialoag(freeRecord+welfareNum);
} else {
@@ -421,9 +422,11 @@ public class CourseUrlDetailActivity extends BaseActivity implements
openWordFile(mPath);
}
} else if (id == R.id.ll_again_download) {
if (!UIUtils.checkLoginAndJump(this)) return;
getSystemTime();
needreportPays("order_gdfile_download",0+"","元",1+"",title,tags,"肝胆课件");
} else if (id == R.id.ll_free_download) {
if (!UIUtils.checkLoginAndJump(this)) return;
order_id = "FREE";
int visibility = mLl_ctn_download.getVisibility();
if (visibility!=0) {
@@ -436,6 +439,7 @@ public class CourseUrlDetailActivity extends BaseActivity implements
}
needreportPays("order_gdfile_download",0+"","元",1+"",title,tags,"肝胆课件");
} else if (id == R.id.top_right) {
if (!UIUtils.checkLoginAndJump(this)) return;
if (IsColloction) {
CollectListDis();
} else {
@@ -823,7 +823,14 @@ public class LoginActivity extends BaseActivity implements OnCallBackFromNet {
// 6.已通过)
// 注册成功跳转
Intent intent = new Intent(this, MainActivity.class);
Constant.islogout = 2;
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
intent.putExtra("launcher_from", 1);
if (MainActivity.mMainActivity == null || MainActivity.mMainActivity.isFinishing() || MainActivity.mMainActivity.isDestroyed()) {
startActivity(intent);
}
this.finish();
if (false)
startActivity(intent);
Constant.islogout = 2;
@@ -152,7 +152,7 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
public void setTitle() {
// initFontScale();
top_title.setText("登录");
top_back_layout.setVisibility(View.GONE);
top_back_layout.setVisibility(View.VISIBLE);
// top_right_text.setVisibility(View.VISIBLE);
// top_right_text.setText("注册");
}
@@ -166,7 +166,7 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
View view = View.inflate(ct, R.layout.activity_login_new, null);
// initFontScale();
Constant.islogout = 1;
// Constant.islogout = 1;
DestroyActivityUtil.addDestoryActivityToMap(this,"LoginActivity");
usernameEditText = (EditText) view.findViewById(R.id.username);// 账号
// 设置输入框获得焦点hint提示消失添加监听
@@ -421,6 +421,7 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
Log.d("LoginTAG", "获取token成功:" + s);
// mPhoneNumberAuthHelper.hideLoginLoading();
// mPhoneNumberAuthHelper.quitLoginPage();
mPhoneNumberAuthHelper.quitLoginPage();
getResultWithToken(tokenRet.getToken());
}
@@ -781,13 +782,18 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
}
public void getYunxin(JSONObject objs) throws JSONException {
String yx_accid =objs.getString("YX_accid");
String yx_token =objs.getString("YX_token");
String yx_accid = objs.optString("YX_accid", "");
String yx_token = objs.optString("YX_token", "");
SharePrefUtil.saveString(ct, Constant.yx_accid, yx_accid);
SharePrefUtil.saveString(ct, Constant.yx_token, yx_token);
}
public void getLoginInfo(int state,JSONObject objs) throws JSONException {
if (mPhoneNumberAuthHelper != null) {
mPhoneNumberAuthHelper.hideLoginLoading();
mPhoneNumberAuthHelper.quitLoginPage();
}
getYunxin(objs);
if (state != 6) {
// 需要完善资料,跳转到完善资料页面
@@ -798,7 +804,8 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
intent.putExtra("state", state);
startActivity(intent);
closeProgressDialog();
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, false);
Constant.islogout = 2;
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
this.finish();
} else {
getYunxin(objs);
@@ -883,8 +890,9 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
} else if (id == R.id.top_back_layout) {
// 返回
finish();
AppManager.getAppManager().finishAllActivity();
android.os.Process.killProcess(android.os.Process.myPid());
handleBackClose();
if (false) {
}
} else if (id == R.id.bt_login) {
// 登录
@@ -1119,8 +1127,9 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
super.onBackPressed();
// 监听返回键
finish();
AppManager.getAppManager().finishAllActivity();
android.os.Process.killProcess(android.os.Process.myPid());
handleBackClose();
if (false) {
}
}
/**
@@ -1197,6 +1206,10 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
private void doLauncherAction() {
if (mPhoneNumberAuthHelper != null) {
mPhoneNumberAuthHelper.hideLoginLoading();
mPhoneNumberAuthHelper.quitLoginPage();
}
closeProgressDialog();
// ( 1.待审核 2.审核中 3.需要补充修改资料 4.再次提交审核 5.拒绝
@@ -1212,7 +1225,13 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
// {
intent.setClass(this, MainActivity.class);
// }
Constant.islogout = 2;
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
intent.putExtra("launcher_from", 1);
if (MainActivity.mMainActivity == null || MainActivity.mMainActivity.isFinishing() || MainActivity.mMainActivity.isDestroyed()) {
startActivity(intent);
}
if (false)
startActivity(intent);
Constant.islogout = 2;
@@ -1221,6 +1240,7 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
// 1登入系统 2退出系统 3专家客户端在手机前台运行 4.专家客户端在手机后台运行
BaseActivity.foreBack(LoginNewActivity.this, 1);
finish();
}
public final static int GET_SYSTEM_TIME_RESULT = 103;
@@ -1303,6 +1323,10 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
private void startBind()
{
// mPhoneNumberAuthHelper.quitLoginPage();
if (mPhoneNumberAuthHelper != null) {
mPhoneNumberAuthHelper.hideLoginLoading();
mPhoneNumberAuthHelper.quitLoginPage();
}
Intent intent=new Intent(LoginNewActivity.this,BindNumberActivity.class);
intent.putExtra("wechat_user_info",wechat_user_info);
startActivity(intent);
@@ -1572,9 +1596,32 @@ public class LoginNewActivity extends BaseActivity implements OnCallBackFromNet
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK&& event.getAction() == KeyEvent.ACTION_DOWN){
finishAffinity();
AppManager.getAppManager().finishAllActivity();
System.exit(0);
handleBackClose();
return true;
}
return super.onKeyDown(keyCode, event);
}
private void handleBackClose() {
if (mPhoneNumberAuthHelper != null) {
mPhoneNumberAuthHelper.hideLoginLoading();
mPhoneNumberAuthHelper.quitLoginPage();
}
if (MainActivity.mMainActivity == null || MainActivity.mMainActivity.isFinishing() || MainActivity.mMainActivity.isDestroyed()) {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
finish();
}
private boolean unusedExitStub() {
if (false) {
handleBackClose();
if (false) {
handleBackClose();
if (false) {
}
}
}
return false;
}
@@ -23,6 +23,7 @@ import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -83,6 +84,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
OnItemClickListener {
private Button submit_myinfo;
private Button btn_skip_info;
private TextView tv_showCheckInfo;
private ImageView upload_certificateImg;
private static final int TO_SELECT_PHOTO = 3;
@@ -124,11 +126,11 @@ public class LoginSetInfoActivity extends BaseActivity implements
private String disctictId = "";
private boolean choosehos =false;
private TextView my_hospital;
private TextView my_office_phone;
private EditText my_office_phone;
private TextView my_professional;
private TextView my_zgzs_number;
private EditText my_zgzs_number;
private TextView my_disease;
private TextView my_name;
private EditText my_name;
private TextView my_sex;
private TextView my_office_name;
private int checkNum = 0; // 记录选中的条目数量
@@ -173,7 +175,7 @@ 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);// 姓名
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
@@ -187,7 +189,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
ll_my_office_phone = (LinearLayout) view
.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
.findViewById(R.id.ll_my_professional);// 职业职称
@@ -195,7 +197,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
ll_my_zgzs_number = (LinearLayout) view
.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
.findViewById(R.id.ll_upload_certificateImg);// 医师资格证图片
@@ -206,6 +208,10 @@ public class LoginSetInfoActivity extends BaseActivity implements
my_disease = (TextView) view.findViewById(R.id.my_disease);// 专长
submit_myinfo = (Button) view.findViewById(R.id.submit_myinfo);// 提交
btn_skip_info = (Button) view.findViewById(R.id.btn_skip_info);// 跳过
if (btn_skip_info != null) {
btn_skip_info.setOnClickListener(this);
}
tv_showCheckInfo = (TextView) view.findViewById(R.id.tv_showCheckInfo);// 回显审核状态
// my_photo.setOnClickListener(this);
@@ -377,86 +383,26 @@ public class LoginSetInfoActivity extends BaseActivity implements
Intent intent = getIntent();
// ( 1.待审核 2.审核中 3.需要补充修改资料 4.再次提交审核 5.拒绝
// 6.已通过)//修改,0,1,3,4,5需要提交资料,6是通过,2其他不允许提交
state = intent.getIntExtra("state", 0);
state = intent.getIntExtra("state", SharePrefUtil.getInt(ct, "state", 0));
String checkInfo = intent.getStringExtra("checkInfo");
if (TextUtils.isEmpty(checkInfo)) {
checkInfo = SharePrefUtil.getString(ct, "checkInfo", "");
}
userName = intent.getStringExtra("phone");
LogUtil.i("审核信息==" + state);
// 根据状态进行显示规则,与提示用户
if(11 == state||10 == state ||9 == state)//hcp登陆可编辑
{
tv_showCheckInfo.setVisibility(View.GONE);
tv_showCheckInfo.setText("请完善资料");
submit_myinfo.setVisibility(View.VISIBLE);
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
applyStateUI(state, checkInfo);
// 向服务端同步最新审核状态(防止用户在已登录状态下后台已完成审核但本地 state 未更新)
UIUtils.refreshDoctorStateIfNeeded(ct, new UIUtils.OnDoctorStateRefreshListener() {
@Override
public void onStateRefreshed(int newState, String newCheckInfo) {
if (isFinishing() || newState <= 0 || newState == state) {
return;
}
else if (0 == state || 1 == state) {// 0,3,5需要提交资料
tv_showCheckInfo.setVisibility(View.GONE);
tv_showCheckInfo.setText("请完善资料");
submit_myinfo.setVisibility(View.VISIBLE);
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
// 根据不同用户名获取相应的资料
String mobile = SharePrefUtil.getString(ct,
Constant.SP_IS_FIRST_NAME, Constant.mobile, "");// 登录的手机号
get(mobile);
} else if (3 == state || 4 == state || 5 == state) {// 3,5需要提交资料//7
tv_showCheckInfo.setVisibility(View.VISIBLE);
String text = "您的资料未通过审核,请修改完善后重新提交。";
if (!TextUtils.isEmpty(checkInfo)) {
text = checkInfo;
state = newState;
applyStateUI(newState, newCheckInfo);
}
tv_showCheckInfo.setText(text);
showAlertTips(text);
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
} else if (6 == state) {// 通过
tv_showCheckInfo.setVisibility(View.VISIBLE);
tv_showCheckInfo.setText("您的资料已经通过了审核,将会自动进入应用");
setInfoClick(false);
submit_myinfo.setVisibility(View.GONE);
submit_myinfo.setEnabled(false);
ToastUtil.showToast("您的资料已经通过了审核,将会自动进入应用");
try {
Thread.sleep(2000);
// 注册成功跳转
Intent i = new Intent();
// if(BigModule())
// {
// i.setClass(this, BigMainActivity.class);
//
// }
// else
// {
i.setClass(this, MainActivity.class);
// }
i.putExtra("launcher_from", 1);
startActivity(i);
// 保存登陆
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else if (7 == state){//2018.12.21改,checkInfo = undefind继续追踪,暂不出现弹窗处理
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
}else {
tv_showCheckInfo.setVisibility(View.VISIBLE);
tv_showCheckInfo.setText("肝胆相照将尽快对您的资料进行审核,请耐心等待。");
setInfoClick(false);
submit_myinfo.setVisibility(View.GONE);
submit_myinfo.setEnabled(false);
}
});
// showAlertTips(tv_showCheckInfo.getText().toString());
@@ -481,22 +427,112 @@ public class LoginSetInfoActivity extends BaseActivity implements
}
/**
* 根据审核状态更新界面展示与可编辑状态
*/
private void applyStateUI(int currentState, String checkInfo) {
if (11 == currentState || 10 == currentState || 9 == currentState) {// hcp登陆可编辑
tv_showCheckInfo.setVisibility(View.GONE);
tv_showCheckInfo.setText("请完善资料");
submit_myinfo.setVisibility(View.VISIBLE);
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
} else if (0 == currentState || 1 == currentState) {// 0,3,5需要提交资料
tv_showCheckInfo.setVisibility(View.GONE);
tv_showCheckInfo.setText("请完善资料");
submit_myinfo.setVisibility(View.VISIBLE);
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
// 根据不同用户名获取相应的资料
String mobile = SharePrefUtil.getString(ct,
Constant.SP_IS_FIRST_NAME, Constant.mobile, "");// 登录的手机号
get(mobile);
} else if (3 == currentState || 4 == currentState || 5 == currentState) {// 3,5需要提交资料//7
tv_showCheckInfo.setVisibility(View.VISIBLE);
String text = "您的资料未通过审核,请修改完善后重新提交。";
if (!TextUtils.isEmpty(checkInfo)) {
text = checkInfo;
}
tv_showCheckInfo.setText(text);
showAlertTips(text);
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
} else if (6 == currentState) {// 通过
tv_showCheckInfo.setVisibility(View.VISIBLE);
tv_showCheckInfo.setText("您的资料已经通过了审核,将会自动进入应用");
setInfoClick(false);
submit_myinfo.setVisibility(View.GONE);
submit_myinfo.setEnabled(false);
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
SharePrefUtil.saveInt(ct, "state", 6);
ToastUtil.showToast("您的资料已经通过了审核");
Intent i = new Intent(this, MainActivity.class);
i.putExtra("launcher_from", 1);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(i);
finish();
} else if (7 == currentState) {// 2018.12.21改,checkInfo = undefind继续追踪,暂不出现弹窗处理
setInfoClick(true);
submit_myinfo.setVisibility(View.VISIBLE);
submit_myinfo.setEnabled(true);
} else {
tv_showCheckInfo.setVisibility(View.VISIBLE);
tv_showCheckInfo.setText("肝胆相照将尽快对您的资料进行审核,请耐心等待。");
setInfoClick(false);
submit_myinfo.setVisibility(View.GONE);
submit_myinfo.setEnabled(false);
}
}
/**
* 设置资料各项点击事件
*/
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);
}
}
// 弹出对话框
private void showAlertTips(String message) {
buildAlert = ECAlertDialog.buildAlert(ct, message,
@@ -553,12 +589,14 @@ public class LoginSetInfoActivity extends BaseActivity implements
Constant.mobile, "");// 手机号
switch (v.getId()) {
case R.id.ll_my_name:// 姓名
showEditPopuWindows(my_name, 1);
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));
@@ -571,20 +609,23 @@ public class LoginSetInfoActivity extends BaseActivity implements
// 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:// 科室电话
showEditPopuWindows(my_office_phone, 2);
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:// 资格证号
showEditPopuWindows(my_zgzs_number, 3);
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);// 是否等比例裁剪
@@ -594,8 +635,12 @@ public class LoginSetInfoActivity extends BaseActivity implements
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);
break;
case R.id.submit_myinfo:// 提交
submitInfo();
break;
@@ -608,6 +653,8 @@ public class LoginSetInfoActivity extends BaseActivity implements
R.anim.timepicker_anim_exit_bottom);
break;
case R.id.top_back_layout:// 返回
handleSkipOrBack(SharePrefUtil.getString(ct, Constant.SP_IS_FIRST_NAME, Constant.mobile, ""));
if (ct != null) return;
Intent Login = new Intent(ct, LoginNewActivity.class);
// 注册后跳转到登录页面
@@ -626,6 +673,19 @@ public class LoginSetInfoActivity extends BaseActivity implements
}
}
private void handleSkipOrBack(String mobile) {
if (submit_myinfo != null && submit_myinfo.getVisibility() == View.VISIBLE && !StringUtil.isEmpty(mobile)) {
save(mobile);
}
cn.shangyu.gdxzExpert.base.AppManager.getAppManager().finishActivity(LoginNewActivity.class);
cn.shangyu.gdxzExpert.base.AppManager.getAppManager().finishActivity(BindNumberActivity.class);
if (MainActivity.mMainActivity == null || MainActivity.mMainActivity.isFinishing() || MainActivity.mMainActivity.isDestroyed()) {
Intent intent = new Intent(ct, MainActivity.class);
startActivity(intent);
}
this.finish();
}
// 返回键监听
@Override
public void onBackPressed() {
@@ -636,6 +696,8 @@ public class LoginSetInfoActivity extends BaseActivity implements
// finish();
// AppManager.getAppManager().finishAllActivity();
// android.os.Process.killProcess(android.os.Process.myPid());
handleSkipOrBack(SharePrefUtil.getString(ct, Constant.SP_IS_FIRST_NAME, Constant.mobile, ""));
if (ct != null) return;
Intent Login = new Intent(ct, LoginNewActivity.class);
// 注册后跳转到登录页面
@@ -1018,7 +1080,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
ToastUtil.showToast("科室电话不为空");
return;
}
if (officePhone.equals("请输入科室电话")) {
if (officePhone.equals("请输入科室电话") || officePhone.length() < 10) {
ToastUtil.showToast("请输入正确的科室电话");
return;
}
@@ -1265,6 +1327,7 @@ public class LoginSetInfoActivity extends BaseActivity implements
submit_myinfo.setVisibility(View.GONE);
setInfoClick(false);
SharePrefUtil.saveString(ct, Constant.realName, name);// 真实姓名
SharePrefUtil.saveInt(ct, "state", 2);// 审核中
} else {
ToastUtil.showToast("提交失败,请重试" + bean.message);
}
@@ -589,6 +589,9 @@ public class MainActivity extends BaseActivity implements
}
private void getAccessToken(){
if (!UIUtils.isLogined()) {
return;
}
Map<String, String> param = new HashMap<>();
sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN,this);
}
@@ -767,6 +770,9 @@ public class MainActivity extends BaseActivity implements
* 云信
*/
private void login() {
if (!UIUtils.isLogined()) {
return;
}
String yx_accid = SharePrefUtil.getString(MainActivity.this, Constant.yx_accid, "");
String yx_token = SharePrefUtil.getString(MainActivity.this, Constant.yx_token, "");
if(StringUtil.isEmpty(yx_accid)||StringUtil.isEmpty(yx_token))
@@ -838,6 +844,9 @@ public class MainActivity extends BaseActivity implements
private void setPolvPlayViewerId() {
if (!UIUtils.isLogined()) {
return;
}
String mobile = SharePrefUtil.getString(MainActivity.this, Constant.mobile, "");
String mobile_encryption = mobile +Url.polvId;
@@ -864,6 +873,10 @@ public class MainActivity extends BaseActivity implements
private void getIsAccount() {
Map<String,String> map = new HashMap<>();
sendJsonPostParamtoNetSignMD5(Url.getGray,map,222,this);
if (!UIUtils.isLogined()) {
return;
}
sendJsonPostParamtoNetSignMD5(Url.getIsAccount,map,GETISACCOUNT,this);
sendJsonPostParamtoNetSignMD5(Url.getGray,map,222,this);
sendJsonPostParamtoNetSignMD5(Url.checkUser,map,333,this);
@@ -877,6 +890,9 @@ public class MainActivity extends BaseActivity implements
private void isMaiLanExpert() {
if (!UIUtils.isLogined()) {
return;
}
Map<String,String> map = new HashMap<>();
sendJsonPostParamtoNetSignMD5(Url.isMaiLanExpert,map,ISMAILANEXPERT,this);
}
@@ -996,6 +1012,9 @@ public class MainActivity extends BaseActivity implements
}
private void getWelfareNotice() {
if (!UIUtils.isLogined()) {
return;
}
if(!isSendGetUP)
{
Map<String,String> map = new HashMap<>();
@@ -1180,6 +1199,20 @@ public class MainActivity extends BaseActivity implements
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (!UIUtils.isLogined() && (checkedId == R.id.tab_rbn_kepu || checkedId == R.id.tab_rbn_donation)) {
BaseApplication.auto_show_unimp = false;
main_radiogroup.setOnCheckedChangeListener(null);
if (checkedId == R.id.tab_rbn_donation) {
mRb_meeting.setTextColor(getResources().getColor(R.color.tab_text_nor));
mRb_meeting.setCompoundDrawablesWithIntrinsicBounds(null,
getResources().getDrawable(R.drawable.home_my_meeting_nor), null, null);
mRb_meeting.setChecked(false);
}
main_radiogroup.check(current_tab_id);
main_radiogroup.setOnCheckedChangeListener(this);
UIUtils.checkLoginAndJump(MainActivity.this);
return;
}
BaseApplication.auto_show_unimp = true;
/** 改变文字的颜色 */
@@ -1284,7 +1317,9 @@ public class MainActivity extends BaseActivity implements
mRb_meeting.setCompoundDrawablesWithIntrinsicBounds(null,
getResources().getDrawable(R.drawable.home_my_meeting_nor), null, null);
main_radiogroup.setOnCheckedChangeListener(null);
mRb_meeting.setChecked(false);
main_radiogroup.setOnCheckedChangeListener(this);
// if(current_tab_id == R.id.tab_rbn_home){
// mRb_home.setTextColor(getResources().getColor(R.color.tab_text_sel));
@@ -1408,6 +1443,9 @@ public class MainActivity extends BaseActivity implements
//展示uniapp mp
public void showUniMp(boolean showLoading, String targetPath){
if (!UIUtils.checkLoginAndJump(MainActivity.this)) {
return;
}
if(showLoading){
showFullScreenLoading();
}
@@ -1726,6 +1764,9 @@ public class MainActivity extends BaseActivity implements
return;
}
if (!UIUtils.checkLoginAndJump(MainActivity.this)) {
return;
}
if (isSign) {
MobclickAgent.onEvent(MainActivity.this, StaUtil.EXPERT_HOME_SIGN_IN_AGAIN);
dilaog2 = ECAlertDialog.buildAlert(MainActivity.this,
@@ -2075,7 +2116,7 @@ public class MainActivity extends BaseActivity implements
protected void onResume() {
LogUtil.i("onResume: ", current_tab_id+"");
if((current_tab_id == R.id.tab_rbn_donation || current_tab_id == R.id.tab_rbn_kepu) && BaseApplication.auto_show_unimp){
if(UIUtils.isLogined() && (current_tab_id == R.id.tab_rbn_donation || current_tab_id == R.id.tab_rbn_kepu) && BaseApplication.auto_show_unimp){
long current_timestmp = System.currentTimeMillis();
//防止无限循环打开
if(current_timestmp - BaseApplication.auto_show_unimp_timestamp > 1.5 * 1000){
@@ -2099,6 +2140,17 @@ public class MainActivity extends BaseActivity implements
super.onResume();
ShowMagazine();
if (UIUtils.isLogined()) {
UIUtils.refreshDoctorStateIfNeeded(this, null);
isMaiLanExpert();
getIsAccount();
setPolvPlayViewerId();
login();
getHospital();
if (StringUtil.isEmpty(Constant.Repotr_token)) {
initReport();
}
}
getAccessToken();
if(!needshowGuideView()&&order>0)
{
@@ -2127,7 +2179,7 @@ public class MainActivity extends BaseActivity implements
/**退出账号会重新加载此页面,有时判断是*/
if (TextUtils.isEmpty(account)) {
if (Constant.islogout == 1){
if (Constant.islogout == 1 && false){
// 注销账号,清除该账号的所有文件,
DataCleanManager.cleanApplicationData(ct);
startActivity(new Intent(this, LoginNewActivity.class));
@@ -3494,6 +3546,9 @@ public class MainActivity extends BaseActivity implements
// param.put("user_name", "吴从兴");
// param.put("mobile", "13196988208");
// param.put("user_name", "顾生旺 ");
if (!UIUtils.isLogined()) {
return;
}
param.put("mobile", SharePrefUtil.getString(this, "mobile", ""));
param.put("user_name", SharePrefUtil.getString(this, "realName", ""));
Map<String,String> map = new HashMap<>();
@@ -3551,6 +3606,9 @@ public class MainActivity extends BaseActivity implements
{
Map<String,String> map = new HashMap<>();
if (!UIUtils.isLogined()) {
return;
}
sendJsonPostParamtoNetSignMD5(Url.getTagToken,map,1122,this);
@@ -965,6 +965,9 @@ public class MyDetailInfoActivity extends BaseActivity implements
// SharePrefUtil.saveInt(ct, "provId", provId);
SharePrefUtil.saveInt(ct, "sex", sex);
SharePrefUtil.saveString(ct, "isStar", isStar);
if (data.state > 0) {
SharePrefUtil.saveInt(ct, "state", data.state);
}
LogUtil.i("data==" + data.toString());
@@ -1156,6 +1156,7 @@ public class NewsDetailActivity extends BaseActivity implements
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId();
if (id == R.id.top_right_text) {
if (!UIUtils.checkLoginAndJump(this)) return;
//分享功能换成分享到容联
delVisit();
// case R.id.inside_share:
@@ -1188,6 +1189,7 @@ public class NewsDetailActivity extends BaseActivity implements
}
} else if (id == R.id.ll_collect) {
if (!UIUtils.checkLoginAndJump(this)) return;
// 调用收藏
if (isCollection != null) {
if (flag==3||flag==4){//新闻
@@ -1223,6 +1225,7 @@ public class NewsDetailActivity extends BaseActivity implements
}
}
} else if (id == R.id.ll_agree) {
if (!UIUtils.checkLoginAndJump(this)) return;
if (isAgree != null) {
LogUtil.i("isAgree = "+isAgree);
if (!isAgree.equals("1")) {
@@ -221,6 +221,9 @@ public class SettingAndHelpActivity extends BaseActivity implements OnCallBackFr
rl_setting_yinsi.setOnClickListener(this);
rl_setting_yinsi1.setOnClickListener(this);
m_out.setOnClickListener(this);
if (!UIUtils.isAccountLogined()) {
m_out.setVisibility(View.GONE);
}
m_abouat.setOnClickListener(this);
rl_gdxz_live.setOnClickListener(this);
rl_shareapp.setOnClickListener(this);
@@ -354,6 +357,11 @@ public class SettingAndHelpActivity extends BaseActivity implements OnCallBackFr
protected void processClick(View v) {
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId();
if ((id == R.id.rl_setting_feedback || id == R.id.rl_setting_zhuxiao
|| id == R.id.rl_setting_changepsw || id == R.id.rl_changenum
|| id == R.id.rl_setting_bindwx) && !UIUtils.checkAccountLoginAndJump(this)) {
return;
}
if (id == R.id.ll_dynamic) {
goToNotificationSetting();
} else if (id == R.id.rl_setting_version) {// 版本
@@ -703,15 +711,28 @@ public class SettingAndHelpActivity extends BaseActivity implements OnCallBackFr
// LogUtil.i("容联连接失败");
// }
// PatientSqlManager.delAllPatientInfo(Constant.typePatient);
String logoutPhone = SharePrefUtil.getString(ctx, Constant.mobile, "");
BaseActivity.foreBack(mMainActivity != null ? mMainActivity : ctx, 2);
LogoutHelper.logout();
Badger.clearAllBadges(ctx);
SharePrefUtil.saveBoolean(ctx, Constant.IS_LOGIN, false);
SharePrefUtil.saveString(ctx, Constant.uuid, "");
SharePrefUtil.saveString(ctx, Constant.USERID, "");
SharePrefUtil.saveString(ctx, "access_token", "");
SharePrefUtil.saveString(ctx, "refresh_token", "");
SharePrefUtil.saveString(ctx, Constant.realName, "");
SharePrefUtil.saveInt(ctx, "state", 0);
SharePrefUtil.saveString(ctx, "checkInfo", "");
SharePrefUtil.saveString(ctx, "hospitalName", "");
SharePrefUtil.saveString(ctx, Constant.photo, "");
addUMToken("");
Intent intent = new Intent(ctx, LoginNewActivity.class);
intent.putExtra("flag", true);
intent.putExtra("phone",SharePrefUtil.getString(ctx, Constant.mobile, ""));
intent.putExtra("phone", logoutPhone);
startActivity(intent);
Constant.islogout =1;
// 1登入系统 2退出系统 3患者客户端在手机前台运行 4.客户端在手机后台运行
BaseActivity.foreBack(mMainActivity, 2);
// BaseActivity.foreBack 已在清空 uuid 前执行
ctx.finish();
}
@@ -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
@@ -518,11 +525,17 @@ public class BaseApplication extends Application {
currentActivity.startActivity(intentv);
}
} else if(event.equals("buyPointPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
// 我的积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
Intent intentv = new Intent(BaseApplication.this, cn.shangyu.gdxzExpert.pointsmall.BuyIntegerActivty.class);
intentv.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentv);
} else if(event.equals("payPptPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
if (currentActivity != null) {
LogUtil.i("payPptPage", msgValue);
JSONObject jsonObject = new JSONObject(msgValue);
@@ -538,6 +551,9 @@ public class BaseApplication extends Application {
currentActivity.startActivity(intent);
}
}else if(event.equals("payPonitPage")) {
if (!UIUtils.checkLoginAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
// 支付积分页:不再依赖 currentActivity,直接使用 Application 作为 Context 启动页面
LogUtil.i("payPointPage", msgValue);
JSONObject jsonObject = new JSONObject(msgValue);
@@ -559,6 +575,9 @@ public class BaseApplication extends Application {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}else if(event.equals("goPatientMsg")) {
if (!UIUtils.checkDoctorVerifiedAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
Intent intent = null;
if (currentActivity != null) {
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.MyPatientActivity.class);
@@ -573,6 +592,9 @@ public class BaseApplication extends Application {
startActivity(intent);
}
}else if(event.equals("goSendMsg")) {
if (!UIUtils.checkDoctorVerifiedAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
if (currentActivity != null) {
String patientUuid = msgValue;
try {
@@ -615,6 +637,9 @@ public class BaseApplication extends Application {
startActivity(intent);
}
}else if(event.equals("goGroupMessagePage")) {
if (!UIUtils.checkDoctorVerifiedAndJump(currentActivity != null ? currentActivity : BaseApplication.this)) {
return;
}
Intent intent = null;
if (currentActivity != null) {
intent = new Intent(currentActivity, cn.shangyu.gdxzExpert.activity.SendGroupMsgListActivity.class);
@@ -293,6 +293,9 @@ public abstract class BaseActivity extends AppCompatActivity implements
LogUtil.i("首页切换逻辑执行完成");
}else if(msg.equals("patientClass")){
if (!UIUtils.checkLoginAndJump(finalMainActivity)) {
return;
}
LogUtil.i("准备切换到患教页");
if (main_radiogroup == null) {
LogUtil.e("main_radiogroup is null!");
@@ -323,6 +326,9 @@ public abstract class BaseActivity extends AppCompatActivity implements
LogUtil.i("患教页切换逻辑执行完成");
}else if(msg.equals("education")){
if (!UIUtils.checkLoginAndJump(finalMainActivity)) {
return;
}
LogUtil.i("准备切换到继续教育页");
if (main_radiogroup == null) {
LogUtil.e("main_radiogroup is null!");
@@ -450,6 +456,9 @@ public abstract class BaseActivity extends AppCompatActivity implements
* 处理 Token 检查
*/
public void handleCheckToken(DCUniMPJSCallback callback) {
if (!UIUtils.isLogined()) {
return;
}
try {
Map<String, String> param = new HashMap<>();
sendJsonPostParamtoNetSignMD5(getAccessToken, param, ACCESS_TOKEN, new OnCallBackFromNet() {
@@ -513,6 +522,10 @@ public abstract class BaseActivity extends AppCompatActivity implements
public void handleMessage(Message msg) {
if (msg != null) {
String resultData = (String) msg.obj;
if (UIUtils.interceptCode38000(ct, resultData)) {
closeProgressDialog();
return;
}
OnCallBackFromNet callBack = (OnCallBackFromNet) msg.getData().getSerializable("callback");
int i = msg.what;
if (callBack == null) {
@@ -1522,6 +1535,11 @@ public abstract class BaseActivity extends AppCompatActivity implements
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);
@@ -2,6 +2,7 @@ package cn.shangyu.gdxzExpert.base;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
@@ -242,6 +243,10 @@ public abstract class BaseFragment extends Fragment {
public void handleMessage(Message msg) {
if (msg != null) {
String resultData = (String) msg.obj;
if (UIUtils.interceptCode38000(getActivity(), resultData)) {
closeProgressDialog();
return;
}
OnCallBackFromNet callBack = (OnCallBackFromNet) msg.getData().getSerializable("callback");
int i = msg.what;
if (callBack == null) {
@@ -608,14 +613,18 @@ public abstract class BaseFragment extends Fragment {
}
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)
{
intent.putExtra("report_list", (Serializable) list);
}
intent.putExtra("report_token", Constant.Repotr_token);
getActivity().startService(intent);
targetContext.startService(intent);
}
public void needreportSimple(String name)
{
@@ -34,6 +34,7 @@ public class ChangeMyInfoBean extends BaseBean {
public String qrcode;//二维码
public String isStar;//是否是肝胆名医 0否 1是
public int state;
public String checkInfo;
@Override
public String toString() {
return "InfoData [uuid=" + uuid + ", mobile=" + mobile
@@ -270,6 +270,9 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
private int consultCount = 0;
public void showRedUnCount()
{
if (!UIUtils.isLogined()) {
return;
}
patientCount =NIMClient.getService(MsgService.class).getTotalUnreadCount();
consultCount =0;
NIMClient.getService(MsgService.class).queryRecentContacts()
@@ -323,6 +326,9 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
*
*/
private void getNewPatientList() {
if (!UIUtils.isLogined()) {
return;
}
String uuid = SharePrefUtil.getString(mActivity, Constant.uuid, "");
RequestParams params = new RequestParams();
params.addBodyParameter("expertUuid", uuid);
@@ -495,6 +501,9 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
*/
private void getHomeModal() {
Map<String,String> map = new HashMap<>();
if (!UIUtils.isLogined()) {
return;
}
sendJsonPostParamtoNetSignMD5(Url.homeModalurl,map,GETHOMEMODAL,this);
@@ -511,9 +520,23 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
// 从sp文件里取出资料
String realName = SharePrefUtil.getString(mActivity, "realName", "");
// doctor_name.setText("麦麦提图尔洪·阿不都茹苏力麦麦提图尔洪·阿不都茹苏力麦麦提图尔洪·阿不都茹苏力麦麦提图尔洪·阿不都茹苏力麦麦提图尔洪·阿不都茹苏力麦麦提图尔洪·阿不都茹苏力");
if (!UIUtils.isLogined()) {
if (doctor_name != null) {
doctor_name.setText("点击登录");
}
if (pic != null) {
pic.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
}
return;
}
if (doctor_name == null)
return;
if(realName.length()>5)
if (!UIUtils.isDoctorVerified()) {
String mobile = SharePrefUtil.getString(mActivity, Constant.mobile, "");
String display = (!StringUtil.isEmpty(realName) && !"null".equals(realName)) ? realName : (!StringUtil.isEmpty(mobile) ? mobile : "已登录");
int st = SharePrefUtil.getInt(mActivity, "state", 0);
doctor_name.setText(display + (st == 2 ? "(审核中)" : "(去完善资料)"));
} else if(realName.length()>5)
{
doctor_name.setText(realName);
}
@@ -537,7 +560,9 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
private void getHomeData() {
initData();
Map<String,String> map = new HashMap<>();
if (UIUtils.isLogined()) {
sendJsonPostParamtoNetSignMD5(unReadList,map,112,this);
}
sendJsonPostParamtoNetSignMD5(Url.myHomeNew,map,111,this);
}
@@ -694,21 +719,28 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
else
{
handleLogout(false);
if (UIUtils.isLogined()) {
ToastUtil.showToast(homeBean.getMessage());
}
}
break;
}
else
{
handleLogout(false);
if (UIUtils.isLogined()) {
ToastUtil.showToast(homeBean.getMessage());
}
}
isfirst=false;
break;
}
}
private void handleLogout(boolean isNotice) {
if (!UIUtils.isDoctorVerified()) {
return;
}
ToastUtil.showMessage("专家账号信息为空");
showProgressDialog(getString(R.string.posting_logout));
/**
@@ -809,6 +841,7 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
startActivity(broadc);
}
} else if (id == R.id.l_message) {
if (!UIUtils.checkLoginAndJump(mActivity)) return;
startActivity(new Intent(getActivity(), BigNewSystemMessageActivity.class));
} else if (id == R.id.tv_top_search) {
Intent intentv = new Intent(getActivity(), BigPublicSearchActivity.class);
@@ -817,10 +850,13 @@ public class BigHomeFragment extends BaseFragment implements OnCallBackFromNet,
} else if (id == R.id.l_change) {
changeBig();
} else if (id == R.id.big_top_bar) {
if (!UIUtils.checkDoctorVerifiedAndJump(mActivity)) return;
startActivity(new Intent(mActivity, MyDetailInfoActivity.class));
} else if (id == R.id.big_p1) {
if (!UIUtils.checkDoctorVerifiedAndJump(mActivity)) return;
startActivity(new Intent(mActivity, MyPatientActivity.class));
} else if (id == R.id.big_g1) {
if (!UIUtils.checkDoctorVerifiedAndJump(mActivity)) return;
startActivity(new Intent(mActivity, PublicConsultationActivity.class));
} else if (id == R.id.big_v) {
startActivity(new Intent(mActivity, BigVideoActivity.class));
@@ -426,7 +426,30 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
{
// 从sp文件里取出资料
String realName = SharePrefUtil.getString(mActivity, "realName", "");
if (!UIUtils.isLogined()) {
if (tv_name != null) {
if (UIUtils.isAccountLogined()) {
String mobile = StringUtil.maskMobile(SharePrefUtil.getString(mActivity, Constant.mobile, ""));
String display = (!StringUtil.isEmpty(realName) && !"null".equals(realName)) ? StringUtil.maskMobile(realName) : (!StringUtil.isEmpty(mobile) ? mobile : "已登录");
int st = SharePrefUtil.getInt(mActivity, "state", 0);
tv_name.setText(display + (st == 2 ? "(审核中)" : "(去完善资料)"));
} else {
tv_name.setText("点击登录");
}
}
if (im_bg != null) im_bg.setBackgroundResource(R.drawable.big_background_my);
if (pic != null) pic.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
if (tv_qiandao != null) tv_qiandao.setText("签到");
return;
}
if (!UIUtils.isDoctorVerified()) {
String mobile = StringUtil.maskMobile(SharePrefUtil.getString(mActivity, Constant.mobile, ""));
String display = (!StringUtil.isEmpty(realName) && !"null".equals(realName)) ? StringUtil.maskMobile(realName) : (!StringUtil.isEmpty(mobile) ? mobile : "已登录");
int st = SharePrefUtil.getInt(mActivity, "state", 0);
tv_name.setText(display + (st == 2 ? "(审核中)" : "(去完善资料)"));
} else {
tv_name.setText(realName);
}
String photo = SharePrefUtil.getString(mActivity, "photo", null);
if (photo != null && !"null".equals(photo)) {
ImageLoader
@@ -440,6 +463,9 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
}
//年终总结
private void getzongjie() {
if (!UIUtils.isLogined()) {
return;
}
Map<String,String> map = new HashMap<>();
map.put("id","8");
sendJsonPostParamtoNetSignMD5(Url.getAppActivity,map,200,this);
@@ -448,6 +474,18 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
@Override
public void onResume() {
super.onResume();
initData();
if (UIUtils.isLogined()) {
UIUtils.refreshDoctorStateIfNeeded(mActivity, new UIUtils.OnDoctorStateRefreshListener() {
@Override
public void onStateRefreshed(int state, String checkInfo) {
if (getActivity() != null && isAdded()) {
initData();
}
}
});
getMyData();
}
getNewPatientList();
String photo = SharePrefUtil.getString(mActivity, "MyChangePhoto", "");
if (!StringUtil.isBland(photo) && pic != null) {
@@ -498,6 +536,9 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
}
//判断用户是否绑定过微信
private void isBoundWechatByUuid() {
if (!UIUtils.isLogined()) {
return;
}
Map<String,String> map = new HashMap<>();
sendJsonPostParamtoNetSignMD5(Url.isBoundWechatByUuid,map,207,this);
@@ -506,6 +547,10 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
* 获取新我的数据
*/
private void getMyData() {
if (!UIUtils.isLogined()) {
dismissLoadingProgress();
return;
}
// showProgressDialog("加载中");
showLoadingProgress();
Map<String,String> map = new HashMap<>();
@@ -519,6 +564,9 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
*
*/
private void getNewPatientList() {
if (!UIUtils.isLogined()) {
return;
}
String uuid = SharePrefUtil.getString(mActivity, Constant.uuid, "");
RequestParams params = new RequestParams();
params.addBodyParameter("expertUuid", uuid);
@@ -643,6 +691,9 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
public void onClick(View v) {
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId();
if (id != R.id.r_shezhi && !UIUtils.checkLoginAndJump(mActivity)) {
return;
}
if (id == R.id.bt_nianzong) {
if(bean1!=null&&bean1.getData()!=null&&bean1.getData().getUrl_path()!=null)
{
@@ -691,6 +742,7 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
} else if (id == R.id.l_h) {
startActivity(new Intent(mActivity, MyFlowerActivity.class));
} else if (id == R.id.big_top_bar) {
if (!UIUtils.checkDoctorVerifiedAndJump(mActivity)) return;
startActivity(new Intent(mActivity, MyDetailInfoActivity.class));
} else if (id == R.id.r_banck) {
startActivity(new Intent(mActivity, MyBankCardActivity.class));
@@ -816,7 +868,9 @@ public class BigMyFragment extends BaseFragment implements View.OnClickListener,
return;
if(myNewBean.getData()!=null)
{
Glide.with(getActivity())
if (StringUtil.isEmpty(myNewBean.getData().getMyInfoBackGround())) {
im_bg.setBackgroundResource(R.drawable.big_background_my);
} else Glide.with(getActivity())
.asBitmap()
.load(myNewBean.getData().getMyInfoBackGround())
.into(new SimpleTarget<Bitmap>() {
@@ -676,7 +676,14 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
private void initBanner( List<HomeBean.NewsBean> datas)
{
List<CustomViewsInfo> data = new ArrayList<>();
for (HomeBean.NewsBean bean:datas)
final boolean showStudioSlide = UIUtils.isDoctorVerified() && !StringUtil.isEmpty(SharePrefUtil.getString(mActivity, "realName", ""));
if (datas != null) {
int startIndex = (showStudioSlide || datas.size() <= 1) ? 0 : 1;
for (int i = startIndex; i < datas.size(); i++) {
data.add(new CustomViewsInfo(datas.get(i)));
}
}
if (false) for (HomeBean.NewsBean bean:datas)
{
data.add(new CustomViewsInfo(bean));
}
@@ -699,7 +706,7 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
TextView mIv_name = view.findViewById(R.id.doctor_name);
TextView mIv_positionName = view.findViewById(R.id.positionName);
ImageView im_gg=view.findViewById(R.id.im_gg);
if(position==0)
if(showStudioSlide && position==0)
{
// //得到AssetManager
@@ -757,7 +764,7 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
// startReport(reportBeans);
MobclickAgent.onEvent(mainActivity, EXPERT_HOME_SHUFFLING);
if(position==0)
if(showStudioSlide && position==0)
{
startActivity(new Intent(mActivity, MyDetailInfoActivity.class));
needreportHome("首页",realName+"专家工作室");
@@ -841,6 +848,9 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
*/
private void getHomeModal() {
Map<String,String> map = new HashMap<>();
if (!UIUtils.isLogined()) {
return;
}
sendJsonPostParamtoNetSignMD5(Url.homeModalurl,map,GETHOMEMODAL,this);
@@ -863,6 +873,9 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
public void initMessage()
{
Map<String,String> map=new HashMap<>();
if (!UIUtils.isLogined()) {
return;
}
sendJsonPostParamtoNetSignMD5(unReadList,map,112,this);
}
@@ -920,6 +933,10 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (!UIUtils.checkDoctorVerifiedAndJump(getActivity())) {
dialog.dismiss();
return;
}
Intent intent = new Intent(getActivity(), MyQrCodeActivity.class);
startActivity(intent);
dialog.dismiss();
@@ -1022,6 +1039,9 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
private int consultCount = 0;
private void handleLogout(boolean isNotice) {
if (!UIUtils.isDoctorVerified()) {
return;
}
ToastUtil.showMessage("专家账号信息为空");
showProgressDialog(getString(R.string.posting_logout));
/**
@@ -1248,6 +1268,9 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
*
*/
private void getNewPatientList() {
if (!UIUtils.isLogined()) {
return;
}
String uuid = SharePrefUtil.getString(mActivity, Constant.uuid, "");
RequestParams params = new RequestParams();
params.addBodyParameter("expertUuid", uuid);
@@ -1462,6 +1485,9 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
* 查询系统消息未读数
*/
private void requestSystemMessageUnreadCount() {
if (!UIUtils.isLogined()) {
return;
}
patientCount =NIMClient.getService(MsgService.class).getTotalUnreadCount();
consultCount =0;
NIMClient.getService(MsgService.class).queryRecentContacts()
@@ -1700,9 +1726,9 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
{
if(homeBean.getData()!=null)
{
if(homeBean.getData().getExpertDetail()==null)
if(false && homeBean.getData().getExpertDetail()==null && UIUtils.isLogined())
{
handleLogout(false);
// handleLogout(false);
return;
}
news_list=homeBean.getData().getNews_list();
@@ -1845,8 +1871,13 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
}
else
{
// handleLogout(false);
if (UIUtils.isLogined()) {
handleLogout(false);
ToastUtil.showToast(homeBean.getMessage());
} else {
initGongge(iconBeans);
}
}
isfirst=false;
break;
@@ -2018,6 +2049,16 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
@RequiresApi(api = Build.VERSION_CODES.N)
private void initGongge(List<HomeBean.IconBean> iconBeans) {
if (iconBeans != null && iconBeans.isEmpty()) {
HomeBean fallbackBean = homeBean != null ? homeBean : new HomeBean();
String[] defaultNames = new String[]{"我的患者", "公益咨询", "肝胆视频", "临床工具", "精品课", "肝胆课件", "指南杂志"};
for (String name : defaultNames) {
HomeBean.IconBean item = fallbackBean.new IconBean();
item.setName(name);
item.setImg("");
iconBeans.add(item);
}
}
if(cellAdapter==null)
{
@@ -2033,6 +2074,9 @@ public class HomeNewFragment extends BaseFragment implements OnClickListener,OnC
public void onItemClick(View view, int position) {
if(position==iconBeans.size())
{
if (!UIUtils.checkLoginAndJump(mActivity)) {
return;
}
startActivityForResult(new Intent(mActivity, MyUserIconActivity.class),MYUSERICON);
}
else
@@ -174,6 +174,7 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
pic=view.findViewById(R.id.pic);
pic.setOnClickListener(this);
tv_name=view.findViewById(R.id.tv_name);
tv_name.setOnClickListener(this);
patient_num=view.findViewById(R.id.patient_num);
tv_gongyi=view.findViewById(R.id.tv_gongyi);
tv_hua=view.findViewById(R.id.tv_hua);
@@ -355,7 +356,33 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
{
// 从sp文件里取出资料
String realName = SharePrefUtil.getString(mActivity, "realName", "");
if (!UIUtils.isLogined()) {
if (tv_name != null) {
if (UIUtils.isAccountLogined()) {
String mobile = StringUtil.maskMobile(SharePrefUtil.getString(mActivity, Constant.mobile, ""));
String display = (!StringUtil.isEmpty(realName) && !"null".equals(realName)) ? StringUtil.maskMobile(realName) : (!StringUtil.isEmpty(mobile) ? mobile : "已登录");
int st = SharePrefUtil.getInt(mActivity, "state", 0);
tv_name.setText(display + (st == 2 ? "(审核中)" : "(去完善资料)"));
} else {
tv_name.setText("点击登录");
}
}
if (im_bg != null) im_bg.setBackgroundResource(R.drawable.my_head_bg);
if (pic != null) pic.setImageResource(R.drawable.icon_touxiang_persion_gray_big);
if (patient_num != null) patient_num.setText("0");
if (tv_gongyi != null) tv_gongyi.setText("0");
if (tv_hua != null) tv_hua.setText("0");
if (tv_qiandao != null) tv_qiandao.setText("签到");
return;
}
if (!UIUtils.isDoctorVerified()) {
String mobile = StringUtil.maskMobile(SharePrefUtil.getString(mActivity, Constant.mobile, ""));
String display = (!StringUtil.isEmpty(realName) && !"null".equals(realName)) ? StringUtil.maskMobile(realName) : (!StringUtil.isEmpty(mobile) ? mobile : "已登录");
int st = SharePrefUtil.getInt(mActivity, "state", 0);
tv_name.setText(display + (st == 2 ? "(审核中)" : "(去完善资料)"));
} else {
tv_name.setText(realName);
}
String photo = SharePrefUtil.getString(mActivity, "photo", null);
if (photo != null && !"null".equals(photo)) {
ImageLoader
@@ -369,6 +396,9 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
}
//年终总结
private void getzongjie() {
if (!UIUtils.isLogined()) {
return;
}
Map<String,String> map = new HashMap<>();
map.put("id","8");
sendJsonPostParamtoNetSignMD5(Url.getAppActivity,map,200,this);
@@ -378,6 +408,18 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
public void onResume() {
super.onResume();
needreportPage("我的");
initData();
if (UIUtils.isLogined()) {
UIUtils.refreshDoctorStateIfNeeded(mActivity, new UIUtils.OnDoctorStateRefreshListener() {
@Override
public void onStateRefreshed(int state, String checkInfo) {
if (getActivity() != null && isAdded()) {
initData();
}
}
});
getMyData();
}
getNewPatientList();
String photo = SharePrefUtil.getString(mActivity, "MyChangePhoto", "");
if (!StringUtil.isBland(photo) && pic != null) {
@@ -428,6 +470,9 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
}
//判断用户是否绑定过微信
private void isBoundWechatByUuid() {
if (!UIUtils.isLogined()) {
return;
}
Map<String,String> map = new HashMap<>();
sendJsonPostParamtoNetSignMD5(Url.isBoundWechatByUuid,map,207,this);
@@ -436,6 +481,9 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
* 获取新我的数据
*/
private void getMyData() {
if (!UIUtils.isLogined()) {
return;
}
// showProgressDialog("加载中");
Map<String,String> map = new HashMap<>();
sendJsonPostParamtoNetSignMD5(Url.myNew,map,111,this);
@@ -448,6 +496,9 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
*
*/
private void getNewPatientList() {
if (!UIUtils.isLogined()) {
return;
}
String uuid = SharePrefUtil.getString(mActivity, Constant.uuid, "");
RequestParams params = new RequestParams();
params.addBodyParameter("expertUuid", uuid);
@@ -572,6 +623,16 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
public void onClick(View v) {
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
int id = v.getId();
if (id != R.id.r_shezhi && !UIUtils.checkLoginAndJump(mActivity)) {
return;
}
if (id == R.id.tv_name || id == R.id.pic) {
if (!UIUtils.checkDoctorVerifiedAndJump(mActivity)) {
return;
}
startActivity(new Intent(mActivity, MyDetailInfoActivity.class));
return;
}
if (id == R.id.bt_nianzong) {
if(bean1!=null&&bean1.getData()!=null&&bean1.getData().getUrl_path()!=null)
{
@@ -615,8 +676,10 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
qiandao();
}
} else if (id == R.id.l_g) {
if (!UIUtils.checkDoctorVerifiedAndJump(mActivity)) return;
startActivity(new Intent(mActivity, PublicConsultationActivity.class));
} else if (id == R.id.l_p) {
if (!UIUtils.checkDoctorVerifiedAndJump(mActivity)) return;
startActivity(new Intent(mActivity, MyPatientActivity.class));
} else if (id == R.id.l_h) {
startActivity(new Intent(mActivity, MyFlowerActivity.class));
@@ -733,7 +796,9 @@ public class MyNewFragment extends BaseFragment implements View.OnClickListener,
return;
if(myNewBean.getData()!=null)
{
Glide.with(getActivity())
if (StringUtil.isEmpty(myNewBean.getData().getMyInfoBackGround())) {
im_bg.setBackgroundResource(R.drawable.my_head_bg);
} else Glide.with(getActivity())
.asBitmap()
.load(myNewBean.getData().getMyInfoBackGround())
.into(new SimpleTarget<Bitmap>() {
@@ -29,6 +29,9 @@ import java.util.List;
import cn.shangyu.gdxzExpert.utils.IoUtils;
import cn.shangyu.gdxzExpert.utils.StringUtil;
import cn.shangyu.gdxzExpert.utils.UIUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
public class HttpHelper {
// public static final String URL = "http://10.0.2.2:8080/";
@@ -117,7 +120,37 @@ public class HttpHelper {
// else {
// http.send(method, url, params, callback);
// }
HttpHandler<String> cancleHttp = http.send(method, url, params,callback);
final RequestCallBack<String> finalCallback = callback;
RequestCallBack<String> wrappedCallback = finalCallback == null ? null : new RequestCallBack<String>() {
@Override
public void onStart() {
finalCallback.onStart();
}
@Override
public void onLoading(long total, long current, boolean isUploading) {
finalCallback.onLoading(total, current, isUploading);
}
@Override
public void onCancelled() {
finalCallback.onCancelled();
}
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
if (responseInfo != null && UIUtils.interceptCode38000(UIUtils.getContext(), responseInfo.result)) {
return;
}
finalCallback.onSuccess(responseInfo);
}
@Override
public void onFailure(HttpException error, String msg) {
finalCallback.onFailure(error, msg);
}
};
HttpHandler<String> cancleHttp = http.send(method, url, params, wrappedCallback);
// if(cancleHttp!=null){
// cancleHttp.cancel();//取消网络请求
// }
@@ -278,6 +311,7 @@ public class HttpHelper {
}
byte[] data = out.toByteArray();
mStr = new String(data, "utf-8");
UIUtils.interceptCode38000(UIUtils.getContext(), mStr);
} catch (Exception e) {
e.printStackTrace();
} finally {
@@ -15,6 +15,7 @@ import java.util.List;
import cn.shangyu.gdxzExpert.ecdemo.ui.SDKCoreHelper;
import cn.shangyu.gdxzExpert.netease.DemoCache;
import cn.shangyu.gdxzExpert.netease.config.preference.Preferences;
import cn.shangyu.gdxzExpert.report.ReportService;
import cn.shangyu.gdxzExpert.report.reportBean;
import cn.shangyu.gdxzExpert.utils.CommonUtil;
@@ -40,7 +41,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,
@@ -51,6 +54,8 @@ public class LogoutHelper {
DataCleanManager.cleanApplicationData(UIUtils.getContext());
SDKCoreHelper.logout(true);
// 清理缓存&注销监听&清除状态
Preferences.saveUserAccount("");
Preferences.saveUserToken("");
NimUIKit.logout();
DemoCache.clear();
NIMClient.getService(AuthService.class).logout();
@@ -9,6 +9,7 @@ import com.netease.nimlib.push.packet.symmetry.SymmetryType;
import com.netease.nimlib.sdk.NimHandshakeType;
import cn.shangyu.gdxzExpert.netease.DemoCache;
import cn.shangyu.gdxzExpert.utils.UIUtils;
/**
* Created by hzxuwen on 2015/4/13.
@@ -94,6 +95,7 @@ public class Preferences {
}
static SharedPreferences getSharedPreferences() {
return DemoCache.getContext().getSharedPreferences("Demo", Context.MODE_PRIVATE);
Context context = DemoCache.getContext() != null ? DemoCache.getContext() : UIUtils.getContext();
return context.getSharedPreferences("Demo", Context.MODE_PRIVATE);
}
}
@@ -522,6 +522,9 @@ public class CourseDetailPolyvPlayerActivity extends AppCompatActivity implement
r_e.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!UIUtils.checkLoginAndJump(CourseDetailPolyvPlayerActivity.this)) {
return;
}
Intent intent=new Intent(CourseDetailPolyvPlayerActivity.this, EvaluateActivity.class);
intent.putExtra("excellentcourse_id",excellentcourse_id);
intent.putExtra("p_id","");
@@ -1487,6 +1490,9 @@ public class CourseDetailPolyvPlayerActivity extends AppCompatActivity implement
handleBackAction();
break;
case R.id.r_buy:
if (!UIUtils.checkLoginAndJump(CourseDetailPolyvPlayerActivity.this)) {
return;
}
MobclickAgent.onEvent(CourseDetailPolyvPlayerActivity.this,EXPERT_CLASS_QUALITY_PAY);
Intent intent=new Intent(CourseDetailPolyvPlayerActivity.this, PayClassActivity.class);
intent.putExtra("price",im_yuan.getText().toString());
@@ -474,8 +474,12 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
initIntent();
getCommentList();
if (UIUtils.isLogined()) {
addVideoWatchRecord();
}
if (UIUtils.isLogined()) {
isVideoDownloadRecord();
}
needreportDetail(getIntent().getStringExtra("pagetype"), videoTeachDetailBean.getVideo().getTags(),title);
break;
case 0:
@@ -606,8 +610,12 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
case 404://第一次请求失败
LogUtil.e("提交失败,重新请求 ");
videoDetail();
if (UIUtils.isLogined()) {
isVideoDownloadRecord();
}
if (UIUtils.isLogined()) {
addVideoWatchRecord();
}
break;
}
@@ -1672,6 +1680,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
public void onClick(View v) {
switch (v.getId()){
case R.id.bt_inside_share:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
delVisit();
break;
case R.id.top_back:
@@ -1685,6 +1694,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
this.finish();
break;
case R.id.top_right:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if (isCollt) {
showProgressDialog("正在取消收藏");
DisCollection();
@@ -1709,6 +1719,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break;
case R.id.bt_add_pinglun:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if (StringUtil.isEmpty(mEt_add.getText().toString().trim())) {
ToastUtil.showMessage("输入内容");
return;
@@ -1717,6 +1728,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
hideSoftInputFromWindow();
break;
case R.id.et_add_pinglun:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if(CommonUtil.BigModule())
{
@@ -1728,6 +1740,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break;
case R.id.tv_delete://删除
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
if ( downloadInfo!=null&&!downloadSQLiteHelper.isAdd(downloadInfo)){
return;
@@ -1774,6 +1787,7 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break;
case R.id.tv_video_long:
case R.id.iv_video_Long://继续/停止
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
final PolyvDownloader downloader1 = PolyvDownloaderManager.getPolyvDownloader(vid, bitrate);
if ("停止".equals(tv_video_long.getText().toString())){
downloader1.stop();
@@ -1787,28 +1801,16 @@ public class VideoDetailPolyvPlayerActivity extends FragmentActivity implements
break;
case R.id.tv_exchange1:
if (!UIUtils.checkLoginAndJump(VideoDetailPolyvPlayerActivity.this)) return;
startActivityForResult(new Intent(VideoDetailPolyvPlayerActivity.this, PolyvDownloadActivity.class),101);
break;
case R.id.rl_huancun:
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();
}else if("视频缓存中".equals(tv_exchange.getText().toString())){
Intent intent1 = new Intent(VideoDetailPolyvPlayerActivity.this, PolyvDownloadActivity.class);
intent1.putExtra("isStarting",true);
@@ -22,6 +22,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
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,8 +81,20 @@ public class CommUtil {
Log.d("saveListToFile",file.getAbsolutePath());
try {
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) {
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(); // 每个布尔值后写入一个新行
}
@@ -106,20 +120,21 @@ public class CommUtil {
try (FileOutputStream fos = new FileOutputStream(zipFile);
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 {
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();
// 递归地压缩子文件夹
zipFolderCorrected(file, zipFile, basePath);
zipFolderInternal(file, zos, basePath);
} else {
// 添加文件条目并写入文件内容
zos.putNextEntry(new ZipEntry(entryName));
try (FileInputStream fis = new FileInputStream(file)) {
byte[] buffer = new byte[1024];
@@ -133,6 +148,34 @@ public class CommUtil {
}
}
}
/**
* 将待打包的 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,88 +114,160 @@ 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();
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;
}
}).start();
}
return START_NOT_STICKY;
}
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))
{
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;
}
Log.d("okhttp","CommUtil.totalreport "+ CommUtil.totalreport);
if(CommUtil.totalreport>99&&checkReport())
{
// Token 已就绪:先把之前暂存的埋点补齐 user_id/app_key 并落盘
boolean pendingHasImmediate = flushPendingBeforeTokenList();
if (incomingList == null) {
if (checkReport()) {
zipFile();
}
else{
CommUtil.saveListToFile(list,ReportFile,"upload",ReportFileZip);
return;
}
if (!incomingList.isEmpty()) {
writeReport(incomingList, pendingHasImmediate);
} else if (pendingHasImmediate && checkReport()) {
zipFile();
}
}
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;
}
public void zipFile()
{
CommUtil.isReoprtingNow="true";
File folderToZip = new File(ReportFile);
File zipFile = new File(ReportFileZip,"outputandroid.zip");
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() {
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");
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() {
@@ -191,71 +275,89 @@ public class ReportService extends Service {
public void onError(Call call, Exception e, int id) {
Log.d("okhttp", e + "e");
CommUtil.isReoprtingNow = "false";
CommUtil.totalreport=0;
}
@Override
public void onResponse(String response, int id) {
Log.d("okhttp", response + "responseoutput");
CommUtil.isReoprtingNow="false";
JSONObject jsonObject= null;
try {
jsonObject = new JSONObject(response);
if("30007".equals(jsonObject.optString("code")))
{
initReport();
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 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;
});
} 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;
}
return false;
}
public void initReport()
{
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;
}
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);
sendJsonPostParamtoNetSignMD5(Url.getTagToken, map, retryUploadAfterToken);
}
public void sendJsonPostParamtoNetSignMD5(final String postUrl, final Map<String, String> param) {
public void sendJsonPostParamtoNetSignMD5(final String postUrl, final Map<String, String> param, final boolean retryUploadAfterToken) {
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,6 +367,7 @@ 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());
@@ -285,25 +388,37 @@ public class ReportService extends Service {
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);
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;
// Log.d("okhttp","report_token666"+report_token);
uploadFile();
tokenRefreshed = true;
}
}
} catch (Exception e) {
LogUtil.e("提交失败,请重试 = " + e.getMessage());
// TODO Auto-generated catch block
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";
}
}
});
@@ -23,6 +23,7 @@ import java.util.List;
import cn.shangyu.gdxzExpert.R;
import cn.shangyu.gdxzExpert.activity.LoginNewActivity;
import cn.shangyu.gdxzExpert.activity.MainActivity;
import cn.shangyu.gdxzExpert.utils.Constant;
import cn.shangyu.gdxzExpert.utils.SharePrefUtil;
@@ -231,7 +232,7 @@ public class GuideUI extends AppCompatActivity implements ViewPager.OnPageChange
// startActivity(new Intent(this, LoginActivity.class));
// }
// 打开登录
startActivity(new Intent(this, LoginNewActivity.class));
startActivity(new Intent(this, MainActivity.class));
finish();
}
@@ -305,7 +305,7 @@ public class WelcomeUI extends Activity implements AnimationListener {
// }
if (isOpenMainPager) {
if (UIUtils.isLogined()) {
if (true || UIUtils.isLogined()) {
// 已经打开过一次主界面, 直接进入主界面.
// ( 1.待审核 2.审核中 3.需要补充修改资料 4.再次提交审核 5.拒绝 6.已通过)
// int state = SharePrefUtil.getInt(WelcomeUI.this,
@@ -333,7 +333,7 @@ public class WelcomeUI extends Activity implements AnimationListener {
} else {
// 打开登录
Intent intent = new Intent();
intent.setClass(WelcomeUI.this, LoginNewActivity.class);
intent.setClass(WelcomeUI.this, MainActivity.class);
startActivity(intent);
finish();
}
@@ -47,7 +47,11 @@ import cn.shangyu.gdxzExpert.polyvplayer.CourseDetailPolyvPlayerActivity;
import cn.shangyu.gdxzExpert.polyvplayer.VideoDetailPolyvPlayerActivity;
import cn.shangyu.gdxzExpert.utils.GsonTools;
import cn.shangyu.gdxzExpert.utils.MyUserIconUtil;
import cn.shangyu.gdxzExpert.netease.config.LogoutHelper;
import cn.shangyu.gdxzExpert.utils.Constant;
import cn.shangyu.gdxzExpert.utils.SharePrefUtil;
import cn.shangyu.gdxzExpert.utils.StringUtil;
import cn.shangyu.gdxzExpert.utils.UIUtils;
import cn.shangyu.gdxzExpert.utils.UniappUtil;
import cn.shangyu.gdxzExpert.utils.Url;
@@ -101,7 +105,9 @@ public class PushHelper {
public void onSuccess(String deviceToken) {
//注册成功会返回deviceToken deviceToken是推送消息的唯一标志
Log.d(TAG, "deviceToken --> " + deviceToken);
if (UIUtils.isLogined()) {
addUMToken(deviceToken);
}
// //获取deviceToken可通过接口:
// PushAgent.getInstance(context).getRegistrationId();
// //可设置别名,推送时使用别名推送
@@ -123,6 +129,19 @@ public class PushHelper {
registerDeviceChannel(context);
}
public static void addUMToken(String device_token) {
String uuid = SharePrefUtil.getString(getContext(), Constant.uuid, "");
if (!StringUtil.isEmpty(device_token)) {
if (StringUtil.isEmpty(uuid)) {
return;
}
} else {
if (StringUtil.isEmpty(uuid)) {
uuid = LogoutHelper.addUMTokenuuid;
}
if (StringUtil.isEmpty(uuid)) {
return;
}
}
Map<String,String> map = new HashMap<>();
map.put("device_token",device_token);
@@ -10,6 +10,7 @@ import java.io.File;
import java.math.BigDecimal;
import cn.shangyu.gdxzExpert.ecdemo.storage.PatientSqlManager;
import cn.shangyu.gdxzExpert.netease.config.preference.Preferences;
public class DataCleanManager {
@@ -88,6 +89,11 @@ public class DataCleanManager {
public static void cleanSharedPreference(Context context) {
/** 删除SharedPreferences文件 **/
SharePrefUtil.clear(context);
Preferences.saveUserAccount("");
Preferences.saveUserToken("");
Constant.Repotr_token = "";
Constant.Report_userId = "";
Constant.Repotr_app_key = "";
File file = new File("/data/data/"
+ context.getPackageName() + "/shared_prefs", Constant.SP_NAME);
deleteDir(file);
@@ -82,6 +82,9 @@ public class HttpMD5SendInfoUtil {
InputStream inStream = conn.getInputStream();
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
String string = new String(result);
if (UIUtils.interceptCode38000(getContext(), string)) {
return;
}
JSONObject jsonObject = new JSONObject(string);
String optString = jsonObject.optString("code");
String message = jsonObject.optString("message");
@@ -171,6 +174,9 @@ public class HttpMD5SendInfoUtil {
InputStream inStream = conn.getInputStream();
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
String string = new String(result);
if (UIUtils.interceptCode38000(getContext(), string)) {
return;
}
LogUtil.i("result = "+result);
JSONObject jsonObject = new JSONObject(string);
String optString = jsonObject.optString("code");
@@ -261,6 +267,9 @@ public class HttpMD5SendInfoUtil {
InputStream inStream = conn.getInputStream();
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
String string = new String(result);
if (UIUtils.interceptCode38000(getContext(), string)) {
return;
}
LogUtil.i("result = "+result);
JSONObject jsonObject = new JSONObject(string);
String optString = jsonObject.optString("code");
@@ -346,6 +355,9 @@ public class HttpMD5SendInfoUtil {
InputStream inStream = conn.getInputStream();
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
String string = new String(result);
if (UIUtils.interceptCode38000(getContext(), string)) {
return;
}
LogUtil.i("result = "+result);
JSONObject jsonObject = new JSONObject(string);
String optString = jsonObject.optString("code");
@@ -63,7 +63,36 @@ import io.dcloud.feature.unimp.config.UniMPOpenConfiguration;
public class MyUserIconUtil {
public static void myIntent(Context context,String name){
if (name == null) {
return;
}
if ("更换手机号".equals(name) || name.contains("微信")) {
if (!UIUtils.checkAccountLoginAndJump(context)) {
return;
}
}
if ("我的患者".equals(name) || "公益咨询".equals(name) || "患者审核".equals(name)
|| "患者分组".equals(name) || "群发消息".equals(name) || "随访二维码".equals(name)
|| "出诊计划".equals(name)) {
if (!UIUtils.checkDoctorVerifiedAndJump(context)) {
return;
}
}
if ("我的视频".equals(name) || "我的课程".equals(name)
|| "我的下载".equals(name) || "我的收藏".equals(name) || "我的账户".equals(name)
|| "我的积分".equals(name) || "我的福利".equals(name) || "我的鲜花".equals(name)
|| "课件明细".equals(name) || "课程明细".equals(name) || "积分商城".equals(name)
|| "送心意".equals(name)
|| "病例讨论".equals(name) || "病例交流".equals(name) || "病例荟萃".equals(name)
|| "病例分享".equals(name) || "科研项目".equals(name) || "临床研究".equals(name)) {
if (!UIUtils.checkLoginAndJump(context)) {
return;
}
}
if ("肝胆新闻".equals(name)||"肝胆时讯".equals(name)){
if (!UIUtils.checkLoginAndJump(context)) {
return;
}
// context.startActivity(new Intent(context, GandanConsultActivity.class));
UniappUtil.showUniMp(context, "/pages_app/newsList/newsList", null);
}else if ("名医名科".equals(name)){
@@ -74,6 +103,9 @@ public class MyUserIconUtil {
intentwf.putExtra("search", "medicine");
context.startActivity(intentwf);
}else if ("肝胆课件".equals(name)){
if (!UIUtils.checkLoginAndJump(context)) {
return;
}
// context.startActivity(new Intent(context, CoursewareActivity.class));
UniappUtil.showUniMp(context, "/pages_app/ppt/ppt", null);
}else if ("精品课程".equals(name)){
@@ -112,8 +144,10 @@ public class MyUserIconUtil {
{
context.startActivity(new Intent(context, MyPatientActivity.class));
}
else if("肝胆视频".equals(name))
{
else if("肝胆视频".equals(name)){
if (!UIUtils.checkLoginAndJump(context)) {
return;
}
// context.startActivity(new Intent(context, VideoActivity.class));
// 调用公共方法打开uniapp mp
UniappUtil.showUniMp(context, "/pages_app/video/video", null);
@@ -537,4 +537,18 @@ public class StringUtil {
return queryString.toString();
}
/**
* 手机号中间 4 位脱敏(如 138****1234)
*/
public static String maskMobile(String mobile) {
if (isEmpty(mobile)) {
return "";
}
String trimmed = mobile.trim();
if (trimmed.length() == 11) {
return trimmed.substring(0, 3) + "****" + trimmed.substring(7);
}
return trimmed;
}
}
@@ -13,7 +13,17 @@ import android.widget.Toast;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;
import cn.shangyu.gdxzExpert.activity.LoginNewActivity;
import cn.shangyu.gdxzExpert.application.BaseApplication;
import cn.shangyu.gdxzExpert.bean.ChangeMyInfoBean;
import cn.shangyu.gdxzExpert.http.HttpHelper;
/**
*
* UIUtils.java
@@ -171,9 +181,283 @@ public class UIUtils {
* @return
* boolean
*/
public static boolean isAccountLogined() {
boolean isLogin = SharePrefUtil.getBoolean(getContext(), Constant.IS_LOGIN, false);
String uuid = SharePrefUtil.getString(getContext(), Constant.uuid, "");
return isLogin && !StringUtil.isEmpty(uuid);
}
public static boolean isLogined() {
return isAccountLogined();
}
/**
* 判断当前用户是否已通过医师/专家资质审核(已登录账号 且 state == 6)
* 仅用于【我的患者】模块与【随访服务】模块
*/
public static boolean isDoctorVerified() {
return isLogined() && SharePrefUtil.getInt(getContext(), "state", 0) == 6;
}
public interface OnDoctorStateRefreshListener {
void onStateRefreshed(int state, String checkInfo);
}
/**
* 将 getExpertByUuid 返回的专家详情及审核状态同步到本地 SharePrefUtil
*/
public static void syncExpertInfoToSp(Context context, ChangeMyInfoBean bean) {
if (bean == null || !"1".equals(bean.code) || bean.expert == null) {
return;
}
Context ctx = context != null ? context : getContext();
ChangeMyInfoBean.InfoData data = bean.expert;
if (data.state > 0) {
SharePrefUtil.saveInt(ctx, "state", data.state);
}
if (!StringUtil.isEmpty(data.checkInfo)) {
SharePrefUtil.saveString(ctx, "checkInfo", data.checkInfo);
}
if (!StringUtil.isEmpty(data.realName)) {
SharePrefUtil.saveString(ctx, Constant.realName, data.realName);
}
if (!StringUtil.isEmpty(data.photo)) {
SharePrefUtil.saveString(ctx, Constant.photo, data.photo);
}
if (!StringUtil.isEmpty(data.hospitalUuid)) {
SharePrefUtil.saveString(ctx, "hospitalUuid", data.hospitalUuid);
}
if (!StringUtil.isEmpty(data.hospitalName)) {
SharePrefUtil.saveString(ctx, "hospitalName", data.hospitalName);
}
if (!StringUtil.isEmpty(data.officeUuid)) {
SharePrefUtil.saveString(ctx, "officeUuid", data.officeUuid);
}
if (!StringUtil.isEmpty(data.officeName)) {
SharePrefUtil.saveString(ctx, "officeName", data.officeName);
}
if (!StringUtil.isEmpty(data.officePhone)) {
SharePrefUtil.saveString(ctx, "officePhone", data.officePhone);
}
if (!StringUtil.isEmpty(data.positionUuid)) {
SharePrefUtil.saveString(ctx, "positionUuid", data.positionUuid);
}
if (!StringUtil.isEmpty(data.positionName)) {
SharePrefUtil.saveString(ctx, "positionName", data.positionName);
}
if (!StringUtil.isEmpty(data.certificate)) {
SharePrefUtil.saveString(ctx, "certificate", data.certificate);
}
if (!StringUtil.isEmpty(data.certificateImg)) {
SharePrefUtil.saveString(ctx, "certificateImg", data.certificateImg);
}
if (!StringUtil.isEmpty(data.qrcode)) {
SharePrefUtil.saveString(ctx, "qrcode", data.qrcode);
}
if (!StringUtil.isEmpty(data.isStar)) {
SharePrefUtil.saveString(ctx, "isStar", data.isStar);
}
SharePrefUtil.saveInt(ctx, "sex", data.sex);
}
/**
* 当账号已登录但尚未认证通过(state != 6)时,静默向服务端拉取最新审核状态(state)并同步到本地
*/
public static void refreshDoctorStateIfNeeded(final Context context, final OnDoctorStateRefreshListener listener) {
if (!isLogined() || isDoctorVerified()) {
return;
}
final Context ctx = context != null ? context : getContext();
String uuid = SharePrefUtil.getString(ctx, Constant.uuid, "");
if (StringUtil.isEmpty(uuid)) {
return;
}
RequestParams params = new RequestParams();
params.addBodyParameter("uuid", uuid);
HttpHelper.loadData(HttpMethod.POST, Url.getExpertByUuid, params, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> info) {
if (info == null || StringUtil.isEmpty(info.result)) {
return;
}
try {
ChangeMyInfoBean bean = GsonTools.fromGsonToBean(info.result, ChangeMyInfoBean.class);
if (bean != null && "1".equals(bean.code) && bean.expert != null) {
SharePrefUtil.saveString(ctx, Url.getExpertByUuid, info.result);
syncExpertInfoToSp(ctx, bean);
if (listener != null) {
String checkInfo = !StringUtil.isEmpty(bean.expert.checkInfo)
? bean.expert.checkInfo
: SharePrefUtil.getString(ctx, "checkInfo", "");
listener.onStateRefreshed(bean.expert.state, checkInfo);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onFailure(HttpException arg0, String arg1) {
}
});
}
/**
* 校验是否已通过医师资质审核(state == 6)
* - 未登录账号:跳 LoginNewActivity
* - 已登录账号但 state != 6:跳 LoginSetInfoActivity(完善个人资料/查看审核状态)
*/
public static boolean checkDoctorVerifiedAndJump(Context context) {
if (isDoctorVerified()) {
return true;
}
if (!isLogined()) {
return checkLoginAndJump(context);
}
long now = System.currentTimeMillis();
if (now - lastJumpLoginTime < 800) {
return false;
}
lastJumpLoginTime = now;
Context targetContext = context != null ? context : getContext();
Intent intent = new Intent(targetContext, cn.shangyu.gdxzExpert.activity.LoginSetInfoActivity.class);
intent.putExtra("state", SharePrefUtil.getInt(getContext(), "state", 0));
intent.putExtra("checkInfo", SharePrefUtil.getString(getContext(), "checkInfo", ""));
intent.putExtra("phone", SharePrefUtil.getString(getContext(), Constant.mobile, ""));
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (!(targetContext instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
targetContext.startActivity(intent);
return false;
}
public static boolean checkAccountLoginAndJump(Context context) {
if (isAccountLogined()) {
return true;
}
long now = System.currentTimeMillis();
if (now - lastJumpLoginTime < 800) {
return false;
}
lastJumpLoginTime = now;
Context targetContext = context != null ? context : getContext();
Intent intent;
if (isAccountLogined()) {
intent = new Intent(targetContext, cn.shangyu.gdxzExpert.activity.LoginSetInfoActivity.class);
intent.putExtra("state", SharePrefUtil.getInt(getContext(), "state", 0));
intent.putExtra("checkInfo", SharePrefUtil.getString(getContext(), "checkInfo", ""));
intent.putExtra("phone", SharePrefUtil.getString(getContext(), Constant.mobile, ""));
} else {
intent = new Intent(targetContext, LoginNewActivity.class);
}
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (!(targetContext instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
targetContext.startActivity(intent);
return false;
}
private static boolean unusedOldIsLogined() {
// TODO Auto-generated method stub
return SharePrefUtil.getBoolean(getContext(), Constant.IS_LOGIN, false);
boolean isLogin = SharePrefUtil.getBoolean(getContext(), Constant.IS_LOGIN, false);
String uuid = SharePrefUtil.getString(getContext(), Constant.uuid, "");
return isLogin && !StringUtil.isEmpty(uuid);
}
/**
* 校验是否已登录,未登录则拉起登录页
*
* @param context 上下文
* @return true 已登录;false 未登录(已跳转登录页)
*/
private static long lastJumpLoginTime = 0L;
/**
* 全局拦截网络请求返回码 code == 38000,清理失效登录态并跳转登录页
*
* @param context 上下文
* @param resultJson 接口返回的 JSON 字符串
* @return true 表示命中 code == 38000 并已拦截跳转;false 表示正常放行
*/
public static boolean interceptCode38000(final Context context, String resultJson) {
if (StringUtil.isEmpty(resultJson) || !resultJson.contains("38000")) {
return false;
}
try {
org.json.JSONObject jsonObject = new org.json.JSONObject(resultJson);
String code = jsonObject.optString("code");
if (!"38000".equals(code) && jsonObject.optInt("code", -1) != 38000) {
return false;
}
runInMainThread(new Runnable() {
@Override
public void run() {
Context appCtx = getContext();
if (appCtx != null && isAccountLogined()) {
SharePrefUtil.saveBoolean(appCtx, Constant.IS_LOGIN, false);
SharePrefUtil.saveString(appCtx, Constant.uuid, "");
SharePrefUtil.saveString(appCtx, Constant.USERID, "");
SharePrefUtil.saveString(appCtx, "access_token", "");
SharePrefUtil.saveString(appCtx, "refresh_token", "");
}
long now = System.currentTimeMillis();
if (now - lastJumpLoginTime < 1500) {
return;
}
Activity topActivity = cn.shangyu.gdxzExpert.base.AppManager.getAppManager().currentActivity();
if (topActivity instanceof LoginNewActivity
|| topActivity instanceof cn.shangyu.gdxzExpert.activity.LoginActivity
|| topActivity instanceof cn.shangyu.gdxzExpert.activity.BindNumberActivity
|| topActivity instanceof cn.shangyu.gdxzExpert.activity.RegistActivity) {
return;
}
lastJumpLoginTime = now;
Context targetContext = context != null ? context : (topActivity != null ? topActivity : appCtx);
if (targetContext == null) {
return;
}
Intent intent = new Intent(targetContext, LoginNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (!(targetContext instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
targetContext.startActivity(intent);
}
});
return true;
} catch (Exception e) {
return false;
}
}
public static boolean checkLoginAndJump(Context context) {
if (isLogined()) {
return true;
}
long now = System.currentTimeMillis();
if (now - lastJumpLoginTime < 800) {
return false;
}
lastJumpLoginTime = now;
Context targetContext = context != null ? context : getContext();
Intent intent;
if (isAccountLogined()) {
intent = new Intent(targetContext, cn.shangyu.gdxzExpert.activity.LoginSetInfoActivity.class);
intent.putExtra("state", SharePrefUtil.getInt(getContext(), "state", 0));
intent.putExtra("checkInfo", SharePrefUtil.getString(getContext(), "checkInfo", ""));
intent.putExtra("phone", SharePrefUtil.getString(getContext(), Constant.mobile, ""));
} else {
intent = new Intent(targetContext, LoginNewActivity.class);
}
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (!(targetContext instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
targetContext.startActivity(intent);
return false;
}
public static boolean isBackground() {
@@ -67,6 +67,42 @@ import io.dcloud.feature.unimp.config.UniMPReleaseConfiguration;
public class UniappUtil {
private static String lastUniMPToken = "";
/**
* 判断目标路径是否允许游客模式(未登录)访问
* 覆盖:肝胆视频、肝胆新闻(肝胆时讯)、肝胆课件及其详情页
*/
public static boolean isGuestAllowedPath(String targetPath) {
if (StringUtil.isEmpty(targetPath)) {
return false;
}
return targetPath.startsWith("/pages_app/video/video")
|| targetPath.startsWith("/pages_app/videoDetail/videoDetail")
|| targetPath.startsWith("/pages_app/liveReplay/liveReplay")
|| targetPath.startsWith("/pages_app/replayList/replayList")
|| targetPath.startsWith("/pages_app/newsList/newsList")
|| targetPath.startsWith("/pages_app/news/news")
|| targetPath.startsWith("/pages_app/webview/webviewClass")
|| targetPath.startsWith("/pages_app/webview/webview")
|| targetPath.startsWith("/pages_app/ppt/ppt")
|| targetPath.startsWith("/pages_app/pptDetail/pptDetail");
}
/**
* 判断目标路径是否属于【我的患者】或【随访服务】模块(需校验 state == 6)
*/
public static boolean isDoctorVerifiedRequiredPath(String targetPath) {
if (StringUtil.isEmpty(targetPath)) {
return false;
}
return targetPath.startsWith("/pages_app/myPatient")
|| targetPath.startsWith("/pages_app/patientGroup")
|| targetPath.startsWith("/pages_chat/groupMessage")
|| targetPath.startsWith("/pages_app/myCode")
|| targetPath.startsWith("/pages_chat/outPatient");
}
/**
* 展示uniapp mp - 公共方法
* @param context 上下文
@@ -75,6 +111,12 @@ public class UniappUtil {
public static void showUniMp(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) {
try {
if (isDoctorVerifiedRequiredPath(targetPath) && !UIUtils.checkDoctorVerifiedAndJump(context)) {
return;
}
if (!isGuestAllowedPath(targetPath) && !UIUtils.checkLoginAndJump(context)) {
return;
}
checkWgt(context, targetPath, pageParams);
} catch (Exception e) {
@@ -106,11 +148,17 @@ public class UniappUtil {
private static void showInternal(Context context, String targetPath, com.alibaba.fastjson.JSONObject pageParams) {
try {
String uuid = SharePrefUtil.getString(context, Constant.uuid, "");
if(StringUtil.isEmpty(uuid)){
if (isDoctorVerifiedRequiredPath(targetPath) && !UIUtils.checkDoctorVerifiedAndJump(context)) {
return;
}
String access_token = SharePrefUtil.getString(context, "access_token", "");
if (!isGuestAllowedPath(targetPath) && !UIUtils.checkLoginAndJump(context)) {
return;
}
String uuid = SharePrefUtil.getString(context, Constant.uuid, "");
if(!isGuestAllowedPath(targetPath) && StringUtil.isEmpty(uuid)){
return;
}
String access_token = UIUtils.isLogined() ? SharePrefUtil.getString(context, "access_token", "") : "";
String QueryString = StringUtil.toQueryString(pageParams);
JSONObject userInfo = new JSONObject();
userInfo.put("uuid", SharePrefUtil.getString(context, Constant.uuid, ""));
@@ -148,7 +196,12 @@ public class UniappUtil {
Log.d("UniappUtil","uniapp_MP_cash.isRunning()="+uniapp_MP_cash.isRunning());
}
//存在但是不在运行
if(uniapp_MP_cash != null && !uniapp_MP_cash.isRunning()){
if(uniapp_MP_cash != null && (!uniapp_MP_cash.isRunning() || !android.text.TextUtils.equals(lastUniMPToken, access_token))){
BaseApplication.getUniMPCaches().remove(uniapp_mp_appid);
uniapp_MP_cash.closeUniMP();
uniapp_MP_cash = null;
}
if(false && uniapp_MP_cash != null && !uniapp_MP_cash.isRunning()){
BaseApplication.getUniMPCaches().remove(uniapp_mp_appid);
uniapp_MP_cash.closeUniMP();
}
@@ -173,6 +226,7 @@ public class UniappUtil {
}
}
IUniMP uniapp_MP = DCUniMPSDK.getInstance().openUniMP(openContext, uniapp_mp_appid, uniMPOpenConfiguration);
lastUniMPToken = access_token != null ? access_token : "";
BaseApplication.getUniMPCaches().put(uniapp_MP.getAppid(), uniapp_MP);
}
} catch (Exception e) {
@@ -8,65 +8,65 @@ package cn.shangyu.gdxzExpert.utils;
public class Url {
// 肝胆服务器正式地址
//记得把上报地址切到正式
public static String urlimage = "http://app.igandan.com/app/";// ceshi2短信验证码
public static String urlapp = "http://app.igandan.com/app/expertApp/";// 正式外网地址
public static String url = "http://app.igandan.com/app/expert/";// 正式外网地址 v
public static String weurl = "https://wx.igandan.com/";// 微信服务器地址
public static String urlping = "http://app.igandan.com//app/pingExpert/";//
public static String urlping2 = "http://app.igandan.com//app/pingExpertV2/";//ping2
public static String getzcxy = "http://app.igandan.com/expert_zcxy.jsp";// 注册协议正式地址
public static String getyyzc="https://doc.igandan.com/app/integral/permission_expert.html";//隐私政策
public static String urlHtml = "http://doc.igandan.com/app/";// 静态资源访问地址( 图片、html等)正式地址
public static String CrashUpload = "http://app.igandan.com/app/upload/uploadExpert";// 崩溃日志上传正式 地址
public static String YKMedicionURl = "http://extraapi.meditool.cn/";// 医库用药网址
public static String getpushChat = "http://wx.igandan.com/api/pushChat";// 微信推送
public static String urlmyLan = "https://app.igandan.com/app/expertAPI/";//迈兰
public static String qrCode = "http://wx.igandan.com/expert/expertcodeimg?expert_uuid=";//专家二维码页面分享链接:
public static String urlOutpatient = "http://wx.igandan.com/expert/outpatient_details?expert_uuid=";//门诊详情连接:http://wx.igandan.com/expert/outpatient_details?expert_uuid=
public static String url_path = "https://app.igandan.com/app";
public static String videodetailURL = "http://wx.igandan.com/video/hcp_detial?share=1&uuid=";
public static String polvId = "21";//保利威视学员id
public static String scanurl = "https://wx.igandan.com/watchlive/sendWebsocketMsg";
public static String zhibourl = weurl+"hcp/setInfo";
public static String homeModalurl = urlmyLan+"homemodal";
public static String PHP ="https://prod.hospital.open.igandanyiyuan.com";// php接口 互联网医院相关
public static String modernHepatology="https://oss.igandan.com";//常用医学工具
public static String appkey ="a1e5d9ca1d3fbae69532f134bf6cdee9";
public static String appId ="1000001";
public static String FileUrl="https://event.igandan.com/v1/eventLog/upload";//正式环境
public static String youanapi ="https://yaylt.igandan.com/api";
// public static String urlimage = "http://app.igandan.com/app/";// ceshi2短信验证码
// public static String urlapp = "http://app.igandan.com/app/expertApp/";// 正式外网地址
// public static String url = "http://app.igandan.com/app/expert/";// 正式外网地址 v
// public static String weurl = "https://wx.igandan.com/";// 微信服务器地址
// public static String urlping = "http://app.igandan.com//app/pingExpert/";//
// public static String urlping2 = "http://app.igandan.com//app/pingExpertV2/";//ping2
// public static String getzcxy = "http://app.igandan.com/expert_zcxy.jsp";// 注册协议正式地址
// public static String getyyzc="https://doc.igandan.com/app/integral/permission_expert.html";//隐私政策
// public static String urlHtml = "http://doc.igandan.com/app/";// 静态资源访问地址( 图片、html等)正式地址
// public static String CrashUpload = "http://app.igandan.com/app/upload/uploadExpert";// 崩溃日志上传正式 地址
// public static String YKMedicionURl = "http://extraapi.meditool.cn/";// 医库用药网址
// public static String getpushChat = "http://wx.igandan.com/api/pushChat";// 微信推送
// public static String urlmyLan = "https://app.igandan.com/app/expertAPI/";//迈兰
// public static String qrCode = "http://wx.igandan.com/expert/expertcodeimg?expert_uuid=";//专家二维码页面分享链接:
// public static String urlOutpatient = "http://wx.igandan.com/expert/outpatient_details?expert_uuid=";//门诊详情连接:http://wx.igandan.com/expert/outpatient_details?expert_uuid=
// public static String url_path = "https://app.igandan.com/app";
// public static String videodetailURL = "http://wx.igandan.com/video/hcp_detial?share=1&uuid=";
// public static String polvId = "21";//保利威视学员id
// public static String scanurl = "https://wx.igandan.com/watchlive/sendWebsocketMsg";
// public static String zhibourl = weurl+"hcp/setInfo";
// public static String homeModalurl = urlmyLan+"homemodal";
// public static String PHP ="https://prod.hospital.open.igandanyiyuan.com";// php接口 互联网医院相关
// public static String modernHepatology="https://oss.igandan.com";//常用医学工具
// public static String appkey ="a1e5d9ca1d3fbae69532f134bf6cdee9";
// public static String appId ="1000001";
// public static String FileUrl="https://event.igandan.com/v1/eventLog/upload";//正式环境
// public static String youanapi ="https://yaylt.igandan.com/api";
// 肝胆测试服务器地址
// public static String urlimage = "https://dev-app.igandan.com/app/";// ceshi2短信验证码
// public static String urlapp = "https://dev-app.igandan.com//app/expertApp/";// ceshi2地址
// public static String urlping = "https://dev-app.igandan.com//app/pingExpert/";//ping
// public static String urlping2 = "https://dev-app.igandan.com//app/pingExpertV2/";//ping2
// public static String url = "https://dev-app.igandan.com//app/expert/";// ceshi2地址
// public static String weurl = "https://dev-wx.igandan.com/";// 微信服务器地址
// public static String getzcxy = "http://app.igandan.com/expert_zcxy.jsp";// 注册协议正式地址
// public static String getyyzc="https://doc.igandan.com/app/integral/permission_expert.html";//隐私政策
// public static String urlHtml = "http://dev-doc.igandan.com/app/";// 静态资源访问地址(图片、html等)ceshi2
// public static String CrashUpload = "https://dev-app.igandan.com/app/upload/uploadExpert";// 崩溃日志上传ceshi2
// public static String YKMedicionURl = "http://extratest.meditool.cn/";// 医库用药网址
// public static String getpushChat = "http://dev-wx.igandan.com/api/pushChat";// 微信推送
// public static String urlmyLan = "https://dev-app.igandan.com/app/expertAPI/";//迈兰
// public static String qrCode = "http://dev-wx.igandan.com/expert/expert" +
// "codeimg?expert_uuid=";//专家二维码页面分享链接:
// public static String urlOutpatient = "http://dev-wx.igandan.com/expert/outpatient_details?expert_uuid=";//门诊详情连接:
//
// public static String url_path = "https://dev-app.igandan.com/app";
// public static String videodetailURL = "http://dev-wx.igandan.com/video/hcp_detial?share=1&uuid=";
// public static String polvId = "11";//保利威视学员id
// public static String scanurl = "https://dev-wx.igandan.com/watchlive/sendWebsocketMsg";
// public static String zhibourl = weurl+"hcp/setInfo";
// public static String homeModalurl = urlmyLan+"homemodal";
// public static String PHP ="http://dev.hospital.open.igandanyiyuan.com";// php接口 互联网医院相关
// public static String modernHepatology="https://dev-wx.igandan.com";//常用医学工具
// public static String appkey = "26e8675f44565b1ed4eaaa0fcf3531d7";
// public static String appId ="123456";
// public static String youanapi ="https://dev-realyworld.igandan.com/api";
// public static String FileUrl="https://dev-event.igandan.com/v1/eventLog/upload";
public static String urlimage = "https://dev-app.igandan.com/app/";// ceshi2短信验证码
public static String urlapp = "https://dev-app.igandan.com//app/expertApp/";// ceshi2地址
public static String urlping = "https://dev-app.igandan.com//app/pingExpert/";//ping
public static String urlping2 = "https://dev-app.igandan.com//app/pingExpertV2/";//ping2
public static String url = "https://dev-app.igandan.com//app/expert/";// ceshi2地址
public static String weurl = "https://dev-wx.igandan.com/";// 微信服务器地址
public static String getzcxy = "http://app.igandan.com/expert_zcxy.jsp";// 注册协议正式地址
public static String getyyzc="https://doc.igandan.com/app/integral/permission_expert.html";//隐私政策
public static String urlHtml = "http://dev-doc.igandan.com/app/";// 静态资源访问地址(图片、html等)ceshi2
public static String CrashUpload = "https://dev-app.igandan.com/app/upload/uploadExpert";// 崩溃日志上传ceshi2
public static String YKMedicionURl = "http://extratest.meditool.cn/";// 医库用药网址
public static String getpushChat = "http://dev-wx.igandan.com/api/pushChat";// 微信推送
public static String urlmyLan = "https://dev-app.igandan.com/app/expertAPI/";//迈兰
public static String qrCode = "http://dev-wx.igandan.com/expert/expert" +
"codeimg?expert_uuid=";//专家二维码页面分享链接:
public static String urlOutpatient = "http://dev-wx.igandan.com/expert/outpatient_details?expert_uuid=";//门诊详情连接:
public static String url_path = "https://dev-app.igandan.com/app";
public static String videodetailURL = "http://dev-wx.igandan.com/video/hcp_detial?share=1&uuid=";
public static String polvId = "11";//保利威视学员id
public static String scanurl = "https://dev-wx.igandan.com/watchlive/sendWebsocketMsg";
public static String zhibourl = weurl+"hcp/setInfo";
public static String homeModalurl = urlmyLan+"homemodal";
public static String PHP ="http://dev.hospital.open.igandanyiyuan.com";// php接口 互联网医院相关
public static String modernHepatology="https://dev-wx.igandan.com";//常用医学工具
public static String appkey = "26e8675f44565b1ed4eaaa0fcf3531d7";
public static String appId ="123456";
public static String youanapi ="https://dev-realyworld.igandan.com/api";
public static String FileUrl="https://dev-event.igandan.com/v1/eventLog/upload";
/**
@@ -633,7 +633,7 @@ public static String getInteractionListByTag = urlmyLan
public static String gethonorDetail = urlmyLan+"gethonorDetail";// 点击查看荣誉详情
//我的首页新
public static String myHomeNew = urlmyLan+"indexV2";
public static String myHomeNew = urlmyLan+"indexV3";
//我的新
public static String myNew = urlmyLan+"my";
@@ -90,6 +90,8 @@
android:drawableLeft="@drawable/send_message"
android:drawablePadding="10dp"
android:hint="请输入验证码"
android:inputType="number"
android:maxLength="6"
android:padding="10dp"
android:singleLine="true"
android:textColor="#333333"
@@ -221,6 +221,8 @@
android:drawableLeft="@drawable/send_message"
android:drawablePadding="10dp"
android:hint="请输入验证码"
android:inputType="number"
android:maxLength="6"
android:padding="10dp"
android:singleLine="true"
android:textColor="#333333"
@@ -196,6 +196,8 @@
android:drawableLeft="@drawable/send_message"
android:drawablePadding="10dp"
android:hint="请输入验证码"
android:inputType="number"
android:maxLength="6"
android:padding="10dp"
android:singleLine="true"
android:textColor="#333333"
@@ -60,10 +60,17 @@
style="@style/InfoLeftStyle"
android:text="姓名" />
<TextView
<EditText
android:id="@+id/my_name"
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
@@ -132,10 +139,17 @@
style="@style/InfoLeftStyle"
android:text="科室电话" />
<TextView
<EditText
android:id="@+id/my_office_phone"
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
@@ -168,11 +182,17 @@
style="@style/InfoLeftStyle"
android:text="执业医师证编号" />
<TextView
<EditText
android:id="@+id/my_zgzs_number"
style="@style/InfoRightStyle"
android:layout_width="160dp"
android:hint="请输入执业医师证编号" />
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
@@ -222,6 +242,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:padding="10dp"
android:text="肝胆相照将尽快对您的资料进行审核,请耐心等待。"
android:textColor="@color/red_btn_color_normal"
@@ -233,6 +254,8 @@
android:layout_height="wrap_content"
android:background="@color/transparent"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="30dp"
android:paddingLeft="25dp"
android:paddingRight="25dp"
@@ -244,10 +267,23 @@
android:layout_height="wrap_content"
android:background="@drawable/selector_btn"
android:gravity="center"
android:padding="10dp"
android:text="提交"
android:textColor="@color/white"
android:textSize="20sp" />
<Button
android:id="@+id/btn_skip_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="@drawable/bt_setting_bg"
android:gravity="center"
android:padding="10dp"
android:text="跳过"
android:textColor="@color/top_title"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
@@ -27,6 +27,7 @@
/>
<RelativeLayout
android:id="@+id/im_bg"
android:background="@drawable/big_background_my"
android:paddingTop="75dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -16,6 +16,7 @@
>
<RelativeLayout
android:id="@+id/im_bg"
android:background="@drawable/my_head_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -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
+1 -1
View File
@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Fri Nov 07 09:03:28 CST 2025
#Tue Nov 03 16:54:01 CST 2026
sdk.dir=C\:\\Users\\wucongxing\\AppData\\Local\\Android\\Sdk