Browse Source

Merge branch 'developer' of https://gitlab.com/Arisono/SkWeiChat-Baidu into developer

Bitliker 7 years ago
parent
commit
239d5cf7b5

+ 87 - 2
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/ClientActivity.java

@@ -8,6 +8,8 @@ import android.graphics.drawable.BitmapDrawable;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.Menu;
@@ -49,6 +51,11 @@ import com.handmark.pulltorefresh.library.PullToRefreshBase;
 import com.handmark.pulltorefresh.library.PullToRefreshScrollView;
 import com.lidroid.xutils.ViewUtils;
 import com.lidroid.xutils.view.annotation.ViewInject;
+import com.me.network.app.base.HttpCallback;
+import com.me.network.app.base.HttpParams;
+import com.me.network.app.http.HttpRequest;
+import com.me.network.app.http.Method;
+import com.modular.apputils.utils.RecyclerItemDecoration;
 import com.uas.appworks.CRM.erp.activity.AddBusinessActivity;
 import com.uas.appworks.CRM.erp.activity.BusinessActivity;
 import com.uas.appworks.CRM.erp.activity.BusinessAddActivity;
@@ -58,6 +65,8 @@ import com.uas.appworks.CRM.erp.activity.SalesRankingActivity;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.erp.activity.oa.AddVisitReportActivity;
 import com.xzjmyk.pm.activity.ui.erp.activity.oa.OAActivity;
+import com.xzjmyk.pm.activity.ui.erp.adapter.SellHonorAdapter;
+import com.xzjmyk.pm.activity.ui.erp.model.SellHonorBean;
 import com.xzjmyk.pm.activity.ui.erp.view.MyMarkerView;
 import com.xzjmyk.pm.activity.util.oa.CommonUtil;
 import com.xzjmyk.pm.activity.view.crouton.Style;
@@ -204,6 +213,9 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
     private PullToRefreshScrollView mPullToRefreshScrollView;
     private String[] mMonths;
     private String[] sales;
+    private RecyclerView mHonorRecyclerView;
+    private SellHonorAdapter mSellHonorAdapter;
+    private List<SellHonorBean> mSellHonorBeans;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -216,6 +228,16 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
 
     private void initView() {
         setTitle(R.string.sales_statistics);
+
+        mHonorRecyclerView = findViewById(R.id.client_sell_honor_rv);
+        mHonorRecyclerView.setLayoutManager(new LinearLayoutManager(this));
+        mHonorRecyclerView.addItemDecoration(new RecyclerItemDecoration(1));
+        mHonorRecyclerView.setNestedScrollingEnabled(false);
+
+        mSellHonorBeans = new ArrayList<>();
+        mSellHonorAdapter = new SellHonorAdapter(mSellHonorBeans);
+        mHonorRecyclerView.setAdapter(mSellHonorAdapter);
+
         initBarChart();
         initSaleBarChart();
         initListener();
@@ -257,6 +279,69 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
         if (CommonUtil.isNetWorkConnected(ct)) {
             sendHttpResquest();
             isHasSubordinate(6);//下属
+
+            HttpRequest.getInstance().sendRequest(CommonUtil.getAppBaseUrl(this),
+                    new HttpParams.Builder()
+                            .url("mobile/crm/getRankList.action")
+                            .method(Method.POST)
+                            .addParam("condition", "and to_char(pi_date,'yyyymm')=" + DateFormatUtil.getStrDate4Date(new Date(),
+                                    "yyyyMM"))
+                            .addHeader("Cookie", com.core.utils.CommonUtil.getErpCookie(this))
+                            .build(), new HttpCallback() {
+                        @Override
+                        public void onSuccess(int flag, Object o) throws Exception {
+                            try {
+                                String result = o.toString();
+                                JSONObject resultObject = JSON.parseObject(result);
+                                JSONObject rankListObject = resultObject.getJSONObject("ranklist");
+                                if (rankListObject != null) {
+                                    JSONArray salesArray = rankListObject.getJSONArray("sales");
+                                    JSONArray profitsArray = rankListObject.getJSONArray("profits");
+
+                                    float s_id = salesArray.getFloatValue(0);
+                                    String s_name = salesArray.getString(1);
+                                    String s_position = salesArray.getString(2);
+                                    String s_depart = salesArray.getString(3);
+                                    int s_imid = salesArray.getIntValue(4);
+
+                                    SellHonorBean salesHonor = new SellHonorBean();
+                                    salesHonor.setId(s_id + "");
+                                    salesHonor.setName(s_name);
+                                    salesHonor.setPosition(s_position);
+                                    salesHonor.setDepart(s_depart);
+                                    salesHonor.setImid(s_imid + "");
+                                    salesHonor.setDesc("销售总额冠军");
+
+                                    float p_id = profitsArray.getFloatValue(0);
+                                    String p_name = profitsArray.getString(1);
+                                    String p_position = profitsArray.getString(2);
+                                    String p_depart = profitsArray.getString(3);
+                                    int p_imid = profitsArray.getIntValue(4);
+
+                                    SellHonorBean profitsHonor = new SellHonorBean();
+                                    profitsHonor.setId(p_id + "");
+                                    profitsHonor.setName(p_name);
+                                    profitsHonor.setPosition(p_position);
+                                    profitsHonor.setDepart(p_depart);
+                                    profitsHonor.setImid(p_imid + "");
+                                    profitsHonor.setDesc("毛利润冠军");
+
+                                    mSellHonorBeans.clear();
+                                    mSellHonorBeans.add(salesHonor);
+                                    mSellHonorBeans.add(profitsHonor);
+
+                                    mSellHonorAdapter.notifyDataSetChanged();
+                                }
+                            } catch (Exception e) {
+
+                            }
+                        }
+
+                        @Override
+                        public void onFail(int flag, String failStr) throws Exception {
+
+                        }
+                    });
         } else {
             ToastUtil.showToast(ct, R.string.networks_out);
         }
@@ -393,7 +478,7 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.menu_crm, menu);
+//        getMenuInflater().inflate(R.menu.menu_crm, menu);
         return true;
     }
 
@@ -618,7 +703,7 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
                             if (!StringUtil.isEmpty(CommonUtil.getSharedPreferences(ct, "erp_username")) && !StringUtil.isEmpty(array.getString(2))
                                     && array.getString(2).equals(CommonUtil.getSharedPreferences(ct, "erp_username"))) {
                                 CommonUtil.textAarrySpanForStyle(tv_rank_sale_left,
-                                        getString(R.string.crm_di) + array.get(3) +  getString(R.string.crm_ming)
+                                        getString(R.string.crm_di) + array.get(3) + getString(R.string.crm_ming)
                                                 + ""
                                         , new String[]{
                                                 String.valueOf(array.get(3))},

+ 37 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/adapter/SellHonorAdapter.java

@@ -0,0 +1,37 @@
+package com.xzjmyk.pm.activity.ui.erp.adapter;
+
+import android.support.annotation.Nullable;
+import android.widget.ImageView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.core.utils.helper.AvatarHelper;
+import com.xzjmyk.pm.activity.R;
+import com.xzjmyk.pm.activity.ui.erp.model.SellHonorBean;
+
+import java.util.List;
+
+/**
+ * @author RaoMeng
+ * @describe
+ * @date 2018/10/11 15:19
+ */
+public class SellHonorAdapter extends BaseQuickAdapter<SellHonorBean, BaseViewHolder> {
+
+    public SellHonorAdapter(@Nullable List<SellHonorBean> data) {
+        super(R.layout.item_list_sell_honor, data);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder helper, SellHonorBean item) {
+        ImageView headImg = (ImageView) helper.getView(R.id.sell_honor_head_iv);
+        AvatarHelper.getInstance().display(
+                item.getImid(), headImg, true, true);
+
+        helper.setText(R.id.sell_honor_name_tv, item.getName());
+        helper.setText(R.id.sell_honor_money_tv, item.getId() + "万元");
+        helper.setText(R.id.sell_honor_content_tv, item.getDesc());
+        helper.setText(R.id.sell_honor_position_tv, item.getPosition());
+        helper.setText(R.id.sell_honor_branch_tv, item.getDepart());
+    }
+}

+ 63 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/model/SellHonorBean.java

@@ -0,0 +1,63 @@
+package com.xzjmyk.pm.activity.ui.erp.model;
+
+/**
+ * @author RaoMeng
+ * @describe
+ * @date 2018/10/11 15:29
+ */
+public class SellHonorBean {
+    private String id;
+    private String name;
+    private String position;
+    private String depart;
+    private String imid;
+    private String desc;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPosition() {
+        return position;
+    }
+
+    public void setPosition(String position) {
+        this.position = position;
+    }
+
+    public String getDepart() {
+        return depart;
+    }
+
+    public void setDepart(String depart) {
+        this.depart = depart;
+    }
+
+    public String getImid() {
+        return imid;
+    }
+
+    public void setImid(String imid) {
+        this.imid = imid;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+}

BIN
app_core/common/src/main/res/drawable-hdpi/ic_sell_header.png


BIN
app_core/common/src/main/res/drawable-hdpi/ic_sell_honor.png


BIN
app_core/common/src/main/res/drawable-xhdpi/ic_sell_header.png


BIN
app_core/common/src/main/res/drawable-xhdpi/ic_sell_honor.png


BIN
app_core/common/src/main/res/drawable-xxhdpi/ic_sell_header.png


BIN
app_core/common/src/main/res/drawable-xxhdpi/ic_sell_honor.png


+ 37 - 3
app_core/common/src/main/res/layout/activity_client.xml

@@ -118,7 +118,8 @@
             <!--我的排名-->
             <LinearLayout
                 style="@style/crm_ll_card"
-                android:layout_margin="0dp">
+                android:layout_margin="0dp"
+                android:visibility="gone">
 
                 <RelativeLayout
                     android:layout_width="match_parent"
@@ -476,7 +477,6 @@
                     android:visibility="gone"></View>
             </LinearLayout>
 
-
             <LinearLayout
                 android:id="@+id/ll_subordinate"
                 style="@style/crm_ll_card"
@@ -831,7 +831,6 @@
                 </LinearLayout>
             </LinearLayout>
 
-
             <LinearLayout
                 style="@style/crm_ll_card"
                 android:layout_height="wrap_content"
@@ -1076,6 +1075,41 @@
                 </LinearLayout>
 
             </LinearLayout>
+
+            <LinearLayout
+                style="@style/crm_ll_card"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="0dp"
+                android:layout_marginRight="0dp"
+                android:layout_marginTop="10dp">
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal"
+                    android:padding="10dp">
+
+                    <ImageView
+                        android:layout_width="56dp"
+                        android:layout_height="56dp"
+                        android:layout_marginLeft="10dp"
+                        android:src="@drawable/ic_sell_honor" />
+
+                    <TextView
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:padding="5dp"
+                        android:text="@string/Wall_of_Fame_description"
+                        android:textColor="#FF666666"
+                        android:textSize="12sp" />
+                </LinearLayout>
+
+                <android.support.v7.widget.RecyclerView
+                    android:id="@+id/client_sell_honor_rv"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+            </LinearLayout>
+
         </LinearLayout>
     </com.handmark.pulltorefresh.library.PullToRefreshScrollView>
 

+ 79 - 0
app_core/common/src/main/res/layout/item_list_sell_honor.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:gravity="center_vertical"
+    android:orientation="horizontal"
+    android:padding="10dp">
+
+    <de.hdodenhof.circleimageview.CircleImageView
+        android:id="@+id/sell_honor_head_iv"
+        android:layout_width="50dp"
+        android:layout_height="50dp"
+        />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="10dp"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+
+            <TextView
+                android:id="@+id/sell_honor_name_tv"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:textColor="#FF333333"
+                android:textSize="15sp"
+                tools:text="饶猛" />
+
+            <TextView
+                android:id="@+id/sell_honor_money_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="#FFFF8F00"
+                android:textSize="18sp"
+                tools:text="35.7万元" />
+        </LinearLayout>
+
+        <TextView
+            android:id="@+id/sell_honor_content_tv"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="4dp"
+            android:textColor="#FF666666"
+            android:textSize="14sp"
+            tools:text="销售总额冠军" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="4dp">
+
+            <TextView
+                android:id="@+id/sell_honor_position_tv"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:textColor="#FFA7A7A7"
+                android:textSize="12sp"
+                tools:text="销售工程师" />
+
+            <TextView
+                android:id="@+id/sell_honor_branch_tv"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="10dp"
+                android:layout_weight="1"
+                android:textColor="#FFA7A7A7"
+                android:textSize="12sp"
+                tools:text="创泰华东销售二部" />
+        </LinearLayout>
+    </LinearLayout>
+</LinearLayout>