|
|
@@ -44,6 +44,7 @@ import com.core.utils.sortlist.PingYinUtil;
|
|
|
import com.core.xmpp.dao.ChatMessageDao;
|
|
|
import com.core.xmpp.dao.FriendDao;
|
|
|
import com.modular.appmessages.R;
|
|
|
+import com.modular.appmessages.activity.BusinessTargetsActivity;
|
|
|
import com.modular.appmessages.activity.MsgsSecondCommonActivity;
|
|
|
import com.modular.appmessages.activity.ProcessB2BActivity;
|
|
|
import com.modular.appmessages.activity.ProcessMsgActivity;
|
|
|
@@ -80,6 +81,7 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
private final int LOAD_B2B_COUNT = 0x16;//获取b2b的审批和任务数量
|
|
|
private final int LOAD_BOOKING = 0x17;//小秘书红点
|
|
|
private final int LOAD_REAL_TIME = 0x18;
|
|
|
+ private final int IS_COMPANY_ADMIN = 0x19;
|
|
|
|
|
|
public static final int REAL_TIME_FORM = 7;
|
|
|
public static final int BUSINESS_STATISTICS = 8;
|
|
|
@@ -92,45 +94,45 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
private Activity ct;
|
|
|
private String subReadTime;//订阅号点击时间
|
|
|
|
|
|
- private String filter;//搜索数据
|
|
|
- private int emnewsNum, subsNum, processNum, taskNum, bookingNum, uuHelperNum;//红点消息分类数量
|
|
|
- private String[] RECEIVER_LIST = {ConnectivityManager.CONNECTIVITY_ACTION, OAConfig.AUTO_SIGIN_ALART, MsgBroadcast.ACTION_MSG_COMPANY_UPDATE, "com.app.home.update"
|
|
|
- , MsgBroadcast.ACTION_MSG_UI_UPDATE};
|
|
|
- private BroadcastReceiver dataChangeReceiver = new BroadcastReceiver() {
|
|
|
- @Override
|
|
|
- public void onReceive(Context context, Intent intent) {
|
|
|
- String action = intent.getAction();
|
|
|
- if (StringUtil.isEmpty(action)) return;
|
|
|
- LogUtil.i("MessagePresenter=" + action);
|
|
|
- if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
|
|
|
- iMessageView.changeNet(SystemUtil.isNetWorkConnected(MyApplication.getInstance()));
|
|
|
- } else if (OAConfig.AUTO_SIGIN_ALART.equals(action)) {
|
|
|
- loadNews(isB2b);//获取消息
|
|
|
- } else if (action.equals("com.app.home.update") || action.equals(MsgBroadcast.ACTION_MSG_COMPANY_UPDATE)
|
|
|
- || action.equals(MsgBroadcast.ACTION_MSG_UI_UPDATE)) {
|
|
|
- initHeaderModels();
|
|
|
- loadData();
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
- private boolean isB2b;
|
|
|
-
|
|
|
-
|
|
|
- public MessagePresenter(Activity ct, IMessageView iMessageView, UnReaderListener unReaderListener) {
|
|
|
- this.ct = ct;
|
|
|
- this.unReaderListener = unReaderListener;
|
|
|
- mFriendList = new ArrayList<>();
|
|
|
- if (iMessageView == null)
|
|
|
- new NullPointerException("IMessageView not be null");
|
|
|
- this.iMessageView = iMessageView;
|
|
|
- if (RECEIVER_LIST != null && RECEIVER_LIST.length > 0) {
|
|
|
- IntentFilter dateFilter = new IntentFilter();
|
|
|
- for (String f : RECEIVER_LIST)
|
|
|
- dateFilter.addAction(f);
|
|
|
- LocalBroadcastManager.getInstance(ct).registerReceiver(dataChangeReceiver, dateFilter);
|
|
|
- }
|
|
|
- initHeaderModels();
|
|
|
- }
|
|
|
+ private String filter;//搜索数据
|
|
|
+ private int emnewsNum, subsNum, processNum, taskNum, bookingNum, uuHelperNum;//红点消息分类数量
|
|
|
+ private String[] RECEIVER_LIST = {ConnectivityManager.CONNECTIVITY_ACTION, OAConfig.AUTO_SIGIN_ALART, MsgBroadcast.ACTION_MSG_COMPANY_UPDATE, "com.app.home.update"
|
|
|
+ , MsgBroadcast.ACTION_MSG_UI_UPDATE};
|
|
|
+ private BroadcastReceiver dataChangeReceiver = new BroadcastReceiver() {
|
|
|
+ @Override
|
|
|
+ public void onReceive(Context context, Intent intent) {
|
|
|
+ String action = intent.getAction();
|
|
|
+ if (StringUtil.isEmpty(action)) return;
|
|
|
+ LogUtil.i("MessagePresenter=" + action);
|
|
|
+ if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
|
|
|
+ iMessageView.changeNet(SystemUtil.isNetWorkConnected(MyApplication.getInstance()));
|
|
|
+ } else if (OAConfig.AUTO_SIGIN_ALART.equals(action)) {
|
|
|
+ loadNews(isB2b);//获取消息
|
|
|
+ } else if (action.equals("com.app.home.update") || action.equals(MsgBroadcast.ACTION_MSG_COMPANY_UPDATE)
|
|
|
+ || action.equals(MsgBroadcast.ACTION_MSG_UI_UPDATE)) {
|
|
|
+ initHeaderModels();
|
|
|
+ loadData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ private boolean isB2b;
|
|
|
+
|
|
|
+
|
|
|
+ public MessagePresenter(Activity ct, IMessageView iMessageView, UnReaderListener unReaderListener) {
|
|
|
+ this.ct = ct;
|
|
|
+ this.unReaderListener = unReaderListener;
|
|
|
+ mFriendList = new ArrayList<>();
|
|
|
+ if (iMessageView == null)
|
|
|
+ new NullPointerException("IMessageView not be null");
|
|
|
+ this.iMessageView = iMessageView;
|
|
|
+ if (RECEIVER_LIST != null && RECEIVER_LIST.length > 0) {
|
|
|
+ IntentFilter dateFilter = new IntentFilter();
|
|
|
+ for (String f : RECEIVER_LIST)
|
|
|
+ dateFilter.addAction(f);
|
|
|
+ LocalBroadcastManager.getInstance(ct).registerReceiver(dataChangeReceiver, dateFilter);
|
|
|
+ }
|
|
|
+ initHeaderModels();
|
|
|
+ }
|
|
|
|
|
|
public void loadData() {
|
|
|
String role = CommonUtil.getUserRole();
|
|
|
@@ -138,7 +140,7 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
if (role.equals("2")) {//Erp用户
|
|
|
SUB_READ_TIME = CommonUtil.getMaster() + "SUB_READ_TIME";//订阅好点击阅读时间
|
|
|
subReadTime = PreferenceUtils.getString(SUB_READ_TIME);
|
|
|
- loadRealTime();
|
|
|
+ loadRealTime();//获取实时看板数据
|
|
|
loadTaskData();//获取任务接口
|
|
|
loadProcessToDo();//获取审批流接口
|
|
|
loadSubData();
|
|
|
@@ -148,9 +150,29 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
loadB2bNewsCount();
|
|
|
loadNews(isB2b);//获取消息
|
|
|
|
|
|
- }
|
|
|
- loadBookingNewNum(role);//预约红点接口
|
|
|
- }
|
|
|
+ }
|
|
|
+ isCompanyAdmin();
|
|
|
+ loadBookingNewNum(role);//预约红点接口
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断当前用户是否为商家管理员
|
|
|
+ */
|
|
|
+ private void isCompanyAdmin() {
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("companyid", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_uu"));
|
|
|
+ param.put("userid", MyApplication.getInstance().mLoginUser.getUserId());
|
|
|
+ param.put("token", MyApplication.getInstance().mAccessToken);
|
|
|
+ param.put("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+
|
|
|
+ Request request = new Request.Bulider()
|
|
|
+ .setParam(param)
|
|
|
+ .setUrl("user/appCompanyAdmin")
|
|
|
+ .setMode(Request.Mode.POST)
|
|
|
+ .setWhat(IS_COMPANY_ADMIN)
|
|
|
+ .bulid();
|
|
|
+ OAHttpHelper.getInstance().requestHttp(request, 1, this);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取实时看板数据
|
|
|
@@ -312,90 +334,90 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void loadBookingNewNum(String role) {
|
|
|
- Map<String, Object> param = new HashMap<>();
|
|
|
- param.put("token", MyApplication.getInstance().mAccessToken);
|
|
|
- param.put("userid", MyApplication.getInstance().mLoginUser.getUserId());//默认获取第一页
|
|
|
- Bundle bundle = new Bundle();
|
|
|
- bundle.putString("role", role);
|
|
|
- Request request = new Request.Bulider()
|
|
|
- .setParam(param)
|
|
|
- .setUrl("user/appCount")
|
|
|
- .setMode(Request.Mode.GET)
|
|
|
- .setBundle(bundle)
|
|
|
- .setWhat(LOAD_BOOKING)
|
|
|
- .bulid();
|
|
|
- OAHttpHelper.getInstance().requestHttp(request, 1, this);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void result(int what, boolean isJSON, String message, Bundle bundle) {
|
|
|
- if (!isJSON) {
|
|
|
- //TODO 返回数据错误
|
|
|
- return;
|
|
|
- }
|
|
|
- JSONObject object = JSON.parseObject(message);
|
|
|
- switch (what) {
|
|
|
- case LOAD_BOOKING:
|
|
|
- //{"count":"1"}
|
|
|
- bookingNum = Integer.valueOf(object.getString("count"));
|
|
|
- iMessageView.updateHeaderView(2, Integer.valueOf(object.getString("count")), "", "");
|
|
|
- updateForUnReader();
|
|
|
+ private void loadBookingNewNum(String role) {
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("token", MyApplication.getInstance().mAccessToken);
|
|
|
+ param.put("userid", MyApplication.getInstance().mLoginUser.getUserId());//默认获取第一页
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString("role", role);
|
|
|
+ Request request = new Request.Bulider()
|
|
|
+ .setParam(param)
|
|
|
+ .setUrl("user/appCount")
|
|
|
+ .setMode(Request.Mode.GET)
|
|
|
+ .setBundle(bundle)
|
|
|
+ .setWhat(LOAD_BOOKING)
|
|
|
+ .bulid();
|
|
|
+ OAHttpHelper.getInstance().requestHttp(request, 1, this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void result(int what, boolean isJSON, String message, Bundle bundle) {
|
|
|
+ if (!isJSON) {
|
|
|
+ //TODO 返回数据错误
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject object = JSON.parseObject(message);
|
|
|
+ switch (what) {
|
|
|
+ case LOAD_BOOKING:
|
|
|
+ //{"count":"1"}
|
|
|
+ bookingNum = Integer.valueOf(object.getString("count"));
|
|
|
+ iMessageView.updateHeaderView(2, Integer.valueOf(object.getString("count")), "", "");
|
|
|
+ updateForUnReader();
|
|
|
// iMessageView.showModel(null); ///tODO 这个引起了闪一下的问题(可能存在会有刷新不过来的问题)
|
|
|
- if (bundle != null) {
|
|
|
- String role = bundle.getString("role");
|
|
|
- if (role != null && role.equals("1")) {
|
|
|
- saveErp2DB(null);
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case LOAD_EMNEWS:
|
|
|
- if (!object.containsKey("listdata")) {
|
|
|
- handlerNewsFormErp(new JSONArray());
|
|
|
- return;
|
|
|
- }
|
|
|
- String ids = object.getString("ids");
|
|
|
- if (!StringUtil.isEmpty(ids))
|
|
|
- postReadNews(ids);
|
|
|
- JSONArray array = object.getJSONArray("listdata");
|
|
|
- handlerNewsFormErp(array);
|
|
|
- break;
|
|
|
- case LOAD_SUBS://获取订阅号接口
|
|
|
- handlerSub(object);
|
|
|
- break;
|
|
|
- case LOAD_PROCESS://获取审批流接口
|
|
|
- handlerProcess(object);
|
|
|
- break;
|
|
|
- case LOAD_TASK://获取任务接口
|
|
|
- handlerTask(object);
|
|
|
- break;
|
|
|
- case LOAD_EMNEWS_DETAILS:
|
|
|
- String type = bundle.getString("type");
|
|
|
- boolean isReaded = bundle.getBoolean("isReaded");
|
|
|
- JSONArray msgsArray = object.getJSONArray("listdata");
|
|
|
- if (!ListUtils.isEmpty(msgsArray)) {
|
|
|
- handleMsgsArray(type, msgsArray);
|
|
|
- }
|
|
|
- handlerEndOfReadOrDelete(type, isReaded);
|
|
|
- break;
|
|
|
- case LOAD_B2B_COUNT:
|
|
|
- if (object.containsKey("processcount")) {
|
|
|
- processNum = JSONUtil.getInt(object, "processcount");
|
|
|
- String title = JSONUtil.getText(object, "lastProcess");
|
|
|
- long time = JSONUtil.getTime(object, "lastProcessTime") / 1000;
|
|
|
- if (time == 0) time = System.currentTimeMillis() / 1000;
|
|
|
- iMessageView.updateHeaderView(4, processNum, title, TimeUtils.getFriendlyTimeDesc(ct, (int) time));
|
|
|
- updateForUnReader();
|
|
|
- }
|
|
|
- if (object.containsKey("taskcount")) {
|
|
|
- taskNum = JSONUtil.getInt(object, "taskcount");
|
|
|
- String title = JSONUtil.getText(object, "lasttask");
|
|
|
- long time = JSONUtil.getTime(object, "lasttaskTime") / 1000;
|
|
|
- if (time == 0) time = System.currentTimeMillis() / 1000;
|
|
|
- String taskTime = TimeUtils.getFriendlyTimeDesc(ct, (int) time);
|
|
|
- iMessageView.updateHeaderView(5, taskNum, title, taskTime);
|
|
|
- updateForUnReader();
|
|
|
- }
|
|
|
+ if (bundle != null) {
|
|
|
+ String role = bundle.getString("role");
|
|
|
+ if (role != null && role.equals("1")) {
|
|
|
+ saveErp2DB(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case LOAD_EMNEWS:
|
|
|
+ if (!object.containsKey("listdata")) {
|
|
|
+ handlerNewsFormErp(new JSONArray());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String ids = object.getString("ids");
|
|
|
+ if (!StringUtil.isEmpty(ids))
|
|
|
+ postReadNews(ids);
|
|
|
+ JSONArray array = object.getJSONArray("listdata");
|
|
|
+ handlerNewsFormErp(array);
|
|
|
+ break;
|
|
|
+ case LOAD_SUBS://获取订阅号接口
|
|
|
+ handlerSub(object);
|
|
|
+ break;
|
|
|
+ case LOAD_PROCESS://获取审批流接口
|
|
|
+ handlerProcess(object);
|
|
|
+ break;
|
|
|
+ case LOAD_TASK://获取任务接口
|
|
|
+ handlerTask(object);
|
|
|
+ break;
|
|
|
+ case LOAD_EMNEWS_DETAILS:
|
|
|
+ String type = bundle.getString("type");
|
|
|
+ boolean isReaded = bundle.getBoolean("isReaded");
|
|
|
+ JSONArray msgsArray = object.getJSONArray("listdata");
|
|
|
+ if (!ListUtils.isEmpty(msgsArray)) {
|
|
|
+ handleMsgsArray(type, msgsArray);
|
|
|
+ }
|
|
|
+ handlerEndOfReadOrDelete(type, isReaded);
|
|
|
+ break;
|
|
|
+ case LOAD_B2B_COUNT:
|
|
|
+ if (object.containsKey("processcount")) {
|
|
|
+ processNum = JSONUtil.getInt(object, "processcount");
|
|
|
+ String title = JSONUtil.getText(object, "lastProcess");
|
|
|
+ long time = JSONUtil.getTime(object, "lastProcessTime") / 1000;
|
|
|
+ if (time == 0) time = System.currentTimeMillis() / 1000;
|
|
|
+ iMessageView.updateHeaderView(4, processNum, title, TimeUtils.getFriendlyTimeDesc(ct, (int) time));
|
|
|
+ updateForUnReader();
|
|
|
+ }
|
|
|
+ if (object.containsKey("taskcount")) {
|
|
|
+ taskNum = JSONUtil.getInt(object, "taskcount");
|
|
|
+ String title = JSONUtil.getText(object, "lasttask");
|
|
|
+ long time = JSONUtil.getTime(object, "lasttaskTime") / 1000;
|
|
|
+ if (time == 0) time = System.currentTimeMillis() / 1000;
|
|
|
+ String taskTime = TimeUtils.getFriendlyTimeDesc(ct, (int) time);
|
|
|
+ iMessageView.updateHeaderView(5, taskNum, title, taskTime);
|
|
|
+ updateForUnReader();
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case LOAD_REAL_TIME:
|
|
|
@@ -409,6 +431,13 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
iMessageView.updateHeaderView(REAL_TIME_FORM, 0, "", "");
|
|
|
}
|
|
|
break;
|
|
|
+ case IS_COMPANY_ADMIN:
|
|
|
+ String result = JSONUtil.getText(object, "result");
|
|
|
+ if ("0".equals(result)) {
|
|
|
+ iMessageView.updateHeaderView(BUSINESS_STATISTICS, 0, "", "");
|
|
|
+ } else if ("1".equals(result)) {
|
|
|
+ iMessageView.updateHeaderView(BUSINESS_STATISTICS, 1, "", "");
|
|
|
+ }
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -809,37 +838,37 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
loadEmNewsDetails(friend.getDescription(), true);
|
|
|
// MessageDao.getInstance().upStatusByType(friend.getDescription(), true);
|
|
|
// loadData();
|
|
|
- } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
|
|
|
- UUHelperDao.getInstance().updateRead(true);
|
|
|
- } else {
|
|
|
- if (friend.getUnReadNum() > 0) {
|
|
|
- MsgBroadcast.broadcastMsgNumUpdate(ct, false, friend.getUnReadNum());
|
|
|
- friend.setUnReadNum(0);
|
|
|
- iMessageView.showModel(mFriendList);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 设置未阅读该类型文件
|
|
|
- *
|
|
|
- * @param position
|
|
|
- */
|
|
|
- public void unReaderAllByType(int position) {
|
|
|
- if (ListUtils.isEmpty(mFriendList) || mFriendList.size() < position) return;
|
|
|
- Friend friend = mFriendList.get(position).getBean();
|
|
|
- if (friend.getType() == XmppMessage.TYPE_ERP) {
|
|
|
- MessageDao.getInstance().upStatusByType(friend.getDescription(), false);
|
|
|
- } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
|
|
|
- UUHelperDao.getInstance().updateRead(false);
|
|
|
- } else {
|
|
|
- if (friend.getUnReadNum() > 0) {
|
|
|
- MsgBroadcast.broadcastMsgNumUpdate(ct, false, friend.getUnReadNum());
|
|
|
- friend.setUnReadNum(0);
|
|
|
- iMessageView.showModel(mFriendList);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
|
|
|
+ UUHelperDao.getInstance().updateRead(true);
|
|
|
+ } else {
|
|
|
+ if (friend.getUnReadNum() > 0) {
|
|
|
+ MsgBroadcast.broadcastMsgNumUpdate(ct, false, friend.getUnReadNum());
|
|
|
+ friend.setUnReadNum(0);
|
|
|
+ iMessageView.showModel(mFriendList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置未阅读该类型文件
|
|
|
+ *
|
|
|
+ * @param position
|
|
|
+ */
|
|
|
+ public void unReaderAllByType(int position) {
|
|
|
+ if (ListUtils.isEmpty(mFriendList) || mFriendList.size() < position) return;
|
|
|
+ Friend friend = mFriendList.get(position).getBean();
|
|
|
+ if (friend.getType() == XmppMessage.TYPE_ERP) {
|
|
|
+ MessageDao.getInstance().upStatusByType(friend.getDescription(), false);
|
|
|
+ } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
|
|
|
+ UUHelperDao.getInstance().updateRead(false);
|
|
|
+ } else {
|
|
|
+ if (friend.getUnReadNum() > 0) {
|
|
|
+ MsgBroadcast.broadcastMsgNumUpdate(ct, false, friend.getUnReadNum());
|
|
|
+ friend.setUnReadNum(0);
|
|
|
+ iMessageView.showModel(mFriendList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private void handlerEndOfReadOrDelete(String type, boolean isReaded) {
|
|
|
if (isReaded) {
|
|
|
@@ -912,47 +941,47 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 计算调转到那个界面
|
|
|
- *
|
|
|
- * @param mContext
|
|
|
- * @param position
|
|
|
- */
|
|
|
- public void turn2NextAct(Activity mContext, int position) throws Exception {
|
|
|
- Friend friend = mFriendList.get(position).getBean();
|
|
|
- if (friend == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (friend.getType() == XmppMessage.TYPE_ERP) {
|
|
|
- //消息
|
|
|
- turn2ERp(friend);
|
|
|
- return;
|
|
|
- } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
|
|
|
- ct.startActivity(new Intent(ct, UUHelperActivity.class));
|
|
|
- UUHelperDao.getInstance().updateRead(true);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (friend.getRoomFlag() == 0) {
|
|
|
- if (friend.getUserId().equals(Friend.ID_NEW_FRIEND_MESSAGE)) {// 新朋友消息
|
|
|
- mContext.startActivity(new Intent("com.modular.appcontact.NewFriendActivity"));
|
|
|
- } else {
|
|
|
- Intent intent = new Intent("com.modular.message.ChatActivity");
|
|
|
- intent.putExtra(AppConstant.FRIEND, friend);
|
|
|
- mContext.startActivity(intent);
|
|
|
- }
|
|
|
- } else {
|
|
|
- Intent intent = new Intent("com.modular.message.MucChatActivity");
|
|
|
- intent.putExtra(AppConstant.EXTRA_USER_ID, friend.getUserId());
|
|
|
- intent.putExtra(AppConstant.EXTRA_NICK_NAME, friend.getNickName());
|
|
|
- intent.putExtra(AppConstant.EXTRA_IS_GROUP_CHAT, true);
|
|
|
- mContext.startActivity(intent);
|
|
|
- }
|
|
|
- //将红点去除
|
|
|
- if (friend.getUnReadNum() > 0) {
|
|
|
- MsgBroadcast.broadcastMsgNumUpdate(mContext, false, friend.getUnReadNum());
|
|
|
- friend.setUnReadNum(0);
|
|
|
- }
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 计算调转到那个界面
|
|
|
+ *
|
|
|
+ * @param mContext
|
|
|
+ * @param position
|
|
|
+ */
|
|
|
+ public void turn2NextAct(Activity mContext, int position) throws Exception {
|
|
|
+ Friend friend = mFriendList.get(position).getBean();
|
|
|
+ if (friend == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (friend.getType() == XmppMessage.TYPE_ERP) {
|
|
|
+ //消息
|
|
|
+ turn2ERp(friend);
|
|
|
+ return;
|
|
|
+ } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
|
|
|
+ ct.startActivity(new Intent(ct, UUHelperActivity.class));
|
|
|
+ UUHelperDao.getInstance().updateRead(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (friend.getRoomFlag() == 0) {
|
|
|
+ if (friend.getUserId().equals(Friend.ID_NEW_FRIEND_MESSAGE)) {// 新朋友消息
|
|
|
+ mContext.startActivity(new Intent("com.modular.appcontact.NewFriendActivity"));
|
|
|
+ } else {
|
|
|
+ Intent intent = new Intent("com.modular.message.ChatActivity");
|
|
|
+ intent.putExtra(AppConstant.FRIEND, friend);
|
|
|
+ mContext.startActivity(intent);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Intent intent = new Intent("com.modular.message.MucChatActivity");
|
|
|
+ intent.putExtra(AppConstant.EXTRA_USER_ID, friend.getUserId());
|
|
|
+ intent.putExtra(AppConstant.EXTRA_NICK_NAME, friend.getNickName());
|
|
|
+ intent.putExtra(AppConstant.EXTRA_IS_GROUP_CHAT, true);
|
|
|
+ mContext.startActivity(intent);
|
|
|
+ }
|
|
|
+ //将红点去除
|
|
|
+ if (friend.getUnReadNum() > 0) {
|
|
|
+ MsgBroadcast.broadcastMsgNumUpdate(mContext, false, friend.getUnReadNum());
|
|
|
+ friend.setUnReadNum(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 调转到对应ERP相关知会里面去
|
|
|
@@ -1011,30 +1040,30 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void initHeaderModels() {
|
|
|
- List<MessageHeader> models = new ArrayList<>();
|
|
|
- MessageHeader model = null;
|
|
|
- String role = CommonUtil.getUserRole();
|
|
|
- LogUtil.i("role=" + role);
|
|
|
- if (role.equals("1")) {//个人用户
|
|
|
- models.addAll(getPersonalHeader());
|
|
|
- } else if (role.equals("3")) {//b2b用户
|
|
|
- models.addAll(getB2bHeader());
|
|
|
- } else {
|
|
|
- models.addAll(getErpHeader());
|
|
|
- }
|
|
|
- if (PreferenceUtils.getInt("UUSTEP", -1) == 1) {
|
|
|
- //显示UU运动
|
|
|
- model = new MessageHeader(StringUtil.getMessage(R.string.set_sport));
|
|
|
- model.setIcon(R.drawable.uu_run);
|
|
|
- model.setSubDoc("");
|
|
|
- model.setRedKey(Constants.MESSAGE_RUN);
|
|
|
- model.setType(3);
|
|
|
- model.setTag("");
|
|
|
- models.add(model);
|
|
|
- }
|
|
|
- iMessageView.updateHeader(models);
|
|
|
- }
|
|
|
+ private void initHeaderModels() {
|
|
|
+ List<MessageHeader> models = new ArrayList<>();
|
|
|
+ MessageHeader model = null;
|
|
|
+ String role = CommonUtil.getUserRole();
|
|
|
+ LogUtil.i("role=" + role);
|
|
|
+ if (role.equals("1")) {//个人用户
|
|
|
+ models.addAll(getPersonalHeader());
|
|
|
+ } else if (role.equals("3")) {//b2b用户
|
|
|
+ models.addAll(getB2bHeader());
|
|
|
+ } else {
|
|
|
+ models.addAll(getErpHeader());
|
|
|
+ }
|
|
|
+ if (PreferenceUtils.getInt("UUSTEP", -1) == 1) {
|
|
|
+ //显示UU运动
|
|
|
+ model = new MessageHeader(StringUtil.getMessage(R.string.set_sport));
|
|
|
+ model.setIcon(R.drawable.uu_run);
|
|
|
+ model.setSubDoc("");
|
|
|
+ model.setRedKey(Constants.MESSAGE_RUN);
|
|
|
+ model.setType(3);
|
|
|
+ model.setTag("");
|
|
|
+ models.add(model);
|
|
|
+ }
|
|
|
+ iMessageView.updateHeader(models);
|
|
|
+ }
|
|
|
|
|
|
private List<MessageHeader> getErpHeader() {
|
|
|
List<MessageHeader> models = new ArrayList<>();
|
|
|
@@ -1074,33 +1103,33 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
return models;
|
|
|
}
|
|
|
|
|
|
- private List<MessageHeader> getB2bHeader() {
|
|
|
- List<MessageHeader> models = new ArrayList<>();
|
|
|
- MessageHeader model = new MessageHeader(StringUtil.getMessage(R.string.msg_approval));
|
|
|
- model.setIcon(R.drawable.home_image_01_u);
|
|
|
- model.setSubDoc("");
|
|
|
- model.setRedKey("");
|
|
|
- model.setType(4);
|
|
|
- model.setTag("");
|
|
|
- models.add(model);
|
|
|
-
|
|
|
- model = new MessageHeader(StringUtil.getMessage(R.string.msg_work));
|
|
|
- model.setIcon(R.drawable.daibangongzuo);
|
|
|
- model.setSubDoc("");
|
|
|
- model.setRedKey("");
|
|
|
- model.setType(5);
|
|
|
- model.setTag("");
|
|
|
- models.add(model);
|
|
|
-
|
|
|
- model = new MessageHeader(StringUtil.getMessage(R.string.booking_menu));
|
|
|
- model.setIcon(R.drawable.icon_yuyue3);
|
|
|
- model.setSubDoc("");
|
|
|
- model.setRedKey(Constants.MESSAGE_YUYUE);
|
|
|
- model.setType(2);
|
|
|
- model.setTag("");
|
|
|
- models.add(model);
|
|
|
- return models;
|
|
|
- }
|
|
|
+ private List<MessageHeader> getB2bHeader() {
|
|
|
+ List<MessageHeader> models = new ArrayList<>();
|
|
|
+ MessageHeader model = new MessageHeader(StringUtil.getMessage(R.string.msg_approval));
|
|
|
+ model.setIcon(R.drawable.home_image_01_u);
|
|
|
+ model.setSubDoc("");
|
|
|
+ model.setRedKey("");
|
|
|
+ model.setType(4);
|
|
|
+ model.setTag("");
|
|
|
+ models.add(model);
|
|
|
+
|
|
|
+ model = new MessageHeader(StringUtil.getMessage(R.string.msg_work));
|
|
|
+ model.setIcon(R.drawable.daibangongzuo);
|
|
|
+ model.setSubDoc("");
|
|
|
+ model.setRedKey("");
|
|
|
+ model.setType(5);
|
|
|
+ model.setTag("");
|
|
|
+ models.add(model);
|
|
|
+
|
|
|
+ model = new MessageHeader(StringUtil.getMessage(R.string.booking_menu));
|
|
|
+ model.setIcon(R.drawable.icon_yuyue3);
|
|
|
+ model.setSubDoc("");
|
|
|
+ model.setRedKey(Constants.MESSAGE_YUYUE);
|
|
|
+ model.setType(2);
|
|
|
+ model.setTag("");
|
|
|
+ models.add(model);
|
|
|
+ return models;
|
|
|
+ }
|
|
|
|
|
|
private List<MessageHeader> getPersonalHeader() {
|
|
|
List<MessageHeader> models = new ArrayList<>();
|
|
|
@@ -1206,6 +1235,10 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
intent = new Intent(ct, RealTimeFormActivity.class);
|
|
|
ct.startActivity(intent);
|
|
|
break;
|
|
|
+ case BUSINESS_STATISTICS:
|
|
|
+ intent = new Intent(ct, BusinessTargetsActivity.class);
|
|
|
+ ct.startActivity(intent);
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|