|
|
@@ -45,7 +45,8 @@ import java.util.Map;
|
|
|
/**
|
|
|
* 商机跟进页面
|
|
|
*/
|
|
|
-public class BusinessStateActivity extends BaseActivity implements View.OnClickListener{
|
|
|
+public class BusinessStateActivity extends BaseActivity implements View.OnClickListener {
|
|
|
+
|
|
|
private BussinessDetailAdapter mAdapter;
|
|
|
@ViewInject(R.id.ll_top_state)
|
|
|
private LinearLayout ll_top_state;
|
|
|
@@ -56,19 +57,18 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
private ClearEditText search_edit;
|
|
|
private String formCondition;
|
|
|
private String gridCondition;
|
|
|
- private int page=1;
|
|
|
+ private int page = 1;
|
|
|
@ViewInject(R.id.tv_unmanger)
|
|
|
private TextView tv_unmanger;
|
|
|
@ViewInject(R.id.tv_manged)
|
|
|
- private TextView tv_manged;
|
|
|
+ private TextView tv_manged;
|
|
|
@ViewInject(R.id.tv_timeout)
|
|
|
private TextView tv_timeout;
|
|
|
@ViewInject(R.id.tv_transtered)
|
|
|
- private TextView tv_transtered;
|
|
|
-
|
|
|
+ private TextView tv_transtered;
|
|
|
private EmptyLayout mEmptyLayout;
|
|
|
-
|
|
|
- private int business_state=0;//商机状态
|
|
|
+ private int business_state = 0;//商机状态
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@@ -81,14 +81,14 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
private void initView() {
|
|
|
ViewUtils.inject(this);
|
|
|
updateTabSelectState(tv_unmanger);
|
|
|
- mEmptyLayout = new EmptyLayout(this,mlist.getRefreshableView());
|
|
|
+ mEmptyLayout = new EmptyLayout(this, mlist.getRefreshableView());
|
|
|
mEmptyLayout.setShowLoadingButton(false);
|
|
|
mEmptyLayout.setShowEmptyButton(false);
|
|
|
mEmptyLayout.setShowErrorButton(false);
|
|
|
}
|
|
|
|
|
|
private void updateTabSelectState(TextView view) {
|
|
|
- switch (view.getId()){
|
|
|
+ switch (view.getId()) {
|
|
|
case R.id.tv_unmanger:
|
|
|
tv_unmanger.setSelected(true);
|
|
|
tv_manged.setSelected(false);
|
|
|
@@ -114,7 +114,7 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
tv_transtered.setSelected(true);
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void initListener() {
|
|
|
@@ -122,7 +122,7 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
tv_manged.setOnClickListener(this);
|
|
|
tv_timeout.setOnClickListener(this);
|
|
|
tv_transtered.setOnClickListener(this);
|
|
|
- // mlist.setMode(PullToRefreshBase.Mode.BOTH);
|
|
|
+ mlist.setMode(PullToRefreshBase.Mode.BOTH);
|
|
|
mlist.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
|
|
|
@Override
|
|
|
public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
|
|
|
@@ -157,20 +157,20 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
if (!StringUtils.isEmpty(search_edit.getText().toString())) {
|
|
|
mAdapter.getFilter().filter(search_edit.getText().toString());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
mAdapter.getFilter().filter("");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
-// if (!StringUtils.isEmpty(search_edit.getText().toString())) {
|
|
|
-// mAdapter.getFilter().filter(search_edit.getText().toString());
|
|
|
-// }
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
int type;
|
|
|
+
|
|
|
private void initData() {
|
|
|
sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page);
|
|
|
Intent intent = getIntent();
|
|
|
@@ -188,43 +188,33 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
getSupportActionBar().setTitle("分配");
|
|
|
ll_top_state.setVisibility(View.GONE);
|
|
|
}
|
|
|
- /* for (int i = 0; i < 22; i++) {
|
|
|
- Business model = new Business();
|
|
|
- model.setNum("013223" + i);
|
|
|
- model.setName("xxx" + i);
|
|
|
- model.setLeader("****" + i);
|
|
|
- model.setNote("xxxxxxxxxxxx" + i);
|
|
|
- model.setPhone("*********" + i);
|
|
|
- model.setSource("####" + i);
|
|
|
- model.setType(type);
|
|
|
- mData.add(model);
|
|
|
- }*/
|
|
|
-// mAdapter = new BussinessDetailAdapter(this, mData);
|
|
|
-// mlist.setAdapter(mAdapter);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- switch (v.getId()){
|
|
|
+ switch (v.getId()) {
|
|
|
case R.id.tv_unmanger:
|
|
|
updateTabSelectState((TextView) v.findViewById(R.id.tv_unmanger));
|
|
|
- business_state=0;
|
|
|
+ business_state = 0;
|
|
|
+ page=1;
|
|
|
sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page);
|
|
|
break;
|
|
|
case R.id.tv_manged:
|
|
|
updateTabSelectState((TextView) v.findViewById(R.id.tv_manged));
|
|
|
- business_state=1;
|
|
|
+ business_state = 1;
|
|
|
+ page=1;
|
|
|
sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page);
|
|
|
break;
|
|
|
case R.id.tv_timeout:
|
|
|
updateTabSelectState((TextView) v.findViewById(R.id.tv_timeout));
|
|
|
- business_state=2;
|
|
|
+ business_state = 2;
|
|
|
+ page=1;
|
|
|
sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page);
|
|
|
break;
|
|
|
case R.id.tv_transtered:
|
|
|
updateTabSelectState((TextView) v.findViewById(R.id.tv_transtered));
|
|
|
- business_state=3;
|
|
|
+ business_state = 3;
|
|
|
+ page=1;
|
|
|
sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page);
|
|
|
break;
|
|
|
}
|
|
|
@@ -247,9 +237,9 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
|
|
|
@Override
|
|
|
public int getCount() {
|
|
|
- if (mdata == null){
|
|
|
+ if (mdata == null) {
|
|
|
return 0;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return mdata.size();
|
|
|
|
|
|
}
|
|
|
@@ -257,9 +247,9 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
|
|
|
@Override
|
|
|
public Object getItem(int position) {
|
|
|
- if (mdata == null){
|
|
|
+ if (mdata == null) {
|
|
|
return null;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return mdata.get(position);
|
|
|
|
|
|
}
|
|
|
@@ -283,7 +273,7 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
holder.tv_datetv = (TextView) convertView.findViewById(R.id.tv_crm_business_datetv);
|
|
|
holder.tv_phone = (TextView) convertView.findViewById(R.id.tv_crm_business_phone);
|
|
|
holder.tv_source = (TextView) convertView.findViewById(R.id.tv_crm_business_source);
|
|
|
- holder.tv_steps= (TextView) convertView.findViewById(R.id.tv_crm_business_steps);
|
|
|
+ holder.tv_steps = (TextView) convertView.findViewById(R.id.tv_crm_business_steps);
|
|
|
//holder.tv_datetv= (TextView) convertView.findViewById(R.id.tv_crm_business_datetv);
|
|
|
// holder.bt_event = (Button) convertView.findViewById(R.id.bt_business_qiang);
|
|
|
holder.iv_event = (ImageView) convertView.findViewById(R.id.iv_business_qiang);
|
|
|
@@ -291,7 +281,7 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
} else {
|
|
|
holder = (ViewHolder) convertView.getTag();
|
|
|
}
|
|
|
- holder.bc_id=mdata.get(position).getBc_id();
|
|
|
+ holder.bc_id = mdata.get(position).getBc_id();
|
|
|
holder.type = mdata.get(position).getType();
|
|
|
holder.tv_num.setText(mdata.get(position).getNum());
|
|
|
holder.tv_name.setText(mdata.get(position).getName());
|
|
|
@@ -327,7 +317,7 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
|
|
|
@Override
|
|
|
public Filter getFilter() {
|
|
|
- if (myFilter == null){
|
|
|
+ if (myFilter == null) {
|
|
|
myFilter = new MyFilter();
|
|
|
}
|
|
|
return myFilter;
|
|
|
@@ -344,63 +334,62 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
TextView tv_note;
|
|
|
TextView tv_datetv;
|
|
|
TextView tv_date;
|
|
|
-// Button bt_event;
|
|
|
+ // Button bt_event;
|
|
|
ImageView iv_event;
|
|
|
int type;
|
|
|
}
|
|
|
|
|
|
|
|
|
- class MyFilter extends Filter{
|
|
|
+ class MyFilter extends Filter {
|
|
|
@Override
|
|
|
protected FilterResults performFiltering(CharSequence constraint) {
|
|
|
//过滤数据
|
|
|
FilterResults searchResults = new FilterResults();
|
|
|
- if (mOrignalValues == null){
|
|
|
- synchronized (mLock){
|
|
|
+ if (mOrignalValues == null) {
|
|
|
+ synchronized (mLock) {
|
|
|
mOrignalValues = new ArrayList<Business>(mdata);
|
|
|
}
|
|
|
}
|
|
|
- if (constraint == null || constraint.length() == 0){
|
|
|
- synchronized (mLock){
|
|
|
+ if (constraint == null || constraint.length() == 0) {
|
|
|
+ synchronized (mLock) {
|
|
|
ArrayList<Business> tempList = new ArrayList<>(mOrignalValues);
|
|
|
- searchResults.values=tempList;
|
|
|
- searchResults.count=tempList.size();
|
|
|
+ searchResults.values = tempList;
|
|
|
+ searchResults.count = tempList.size();
|
|
|
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
final ArrayList<Business> values = mOrignalValues;
|
|
|
final int count = values.size();
|
|
|
|
|
|
- final ArrayList<Business> newBusiness=new ArrayList<>();
|
|
|
+ final ArrayList<Business> newBusiness = new ArrayList<>();
|
|
|
String input = constraint.toString();
|
|
|
- for (Business business: values){
|
|
|
- String num=business.getNum();
|
|
|
- String name=business.getName();
|
|
|
- String source=business.getSource();
|
|
|
- String links=business.getPhone();
|
|
|
- String remark=business.getNote();
|
|
|
- String date=business.getDate();
|
|
|
- if ((num != null && num.contains(input))||(name != null && name.contains(input))
|
|
|
- ||(source != null && source.contains(input))
|
|
|
- ||(links != null && links.contains(input))
|
|
|
- ||(remark != null && remark.contains(input))
|
|
|
- ||(date != null && date.contains(input)))
|
|
|
- {
|
|
|
+ for (Business business : values) {
|
|
|
+ String num = business.getNum();
|
|
|
+ String name = business.getName();
|
|
|
+ String source = business.getSource();
|
|
|
+ String links = business.getPhone();
|
|
|
+ String remark = business.getNote();
|
|
|
+ String date = business.getDate();
|
|
|
+ if ((num != null && num.contains(input)) || (name != null && name.contains(input))
|
|
|
+ || (source != null && source.contains(input))
|
|
|
+ || (links != null && links.contains(input))
|
|
|
+ || (remark != null && remark.contains(input))
|
|
|
+ || (date != null && date.contains(input))) {
|
|
|
newBusiness.add(business);
|
|
|
}
|
|
|
}
|
|
|
- searchResults.values=newBusiness;
|
|
|
- searchResults.count=newBusiness.size();
|
|
|
+ searchResults.values = newBusiness;
|
|
|
+ searchResults.count = newBusiness.size();
|
|
|
}
|
|
|
return searchResults;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void publishResults(CharSequence constraint, FilterResults results) {
|
|
|
- mdata= (ArrayList<Business>) results.values;
|
|
|
+ mdata = (ArrayList<Business>) results.values;
|
|
|
if (mAdapter.getCount() > 0) {
|
|
|
notifyDataSetChanged();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
notifyDataSetInvalidated();
|
|
|
}
|
|
|
}
|
|
|
@@ -410,51 +399,47 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
|
|
|
|
|
|
- private Handler mHandler=new Handler(){
|
|
|
+ private Handler mHandler = new Handler() {
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
- switch (msg.what){
|
|
|
+ switch (msg.what) {
|
|
|
case Constants.HTTP_SUCCESS_INIT:
|
|
|
progressDialog.dismiss();
|
|
|
Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
|
//bc_id
|
|
|
- formCondition= "";
|
|
|
- gridCondition="bc_id";
|
|
|
- JSONArray arraya= JSON.parseObject(msg.getData().getString("result")).getJSONArray("lista");
|
|
|
- JSONArray arrayb= JSON.parseObject(msg.getData().getString("result")).getJSONArray("listb");
|
|
|
- JSONArray arrayc= JSON.parseObject(msg.getData().getString("result")).getJSONArray("listc");
|
|
|
- JSONArray arrayd= JSON.parseObject(msg.getData().getString("result")).getJSONArray("listd");
|
|
|
-
|
|
|
- int counta= JSON.parseObject(msg.getData().getString("result")).getInteger("counta");
|
|
|
- int countb= JSON.parseObject(msg.getData().getString("result")).getInteger("countb");
|
|
|
- int countc= JSON.parseObject(msg.getData().getString("result")).getInteger("countc");
|
|
|
- int countd= JSON.parseObject(msg.getData().getString("result")).getInteger("countd");
|
|
|
- CommonUtil.textSpanForStyle(tv_unmanger,"未排日程 "+counta,String.valueOf(counta),ct.getResources().getColor(R.color.yellow_home));
|
|
|
- CommonUtil.textSpanForStyle(tv_manged,"已排日程 "+countb,String.valueOf(countb),ct.getResources().getColor(R.color.yellow_home));
|
|
|
- CommonUtil.textSpanForStyle(tv_timeout,"即将超时 "+countc,String.valueOf(countc),ct.getResources().getColor(R.color.yellow_home));
|
|
|
- CommonUtil.textSpanForStyle(tv_transtered,"已转客户 "+countd,String.valueOf(countd),ct.getResources().getColor(R.color.yellow_home));
|
|
|
-// tv_unmanger.setText("未排日程");
|
|
|
-// tv_manged.setText("未排日程");
|
|
|
-// tv_timeout.setText("即将超时");
|
|
|
-// tv_transtered.setText("已转客户");
|
|
|
- JSONArray array=new JSONArray();
|
|
|
- switch (business_state){
|
|
|
+ formCondition = "";
|
|
|
+ gridCondition = "bc_id";
|
|
|
+ JSONArray arraya = JSON.parseObject(msg.getData().getString("result")).getJSONArray("lista");
|
|
|
+ JSONArray arrayb = JSON.parseObject(msg.getData().getString("result")).getJSONArray("listb");
|
|
|
+ JSONArray arrayc = JSON.parseObject(msg.getData().getString("result")).getJSONArray("listc");
|
|
|
+ JSONArray arrayd = JSON.parseObject(msg.getData().getString("result")).getJSONArray("listd");
|
|
|
+
|
|
|
+ int counta = JSON.parseObject(msg.getData().getString("result")).getInteger("counta");
|
|
|
+ int countb = JSON.parseObject(msg.getData().getString("result")).getInteger("countb");
|
|
|
+ int countc = JSON.parseObject(msg.getData().getString("result")).getInteger("countc");
|
|
|
+ int countd = JSON.parseObject(msg.getData().getString("result")).getInteger("countd");
|
|
|
+ CommonUtil.textSpanForStyle(tv_unmanger, "未排日程 " + counta, String.valueOf(counta), ct.getResources().getColor(R.color.yellow_home));
|
|
|
+ CommonUtil.textSpanForStyle(tv_manged, "已排日程 " + countb, String.valueOf(countb), ct.getResources().getColor(R.color.yellow_home));
|
|
|
+ CommonUtil.textSpanForStyle(tv_timeout, "即将超时 " + countc, String.valueOf(countc), ct.getResources().getColor(R.color.yellow_home));
|
|
|
+ CommonUtil.textSpanForStyle(tv_transtered, "已转客户 " + countd, String.valueOf(countd), ct.getResources().getColor(R.color.yellow_home));
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
+ switch (business_state) {
|
|
|
case 0:
|
|
|
- array=arraya;
|
|
|
+ array = arraya;
|
|
|
break;
|
|
|
case 1:
|
|
|
- array=arrayb;
|
|
|
+ array = arrayb;
|
|
|
break;
|
|
|
case 2:
|
|
|
- array=arrayc;
|
|
|
+ array = arrayc;
|
|
|
break;
|
|
|
case 3:
|
|
|
- array=arrayd;
|
|
|
+ array = arrayd;
|
|
|
break;
|
|
|
}
|
|
|
- if(!array.isEmpty()){
|
|
|
- for (int i=0;i<array.size();i++){
|
|
|
- Business model=new Business();
|
|
|
+ if (!array.isEmpty()) {
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ Business model = new Business();
|
|
|
model.setNum(array.getJSONObject(i).getString("BC_CODE"));
|
|
|
model.setDate(array.getJSONObject(i).getString("BC_RECORDDATE"));
|
|
|
model.setName(array.getJSONObject(i).getString("BC_DESCRIPTION"));
|
|
|
@@ -462,19 +447,20 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
model.setNote(array.getJSONObject(i).getString("BC_REMARK"));
|
|
|
model.setSteps(array.getJSONObject(i).getString("BC_NICHEHOUSE"));
|
|
|
model.setSource(array.getJSONObject(i).getString("BC_FROM"));
|
|
|
- if (array.getJSONObject(i).getObject("BC_ID",Object.class) instanceof Integer)
|
|
|
- { model.setBc_id(array.getJSONObject(i).getInteger("BC_ID"));}
|
|
|
+ if (array.getJSONObject(i).getObject("BC_ID", Object.class) instanceof Integer) {
|
|
|
+ model.setBc_id(array.getJSONObject(i).getInteger("BC_ID"));
|
|
|
+ }
|
|
|
model.setType(type);
|
|
|
mData.add(model);
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
mEmptyLayout.showEmpty();
|
|
|
}
|
|
|
mAdapter = new BussinessDetailAdapter(ct, mData);
|
|
|
mlist.setAdapter(mAdapter);
|
|
|
// mAdapter.notifyDataSetChanged();
|
|
|
- if (page!=1) {
|
|
|
- mlist.getRefreshableView().setSelection(mAdapter.getCount());
|
|
|
+ if (page != 1) {
|
|
|
+ mlist.getRefreshableView().setSelection(page*array.size());
|
|
|
}
|
|
|
mlist.onRefreshComplete();
|
|
|
break;
|
|
|
@@ -487,18 +473,18 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- private void sendHttpResquest(int what,int page){
|
|
|
+ private void sendHttpResquest(int what, int page) {
|
|
|
progressDialog.show();
|
|
|
- if (CommonUtil.isNetWorkConnected(this)){
|
|
|
- String url= Constants.getAppBaseUrl(ct)+"mobile/crm/getNicheByCondition.action";
|
|
|
- Map<String,Object> params=new HashMap<>();
|
|
|
- if (page==1)mData.clear();
|
|
|
- params.put("bc_domancode", CommonUtil.getSharedPreferences(ct,"erp_username"));
|
|
|
-
|
|
|
- LinkedHashMap<String , Object> headers=new LinkedHashMap<>();
|
|
|
+ if (CommonUtil.isNetWorkConnected(this)) {
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "mobile/crm/getNicheByCondition.action";
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ if (page == 1) mData.clear();
|
|
|
+ params.put("bc_domancode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
+ params.put("pageIndex", page);
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
progressDialog.dismiss();
|
|
|
mlist.onRefreshComplete();
|
|
|
mEmptyLayout.setErrorMessage("网络未连接");
|
|
|
@@ -509,7 +495,7 @@ public class BusinessStateActivity extends BaseActivity implements View.OnClickL
|
|
|
|
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
- switch (requestCode){
|
|
|
+ switch (requestCode) {
|
|
|
case 1:
|
|
|
if (data == null) {
|
|
|
return;
|