|
|
@@ -2,6 +2,7 @@ package com.xzjmyk.pm.activity.ui.erp.activity.crm;
|
|
|
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
+import android.content.res.Resources;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
@@ -43,6 +44,7 @@ import com.xzjmyk.pm.activity.ui.erp.view.EmptyLayout;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.view.VoiceSearchView;
|
|
|
import com.xzjmyk.pm.activity.view.crouton.Crouton;
|
|
|
import com.xzjmyk.pm.activity.view.crouton.Style;
|
|
|
+import com.xzjmyk.pm.activity.view.steps.HorizontalStepsView;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
@@ -57,6 +59,7 @@ import java.util.Map;
|
|
|
*/
|
|
|
public class BusinessDetailActivty extends BaseActivity {
|
|
|
|
|
|
+ private final int LOAD_JIEDUAN = 0x210;
|
|
|
private BussinessDetailAdapter mAdapter;
|
|
|
@ViewInject(R.id.ll_top_state)
|
|
|
private LinearLayout ll_top_state;
|
|
|
@@ -72,6 +75,7 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
private String bc_code;
|
|
|
private EmptyLayout mEmptyLayout;
|
|
|
private final int CAN_QIANG_NOT = 34;
|
|
|
+ private String[] labels;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -126,7 +130,6 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
final BussinessDetailAdapter.ViewHolder holder = (BussinessDetailAdapter.ViewHolder) view.getTag();
|
|
|
-
|
|
|
startActivity(new Intent(BusinessDetailActivty.this, BusinessDetailInfoActivity.class)
|
|
|
.putExtra("type", holder.type)
|
|
|
.putExtra("formCondition", formCondition + "=" + holder.bc_id)
|
|
|
@@ -170,6 +173,7 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
|
|
|
private void initData() {
|
|
|
Intent intent = getIntent();
|
|
|
+ loadJieDuan();
|
|
|
type = 0;
|
|
|
if (intent != null) {
|
|
|
type = intent.getIntExtra("bt_type", 0);
|
|
|
@@ -229,10 +233,14 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
|
|
- ViewHolder holder = null;
|
|
|
+ return getNewView(position, convertView, parent);
|
|
|
+ }
|
|
|
+
|
|
|
+ private View getOldView(final int position, View convertView, ViewGroup parent) {
|
|
|
+ OldViewHolder holder = null;
|
|
|
if (convertView == null) {
|
|
|
convertView = inflater.inflate(R.layout.item_business_detail, null);
|
|
|
- holder = new ViewHolder();
|
|
|
+ holder = new OldViewHolder();
|
|
|
holder.tv_num = (TextView) convertView.findViewById(R.id.tv_crm_business_num);
|
|
|
holder.tv_name = (TextView) convertView.findViewById(R.id.tv_crm_business_name);
|
|
|
holder.tv_note = (TextView) convertView.findViewById(R.id.tv_crm_business_note);
|
|
|
@@ -245,7 +253,7 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
holder.iv_event = (ImageView) convertView.findViewById(R.id.iv_business_qiang);
|
|
|
convertView.setTag(holder);
|
|
|
} else {
|
|
|
- holder = (ViewHolder) convertView.getTag();
|
|
|
+ holder = (OldViewHolder) convertView.getTag();
|
|
|
}
|
|
|
holder.bc_id = mdata.get(position).getBc_id();
|
|
|
holder.type = mdata.get(position).getType();
|
|
|
@@ -295,6 +303,40 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
return convertView;
|
|
|
}
|
|
|
|
|
|
+ private View getNewView(final int position, View convertView, ViewGroup parent) {
|
|
|
+ ViewHolder holder = null;
|
|
|
+ if (convertView == null) {
|
|
|
+ convertView = inflater.inflate(R.layout.item_business, parent, false);
|
|
|
+ holder = new ViewHolder();
|
|
|
+ holder.companyname_tv = (TextView) convertView.findViewById(R.id.companyname_tv);
|
|
|
+ holder.describe_tv = (TextView) convertView.findViewById(R.id.describe_tv);
|
|
|
+ holder.create_date_tv = (TextView) convertView.findViewById(R.id.create_date_tv);
|
|
|
+ holder.stepsView = (HorizontalStepsView) convertView.findViewById(R.id.stepsView);
|
|
|
+ convertView.setTag(holder);
|
|
|
+ } else {
|
|
|
+ holder = (ViewHolder) convertView.getTag();
|
|
|
+ }
|
|
|
+ holder.bc_id = mdata.get(position).getBc_id();
|
|
|
+ holder.type = mdata.get(position).getType();
|
|
|
+ holder.create_date_tv.setText(mdata.get(position).getDate());
|
|
|
+ holder.companyname_tv.setText(mdata.get(position).getName());
|
|
|
+ holder.describe_tv.setText(mdata.get(position).getNote());
|
|
|
+ holder.stepsView.setProgress(getPosition(mdata.get(position).getCurrentprocess()), labels);
|
|
|
+// holder.stepsView.setProgress(4, labels);
|
|
|
+ holder.stepsView.setFocusable(false);
|
|
|
+ holder.stepsView.setClickable(false);
|
|
|
+ return convertView;
|
|
|
+ }
|
|
|
+
|
|
|
+ private int getPosition(String currentprocess) {
|
|
|
+ if (labels == null || labels.length <= 0 || StringUtils.isEmpty(currentprocess))
|
|
|
+ return 0;
|
|
|
+ for (int i = 0; i < labels.length; i++)
|
|
|
+ if (!StringUtils.isEmpty(labels[i]) && labels[i].equals(currentprocess))
|
|
|
+ return i;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Filter getFilter() {
|
|
|
return new Filter() {
|
|
|
@@ -309,9 +351,9 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
searchResults.values = mData;
|
|
|
searchResults.count = mData.size();
|
|
|
} else {
|
|
|
- mdata = mData;
|
|
|
+ ArrayList<Business> businessList = mData;
|
|
|
ArrayList<Business> newBusiness = new ArrayList<>();
|
|
|
- for (Business business : mdata) {
|
|
|
+ for (Business business : businessList) {
|
|
|
String num = business.getNum() == null ? "" : business.getNum();
|
|
|
String name = business.getName() == null ? "" : business.getName();
|
|
|
String source = business.getSource() == null ? "" : business.getSource();
|
|
|
@@ -338,8 +380,16 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-
|
|
|
class ViewHolder {
|
|
|
+ int bc_id;
|
|
|
+ int type;
|
|
|
+ TextView companyname_tv;
|
|
|
+ TextView describe_tv;
|
|
|
+ TextView create_date_tv;
|
|
|
+ HorizontalStepsView stepsView;
|
|
|
+ }
|
|
|
+
|
|
|
+ class OldViewHolder {
|
|
|
int bc_id;
|
|
|
TextView tv_num;
|
|
|
TextView tv_name;
|
|
|
@@ -363,6 +413,21 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
switch (msg.what) {
|
|
|
+ case LOAD_JIEDUAN:
|
|
|
+ try {
|
|
|
+ JSONArray array = JSON.parseObject(msg.getData().getString("result")).getJSONArray("stages");
|
|
|
+ labels = new String[array.size()];
|
|
|
+ if (!array.isEmpty()) {
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ labels[i] = array.getJSONObject(i).getString("BS_NAME");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Resources.NotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ ToastMessage("扔出异常!");
|
|
|
+ }
|
|
|
+ sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page);
|
|
|
+ break;
|
|
|
case Constants.HTTP_SUCCESS_INIT:
|
|
|
progressDialog.dismiss();
|
|
|
// LogUtil.d(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
|
@@ -465,6 +530,20 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * @desc:加载阶段
|
|
|
+ * @author:Arison on 2016/7/20
|
|
|
+ */
|
|
|
+ public void loadJieDuan() {
|
|
|
+ progressDialog.show();
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "/mobile/crm/getBusinessChanceStage.action";
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("condition", "1=1");
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, LOAD_JIEDUAN, null, null, "post");
|
|
|
+ }
|
|
|
+
|
|
|
private void sendHttpResquest(int what, int page) {
|
|
|
progressDialog.show();
|
|
|
if (CommonUtil.isNetWorkConnected(this)) {
|