CenterService.java
6.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
package com.hjx.personalcenter.service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import com.google.gson.Gson;
import com.hjx.personalcenter.activity.LoginAndRegisterActivity;
import com.hjx.personalcenter.db.SaveParam;
import com.hjx.personalcenter.model.CardInfo;
import com.hjx.personalcenter.model.LoginInfo;
import com.hjx.personalcenter.model.UserInfoModer;
import com.hjx.personalcenter.util.GetDevicesUtil;
/**
* Created by h on 2017/9/1.
*/
public class CenterService extends BaseService {
enum ACTIVITY_ACTION{
userinfo_activity
}
public CenterService(){
}
IPresonalInterface.Stub binder = new IPresonalInterface.Stub() {
@Override
public String sayHello() throws RemoteException {
return "这是测试AIDL的方法";
}
@Override
public String viewPage(String action) throws RemoteException {
String result = null;
if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){
//登录界面
Intent intent = new Intent();
intent.setClass(CenterService.this, LoginAndRegisterActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
result= "跳转成功";
}
return result;
}
@Override
public String getSimpleUser() throws RemoteException {
String logininfo = null;
Gson gson = new Gson();
LoginInfo loginInfo = new LoginInfo();
String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login");
//子账户id
String childsidid = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CHILDSID);
//账户类型
String accounts = SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ACCOUNT);
if ("true".equals(islogin)){
loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username"));
loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password"));
loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token"));
loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login"));
if ("2".equals(accounts)){
loginInfo.setUserId(childsidid);
}else {
loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId"));
}
logininfo =gson.toJson(loginInfo);
//Log.e("test","登录信息"+logininfo);
}
return logininfo;
}
//保卡信息
@Override
public String getcardUser() throws RemoteException {
String results = null;
// CardInfo cardInfo = new CardInfo();
CardInfo.DataBean dataBean = new CardInfo.DataBean();
Gson gson = new Gson();
//获取设备信息
dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel());
dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber());
dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac());
//获取保卡信息
dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME));
dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM));
dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME));
dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS));
dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE));
dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE));
// cardInfo.setData(dataBean);
//Log.e("test","保卡信息"+results);
String yangji = SaveParam.getInstance().getLoginParam(getApplication(), SaveParam.YANGJI);
if ("1".equals(yangji)) {
results = null;
} else {
results = gson.toJson(dataBean);
}
return results;
}
@Override
public String getUserInfo() throws RemoteException {
String userinfo = null;
Gson gson = new Gson();
UserInfoModer userInfoModer = new UserInfoModer();
userInfoModer.setNickName(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTUSERNAME));
userInfoModer.setGrade(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTGRADES));
userInfoModer.setSchool(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSCHOOL));
userInfoModer.setBirthday(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTCONSTELLATION));
userInfoModer.setGender(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTSEX));
userInfoModer.setQq(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTQQ));
userInfoModer.setAddress(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.ACCOUNTXINGZUO));
userInfoModer.setPortrait(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.PORTAIT));
userInfoModer.setGradeid(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.GRADENS));
userInfoModer.setIsprototype(SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.YANGJI));
userinfo = gson.toJson(userInfoModer);
return userinfo;
}
@Override
public String logout() throws RemoteException {
String visoninfo = SaveParam.getInstance().getLoginParam(getApplication(),SaveParam.VERSIONINTEFACE);
return visoninfo;
}
@Override
public String validateToken() throws RemoteException {
return null;
}
@Override
public String getDeviceID() throws RemoteException {
return null;
}
@Override
public String getChildsInfo() throws RemoteException {
return null;
}
};
@Override
public IBinder onBind(Intent intent) {
return binder;
}
@Override
public void onDestroy() {
super.onDestroy();
}
}