|
|
@@ -58,13 +58,18 @@ import com.modular.appmessages.model.MessageNew;
|
|
|
import com.modular.appmessages.model.SubMessage;
|
|
|
import com.modular.appmessages.presenter.imp.IMessageView;
|
|
|
import com.modular.appmessages.util.ApprovalUtil;
|
|
|
+import com.modular.apputils.listener.OnSmartHttpListener;
|
|
|
+import com.modular.apputils.network.Parameter;
|
|
|
+import com.modular.apputils.network.Tags;
|
|
|
import com.modular.apputils.utils.SignUtils;
|
|
|
import com.modular.apputils.utils.SwitchUtil;
|
|
|
+import com.modular.apputils.utils.UUHttpHelper;
|
|
|
import com.modular.apputils.utils.VoiceUtils;
|
|
|
import com.modular.booking.activity.services.BServiceListActivity;
|
|
|
import com.modular.booking.model.SBMenuModel;
|
|
|
import com.uas.appworks.OA.platform.activity.BusinessTravelActivity;
|
|
|
import com.uas.appworks.OA.platform.activity.PurchaseDetailsActivity;
|
|
|
+import com.uas.appworks.activity.ScheduleActivity;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
@@ -88,6 +93,7 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
private final int LOAD_BOOKING = 0x17;//小秘书红点
|
|
|
private final int LOAD_REAL_TIME = 0x18;
|
|
|
private final int IS_COMPANY_ADMIN = 0x19;
|
|
|
+ private final int LOAD_SCHEDULE = 0x20;//获取日程数据
|
|
|
|
|
|
public static final int REAL_TIME_FORM = 7;
|
|
|
public static final int BUSINESS_STATISTICS = 8;
|
|
|
@@ -101,7 +107,7 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
private String subReadTime;//订阅号点击时间
|
|
|
|
|
|
private String filter;//搜索数据
|
|
|
- private int emnewsNum, subsNum, processNum, taskNum, bookingNum, uuHelperNum;//红点消息分类数量
|
|
|
+ private int emnewsNum, subsNum, processNum, taskNum, bookingNum, uuHelperNum, scheduleNum;//红点消息分类数量
|
|
|
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() {
|
|
|
@@ -155,6 +161,9 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
loadProcessToDo();//获取审批流接口
|
|
|
loadSubData();
|
|
|
loadNews(isB2b);//获取消息
|
|
|
+ if (!isB2b) {
|
|
|
+ loadSchedule();
|
|
|
+ }
|
|
|
} else if (role.equals("3")) {//B2b用户
|
|
|
isB2b = true;
|
|
|
loadB2bNewsCount();
|
|
|
@@ -251,9 +260,48 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
.setWhat(LOAD_EMNEWS)
|
|
|
.bulid();
|
|
|
OAHttpHelper.getInstance().requestHttp(request, this);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取日程
|
|
|
+ */
|
|
|
+ private void loadSchedule() {
|
|
|
+ if (mUUHttpHelper == null) {
|
|
|
+ mUUHttpHelper = new UUHttpHelper(CommonUtil.getSchedulerBaseUrl());
|
|
|
+ }
|
|
|
+ String sessionId= CommonUtil.getSharedPreferences(ct, "sessionId");
|
|
|
+ mUUHttpHelper.requestHttp(new Parameter.Builder()
|
|
|
+ .url("schedule/getSchedule")
|
|
|
+ .addParams("imid", MyApplication.getInstance().getLoginUserId())
|
|
|
+ .addParams("uasUrl", CommonUtil.getAppBaseUrl(ct))
|
|
|
+ .addParams("emcode", CommonUtil.getEmcode())
|
|
|
+ .addParams("master", CommonUtil.getMaster())
|
|
|
+ .addParams("sessionId",sessionId)
|
|
|
+ .addSuperHeaders("Cookie", "JSESSIONID=" + sessionId)
|
|
|
+ .record(LOAD_SCHEDULE), mOnSmartHttpListener);
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private UUHttpHelper mUUHttpHelper;
|
|
|
+ private OnSmartHttpListener mOnSmartHttpListener = new OnSmartHttpListener() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int what, String message, Tags tag) throws Exception {
|
|
|
+ JSONObject object = JSON.parseObject(message);
|
|
|
+ switch (what) {
|
|
|
+ case LOAD_SCHEDULE:
|
|
|
+ if (JSONUtil.getBoolean(object, "success")) {
|
|
|
+ int unRead = JSONUtil.getInt(object, "data");
|
|
|
+ showScheduleNum(unRead);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(int what, String message, Tags tag) throws Exception {
|
|
|
+
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
private void postReadNews(String ids) {
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
@@ -422,6 +470,10 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
} else if ("1".equals(result)) {
|
|
|
iMessageView.updateHeaderView(BUSINESS_STATISTICS, 1, "", "");
|
|
|
}
|
|
|
+ break;
|
|
|
+ case LOAD_SCHEDULE:
|
|
|
+ //TODO 获取日程数据
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -551,6 +603,12 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
iMessageView.updateHeaderView(6, num, num > 0 ? title : "", time);
|
|
|
}
|
|
|
|
|
|
+ private void showScheduleNum(int num) {
|
|
|
+ scheduleNum = num;
|
|
|
+ updateForUnReader();
|
|
|
+ iMessageView.updateHeaderView(21, num, num > 0 ? "你有新的日程" : "", "");
|
|
|
+ }
|
|
|
+
|
|
|
private void saveSubs2Db(JSONObject o) throws Exception {
|
|
|
JSONArray array = o.getJSONArray("data");
|
|
|
if (ListUtils.isEmpty(array)) return;
|
|
|
@@ -1035,7 +1093,7 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
|
|
|
/*跟新未读红点信息*/
|
|
|
private void updateForUnReader() {
|
|
|
- int num = subsNum + processNum + uuHelperNum + emnewsNum + taskNum + bookingNum;
|
|
|
+ int num = subsNum + processNum + uuHelperNum + emnewsNum + taskNum + bookingNum + scheduleNum;
|
|
|
if (this.unReaderListener != null) {
|
|
|
this.unReaderListener.setUnReader(num);
|
|
|
}
|
|
|
@@ -1128,6 +1186,16 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
models.addAll(getErpHeader());
|
|
|
}
|
|
|
|
|
|
+ if (1 == 1) {
|
|
|
+ MessageNew h = new MessageNew();
|
|
|
+ MessageHeader model = new MessageHeader(StringUtil.getMessage(R.string.my_scheduler));
|
|
|
+ model.setIcon(R.drawable.icon_menu_my_scheduler);
|
|
|
+ model.setSubDoc("");
|
|
|
+ model.setType(21);
|
|
|
+ model.setRedKey("my_scheduler");
|
|
|
+ h.setT(model);
|
|
|
+ models.add(h);
|
|
|
+ }
|
|
|
if (PreferenceUtils.getInt("UUSTEP", -1) == 1) {
|
|
|
//显示UU运动
|
|
|
MessageNew h = new MessageNew();
|
|
|
@@ -1364,6 +1432,10 @@ public class MessagePresenter implements OnHttpResultListener {
|
|
|
intent = new Intent(ct, PurchaseDetailsActivity.class).putExtra(Constants.FLAG.EXTRA_B2B_LIST_STATE, "待回复");
|
|
|
ct.startActivity(intent);
|
|
|
break;
|
|
|
+ case 21:
|
|
|
+ intent = new Intent(ct, ScheduleActivity.class);
|
|
|
+ ct.startActivity(intent);
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|