Procházet zdrojové kódy

2016/09/09 oa保存

Bitliker před 10 roky
rodič
revize
b9920cec8f

+ 1 - 1
WeiChat/build.gradle

@@ -4,7 +4,7 @@ apply plugin: 'com.getkeepsafe.dexcount'
 android {
     signingConfigs {
         config {
-            storeFile file('C:/Users/Arison/Desktop/applicationsignname[20150409]')
+            storeFile file('D:/config/applicationsignname[20150409]')
             storePassword '13237658359'
             keyAlias 'jie-20150409'
             keyPassword '13237658359'

+ 7 - 6
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/TaskAddActivity.java

@@ -175,12 +175,13 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
                         tv.setText(str);
                     }
                 } else {
-                    start = TimeUtils.f_long_2_str(System.currentTimeMillis());
-                    if (str.compareTo(start) < 0) {
-                        ToastUtil.showToast(ct, "开始时间不能小于当前时间");
-                    } else {
-                        tv.setText(str);
-                    }
+                    tv.setText(str);
+//                    start = TimeUtils.f_long_2_str(System.currentTimeMillis());
+//                    if (str.compareTo(start) < 0) {
+//                        ToastUtil.showToast(ct, "开始时间不能小于当前时间");
+//                    } else {
+//
+//                    }
                 }
             }
         });

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

@@ -88,6 +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 MyListViewAdapter adapter;
     private EmptyLayout mEmptyLayout;
 
@@ -102,7 +103,6 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                     if (jsonObject.isEmpty())
                         return;
                     loadSuccess(jsonObject);
-                    setTop();
                     break;
             }
         }
@@ -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,13 +149,16 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
         } else {
             adapter.setBeans(chche);
         }
-        setTaskDay(tag == 1 ? meBeans : otherBeans);
     }
 
-    private void setTaskDay(List<OABean> beans) {
+    private void setTaskDay() {
+        if (ListUtils.isEmpty(showBeans)) {
+            picker.setTaskDay(new int[]{0});
+            return;
+        }
         Calendar c = Calendar.getInstance();
         ArrayList<Integer> tasks = new ArrayList<>();
-        for (OABean b : beans) {
+        for (OABean b : showBeans) {
             String time = b.getStartdate() == null ? b.getEnddate() : b.getStartdate();
             if (time == null) continue;
             if (getIntent() == null || getIntent().getIntExtra("type", 0) != 1) {//非crm
@@ -240,7 +243,8 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                 return;
             }
             List<OABean> chche = new ArrayList<>();
-            String name = entity.getName().trim();
+            String name = "," + entity.getName().trim() + ",";
+
             if (name == null) return;
             String nameStr;
             for (OABean e : otherBeans) {
@@ -258,7 +262,6 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                     }
                 }
             }
-            setTaskDay(chche);
             adapter.setBeans(chche);
         }
         if (requestCode == 0x20 && 0x20 == resultCode) {
@@ -378,12 +381,20 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                     Intent intent = null;
                     switch (position) {
                         case 0:
-                            intent = new Intent(ct, TaskAddActivity.class);
-                            intent.putExtra("type", 0);
+                            if (!(getIntent() == null || getIntent().getIntExtra("type", 0) != 1)) {
+                                intent = new Intent(ct, VisitReportPlanActivity.class);
+                            } else {
+                                intent = new Intent(ct, TaskAddActivity.class);
+                                intent.putExtra("type", 0);
+                            }
                             break;
                         case 1:
-                            intent = new Intent(ct, TaskAddActivity.class);
-                            intent.putExtra("type", 1);
+                            if (!(getIntent() == null || getIntent().getIntExtra("type", 0) != 1)) {
+                                intent = new Intent(ct, VisitReportAddActivity.class);
+                            } else {
+                                intent = new Intent(ct, TaskAddActivity.class);
+                                intent.putExtra("type", 1);
+                            }
                             break;
                         case 2:
                             intent = new Intent(ct, VisitReportPlanActivity.class);
@@ -455,45 +466,21 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                 String chche = TimeUtils.long2str(System.currentTimeMillis(), "yyyy-MM") + "-" + (downDate < 10 ? "0" : "") + downDate;
                 date_tv.setText(chche + "  " + TimeUtils.getWeek(chche));
                 Calendar c = Calendar.getInstance();
-                int ok = 0;
-                int noOk = 0;
                 List<OABean> beans = new ArrayList<>();
-                try {// meBeans : otherBeans 可能为空
-//                    for (OABean e : (tag == 1 ? meBeans : otherBeans)) {
-                    List<OABean> b;
-                    if (tag == 1) {
-                        b = meBeans == null ? new ArrayList<OABean>() : meBeans;
-                    } else {
-                        b = otherBeans == null ? new ArrayList<OABean>() : otherBeans;
+                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);
                     }
-                    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);
-                            if ("已完成".equals(e.getStatus()) || "已拜访".equals(e.getStatus())) {
-                                ok += 1;
-                            } else {
-                                noOk += 1;
-                            }
-                        }
-                    }
-                } catch (NullPointerException e) {
-                    e.printStackTrace();
-                } finally {
-                    adapter.setBeans(beans);
-                    setTop();
                 }
+                adapter.setBeans(beans);
             }
         });
     }
 
-    private void setTop() {
-//        rootScrollView.smoothScrollTo(0, 20);
-//        rootScrollView.scrollTo(0, 0);
-    }
-
     private void setPoithNum(List<OABean> beans) {
         int ok = 0, noOk = 0;
         if (!ListUtils.isEmpty(beans)) {
@@ -528,7 +515,6 @@ 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;
@@ -537,16 +523,13 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
             my_log_tag.setBackgroundDrawable(null);
             if (adapter != null && otherBeans != null) {
                 adapter.setBeans(otherBeans);
-                setTaskDay(otherBeans);
             }
         }
-        setTop();
     }
 
     //列表适配器
     class MyListViewAdapter extends BaseAdapter {
         private List<OABean> beans;//适配器使用
-
         public MyListViewAdapter() {
         }
 
@@ -568,6 +551,8 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
                     }
             }
             setPoithNum(chche);
+            showBeans = chche;
+            setTaskDay();
             return chche;
         }
 

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

@@ -81,7 +81,6 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
 
     //变量
     private BaseActivity ct;
-    private boolean isInCompany = false;//当前员工是否配置公司信息
     private double companyX;//当前公司位置经度
     private double companyY;//当前公司位置纬度
     private int companyDistance = -1;//当前规定距离
@@ -109,7 +108,6 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
                     JSONObject jsonObject = JSON.parseObject(message);//返回对象
                     if (jsonObject.containsKey("success") && jsonObject.getBoolean("success")) {//返回正常
                         if (jsonObject.containsKey("comaddressset") ? jsonObject.getBoolean("comaddressset") : false) {//如果有分配公司
-                            isInCompany = true;
                             companyDistance = Integer.parseInt(jsonObject.containsKey("distance") ? jsonObject.getString("distance") : "0");
                             companyX = Double.parseDouble(jsonObject.containsKey("longitude") ? jsonObject.getString("longitude") : "0");
                             companyY = Double.parseDouble(jsonObject.containsKey("latitude") ? jsonObject.getString("latitude") : "0");
@@ -439,36 +437,17 @@ public class SigninFragment extends EasyFragment implements View.OnClickListener
             bindClass(beans, object.getJSONObject("Class2"));
         if (object.containsKey("Class1"))
             bindClass(beans, object.getJSONObject("Class1"));
-//        switch (num) {
-//            case 3:
-//                b = new Bean();//上班
-//                b.startTime = object.containsKey("wd_ondutythree") ? object.getString("wd_ondutythree") : "08:30";
-//                b.startSignin = object.containsKey("wd_onbeg3") ? object.getString("wd_onbeg3") : "07:00";
-//                b.endTime = object.containsKey("wd_offdutythree") ? object.getString("wd_offdutythree") : "11:30";
-//                b.endSignnin = object.containsKey("wd_offend3") ? object.getString("wd_offend3") : "12:00";
-//                beans.add(0, b);
-//            case 2:
-//                b = new Bean();
-//                b.startTime = object.containsKey("wd_ondutytwo") ? object.getString("wd_ondutytwo") : "--:--";
-//                b.startSignin = object.containsKey("wd_onbeg2") ? object.getString("wd_onbeg2") : "07:00";
-//                b.endTime = object.containsKey("wd_offdutytwo") ? object.getString("wd_offdutytwo") : "--:--";
-//                b.endSignnin = object.containsKey("wd_offend2") ? object.getString("wd_offend2") : "07:00";
-//                beans.add(0, b);
-//            case 1:
-//                b = new Bean();
-//                b.startTime = object.containsKey("wd_ondutyone") ? object.getString("wd_ondutyone") : "--:--";
-//                b.startSignin = object.containsKey("wd_onbeg1") ? object.getString("wd_onbeg1") : "07:00";
-//                b.endTime = object.containsKey("wd_offdutyone") ? object.getString("wd_offdutyone") : "--:--";
-//                b.endSignnin = object.containsKey("wd_offend1") ? object.getString("wd_offend1") : "07:00";
-//                beans.add(0, b);
-//                break;
-//        }//添加上班签到时间完成
         setDataForAdapter(beans);
     }
 
     //处理数据,获取到用户签到列表
     public void setDataByLogs(JSONArray array) {
         ArrayList<Bean> beans = getDataByAdapter();
+        if (array.size() <= 0) {
+            for (int i = 0; i < beans.size(); i++)
+                beans.get(i).getSigninList().clear();
+            return;
+        }
         String[] logTime = new String[array.size()];
         for (int i = 0; i < array.size(); i++) {//获取打卡记录中的打卡时间
             logTime[i] = clearDay(array.getJSONObject(i).containsKey("cl_time") ? (array.getJSONObject(i).getString("cl_time") == null ? " " : array.getJSONObject(i).getString("cl_time")) : " ");