|
|
@@ -60,7 +60,9 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
private ClearEditText search_edit;
|
|
|
private String formCondition;
|
|
|
private String gridCondition;
|
|
|
- private int page=1;
|
|
|
+ private int page = 1;
|
|
|
+ private String bc_code;
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@@ -92,6 +94,7 @@ 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)
|
|
|
@@ -121,11 +124,13 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
int type;
|
|
|
+
|
|
|
private void initData() {
|
|
|
sendHttpResquest(Constants.HTTP_SUCCESS_INIT, page);
|
|
|
Intent intent = getIntent();
|
|
|
- type = 0;
|
|
|
+ type = 0;
|
|
|
if (intent != null) {
|
|
|
type = intent.getIntExtra("bt_type", 0);
|
|
|
}
|
|
|
@@ -201,7 +206,7 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
} 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());
|
|
|
@@ -220,13 +225,18 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
holder.bt_event.setVisibility(View.VISIBLE);
|
|
|
holder.bt_event.setText("分配");
|
|
|
}
|
|
|
- // holder.tv_date.setText(mdata.get(position).getDate());
|
|
|
+ // holder.tv_date.setText(mdata.get(position).getDate());
|
|
|
holder.bt_event.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
if (mdata.get(position).getType() == 1) {
|
|
|
- startActivity(new Intent(BusinessDetailActivty.this, BusinessDetailInfoActivity.class));
|
|
|
+ startActivity(new Intent(BusinessDetailActivty.this, BusinessDetailInfoActivity.class)
|
|
|
+ .putExtra("type", 1)
|
|
|
+ .putExtra("formCondition", formCondition + "=" + mdata.get(position).getBc_id())
|
|
|
+ .putExtra("gridCondition", gridCondition + "=" + mdata.get(position).getBc_id())
|
|
|
+ );
|
|
|
} else if (mdata.get(position).getType() == 2) {
|
|
|
+ bc_code = mdata.get(position).getNum();
|
|
|
startActivityForResult(new Intent(ct, DbfindListActivity.class), 1);
|
|
|
}
|
|
|
}
|
|
|
@@ -241,23 +251,22 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
protected FilterResults performFiltering(CharSequence constraint) {
|
|
|
//过滤数据
|
|
|
FilterResults searchResults = new FilterResults();
|
|
|
-
|
|
|
- if (constraint == null || constraint.length() == 0){
|
|
|
- searchResults.values=mData;
|
|
|
- searchResults.count=mData.size();
|
|
|
- }else{
|
|
|
+
|
|
|
+ if (constraint == null || constraint.length() == 0) {
|
|
|
+ searchResults.values = mData;
|
|
|
+ searchResults.count = mData.size();
|
|
|
+ } else {
|
|
|
ArrayList<String> searchKey = new ArrayList<String>();
|
|
|
- ArrayList<Business> newBusiness=new ArrayList<>();
|
|
|
- for (Business business:mdata){
|
|
|
- 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.contains(constraint)||name.contains(constraint)||source.contains(constraint)
|
|
|
- ||links.contains(constraint)||remark.contains(constraint)||date.contains(constraint))
|
|
|
- {
|
|
|
+ ArrayList<Business> newBusiness = new ArrayList<>();
|
|
|
+ for (Business business : mdata) {
|
|
|
+ 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.contains(constraint) || name.contains(constraint) || source.contains(constraint)
|
|
|
+ || links.contains(constraint) || remark.contains(constraint) || date.contains(constraint)) {
|
|
|
newBusiness.add(business);
|
|
|
}
|
|
|
// searchKey.add(num);
|
|
|
@@ -267,18 +276,18 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
// searchKey.add(remark);
|
|
|
// searchKey.add(date);
|
|
|
}
|
|
|
- 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();
|
|
|
}
|
|
|
@@ -299,36 +308,39 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
Button bt_event;
|
|
|
int type;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
- 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"));
|
|
|
- formCondition=JSON.parseObject(msg.getData().getString("result")).getString("keyField");
|
|
|
- gridCondition=JSON.parseObject(msg.getData().getString("result")).getString("pfField");
|
|
|
- JSONArray array= JSON.parseObject(msg.getData().getString("result")).getJSONArray("listdata");
|
|
|
- if(!array.isEmpty()){
|
|
|
- for (int i=0;i<array.size();i++){
|
|
|
- Business model=new Business();
|
|
|
+ formCondition = JSON.parseObject(msg.getData().getString("result")).getString("keyField");
|
|
|
+ gridCondition = JSON.parseObject(msg.getData().getString("result")).getString("pfField");
|
|
|
+ if (StringUtils.isEmpty(formCondition))formCondition="bc_id";
|
|
|
+ if (StringUtils.isEmpty(gridCondition))gridCondition="bc_id";
|
|
|
+ JSONArray array = JSON.parseObject(msg.getData().getString("result")).getJSONArray("listdata");
|
|
|
+ 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"));
|
|
|
model.setPhone(array.getJSONObject(i).getString("bc_tel"));
|
|
|
model.setNote(array.getJSONObject(i).getString("bc_remark"));
|
|
|
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 {
|
|
|
ToastMessage("数据加载完毕!");
|
|
|
}
|
|
|
// "bc_tel":"",
|
|
|
@@ -340,7 +352,7 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
// "bc_id":730
|
|
|
mAdapter = new BussinessDetailAdapter(ct, mData);
|
|
|
mlist.setAdapter(mAdapter);
|
|
|
- if (page!=1) {
|
|
|
+ if (page != 1) {
|
|
|
mlist.getRefreshableView().setSelection(mAdapter.getCount());
|
|
|
}
|
|
|
mlist.onRefreshComplete();
|
|
|
@@ -350,35 +362,63 @@ public class BusinessDetailActivty extends BaseActivity {
|
|
|
Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
|
mlist.onRefreshComplete();
|
|
|
break;
|
|
|
+ case BUSINESS_QIANG:
|
|
|
+ Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
|
+ progressDialog.dismiss();
|
|
|
+ ToastMessage("抢商机成功!");
|
|
|
+ startActivity(new Intent(ct, BusinessActivity.class));
|
|
|
+ break;
|
|
|
+ case BUSINESS_FENPEI:
|
|
|
+ progressDialog.dismiss();
|
|
|
+ ToastMessage("分配商机成功!");
|
|
|
+ startActivity(new Intent(ct, BusinessActivity.class));
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- private void sendHttpResquest(int what,int page){
|
|
|
+ private void sendHttpResquest(int what, int page) {
|
|
|
progressDialog.show();
|
|
|
- String url= Constants.getAppBaseUrl(ct)+"mobile/common/list.action";
|
|
|
- Map<String,Object> params=new HashMap<>();
|
|
|
- if (page==1)mData.clear();
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "mobile/common/list.action";
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ if (page == 1) mData.clear();
|
|
|
params.put("page", page);
|
|
|
params.put("pageSize", 10);
|
|
|
- params.put("caller","BusinessChance");
|
|
|
- params.put("condition", "1=1");
|
|
|
- LinkedHashMap<String , Object> headers=new LinkedHashMap<>();
|
|
|
+ params.put("caller", "BusinessChance");
|
|
|
+ params.put("condition", "(bc_type='公有' or nvl(bc_type,' ')=' ')");
|
|
|
+ //bc_currentprocess=商机阶段
|
|
|
+ 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");
|
|
|
}
|
|
|
|
|
|
+ private final int BUSINESS_FENPEI = 3;
|
|
|
+ private final int BUSINESS_QIANG = 2;
|
|
|
+
|
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
- switch (requestCode){
|
|
|
+ switch (requestCode) {
|
|
|
case 1:
|
|
|
if (data == null) {
|
|
|
return;
|
|
|
}
|
|
|
- String en_name = data.getStringExtra("en_name");
|
|
|
-
|
|
|
+ String bt_doman = data.getStringExtra("en_name");
|
|
|
+ sendHttpBusinessQiang(BUSINESS_FENPEI, bc_code, bt_doman);
|
|
|
break;
|
|
|
}
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private void sendHttpBusinessQiang(int what, String bc_code, String bc_doman) {
|
|
|
+ progressDialog.show();
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "mobile/crm/updateBusinessChanceDoman.action";
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("bc_code", bc_code);
|
|
|
+ params.put("bc_doman", bc_doman);
|
|
|
+ params.put("bc_domancode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
+ 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");
|
|
|
+ }
|
|
|
}
|