|
|
@@ -50,8 +50,11 @@ import com.xzjmyk.pm.activity.ui.erp.util.Constants;
|
|
|
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.ToastUtil;
|
|
|
+import com.xzjmyk.pm.activity.view.wheel.DatePicker;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
|
@@ -124,6 +127,15 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
|
|
|
@ViewInject(R.id.tv_cu_count)
|
|
|
private TextView tv_cu_count;
|
|
|
+
|
|
|
+ @ViewInject(R.id.ib_ranking_condition)
|
|
|
+ private ImageButton ib_ranking_condition;
|
|
|
+ @ViewInject(R.id.ib_sale_condition)
|
|
|
+ private ImageButton ib_sale_condition;
|
|
|
+ @ViewInject(R.id.ib_index_condition)
|
|
|
+ private ImageButton ib_index_condition;
|
|
|
+ @ViewInject(R.id.ib_em_condition)
|
|
|
+ private ImageButton ib_em_condition;
|
|
|
|
|
|
@ViewInject(R.id.crm_chart_bar)
|
|
|
private BarChart mChart;
|
|
|
@@ -153,6 +165,11 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
ib_business.setOnClickListener(this);
|
|
|
ib_customer.setOnClickListener(this);
|
|
|
ib_waller.setOnClickListener(this);
|
|
|
+
|
|
|
+ ib_sale_condition.setOnClickListener(this);
|
|
|
+ ib_ranking_condition.setOnClickListener(this);
|
|
|
+ ib_index_condition.setOnClickListener(this);
|
|
|
+ ib_em_condition.setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
@@ -295,7 +312,18 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
case R.id.ib_waller:
|
|
|
startActivity(new Intent(this, SalesRankingActivity.class));
|
|
|
break;
|
|
|
-
|
|
|
+ case R.id.ib_sale_condition:
|
|
|
+ showDateDialog(R.id.ib_sale_condition);
|
|
|
+ break;
|
|
|
+ case R.id.ib_index_condition:
|
|
|
+ showDateDialog(R.id.ib_index_condition);
|
|
|
+ break;
|
|
|
+ case R.id.ib_ranking_condition:
|
|
|
+ showDateDialog(R.id.ib_ranking_condition);
|
|
|
+ break;
|
|
|
+ case R.id.ib_em_condition:
|
|
|
+ showDateDialog(R.id.ib_em_condition);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -510,6 +538,13 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
|
|
|
|
|
|
private void sendHttpResquest() {
|
|
|
+ sendInactionCusts();
|
|
|
+ sendPersonalRank(DateFormatUtil.getStrDate4Date(new Date(),"yyyyMM"));
|
|
|
+ sendSalesKit(DateFormatUtil.getStrDate4Date(new Date(),"yyyyMM"));
|
|
|
+ sendTargets(DateFormatUtil.getStrDate4Date(new Date(),"yyyyMM"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sendInactionCusts() {
|
|
|
progressDialog.show();
|
|
|
String url = Constants.getAppBaseUrl(ct) + "mobile/crm/getInactionCusts.action";
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
@@ -519,27 +554,47 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, INIT_InactionCusts, null, null, "post");
|
|
|
+ }
|
|
|
|
|
|
- url = Constants.getAppBaseUrl(ct) + "mobile/crm/getPersonalRank.action";
|
|
|
+ private void sendTargets(String date) {
|
|
|
+ progressDialog.show();
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ String url;
|
|
|
+ Map<String, Object> params;
|
|
|
+ url = Constants.getAppBaseUrl(ct) + "mobile/crm/getTargets.action";
|
|
|
params = new HashMap<>();
|
|
|
params.put("emcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
- params.put("yearmonth", DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM"));
|
|
|
-
|
|
|
- ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, INIT_PersonalRank, null, null, "post");
|
|
|
+ params.put("yearmonth", date);
|
|
|
+ params.put("page", "1");
|
|
|
+ params.put("pageSize", "10");
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, INIT_Targets, null, null, "post");
|
|
|
+ }
|
|
|
|
|
|
+ private void sendSalesKit(String date) {
|
|
|
+ progressDialog.show();
|
|
|
+ String url;
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ Map<String, Object> params;
|
|
|
url = Constants.getAppBaseUrl(ct) + "mobile/crm/getSalesKit.action";
|
|
|
params = new HashMap<>();
|
|
|
params.put("emcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
- params.put("yearmonth", DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM"));
|
|
|
+ params.put("yearmonth", date);
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, INIT_SalesKit, null, null, "post");
|
|
|
+ }
|
|
|
|
|
|
- url = Constants.getAppBaseUrl(ct) + "mobile/crm/getTargets.action";
|
|
|
+ private void sendPersonalRank(String date) {
|
|
|
+ progressDialog.show();
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();;
|
|
|
+ String url;
|
|
|
+ Map<String, Object> params;
|
|
|
+ url = Constants.getAppBaseUrl(ct) + "mobile/crm/getPersonalRank.action";
|
|
|
params = new HashMap<>();
|
|
|
params.put("emcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
- params.put("yearmonth", DateFormatUtil.getStrDate4Date(new Date(), "yyyyMM"));
|
|
|
- params.put("page", "1");
|
|
|
- params.put("pageSize", "10");
|
|
|
- ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, INIT_Targets, null, null, "post");
|
|
|
+ params.put("yearmonth", date);
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, INIT_PersonalRank, null, null, "post");
|
|
|
}
|
|
|
|
|
|
//需要抽取的代码
|
|
|
@@ -642,5 +697,39 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
|
|
|
list.add(map);
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private void showDateDialog(final int resId) {
|
|
|
+ DatePicker picker = new DatePicker(this,DatePicker.YEAR_MONTH);
|
|
|
+ picker.setRange(1950, 2030);
|
|
|
+ //Calendar.getInstance().get(Calendar.DAY_OF_MONTH)
|
|
|
+ picker.setSelectedItem(
|
|
|
+ Calendar.getInstance().get(Calendar.YEAR),
|
|
|
+ Calendar.getInstance().get(Calendar.MONTH) + 1);
|
|
|
+ picker.setOnDatePickListener(new DatePicker.OnYearMonthPickListener() {
|
|
|
+ @Override
|
|
|
+ public void onDatePicked(String year, String month) {
|
|
|
+// ToastUtil.showToast(ct, year + "-" + month + "-" + day);
|
|
|
+ switch (resId) {
|
|
|
+ case R.id.ib_ranking_condition://排名
|
|
|
+ ToastUtil.showToast(ct, year + "-" + month );
|
|
|
+ sendPersonalRank(year+month);
|
|
|
+ break;
|
|
|
+ case R.id.ib_index_condition://图表
|
|
|
+ ToastUtil.showToast(ct, year + "-" + month );
|
|
|
+ sendTargets(year+month);
|
|
|
+ break;
|
|
|
+ case R.id.ib_sale_condition://销售
|
|
|
+ ToastUtil.showToast(ct, year + "-" + month );
|
|
|
+ sendSalesKit(year+month);
|
|
|
+ break;
|
|
|
+ case R.id.ib_em_condition://下属
|
|
|
+ sendTargets(year+month);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ picker.show();
|
|
|
+ }
|
|
|
}
|
|
|
|