|
|
@@ -124,10 +124,10 @@ public class BusinessActivity extends BaseActivity implements View.OnClickListen
|
|
|
|
|
|
@Override
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
- if (item.getItemId() == R.id.crm_data_find){
|
|
|
+ if (item.getItemId() == R.id.crm_data_find) {
|
|
|
View view = getWindow().findViewById(item.getItemId());
|
|
|
showPopupWindow(view);
|
|
|
- }else if (item.getItemId() == android.R.id.home){
|
|
|
+ } else if (item.getItemId() == android.R.id.home) {
|
|
|
onBackPressed();
|
|
|
}
|
|
|
return true;
|
|
|
@@ -135,15 +135,15 @@ public class BusinessActivity extends BaseActivity implements View.OnClickListen
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- if (v.getId() == R.id.bt_create){
|
|
|
+ if (v.getId() == R.id.bt_create) {
|
|
|
if (VersionUtil.canShowCrm2_0() && !CommonUtil.isBiteman())
|
|
|
startActivity(new Intent(this, AddBusinessActivity.class));
|
|
|
else startActivity(new Intent(this, BusinessAddActivity.class));
|
|
|
- }else if (v.getId() == R.id.bt_qiang){
|
|
|
+ } else if (v.getId() == R.id.bt_qiang) {
|
|
|
startActivity(new Intent(this, BusinessDetailActivty.class).putExtra("bt_type", 1));
|
|
|
- }else if (v.getId() == R.id.bt_manage){
|
|
|
+ } else if (v.getId() == R.id.bt_manage) {
|
|
|
startActivity(new Intent(this, BusinessDetailActivty.class).putExtra("bt_type", 2));
|
|
|
- }else if (v.getId() == R.id.bt_go){
|
|
|
+ } else if (v.getId() == R.id.bt_go) {
|
|
|
startActivity(new Intent(this, BusinessStateActivity.class).putExtra("bt_type", 0));
|
|
|
}
|
|
|
}
|
|
|
@@ -156,61 +156,79 @@ public class BusinessActivity extends BaseActivity implements View.OnClickListen
|
|
|
progressDialog.dismiss();
|
|
|
gridlists.clear();
|
|
|
Log.i(TAG, "json:" + msg.getData().getString("result"));
|
|
|
- JSONObject root = JSON.parseObject(msg.getData().getString("result"));
|
|
|
- JSONArray chances = root.getJSONArray("chances");
|
|
|
- ArrayList<Integer> counts = new ArrayList<>();
|
|
|
- ArrayList<String> colors = new ArrayList<>();
|
|
|
- int countToatal = 0;
|
|
|
- if (!chances.isEmpty()) {
|
|
|
- ArrayList<String> items = new ArrayList<>();
|
|
|
- items.add(getString(R.string.color_text));
|
|
|
- // items.add("序号");
|
|
|
- items.add(getString(R.string.business_stage));
|
|
|
- items.add(getString(R.string.business_number));
|
|
|
- items.add(getString(R.string.business_Conversion_rate));
|
|
|
- gridlists.add(items);
|
|
|
- for (int i = 0; i < chances.size(); i++) {
|
|
|
- items = new ArrayList<>();
|
|
|
- String currentprocess = chances.getJSONObject(i).getString("currentprocess");
|
|
|
- String percent = chances.getJSONObject(i).getString("percent");
|
|
|
- String color = chances.getJSONObject(i).getString("color");
|
|
|
- int detno = chances.getJSONObject(i).getInteger("detno");
|
|
|
- int count = chances.getJSONObject(i).getInteger("count");
|
|
|
- items.add("#" + color);
|
|
|
- colors.add("#" + color);
|
|
|
- // items.add(String.valueOf(i + 1));
|
|
|
- items.add(currentprocess);
|
|
|
- items.add(String.valueOf(count));
|
|
|
- counts.add(count);
|
|
|
- countToatal = countToatal + count;
|
|
|
- items.add(percent);
|
|
|
- gridlists.add(items);
|
|
|
- }
|
|
|
- }
|
|
|
- //gridlists = (ArrayList) JSON.parseArray(gridData, ArrayList.class);
|
|
|
- hl_adapter = new HListViewOneAdapter(ct, gridlists);
|
|
|
- lv_grid_dispaly.setAdapter(hl_adapter);
|
|
|
- layout.setVisibility(View.VISIBLE);
|
|
|
- Log.i(TAG, "handleMessage:colors:" + JSON.toJSONString(colors));
|
|
|
- Log.i(TAG, "handleMessage:counts:" + JSON.toJSONString(counts));
|
|
|
- Log.i(TAG, "handleMessage:countToatal:" + countToatal);
|
|
|
- if (countToatal == 0) {//数据为空,显示空视图
|
|
|
- for (int i = 0; i < counts.size(); i++) {
|
|
|
- counts.set(i, 50);
|
|
|
- }
|
|
|
- countToatal = counts.size() * 50;
|
|
|
- }
|
|
|
- funnelView.setData(counts, countToatal, colors);
|
|
|
- funnelView.animateY();
|
|
|
+ showFunelView(msg.getData().getString("result"));
|
|
|
break;
|
|
|
case Constants.APP_SOCKETIMEOUTEXCEPTION:
|
|
|
progressDialog.dismiss();
|
|
|
Log.i(TAG, "json:" + msg.getData().getString("result"));
|
|
|
+ String json = "{\"sessionId\":\"A84EE897980B21770FD00FC69C47B27B\",\"chances\":[{\"detno\":1,\"percent\":\"0.00%\",\"count\":0,\"color\":\"485CC6\",\"currentprocess\":\"初次沟通\"},{\"detno\":2,\"percent\":\"0.00%\",\"count\":0,\"color\":\"4686CC\",\"currentprocess\":\"产品演示\"},{\"detno\":3,\"percent\":\"0.00%\",\"count\":0,\"color\":\"49B0C9\",\"currentprocess\":\"立项评估\"},{\"detno\":4,\"percent\":\"0.00%\",\"count\":0,\"color\":\"48C79E\",\"currentprocess\":\"需求分析\"},{\"detno\":5,\"percent\":\"0.00%\",\"count\":0,\"color\":\"55CC59\",\"currentprocess\":\"样品报价\"},{\"detno\":6,\"percent\":\"0.00%\",\"count\":0,\"color\":\"90BB42\",\"currentprocess\":\"商务谈判\"},{\"detno\":7,\"percent\":\"0.00%\",\"count\":0,\"color\":\"BAA535\",\"currentprocess\":\"合同签约\"},{\"detno\":8,\"percent\":\"0.00%\",\"count\":0,\"color\":\"C7853F\",\"currentprocess\":\"完成交易\"},{\"detno\":9,\"percent\":\"0.00%\",\"count\":0,\"color\":\"BB5743\",\"currentprocess\":\"多次交易\"}],\"success\":true}";
|
|
|
+ showFunelView(json);
|
|
|
+ break;
|
|
|
+ case Constants.APP_NOTNETWORK:
|
|
|
+ progressDialog.dismiss();
|
|
|
+ gridlists.clear();
|
|
|
+ ToastMessage(getString(R.string.networks_out));
|
|
|
+ json = "{\"sessionId\":\"A84EE897980B21770FD00FC69C47B27B\",\"chances\":[{\"detno\":1,\"percent\":\"0.00%\",\"count\":0,\"color\":\"485CC6\",\"currentprocess\":\"初次沟通\"},{\"detno\":2,\"percent\":\"0.00%\",\"count\":0,\"color\":\"4686CC\",\"currentprocess\":\"产品演示\"},{\"detno\":3,\"percent\":\"0.00%\",\"count\":0,\"color\":\"49B0C9\",\"currentprocess\":\"立项评估\"},{\"detno\":4,\"percent\":\"0.00%\",\"count\":0,\"color\":\"48C79E\",\"currentprocess\":\"需求分析\"},{\"detno\":5,\"percent\":\"0.00%\",\"count\":0,\"color\":\"55CC59\",\"currentprocess\":\"样品报价\"},{\"detno\":6,\"percent\":\"0.00%\",\"count\":0,\"color\":\"90BB42\",\"currentprocess\":\"商务谈判\"},{\"detno\":7,\"percent\":\"0.00%\",\"count\":0,\"color\":\"BAA535\",\"currentprocess\":\"合同签约\"},{\"detno\":8,\"percent\":\"0.00%\",\"count\":0,\"color\":\"C7853F\",\"currentprocess\":\"完成交易\"},{\"detno\":9,\"percent\":\"0.00%\",\"count\":0,\"color\":\"BB5743\",\"currentprocess\":\"多次交易\"}],\"success\":true}";
|
|
|
+ showFunelView(json);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ progressDialog.dismiss();
|
|
|
+ json = "{\"sessionId\":\"A84EE897980B21770FD00FC69C47B27B\",\"chances\":[{\"detno\":1,\"percent\":\"0.00%\",\"count\":0,\"color\":\"485CC6\",\"currentprocess\":\"初次沟通\"},{\"detno\":2,\"percent\":\"0.00%\",\"count\":0,\"color\":\"4686CC\",\"currentprocess\":\"产品演示\"},{\"detno\":3,\"percent\":\"0.00%\",\"count\":0,\"color\":\"49B0C9\",\"currentprocess\":\"立项评估\"},{\"detno\":4,\"percent\":\"0.00%\",\"count\":0,\"color\":\"48C79E\",\"currentprocess\":\"需求分析\"},{\"detno\":5,\"percent\":\"0.00%\",\"count\":0,\"color\":\"55CC59\",\"currentprocess\":\"样品报价\"},{\"detno\":6,\"percent\":\"0.00%\",\"count\":0,\"color\":\"90BB42\",\"currentprocess\":\"商务谈判\"},{\"detno\":7,\"percent\":\"0.00%\",\"count\":0,\"color\":\"BAA535\",\"currentprocess\":\"合同签约\"},{\"detno\":8,\"percent\":\"0.00%\",\"count\":0,\"color\":\"C7853F\",\"currentprocess\":\"完成交易\"},{\"detno\":9,\"percent\":\"0.00%\",\"count\":0,\"color\":\"BB5743\",\"currentprocess\":\"多次交易\"}],\"success\":true}";
|
|
|
+ showFunelView(json);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ private void showFunelView(String result) {
|
|
|
+ JSONObject root = JSON.parseObject(result);
|
|
|
+ JSONArray chances = root.getJSONArray("chances");
|
|
|
+ ArrayList<Integer> counts = new ArrayList<>();
|
|
|
+ ArrayList<String> colors = new ArrayList<>();
|
|
|
+ int countToatal = 0;
|
|
|
+ if (!chances.isEmpty()) {
|
|
|
+ ArrayList<String> items = new ArrayList<>();
|
|
|
+ items.add(getString(R.string.color_text));
|
|
|
+ // items.add("序号");
|
|
|
+ items.add(getString(R.string.business_stage));
|
|
|
+ items.add(getString(R.string.business_number));
|
|
|
+ items.add(getString(R.string.business_Conversion_rate));
|
|
|
+ gridlists.add(items);
|
|
|
+ for (int i = 0; i < chances.size(); i++) {
|
|
|
+ items = new ArrayList<>();
|
|
|
+ String currentprocess = chances.getJSONObject(i).getString("currentprocess");
|
|
|
+ String percent = chances.getJSONObject(i).getString("percent");
|
|
|
+ String color = chances.getJSONObject(i).getString("color");
|
|
|
+ int detno = chances.getJSONObject(i).getInteger("detno");
|
|
|
+ int count = chances.getJSONObject(i).getInteger("count");
|
|
|
+ items.add("#" + color);
|
|
|
+ colors.add("#" + color);
|
|
|
+ // items.add(String.valueOf(i + 1));
|
|
|
+ items.add(currentprocess);
|
|
|
+ items.add(String.valueOf(count));
|
|
|
+ counts.add(count);
|
|
|
+ countToatal = countToatal + count;
|
|
|
+ items.add(percent);
|
|
|
+ gridlists.add(items);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //gridlists = (ArrayList) JSON.parseArray(gridData, ArrayList.class);
|
|
|
+ hl_adapter = new HListViewOneAdapter(ct, gridlists);
|
|
|
+ lv_grid_dispaly.setAdapter(hl_adapter);
|
|
|
+ layout.setVisibility(View.VISIBLE);
|
|
|
+ Log.i(TAG, "handleMessage:colors:" + JSON.toJSONString(colors));
|
|
|
+ Log.i(TAG, "handleMessage:counts:" + JSON.toJSONString(counts));
|
|
|
+ Log.i(TAG, "handleMessage:countToatal:" + countToatal);
|
|
|
+ if (countToatal == 0) {//数据为空,显示空视图
|
|
|
+ for (int i = 0; i < counts.size(); i++) {
|
|
|
+ counts.set(i, 50);
|
|
|
+ }
|
|
|
+ countToatal = counts.size() * 50;
|
|
|
+ }
|
|
|
+ funnelView.setData(counts, countToatal, colors);
|
|
|
+ funnelView.animateY();
|
|
|
+ }
|
|
|
+
|
|
|
private String currentDate;
|
|
|
|
|
|
private void sendHttpResquest(String currentdate) {
|