|
|
@@ -28,7 +28,6 @@ import android.widget.SimpleAdapter;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
-import com.afollestad.materialdialogs.MaterialDialog;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@@ -80,30 +79,30 @@ import rx.functions.Action1;
|
|
|
import static com.core.utils.HeightUtils.setListViewHeightBasedOnChildren1;
|
|
|
|
|
|
/**
|
|
|
- * @desc:商务预约详情
|
|
|
- * @author:Arison on 2017/9/11
|
|
|
- */
|
|
|
-public class BBookingDetailActivity extends OABaseActivity implements View.OnClickListener{
|
|
|
-
|
|
|
- private MyListView mListDetail;
|
|
|
- private RelativeLayout rvTop;
|
|
|
- private LinearLayout llLeft;
|
|
|
- private CircleImageView ivMe;
|
|
|
- private TextView tvMe;
|
|
|
- private ImageView ivResultInfo;
|
|
|
- private LinearLayout llRight;
|
|
|
- private CircleImageView ivTarget;
|
|
|
- private TextView tvTarget;
|
|
|
- private TextView tvTime;
|
|
|
- private TextView tvAddress;
|
|
|
- private TextView tvContent;
|
|
|
- private TextView tv_topic;
|
|
|
- private ImageView ivResult;
|
|
|
- private LinearLayout ll_bottom;
|
|
|
+ * @desc:商务预约详情
|
|
|
+ * @author:Arison on 2017/9/11
|
|
|
+ */
|
|
|
+public class BBookingDetailActivity extends OABaseActivity implements View.OnClickListener {
|
|
|
+
|
|
|
+ private MyListView mListDetail;
|
|
|
+ private RelativeLayout rvTop;
|
|
|
+ private LinearLayout llLeft;
|
|
|
+ private CircleImageView ivMe;
|
|
|
+ private TextView tvMe;
|
|
|
+ private ImageView ivResultInfo;
|
|
|
+ private LinearLayout llRight;
|
|
|
+ private CircleImageView ivTarget;
|
|
|
+ private TextView tvTarget;
|
|
|
+ private TextView tvTime;
|
|
|
+ private TextView tvAddress;
|
|
|
+ private TextView tvContent;
|
|
|
+ private TextView tv_topic;
|
|
|
+ private ImageView ivResult;
|
|
|
+ private LinearLayout ll_bottom;
|
|
|
|
|
|
private ItemListTypeAdapter mAdapter;
|
|
|
private BookingModel model;
|
|
|
- private boolean isMenuShuffle=false;
|
|
|
+ private boolean isMenuShuffle = false;
|
|
|
private Animation animation;
|
|
|
private boolean isShared;
|
|
|
private LinearLayout ll_refuse;
|
|
|
@@ -141,16 +140,16 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
initEvent();
|
|
|
initData();
|
|
|
}
|
|
|
+
|
|
|
Menu mMenu;
|
|
|
+
|
|
|
@Override
|
|
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
|
- mMenu=menu;
|
|
|
- Log.e("isMenuShuffle",isMenuShuffle + "");
|
|
|
- if(isMenuShuffle)
|
|
|
- {
|
|
|
+ mMenu = menu;
|
|
|
+ Log.e("isMenuShuffle", isMenuShuffle + "");
|
|
|
+ if (isMenuShuffle) {
|
|
|
menu.findItem(R.id.app_about).setVisible(true);
|
|
|
- }else
|
|
|
- {
|
|
|
+ } else {
|
|
|
menu.findItem(R.id.app_about).setVisible(false);
|
|
|
}
|
|
|
return super.onPrepareOptionsMenu(menu);
|
|
|
@@ -180,17 +179,17 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
- public void initView(){
|
|
|
+
|
|
|
+ public void initView() {
|
|
|
setTitle("商务预约");
|
|
|
- sv_top =(CustomerScrollView)findViewById(R.id.sv_top);
|
|
|
- mListDetail=(MyListView) findViewById(R.id.mListDetail);
|
|
|
+ sv_top = (CustomerScrollView) findViewById(R.id.sv_top);
|
|
|
+ mListDetail = (MyListView) findViewById(R.id.mListDetail);
|
|
|
rvTop = (RelativeLayout) findViewById(R.id.rv_top);
|
|
|
llLeft = (LinearLayout) findViewById(R.id.ll_left);
|
|
|
ivMe = (CircleImageView) findViewById(R.id.iv_me);
|
|
|
ll_refuse = (LinearLayout) findViewById(R.id.ll_refuse);
|
|
|
tvMe = (TextView) findViewById(R.id.tv_me);
|
|
|
- tv_sender=(TextView) findViewById(R.id.tv_sender);
|
|
|
+ tv_sender = (TextView) findViewById(R.id.tv_sender);
|
|
|
ivResultInfo = (ImageView) findViewById(R.id.iv_resultInfo);
|
|
|
llRight = (LinearLayout) findViewById(R.id.ll_right);
|
|
|
ivTarget = (CircleImageView) findViewById(R.id.iv_target);
|
|
|
@@ -198,21 +197,21 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
tvTime = (TextView) findViewById(R.id.tv_time);
|
|
|
tvAddress = (TextView) findViewById(R.id.tv_address);
|
|
|
tvContent = (TextView) findViewById(R.id.tv_content);
|
|
|
- tv_topic= (TextView) findViewById(R.id.tv_topic);
|
|
|
- tv_title=(TextView)findViewById(R.id.tv_title);
|
|
|
+ tv_topic = (TextView) findViewById(R.id.tv_topic);
|
|
|
+ tv_title = (TextView) findViewById(R.id.tv_title);
|
|
|
ivResult = (ImageView) findViewById(R.id.iv_result);
|
|
|
- ll_bottom= (LinearLayout) findViewById(R.id.ll_bottom);
|
|
|
-
|
|
|
- animation= AnimationUtils.loadAnimation(this, R.anim.anim_translate_bookingprogress);
|
|
|
- if (getIntent()!=null&&getIntent().getExtras()!=null){
|
|
|
- isShared=getIntent().getExtras().getBoolean("isShared");
|
|
|
- model=getIntent().getExtras().getParcelable("model");
|
|
|
- if ("个人".equals(model.getKind())){
|
|
|
+ ll_bottom = (LinearLayout) findViewById(R.id.ll_bottom);
|
|
|
+
|
|
|
+ animation = AnimationUtils.loadAnimation(this, R.anim.anim_translate_bookingprogress);
|
|
|
+ if (getIntent() != null && getIntent().getExtras() != null) {
|
|
|
+ isShared = getIntent().getExtras().getBoolean("isShared");
|
|
|
+ model = getIntent().getExtras().getParcelable("model");
|
|
|
+ if ("个人".equals(model.getKind())) {
|
|
|
updateUi(isShared);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
getApiData();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -220,13 +219,13 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
private void updateUi(boolean isShared) {
|
|
|
ll_bottom.setVisibility(View.VISIBLE);
|
|
|
sv_top.setVisibility(View.VISIBLE);
|
|
|
- tvTime.setText(model.getAb_starttime().substring(0,10)+" "+model.getAb_starttime().substring(11,16)+"-"+
|
|
|
- model.getAb_endtime().substring(11,16));
|
|
|
+ tvTime.setText(model.getAb_starttime().substring(0, 10) + " " + model.getAb_starttime().substring(11, 16) + "-" +
|
|
|
+ model.getAb_endtime().substring(11, 16));
|
|
|
tvAddress.setText(model.getAb_address());
|
|
|
- if (!StringUtil.isEmpty(model.getAd_reason())){
|
|
|
+ if (!StringUtil.isEmpty(model.getAd_reason())) {
|
|
|
ll_refuse.setVisibility(View.VISIBLE);
|
|
|
tvContent.setText(model.getAd_reason());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
ll_refuse.setVisibility(View.GONE);
|
|
|
}
|
|
|
tv_topic.setText(model.getAb_type());
|
|
|
@@ -235,134 +234,136 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
ivResultInfo.clearAnimation();
|
|
|
ll_bottom.setVisibility(View.GONE);
|
|
|
tv_sender.setText(model.getAb_recordman());
|
|
|
- if ("已拒绝".equals(model.getAb_confirmstatus())){
|
|
|
- ivResult.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_jujue1));
|
|
|
- ivResultInfo.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_jujue));
|
|
|
+ if ("已拒绝".equals(model.getAb_confirmstatus())) {
|
|
|
+ ivResult.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_jujue1));
|
|
|
+ ivResultInfo.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_jujue));
|
|
|
}
|
|
|
- if("未确认".equals(model.getAb_confirmstatus())||"待确认".equals(model.getAb_confirmstatus())){
|
|
|
- ivResult.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_weiqueren));
|
|
|
- ivResultInfo.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_send));
|
|
|
+ if ("未确认".equals(model.getAb_confirmstatus()) || "待确认".equals(model.getAb_confirmstatus())) {
|
|
|
+ ivResult.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_weiqueren));
|
|
|
+ ivResultInfo.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_send));
|
|
|
//开启动画
|
|
|
ll_bottom.setVisibility(View.VISIBLE);
|
|
|
ivResultInfo.startAnimation(animation);
|
|
|
- if( MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_recordid())){
|
|
|
+ if (MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_recordid())) {
|
|
|
//发起人
|
|
|
- ((Button)findViewById(R.id.bt_change)).setText("变更");
|
|
|
- ((Button)findViewById(R.id.bt_change)).setTextColor(getResources().getColor(R.color.white));
|
|
|
- ((Button)findViewById(R.id.bt_cancle)).setText("取消");
|
|
|
- }else{
|
|
|
+ ((Button) findViewById(R.id.bt_change)).setText("变更");
|
|
|
+ ((Button) findViewById(R.id.bt_change)).setTextColor(getResources().getColor(R.color.white));
|
|
|
+ ((Button) findViewById(R.id.bt_cancle)).setText("取消");
|
|
|
+ } else {
|
|
|
//被预约人
|
|
|
- ((Button)findViewById(R.id.bt_change)).setText("确认");
|
|
|
- ((Button)findViewById(R.id.bt_cancle)).setText("拒绝");
|
|
|
+ ((Button) findViewById(R.id.bt_change)).setText("确认");
|
|
|
+ ((Button) findViewById(R.id.bt_cancle)).setText("拒绝");
|
|
|
}
|
|
|
}
|
|
|
- if("已确认".equals(model.getAb_confirmstatus())){
|
|
|
- ivResult.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_yiqueren));
|
|
|
- ivResultInfo.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_queren1));
|
|
|
- isMenuShuffle=true;
|
|
|
- if (model.getAb_sharestatus().equals("已共享")){
|
|
|
- isMenuShuffle=true;
|
|
|
+ if ("已确认".equals(model.getAb_confirmstatus())) {
|
|
|
+ ivResult.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_yiqueren));
|
|
|
+ ivResultInfo.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_queren1));
|
|
|
+ isMenuShuffle = true;
|
|
|
+ if (model.getAb_sharestatus().equals("已共享")) {
|
|
|
+ isMenuShuffle = true;
|
|
|
}
|
|
|
- if( MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_recordid())){
|
|
|
- ((Button)findViewById(R.id.bt_change)).setText("变更");
|
|
|
- ((Button)findViewById(R.id.bt_cancle)).setText("取消");
|
|
|
+ if (MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_recordid())) {
|
|
|
+ ((Button) findViewById(R.id.bt_change)).setText("变更");
|
|
|
+ ((Button) findViewById(R.id.bt_cancle)).setText("取消");
|
|
|
ll_bottom.setVisibility(View.VISIBLE);
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// ll_bottom.setVisibility(View.VISIBLE);
|
|
|
- ((Button)findViewById(R.id.bt_change)).setText("变更");
|
|
|
- ((Button)findViewById(R.id.bt_cancle)).setText("取消");
|
|
|
- ((Button)findViewById(R.id.bt_change)).setVisibility(View.GONE);
|
|
|
+ ((Button) findViewById(R.id.bt_change)).setText("变更");
|
|
|
+ ((Button) findViewById(R.id.bt_cancle)).setText("取消");
|
|
|
+ ((Button) findViewById(R.id.bt_change)).setVisibility(View.GONE);
|
|
|
ll_bottom.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
}
|
|
|
- if("已取消".equals(model.getAb_confirmstatus())){
|
|
|
- ivResult.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_quxiao3));
|
|
|
- ivResultInfo.setImageDrawable(mContext. getResources().getDrawable(R.drawable.icon_cancle3));
|
|
|
+ if ("已取消".equals(model.getAb_confirmstatus())) {
|
|
|
+ ivResult.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_quxiao3));
|
|
|
+ ivResultInfo.setImageDrawable(mContext.getResources().getDrawable(R.drawable.icon_cancle3));
|
|
|
|
|
|
}
|
|
|
//共享状态
|
|
|
- if (isShared){
|
|
|
+ if (isShared) {
|
|
|
tvTarget.setText(model.getAb_bman());
|
|
|
tvMe.setText(model.getAb_recordman());
|
|
|
ll_bottom.setVisibility(View.GONE);
|
|
|
- }else{
|
|
|
- if ( MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_recordid())){
|
|
|
+ } else {
|
|
|
+ if (MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_recordid())) {
|
|
|
//我是发起人
|
|
|
tvMe.setText(getString(R.string.me));
|
|
|
tvTarget.setText(model.getAb_bman());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//被约
|
|
|
tvTarget.setText(getString(R.string.me));
|
|
|
tvMe.setText(model.getAb_recordman());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(model.getAb_starttime().compareTo(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS))<0){
|
|
|
+ if (model.getAb_starttime().compareTo(DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS)) < 0) {
|
|
|
ll_bottom.setVisibility(View.GONE);
|
|
|
- isMenuShuffle=false;
|
|
|
+ isMenuShuffle = false;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- public void initEvent(){
|
|
|
+ public void initEvent() {
|
|
|
findViewById(R.id.bt_change).setOnClickListener(this);
|
|
|
findViewById(R.id.bt_cancle).setOnClickListener(this);
|
|
|
}
|
|
|
-
|
|
|
- public void initData(){
|
|
|
-
|
|
|
- mAdapter=new ItemListTypeAdapter(mContext);
|
|
|
+
|
|
|
+ public void initData() {
|
|
|
+
|
|
|
+ mAdapter = new ItemListTypeAdapter(mContext);
|
|
|
mListDetail.setAdapter(mAdapter);
|
|
|
}
|
|
|
+
|
|
|
private String companys;
|
|
|
- private String bmanid;
|
|
|
- public void getApiData(){
|
|
|
+ private String bmanid;
|
|
|
+
|
|
|
+ public void getApiData() {
|
|
|
showLoading();
|
|
|
- HttpClient httpClient=new HttpClient.Builder(Constants.IM_BASE_URL()).build();
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).build();
|
|
|
httpClient.Api()
|
|
|
.send(new HttpClient.Builder().url("user/appBusinessDetail")
|
|
|
.add("id", model.getAb_id())
|
|
|
- .add("userid",MyApplication.getInstance().mLoginUser.getUserId())
|
|
|
+ .add("userid", MyApplication.getInstance().mLoginUser.getUserId())
|
|
|
.add("token", MyApplication.getInstance().mAccessToken)
|
|
|
.build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public void onResponse(Object o) {
|
|
|
dimssLoading();
|
|
|
- LogUtil.d("ResponseText"," onResponse o:"+o.toString());
|
|
|
+ LogUtil.d("ResponseText", " onResponse o:" + o.toString());
|
|
|
//mapdetail
|
|
|
- if (JSONUtil.validate(o.toString())){
|
|
|
- String detail= JSON.parseObject(o.toString()).getString("mapdetail");
|
|
|
- String baseInfo=JSON.parseObject(o.toString()).getString("map");
|
|
|
- JSONArray baseArray=JSON.parseArray(baseInfo);
|
|
|
- JSONObject baseObject=baseArray.getJSONObject(0);
|
|
|
-
|
|
|
- model= JSON.parseObject(baseObject.toJSONString(),BookingModel.class);
|
|
|
-
|
|
|
+ if (JSONUtil.validate(o.toString())) {
|
|
|
+ String detail = JSON.parseObject(o.toString()).getString("mapdetail");
|
|
|
+ String baseInfo = JSON.parseObject(o.toString()).getString("map");
|
|
|
+ JSONArray baseArray = JSON.parseArray(baseInfo);
|
|
|
+ JSONObject baseObject = baseArray.getJSONObject(0);
|
|
|
+
|
|
|
+ model = JSON.parseObject(baseObject.toJSONString(), BookingModel.class);
|
|
|
+
|
|
|
// tvTime.setText(model.getAb_starttime().substring(0,10)+" "+model.getAb_starttime().substring(11,16)
|
|
|
// +"-"+model.getAb_endtime().substring(11,16));
|
|
|
// tv_topic.setText(model.getAb_content());
|
|
|
// tvAddress.setText(model.getAb_address());
|
|
|
// rvTop.setVisibility(View.GONE);
|
|
|
updateUi(isShared);
|
|
|
- JSONArray array=JSON.parseArray(detail);
|
|
|
- if (!ListUtils.isEmpty(array)){
|
|
|
- List<JSONObject> datas=new ArrayList<>();
|
|
|
- StringBuilder companysBuilder=new StringBuilder("");
|
|
|
- StringBuilder bmanidBuilder=new StringBuilder("");
|
|
|
-
|
|
|
- for (int i=0;i<array.size();i++) {
|
|
|
+ JSONArray array = JSON.parseArray(detail);
|
|
|
+ if (!ListUtils.isEmpty(array)) {
|
|
|
+ List<JSONObject> datas = new ArrayList<>();
|
|
|
+ StringBuilder companysBuilder = new StringBuilder("");
|
|
|
+ StringBuilder bmanidBuilder = new StringBuilder("");
|
|
|
+
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
- companysBuilder.append(object.getString("ad_bcompany")+",");
|
|
|
- bmanidBuilder.append(object.getString("ad_bmanid")+",");
|
|
|
+ companysBuilder.append(object.getString("ad_bcompany") + ",");
|
|
|
+ bmanidBuilder.append(object.getString("ad_bmanid") + ",");
|
|
|
datas.add(object);
|
|
|
}
|
|
|
- companys=companysBuilder.toString();
|
|
|
- bmanid= bmanidBuilder.toString();
|
|
|
+ companys = companysBuilder.toString();
|
|
|
+ bmanid = bmanidBuilder.toString();
|
|
|
mAdapter.setObjects(datas);
|
|
|
mAdapter.notifyDataSetChanged();
|
|
|
- if(mAdapter.getCount()==0){
|
|
|
+ if (mAdapter.getCount() == 0) {
|
|
|
//个人预约界面保持一致
|
|
|
tv_title.setVisibility(View.GONE);
|
|
|
mListDetail.setVisibility(View.GONE);
|
|
|
@@ -371,7 +372,7 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
tvTarget.setText(model.getAb_bman());
|
|
|
AvatarHelper.getInstance().display(model.getAb_bmanid(), ivTarget, true, true);
|
|
|
AvatarHelper.getInstance().display(model.getAb_recordid(), ivMe, true, true);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
tv_title.setVisibility(View.VISIBLE);
|
|
|
rvTop.setVisibility(View.GONE);
|
|
|
mListDetail.setVisibility(View.VISIBLE);
|
|
|
@@ -395,26 +396,26 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
|
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
- if (data==null)return;
|
|
|
- switch (requestCode){
|
|
|
+ if (data == null) return;
|
|
|
+ switch (requestCode) {
|
|
|
case 0x02:
|
|
|
try {
|
|
|
List<SelectEmUser> employeesList = data.getParcelableArrayListExtra("data");
|
|
|
- LogUtil.d("Test",JSON.toJSONString(employeesList));
|
|
|
- StringBuilder stringBuilder=new StringBuilder("");
|
|
|
- for(int i=0;i<employeesList.size();i++){
|
|
|
- if (i==employeesList.size()-1){
|
|
|
+ LogUtil.d("Test", JSON.toJSONString(employeesList));
|
|
|
+ StringBuilder stringBuilder = new StringBuilder("");
|
|
|
+ for (int i = 0; i < employeesList.size(); i++) {
|
|
|
+ if (i == employeesList.size() - 1) {
|
|
|
stringBuilder.append(employeesList.get(i).getImId());
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
stringBuilder.append(employeesList.get(i).getImId());
|
|
|
stringBuilder.append(",");
|
|
|
}
|
|
|
}
|
|
|
- LogUtil.d("Test",stringBuilder.toString());
|
|
|
- LogUtil.d("Test",model.getAb_id());
|
|
|
- if (!StringUtil.isEmpty(stringBuilder.toString())&&!StringUtil.isEmpty(model.getAb_id())){
|
|
|
- shareBooking(model.getAb_id(),stringBuilder.toString());
|
|
|
- }else {
|
|
|
+ LogUtil.d("Test", stringBuilder.toString());
|
|
|
+ LogUtil.d("Test", model.getAb_id());
|
|
|
+ if (!StringUtil.isEmpty(stringBuilder.toString()) && !StringUtil.isEmpty(model.getAb_id())) {
|
|
|
+ shareBooking(model.getAb_id(), stringBuilder.toString());
|
|
|
+ } else {
|
|
|
ToastMessage("共享失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
@@ -424,165 +425,157 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void shareBooking(String id,String imids){
|
|
|
+ public void shareBooking(String id, String imids) {
|
|
|
showLoading();
|
|
|
//map包括planids 个人计划id,bplanids商务计划id,userids共享人员imid,多个id用逗号连接
|
|
|
- String map="{\"planids\":\"" +"" + "\",\"bplanids\":\""+id+"\",\"userids\":\""+imids+"\"}";
|
|
|
- LogUtil.d("HttpLogs","map:"+map);
|
|
|
- HttpClient httpClient=new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build();
|
|
|
+ String map = "{\"planids\":\"" + "" + "\",\"bplanids\":\"" + id + "\",\"userids\":\"" + imids + "\"}";
|
|
|
+ LogUtil.d("HttpLogs", "map:" + map);
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build();
|
|
|
httpClient.Api().send(new HttpClient.Builder()
|
|
|
- .url("/user/appBatchShare")
|
|
|
- .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
- .add("map", map)
|
|
|
- .method(Method.POST)
|
|
|
- .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ .url("/user/appBatchShare")
|
|
|
+ .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
+ .add("map", map)
|
|
|
+ .method(Method.POST)
|
|
|
+ .build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
@Override
|
|
|
public void onResponse(Object o) {
|
|
|
- dimssLoading();
|
|
|
- if (JSONUtil.validate(o.toString())){
|
|
|
- String result=JSON.parseObject(o.toString()).getString("result");
|
|
|
- if ("success".equals(result)){
|
|
|
+ dimssLoading();
|
|
|
+ if (JSONUtil.validate(o.toString())) {
|
|
|
+ String result = JSON.parseObject(o.toString()).getString("result");
|
|
|
+ if ("success".equals(result)) {
|
|
|
ToastMessage("分享成功!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}));
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//发送IM消息
|
|
|
- public void sendMuiltMsg(String content){
|
|
|
- if (!StringUtil.isEmpty(bmanid)){
|
|
|
- String [] barray=bmanid.split(",");
|
|
|
- for (int i=0;i<barray.length;i++){
|
|
|
+ public void sendMuiltMsg(String content) {
|
|
|
+ if (!StringUtil.isEmpty(bmanid)) {
|
|
|
+ String[] barray = bmanid.split(",");
|
|
|
+ for (int i = 0; i < barray.length; i++) {
|
|
|
//barray[i]=100263,Ab_recordid:109079,Ab_recordman:陈爱平
|
|
|
- LogUtil.d("XmppApp","barray[i]="+barray[i]+",Ab_recordid:"+model.getAb_recordid()+",Ab_recordman:"
|
|
|
- +model.getAb_recordman());
|
|
|
+ LogUtil.d("XmppApp", "barray[i]=" + barray[i] + ",Ab_recordid:" + model.getAb_recordid() + ",Ab_recordman:"
|
|
|
+ + model.getAb_recordman());
|
|
|
// sendMessage(model.getAb_recordid(),model.getAb_recordman(),barray[i],content);
|
|
|
- if(MyApplication.getInstance().getLoginUserId().equals(model.getAb_recordid())){
|
|
|
+ if (MyApplication.getInstance().getLoginUserId().equals(model.getAb_recordid())) {
|
|
|
sendMessage(MyApplication.getInstance().mLoginUser.getUserId(),
|
|
|
- MyApplication.getInstance().mLoginUser.getNickName(),barray[i],content);
|
|
|
- }else{
|
|
|
+ MyApplication.getInstance().mLoginUser.getNickName(), barray[i], content);
|
|
|
+ } else {
|
|
|
sendMessage(MyApplication.getInstance().mLoginUser.getUserId(),
|
|
|
- MyApplication.getInstance().mLoginUser.getNickName(),model.getAb_recordid(),content);
|
|
|
+ MyApplication.getInstance().mLoginUser.getNickName(), model.getAb_recordid(), content);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void updateBookingState(Button button){
|
|
|
+ public void updateBookingState(Button button) {
|
|
|
// 发起人 可以变更和取消
|
|
|
//被预约人 不能变更和取消
|
|
|
- String map="{\"ab_confirmstatus\":\"已确认\",\"ab_bmanid\":\""+model.getAb_bmanid()+"\"}";
|
|
|
- String time=model.getAb_starttime().substring(0,16)+"-"+model.getAb_endtime().substring(11,16);
|
|
|
- if (button.getText().equals("变更")){
|
|
|
- String content=model.getAb_recordman()+"变更了您"+time+"的预约计划";
|
|
|
+ String map = "{\"ab_confirmstatus\":\"已确认\",\"ab_bmanid\":\"" + model.getAb_bmanid() + "\"}";
|
|
|
+ String time = model.getAb_starttime().substring(0, 16) + "-" + model.getAb_endtime().substring(11, 16);
|
|
|
+ if (button.getText().equals("变更")) {
|
|
|
+ String content = model.getAb_recordman() + "变更了您" + time + "的预约计划";
|
|
|
sendMuiltMsg(content);
|
|
|
- Bundle bundle=new Bundle();
|
|
|
- bundle.putParcelable("model",model);
|
|
|
- if (!StringUtil.isEmpty(companys)){
|
|
|
- bundle.putString("companys",companys.substring(0,companys.length()-1));
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putParcelable("model", model);
|
|
|
+ if (!StringUtil.isEmpty(companys)) {
|
|
|
+ bundle.putString("companys", companys.substring(0, companys.length() - 1));
|
|
|
}
|
|
|
- if (!StringUtil.isEmpty(bmanid)){
|
|
|
- bundle.putString("bmanid",bmanid.substring(0,bmanid.length()-1));
|
|
|
+ if (!StringUtil.isEmpty(bmanid)) {
|
|
|
+ bundle.putString("bmanid", bmanid.substring(0, bmanid.length() - 1));
|
|
|
}
|
|
|
- startActivity(new Intent(mContext,BBookingAddActivity.class)
|
|
|
+ startActivity(new Intent(mContext, BBookingAddActivity.class)
|
|
|
.putExtras(bundle));
|
|
|
return;
|
|
|
}
|
|
|
showLoading();
|
|
|
- if (button.getText().equals("确认")){
|
|
|
- String content=model.getAb_bman()+"确认了您"+time+"的预约计划";
|
|
|
- // sendMessage(model.getAb_bmanid(),model.getAb_bman(),model.getAb_recordid(),content);
|
|
|
- String action="已确认";
|
|
|
- map="{\"ad_confirmstatus\":\""+action+"\",\"ad_bmanid\":\""+MyApplication.getInstance().getLoginUserId()+"\",\"ad_sharestatus\":\"" +"未共享"+ "\"}";
|
|
|
+ if (button.getText().equals("确认")) {
|
|
|
+ String content = model.getAb_bman() + "确认了您" + time + "的预约计划";
|
|
|
+ // sendMessage(model.getAb_bmanid(),model.getAb_bman(),model.getAb_recordid(),content);
|
|
|
+ String action = "已确认";
|
|
|
+ map = "{\"ad_confirmstatus\":\"" + action + "\",\"ad_bmanid\":\"" + MyApplication.getInstance().getLoginUserId() + "\",\"ad_sharestatus\":\"" + "未共享" + "\"}";
|
|
|
sendMuiltMsg(content);
|
|
|
}
|
|
|
- if (button.getText().equals("拒绝")){
|
|
|
- String content=model.getAb_bman()+"拒绝了您"+time+"的预约计划";
|
|
|
+ if (button.getText().equals("拒绝")) {
|
|
|
+ String content = model.getAb_bman() + "拒绝了您" + time + "的预约计划";
|
|
|
sendMuiltMsg(content);
|
|
|
- // sendMessage(model.getAb_bmanid(),model.getAb_bman(),model.getAb_recordid(),content);
|
|
|
+ // sendMessage(model.getAb_bmanid(),model.getAb_bman(),model.getAb_recordid(),content);
|
|
|
showPopupWindow(button);
|
|
|
return;
|
|
|
}
|
|
|
- if (button.getText().equals("取消")){
|
|
|
- if (MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_bmanid())){
|
|
|
- // String content=model.getAb_bman()+"取消了您"+time+"的预约计划";
|
|
|
+ if (button.getText().equals("取消")) {
|
|
|
+ if (MyApplication.getInstance().mLoginUser.getUserId().equals(model.getAb_bmanid())) {
|
|
|
+ // String content=model.getAb_bman()+"取消了您"+time+"的预约计划";
|
|
|
ToastMessage("您不能进行取消操作!");
|
|
|
return;
|
|
|
- // sendMessage(model.getAb_bmanid(),model.getAb_bman(),model.getAb_recordid(),content);
|
|
|
- }else{
|
|
|
- String content=model.getAb_recordman()+"取消了您"+time+"的预约计划";
|
|
|
+ // sendMessage(model.getAb_bmanid(),model.getAb_bman(),model.getAb_recordid(),content);
|
|
|
+ } else {
|
|
|
+ String content = model.getAb_recordman() + "取消了您" + time + "的预约计划";
|
|
|
sendMuiltMsg(content);
|
|
|
- // sendMessage(model.getAb_recordid(),model.getAb_recordman(),model.getAb_bmanid(),content);
|
|
|
+ // sendMessage(model.getAb_recordid(),model.getAb_recordman(),model.getAb_bmanid(),content);
|
|
|
}
|
|
|
// String action="已取消";
|
|
|
// map="{\"ad_confirmstatus\":\""+action+"\",\"ad_bmanid\":\""+MyApplication.getInstance().getLoginUserId()+"\",\"ad_sharestatus\":\"" +"未共享"+ "\"}";
|
|
|
- new MaterialDialog.Builder(ct)
|
|
|
- .title(MyApplication.getInstance().getString(R.string.app_dialog_title))
|
|
|
- .content("您确定要取消预约计划?")
|
|
|
- .positiveText(MyApplication.getInstance().getString(R.string.app_dialog_ok))
|
|
|
- .negativeText(MyApplication.getInstance().getString(R.string.app_dialog_close))
|
|
|
- .autoDismiss(false)
|
|
|
- .callback(new MaterialDialog.ButtonCallback() {
|
|
|
- @Override
|
|
|
- public void onPositive(MaterialDialog dialog) {
|
|
|
- dialog.dismiss();
|
|
|
- String action="已取消";
|
|
|
- String map="{\"ad_confirmstatus\":\""+action+"\",\"ad_bmanid\":\""+MyApplication.getInstance().getLoginUserId()+"\",\"ad_sharestatus\":\"" +"未共享"+ "\"}";
|
|
|
- actionOrder(model.getAb_id(),map);
|
|
|
- }
|
|
|
|
|
|
+ PopupWindowHelper.showAlart(this,
|
|
|
+ getString(R.string.app_dialog_title), "您确定要取消预约计划?"
|
|
|
+ , new PopupWindowHelper.OnSelectListener() {
|
|
|
@Override
|
|
|
- public void onNegative(MaterialDialog dialog) {
|
|
|
- dialog.dismiss();
|
|
|
- dimssLoading();
|
|
|
+ public void select(boolean selectOk) {
|
|
|
+ if (selectOk) {
|
|
|
+ String action = "已取消";
|
|
|
+ String map = "{\"ad_confirmstatus\":\"" + action + "\",\"ad_bmanid\":\"" + MyApplication.getInstance().getLoginUserId() + "\",\"ad_sharestatus\":\"" + "未共享" + "\"}";
|
|
|
+ actionOrder(model.getAb_id(), map);
|
|
|
+ } else {
|
|
|
+ dimssLoading();
|
|
|
+ }
|
|
|
}
|
|
|
- }).show();
|
|
|
-
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
- actionOrder(model.getAb_id(),map);
|
|
|
+ actionOrder(model.getAb_id(), map);
|
|
|
}
|
|
|
-
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//确认和取消,拒绝
|
|
|
- public void actionOrder(String id, String map){
|
|
|
- LogUtil.d("HttpLogs","id:"+id);
|
|
|
- LogUtil.d("HttpLogs","map:"+map);
|
|
|
- HttpClient httpClient=new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build();
|
|
|
+ public void actionOrder(String id, String map) {
|
|
|
+ LogUtil.d("HttpLogs", "id:" + id);
|
|
|
+ LogUtil.d("HttpLogs", "map:" + map);
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build();
|
|
|
httpClient.Api().send(new HttpClient.Builder()
|
|
|
.url("/user/appDoBusiness")
|
|
|
- .header("Content-Type","application/x-www-form-urlencoded;charset=UTF-8")
|
|
|
+ .header("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
|
|
|
.add("token", MyApplication.getInstance().mAccessToken)
|
|
|
.add("map", map)
|
|
|
- .add("id",id)
|
|
|
+ .add("id", id)
|
|
|
.method(Method.POST)
|
|
|
- .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ .build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
@Override
|
|
|
public void onResponse(Object o) {
|
|
|
dimssLoading();
|
|
|
- if (JSONUtil.validate(o.toString())){
|
|
|
- String result=JSON.parseObject(o.toString()).getString("result");
|
|
|
- if ("true".equals(result)){
|
|
|
+ if (JSONUtil.validate(o.toString())) {
|
|
|
+ String result = JSON.parseObject(o.toString()).getString("result");
|
|
|
+ if ("true".equals(result)) {
|
|
|
ToastMessage("操作成功!");
|
|
|
Observable.timer(2, TimeUnit.SECONDS).subscribe(new Action1<Long>() {
|
|
|
@Override
|
|
|
public void call(Long aLong) {
|
|
|
- startActivity(new Intent("com.modular.booking.BookingListActivity")
|
|
|
- .putExtra("curDate",model.getAb_starttime()));
|
|
|
- finish();
|
|
|
+ startActivity(new Intent("com.modular.booking.BookingListActivity")
|
|
|
+ .putExtra("curDate", model.getAb_starttime()));
|
|
|
+ finish();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
ToastMessage("接口异常");
|
|
|
}
|
|
|
}
|
|
|
}));
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -606,20 +599,20 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
position = position + 1;
|
|
|
- String map="";
|
|
|
- String action="已拒绝";
|
|
|
+ String map = "";
|
|
|
+ String action = "已拒绝";
|
|
|
switch (position) {
|
|
|
case 1:
|
|
|
break;
|
|
|
case 2:
|
|
|
- map="{\"ad_confirmstatus\":\""+action+"\",\"ad_reason\":\"工作繁忙\",\"ad_bmanid\":\""+MyApplication.getInstance().getLoginUserId()+"\",\"ad_sharestatus\":\"" +"未共享"+ "\"}";
|
|
|
+ map = "{\"ad_confirmstatus\":\"" + action + "\",\"ad_reason\":\"工作繁忙\",\"ad_bmanid\":\"" + MyApplication.getInstance().getLoginUserId() + "\",\"ad_sharestatus\":\"" + "未共享" + "\"}";
|
|
|
//ab_reason 工作繁忙
|
|
|
- actionOrder(model.getAb_id(),map);
|
|
|
+ actionOrder(model.getAb_id(), map);
|
|
|
break;
|
|
|
case 3:
|
|
|
//ab_reason 没有必要
|
|
|
- map="{\"ad_confirmstatus\":\""+action+"\",\"ad_reason\":\"沒有必要\",\"ad_bmanid\":\""+MyApplication.getInstance().getLoginUserId()+"\",\"ad_sharestatus\":\"" +"未共享"+ "\"}";
|
|
|
- actionOrder(model.getAb_id(),map);
|
|
|
+ map = "{\"ad_confirmstatus\":\"" + action + "\",\"ad_reason\":\"沒有必要\",\"ad_bmanid\":\"" + MyApplication.getInstance().getLoginUserId() + "\",\"ad_sharestatus\":\"" + "未共享" + "\"}";
|
|
|
+ actionOrder(model.getAb_id(), map);
|
|
|
break;
|
|
|
case 4:
|
|
|
//ab_reason 其它
|
|
|
@@ -627,8 +620,8 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
showEditerDialog(model.getAb_id());
|
|
|
break;
|
|
|
}
|
|
|
- popupWindow.dismiss();
|
|
|
-
|
|
|
+ popupWindow.dismiss();
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -663,8 +656,7 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- private void showEditerDialog(final String id ) {
|
|
|
+ private void showEditerDialog(final String id) {
|
|
|
final PopupWindow window = new PopupWindow(ct);
|
|
|
View view = LayoutInflater.from(ct).inflate(R.layout.item_select_remark_pop, null);
|
|
|
window.setContentView(view);
|
|
|
@@ -680,8 +672,8 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
if (StringUtil.isEmpty(message))
|
|
|
ToastUtil.showToast(ct, R.string.sure_input_valid);
|
|
|
else {
|
|
|
- String map="{\"ad_confirmstatus\":\""+"已拒绝"+"\",\"ad_reason\":\""+message+"\",\"ad_bmanid\":\""+MyApplication.getInstance().getLoginUserId()+"\",\"ad_sharestatus\":\"" +"未共享"+ "\"}";
|
|
|
- actionOrder(id,map);
|
|
|
+ String map = "{\"ad_confirmstatus\":\"" + "已拒绝" + "\",\"ad_reason\":\"" + message + "\",\"ad_bmanid\":\"" + MyApplication.getInstance().getLoginUserId() + "\",\"ad_sharestatus\":\"" + "未共享" + "\"}";
|
|
|
+ actionOrder(id, map);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -705,15 +697,15 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
window.showAtLocation(view, Gravity.CENTER, 0, 0);
|
|
|
DisplayUtil.backgroundAlpha(this, 0.4f);
|
|
|
}
|
|
|
-
|
|
|
- private void sendMessage( final String ownerId,String ownerName, final String objectId, final String text) {
|
|
|
+
|
|
|
+ private void sendMessage(final String ownerId, String ownerName, final String objectId, final String text) {
|
|
|
ChatMessage message = new ChatMessage();
|
|
|
message.setType(XmppMessage.TYPE_TEXT);
|
|
|
message.setContent(text);
|
|
|
message.setFromUserName(ownerName);
|
|
|
message.setFromUserId(ownerId);
|
|
|
message.setTimeSend(CalendarUtil.getSecondMillion());
|
|
|
- if (interprect(ownerId,objectId,message)) {
|
|
|
+ if (interprect(ownerId, objectId, message)) {
|
|
|
return;
|
|
|
}
|
|
|
Log.i("wang", "send message:" + JSON.toJSONString(message));
|
|
|
@@ -743,10 +735,10 @@ public class BBookingDetailActivity extends OABaseActivity implements View.OnCli
|
|
|
*
|
|
|
* @param message
|
|
|
*/
|
|
|
- public boolean interprect(String ownerId,String objectId,ChatMessage message) {
|
|
|
+ public boolean interprect(String ownerId, String objectId, ChatMessage message) {
|
|
|
int len = 0;
|
|
|
List<Friend> mBlackList = FriendDao.getInstance().getAllBlacklists(ownerId);
|
|
|
- if (mBlackList!=null) {
|
|
|
+ if (mBlackList != null) {
|
|
|
for (Friend friend : mBlackList) {
|
|
|
if (friend.getUserId().equals(objectId)) {
|
|
|
Toast.makeText(mContext, "已经加入黑名单,无法发送消息", Toast.LENGTH_SHORT).show();
|