|
|
@@ -47,8 +47,10 @@ import com.xzjmyk.pm.activity.ui.erp.view.MyMarkerView;
|
|
|
import com.xzjmyk.pm.activity.util.DateFormatUtil;
|
|
|
import com.xzjmyk.pm.activity.util.DisplayUtil;
|
|
|
import com.xzjmyk.pm.activity.util.StringUtils;
|
|
|
+import com.xzjmyk.pm.activity.util.TimeUtils;
|
|
|
import com.xzjmyk.pm.activity.view.wheel.DatePicker;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
@@ -81,6 +83,8 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
private TextView tv_rank_sale_right;
|
|
|
@ViewInject(R.id.tv_rank_rirun_left)
|
|
|
private TextView tv_rank_rirun_left;
|
|
|
+ @ViewInject(R.id.subs_tv)
|
|
|
+ private TextView subs_tv;
|
|
|
@ViewInject(R.id.tv_rank_rirun_right)
|
|
|
private TextView tv_rank_rirun_right;
|
|
|
@ViewInject(R.id.tv_rank_visit_left)
|
|
|
@@ -129,9 +133,17 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
private TextView tv_em_saleb;
|
|
|
@ViewInject(R.id.tv_em_salec)
|
|
|
private TextView tv_em_salec;
|
|
|
+ @ViewInject(R.id.ib_forget_condition)
|
|
|
+ private TextView ib_forget_condition;
|
|
|
|
|
|
@ViewInject(R.id.tv_cu_count)
|
|
|
private TextView tv_cu_count;
|
|
|
+ @ViewInject(R.id.tv_customer_name)
|
|
|
+ private TextView tv_customer_name;
|
|
|
+ @ViewInject(R.id.tv_customer_lastTime)
|
|
|
+ private TextView tv_customer_lastTime;
|
|
|
+ @ViewInject(R.id.tv_customer_days)
|
|
|
+ private TextView tv_customer_days;
|
|
|
|
|
|
@ViewInject(R.id.ib_ranking_condition)
|
|
|
private TextView ib_ranking_condition;
|
|
|
@@ -172,6 +184,9 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
private TextView tv_huikuan;
|
|
|
@ViewInject(R.id.tv_chuhuo)
|
|
|
private TextView tv_chuhuo;
|
|
|
+ private JSONArray subs;
|
|
|
+ private String date;
|
|
|
+ private JSONArray custs;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -197,6 +212,8 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
ib_customer_vistor.setOnClickListener(this);
|
|
|
ib_ranking_condition.setOnClickListener(this);
|
|
|
ib_index_condition.setOnClickListener(this);
|
|
|
+ subs_tv.setOnClickListener(this);
|
|
|
+ ib_forget_condition.setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
@@ -388,7 +405,7 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
set1.setColors(JOYFUL_COLORS);
|
|
|
//set1.setVisible(false);
|
|
|
//set1.setDrawValues(false);
|
|
|
- set1.setValueFormatter(new ValueFormatter() {
|
|
|
+ /*set1.setValueFormatter(new ValueFormatter() {
|
|
|
private DecimalFormat mFormat;
|
|
|
|
|
|
public void DefaultValueFormatter(int digits) {
|
|
|
@@ -399,7 +416,6 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
b.append(".");
|
|
|
b.append("0");
|
|
|
}
|
|
|
-
|
|
|
mFormat = new DecimalFormat("###,###,###,##0" + b.toString());
|
|
|
}
|
|
|
|
|
|
@@ -416,7 +432,7 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
- });
|
|
|
+ });*/
|
|
|
dataSets.clear();
|
|
|
dataSets.add(set1);
|
|
|
|
|
|
@@ -518,6 +534,23 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
case R.id.ib_ranking_condition:
|
|
|
showDateDialog(R.id.ib_ranking_condition);
|
|
|
break;
|
|
|
+ case R.id.subs_tv://当点击更多
|
|
|
+ //判断是否可以进去
|
|
|
+ if (subs != null && subs.size() > 3) {
|
|
|
+ Intent intent = new Intent(ct, SubsActivity.class);
|
|
|
+ intent.putExtra("type", 1);
|
|
|
+ intent.putExtra("data", subs.toString());
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case R.id.ib_forget_condition:
|
|
|
+ if (custs != null && custs.size() > 0) {
|
|
|
+ Intent intent = new Intent(ct, SubsActivity.class);
|
|
|
+ intent.putExtra("data", custs.toString());
|
|
|
+ intent.putExtra("type", 2);
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
+ break;
|
|
|
/* case R.id.ib_em_condition:
|
|
|
showDateDialog(R.id.ib_em_condition);
|
|
|
break;*/
|
|
|
@@ -778,69 +811,80 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
//解析指标和下属
|
|
|
if (!root.getJSONArray("target").isEmpty()) {
|
|
|
JSONObject target = root.getJSONArray("target").getJSONObject(0);
|
|
|
- tv_em_a.setText(target.getString("CUSTOMERCOUNT"));
|
|
|
+ if (date.equals(DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM")))
|
|
|
+ tv_em_a.setText(target.getString("CUSTOMERCOUNT"));
|
|
|
float[] ydata = {0, 0, 0, 0, 0, 0, 0};
|
|
|
ydata[1] = target.getIntValue("RANK");
|
|
|
- ydata[0] = target.getFloatValue("FIRSTBFCOUNT");
|
|
|
+ float firstbfcount = target.getFloatValue("FIRSTBFCOUNT");
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(firstbfcount);
|
|
|
+ ydata[0] = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
|
|
ydata[3] = target.getIntValue("TOPCOUNT");
|
|
|
- ydata[2] = target.getFloatValue("ACTUALPROFIT");
|
|
|
+ bigDecimal = new BigDecimal(target.getFloatValue("ACTUALPROFIT"));
|
|
|
+ ydata[2] = bigDecimal.setScale(2,BigDecimal.ROUND_HALF_UP).floatValue();
|
|
|
setData(7, ydata);
|
|
|
} else {
|
|
|
float[] ydata = {0, 0, 0, 0, 0, 0, 0};
|
|
|
setData(7, ydata);
|
|
|
}
|
|
|
- if (!root.getJSONArray("subs").isEmpty()) {
|
|
|
- int size = root.getJSONArray("subs").size();
|
|
|
+ if (!date.equals(DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM"))) return;
|
|
|
+ subs = root.containsKey("subs") ? root.getJSONArray("subs") : new JSONArray();
|
|
|
+ if (!subs.isEmpty()) {
|
|
|
+ int size = subs.size();
|
|
|
ll_data_one.setVisibility(View.GONE);
|
|
|
ll_data_two.setVisibility(View.GONE);
|
|
|
ll_data_three.setVisibility(View.GONE);
|
|
|
switch (size) {
|
|
|
case 3:
|
|
|
- tv_em_c.setText(root.getJSONArray("subs").getJSONObject(2).getString("CUSTOMERCOUNT"));
|
|
|
+ tv_em_c.setText(subs.getJSONObject(2).getString("CUSTOMERCOUNT"));
|
|
|
ll_data_three.setVisibility(View.VISIBLE);
|
|
|
- tv_em_salec.setText(getFloat(root.getJSONArray("subs").getJSONObject(2).getFloatValue("FIRSTBFCOUNT"))
|
|
|
- + "/" + getFloat(root.getJSONArray("subs").getJSONObject(2).getFloatValue("ACTUALPROFIT")));
|
|
|
- tv_em_planc.setText(getFloat(root.getJSONArray("subs").getJSONObject(2).getIntValue("RANK"))
|
|
|
- + "/" + getFloat(root.getJSONArray("subs").getJSONObject(2).getIntValue("TOPCOUNT")));
|
|
|
+ tv_em_salec.setText(getFloat(subs.getJSONObject(2).getFloatValue("FIRSTBFCOUNT"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(2).getFloatValue("ACTUALPROFIT")));
|
|
|
+ tv_em_planc.setText(getFloat(subs.getJSONObject(2).getIntValue("RANK"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(2).getIntValue("TOPCOUNT")));
|
|
|
case 2:
|
|
|
- tv_em_b.setText(root.getJSONArray("subs").getJSONObject(1).getString("CUSTOMERCOUNT"));
|
|
|
+ tv_em_b.setText(subs.getJSONObject(1).getString("CUSTOMERCOUNT"));
|
|
|
ll_data_two.setVisibility(View.VISIBLE);
|
|
|
- tv_em_saleb.setText(getFloat(root.getJSONArray("subs").getJSONObject(1).getFloatValue("FIRSTBFCOUNT"))
|
|
|
- + "/" + getFloat(root.getJSONArray("subs").getJSONObject(1).getFloatValue("ACTUALPROFIT")));
|
|
|
- tv_em_planb.setText(getFloat(root.getJSONArray("subs").getJSONObject(1).getIntValue("RANK"))
|
|
|
- + "/" + getFloat(root.getJSONArray("subs").getJSONObject(1).getIntValue("TOPCOUNT")));
|
|
|
+ tv_em_saleb.setText(getFloat(subs.getJSONObject(1).getFloatValue("FIRSTBFCOUNT"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(1).getFloatValue("ACTUALPROFIT")));
|
|
|
+ tv_em_planb.setText(getFloat(subs.getJSONObject(1).getIntValue("RANK"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(1).getIntValue("TOPCOUNT")));
|
|
|
case 1:
|
|
|
- tv_em_a.setText(root.getJSONArray("subs").getJSONObject(0).getString("CUSTOMERCOUNT"));
|
|
|
+ tv_em_a.setText(subs.getJSONObject(0).getString("CUSTOMERCOUNT"));
|
|
|
ll_data_one.setVisibility(View.VISIBLE);
|
|
|
- tv_em_salea.setText(getFloat(root.getJSONArray("subs").getJSONObject(0).getFloatValue("FIRSTBFCOUNT"))
|
|
|
- + "/" + getFloat(root.getJSONArray("subs").getJSONObject(0).getFloatValue("ACTUALPROFIT")));
|
|
|
- tv_em_plana.setText(getFloat(root.getJSONArray("subs").getJSONObject(0).getIntValue("RANK"))
|
|
|
- + "/" + getFloat(root.getJSONArray("subs").getJSONObject(0).getIntValue("TOPCOUNT")));
|
|
|
+ tv_em_salea.setText(getFloat(subs.getJSONObject(0).getFloatValue("FIRSTBFCOUNT"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(0).getFloatValue("ACTUALPROFIT")));
|
|
|
+ tv_em_plana.setText(getFloat(subs.getJSONObject(0).getIntValue("RANK"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(0).getIntValue("TOPCOUNT")));
|
|
|
break;
|
|
|
default:
|
|
|
- ll_data_one.setVisibility(View.VISIBLE);
|
|
|
- ll_data_two.setVisibility(View.VISIBLE);
|
|
|
- ll_data_three.setVisibility(View.VISIBLE);
|
|
|
- tv_em_a.setText(root.getJSONArray("subs").getJSONObject(0).getString("CUSTOMERCOUNT"));
|
|
|
- tv_em_b.setText(root.getJSONArray("subs").getJSONObject(1).getString("CUSTOMERCOUNT"));
|
|
|
- tv_em_c.setText(root.getJSONArray("subs").getJSONObject(2).getString("CUSTOMERCOUNT"));
|
|
|
- tv_em_plana.setText(root.getJSONArray("subs").getJSONObject(0).getFloatValue("FIRSTBFCOUNT")
|
|
|
- + "/" + root.getJSONArray("subs").getJSONObject(0).getFloatValue("ACTUALPROFIT"));
|
|
|
- tv_em_salea.setText(root.getJSONArray("subs").getJSONObject(0).getIntValue("RANK")
|
|
|
- + "/" + root.getJSONArray("subs").getJSONObject(0).getIntValue("TOPCOUNT"));
|
|
|
- tv_em_planb.setText(root.getJSONArray("subs").getJSONObject(1).getFloatValue("FIRSTBFCOUNT")
|
|
|
- + "/" + root.getJSONArray("subs").getJSONObject(1).getFloatValue("ACTUALPROFIT"));
|
|
|
- tv_em_saleb.setText(root.getJSONArray("subs").getJSONObject(1).getIntValue("RANK")
|
|
|
- + "/" + root.getJSONArray("subs").getJSONObject(1).getIntValue("TOPCOUNT"));
|
|
|
- tv_em_planc.setText(root.getJSONArray("subs").getJSONObject(2).getFloatValue("FIRSTBFCOUNT")
|
|
|
- + "/" + root.getJSONArray("subs").getJSONObject(2).getFloatValue("ACTUALPROFIT"));
|
|
|
- tv_em_salec.setText(root.getJSONArray("subs").getJSONObject(2).getIntValue("RANK")
|
|
|
- + "/" + root.getJSONArray("subs").getJSONObject(2).getIntValue("TOPCOUNT"));
|
|
|
break;
|
|
|
}
|
|
|
- ll_data_empty.setVisibility(View.GONE);
|
|
|
+ if (size > 3) {
|
|
|
+ tv_em_c.setText(subs.getJSONObject(2).getString("CUSTOMERCOUNT"));
|
|
|
+ tv_em_b.setText(subs.getJSONObject(1).getString("CUSTOMERCOUNT"));
|
|
|
+ tv_em_a.setText(subs.getJSONObject(0).getString("CUSTOMERCOUNT"));
|
|
|
+ ll_data_one.setVisibility(View.VISIBLE);
|
|
|
+ ll_data_two.setVisibility(View.VISIBLE);
|
|
|
+ ll_data_three.setVisibility(View.VISIBLE);
|
|
|
+ tv_em_salec.setText(getFloat(subs.getJSONObject(2).getFloatValue("FIRSTBFCOUNT"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(2).getFloatValue("ACTUALPROFIT")));
|
|
|
+ tv_em_planc.setText(getFloat(subs.getJSONObject(2).getIntValue("RANK"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(2).getIntValue("TOPCOUNT")));
|
|
|
+ tv_em_saleb.setText(getFloat(subs.getJSONObject(1).getFloatValue("FIRSTBFCOUNT"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(1).getFloatValue("ACTUALPROFIT")));
|
|
|
+ tv_em_planb.setText(getFloat(subs.getJSONObject(1).getIntValue("RANK"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(1).getIntValue("TOPCOUNT")));
|
|
|
+ tv_em_salea.setText(getFloat(subs.getJSONObject(0).getFloatValue("FIRSTBFCOUNT"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(0).getFloatValue("ACTUALPROFIT")));
|
|
|
+ tv_em_plana.setText(getFloat(subs.getJSONObject(0).getIntValue("RANK"))
|
|
|
+ + "/" + getFloat(subs.getJSONObject(0).getIntValue("TOPCOUNT")));
|
|
|
+ ll_data_empty.setVisibility(View.VISIBLE);
|
|
|
+ subs_tv.setText("点击查看更多");
|
|
|
+ } else
|
|
|
+ ll_data_empty.setVisibility(View.GONE);
|
|
|
} else {
|
|
|
ll_data_empty.setVisibility(View.VISIBLE);
|
|
|
+ subs_tv.setText("暂时没有数据");
|
|
|
ll_data_one.setVisibility(View.GONE);
|
|
|
ll_data_two.setVisibility(View.GONE);
|
|
|
ll_data_three.setVisibility(View.GONE);
|
|
|
@@ -849,14 +893,26 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
case INIT_InactionCusts:
|
|
|
progressDialog.dismiss();
|
|
|
Log.i(TAG, "handleMessage InactionCusts:" + msg.getData().getString("result"));
|
|
|
- if (JSON.parseObject(msg.getData().getString("result")).get("data") instanceof JSONObject) {
|
|
|
- root = JSON.parseObject(msg.getData().getString("result")).getJSONObject("datas");
|
|
|
- CommonUtil.textAarrySpanForStyle(tv_cu_count,
|
|
|
- root.getIntValue("customernum") + " 个"
|
|
|
- , new String[]{String.valueOf(root.getIntValue("customernum"))},
|
|
|
- ct.getResources().getColor(R.color.yellow_home));
|
|
|
- ll_data_empty1.setVisibility(View.GONE);
|
|
|
- ll_customer_lost.setVisibility(View.VISIBLE);
|
|
|
+ String message = msg.getData().getString("result");
|
|
|
+ if (JSON.parseObject(message).get("datas") instanceof JSONObject) {
|
|
|
+ root = JSON.parseObject(message).getJSONObject("datas");
|
|
|
+ custs = root.getJSONArray("cusdatas");
|
|
|
+ if (custs != null && custs.size() > 0) {
|
|
|
+ tv_customer_name.setText(getValues(custs.getJSONArray(0), 0));
|
|
|
+ String time = getValues(custs.getJSONArray(0), 1);
|
|
|
+ tv_customer_lastTime.setText(time);
|
|
|
+ if (time.length() > 5)//容cuo
|
|
|
+ {
|
|
|
+ int i = (int) ((System.currentTimeMillis() - TimeUtils.s_str_2_long(time)) / (60 * 1000 * 24 * 60));
|
|
|
+ tv_customer_days.setText("距离上次跟进" + i + "天");
|
|
|
+ }
|
|
|
+ ll_data_empty1.setVisibility(View.GONE);
|
|
|
+ ll_customer_lost.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ //无数据处理
|
|
|
+ ll_customer_lost.setVisibility(View.GONE);
|
|
|
+ ll_data_empty1.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
} else {
|
|
|
//无数据处理
|
|
|
ll_customer_lost.setVisibility(View.GONE);
|
|
|
@@ -901,11 +957,16 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
return df.format(f);
|
|
|
}
|
|
|
|
|
|
+ private String getValues(JSONArray array, int i) {
|
|
|
+ return array.getString(i) == null ? "" : array.getString(i);
|
|
|
+ }
|
|
|
+
|
|
|
private void sendHttpResquest() {
|
|
|
sendInactionCusts();
|
|
|
- sendPersonalRank(DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM"));
|
|
|
- sendSalesKit(DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM"));
|
|
|
- sendTargets(DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM"));
|
|
|
+ date = DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM");
|
|
|
+ sendPersonalRank(date);
|
|
|
+ sendSalesKit(date);
|
|
|
+ sendTargets(date);
|
|
|
}
|
|
|
|
|
|
private void sendInactionCusts() {
|
|
|
@@ -921,6 +982,7 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
}
|
|
|
|
|
|
private void sendTargets(String date) {
|
|
|
+ this.date = date;
|
|
|
progressDialog.show();
|
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
String url;
|