Browse Source

2016/09/09 bug功能完善 待测试

Bitliker 10 years ago
parent
commit
c93ec890c0

+ 34 - 20
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/oa/OAActivity.java

@@ -88,7 +88,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
     private int tag = 1;
     private ArrayList<OABean> meBeans = null;
     private ArrayList<OABean> otherBeans = null;
-    private List<OABean> showBeans = new ArrayList<>();
+    private List<OABean> showOtherBeans = null;
     private MyListViewAdapter adapter;
     private EmptyLayout mEmptyLayout;
 
@@ -139,7 +139,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
             String time = b.getStartdate() == null ? b.getEnddate() : b.getStartdate();
             if (time == null) continue;
             c.setTimeInMillis(TimeUtils.f_str_2_long(time));
-            if (c.get(Calendar.DAY_OF_MONTH) == CalendarUtils.getCurrentDate()) {//当前 天的任务
+            if (c.get(Calendar.DAY_OF_MONTH) == CalendarUtils.getCurrentDate()) {//当前天的任务
                 chche.add(b);
             }
         }
@@ -149,16 +149,13 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
         } else {
             adapter.setBeans(chche);
         }
+        setTaskDay(tag == 1 ? meBeans : otherBeans);
     }
 
-    private void setTaskDay() {
-        if (ListUtils.isEmpty(showBeans)) {
-            picker.setTaskDay(new int[]{0});
-            return;
-        }
+    private void setTaskDay(List<OABean> beans) {
         Calendar c = Calendar.getInstance();
         ArrayList<Integer> tasks = new ArrayList<>();
-        for (OABean b : showBeans) {
+        for (OABean b : beans) {
             String time = b.getStartdate() == null ? b.getEnddate() : b.getStartdate();
             if (time == null) continue;
             if (getIntent() == null || getIntent().getIntExtra("type", 0) != 1) {//非crm
@@ -244,7 +241,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
             }
             List<OABean> chche = new ArrayList<>();
             String name = "," + entity.getName().trim() + ",";
-
+            Log.i("gongpengming", name);
             if (name == null) return;
             String nameStr;
             for (OABean e : otherBeans) {
@@ -257,11 +254,15 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                 } else if (e.getRecordman() != null) {//拜访
                     if (e.getRecordman() == null || e.getRecordman().length() <= 0) continue;
                     nameStr = "," + e.getRecordman().trim() + ",";
+                    Log.i("gongpengming", nameStr);
                     if (getResult(nameStr, name)) {//是该下属任务日程
+                        Log.i("gongpengming", "是的");
                         chche.add(e);
                     }
                 }
             }
+            setTaskDay(chche);
+            showOtherBeans = chche;
             adapter.setBeans(chche);
         }
         if (requestCode == 0x20 && 0x20 == resultCode) {
@@ -467,16 +468,26 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                 date_tv.setText(chche + "  " + TimeUtils.getWeek(chche));
                 Calendar c = Calendar.getInstance();
                 List<OABean> beans = new ArrayList<>();
-                if (ListUtils.isEmpty(showBeans)) return;
-                for (OABean e : showBeans) {
-                    if (e.getStartdate() == null) continue;
-                    c.setTimeInMillis(TimeUtils.f_str_2_long(e.getStartdate()));
-                    int day = c.get(Calendar.DAY_OF_MONTH);
-                    if (day == downDate) {//选择那天的任务
-                        beans.add(e);
+                try {
+                    List<OABean> b;
+                    if (tag == 1) {
+                        b = meBeans == null ? new ArrayList<OABean>() : meBeans;
+                    } else {
+                        b = showOtherBeans == null ? (otherBeans == null ? new ArrayList<OABean>() : otherBeans) : showOtherBeans;
+                    }
+                    for (OABean e : b) {
+                        if (e.getStartdate() == null) continue;
+                        c.setTimeInMillis(TimeUtils.f_str_2_long(e.getStartdate()));
+                        int day = c.get(Calendar.DAY_OF_MONTH);
+                        if (day == downDate) {//选择那天的任务
+                            beans.add(e);
+                        }
                     }
+                } catch (NullPointerException e) {
+                    e.printStackTrace();
+                } finally {
+                    adapter.setBeans(beans);
                 }
-                adapter.setBeans(beans);
             }
         });
     }
@@ -506,7 +517,8 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
      */
     private void chaneTAG(boolean isMy) {
         if (isMy) {
-            if (!my_client_log.getText().toString().trim().equals("下属工作日志")) {
+            showOtherBeans = null;
+            if (!my_client_log.getText().toString().trim().equals("下属工作日历")) {
                 my_client_log.setText("下属工作日历");
             }
             tag = 1;
@@ -515,6 +527,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
             my_client_log_tag.setBackgroundDrawable(null);
             if (adapter != null && meBeans != null) {
                 adapter.setBeans(meBeans);
+                setTaskDay(meBeans);
             }
         } else {
             tag = 2;
@@ -523,6 +536,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
             my_log_tag.setBackgroundDrawable(null);
             if (adapter != null && otherBeans != null) {
                 adapter.setBeans(otherBeans);
+                setTaskDay(otherBeans);
             }
         }
     }
@@ -530,6 +544,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
     //列表适配器
     class MyListViewAdapter extends BaseAdapter {
         private List<OABean> beans;//适配器使用
+
         public MyListViewAdapter() {
         }
 
@@ -543,6 +558,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
             if (beans == null) return null;
             if (getIntent() == null || getIntent().getIntExtra("type", 0) != 1) {
                 chche = beans;
+
             } else {//crm
                 //只显示拜访
                 for (OABean e : beans)
@@ -551,8 +567,6 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                     }
             }
             setPoithNum(chche);
-            showBeans = chche;
-            setTaskDay();
             return chche;
         }
 

+ 1 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/SigninFragment.java

@@ -446,6 +446,7 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
         if (array.size() <= 0) {
             for (int i = 0; i < beans.size(); i++)
                 beans.get(i).getSigninList().clear();
+            setDataForAdapter(beans);
             return;
         }
         String[] logTime = new String[array.size()];