Browse Source

下拉备份

raomeng 8 years ago
parent
commit
2d17e16a7d
78 changed files with 2770 additions and 1190 deletions
  1. 3 1
      WeiChat/src/main/AndroidManifest.xml
  2. 1 1
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/adapter/WorkMenuParentAdapter.java
  3. 0 1
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/presenter/SelectCollisionPresenter.java
  4. 2 2
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/me/MeFragment.java
  5. 2 2
      WeiChat/src/main/res/layout/pop_crm_list.xml
  6. 5 5
      WeiChat/version.properties
  7. 1 1
      app_core/common/src/main/java/com/common/data/JSONUtil.java
  8. 6 7
      app_core/common/src/main/java/com/common/system/ActivityUtils.java
  9. 21 11
      app_core/common/src/main/java/com/core/model/Approval.java
  10. 2 1
      app_core/common/src/main/java/com/core/net/http/ViewUtil.java
  11. 1 1
      app_core/common/src/main/java/com/core/net/location/BdLocationHelper.java
  12. 18 15
      app_core/common/src/main/java/com/core/utils/BaiduMapUtil.java
  13. 1 1
      app_core/common/src/main/java/com/core/utils/CommonUtil.java
  14. 3 0
      app_core/common/src/main/java/com/core/xmpp/CoreService.java
  15. 435 431
      app_core/common/src/main/java/com/core/xmpp/XMucChatManager.java
  16. 34 6
      app_core/common/src/main/res/layout/item_approval_tag.xml
  17. 3 3
      app_core/common/src/main/res/layout/pop_crm_list.xml
  18. 2 0
      app_modular/appbooking/src/main/AndroidManifest.xml
  19. 520 0
      app_modular/appbooking/src/main/java/com/modular/booking/activity/services/DishMainActivity.java
  20. 14 7
      app_modular/appbooking/src/main/java/com/modular/booking/activity/services/DishSelectActivity.java
  21. 0 6
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishCategoryListAdapter.java
  22. 151 0
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishPinHeaderAdapter.java
  23. 10 10
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishPinnedListAdapter.java
  24. 211 0
      app_modular/appbooking/src/main/java/com/modular/booking/adapter/SectionedBaseAdapter.java
  25. 0 3
      app_modular/appbooking/src/main/java/com/modular/booking/model/ProductCategory.java
  26. 207 0
      app_modular/appbooking/src/main/java/com/modular/booking/widget/PinnedHeaderListView.java
  27. 17 14
      app_modular/appbooking/src/main/java/com/modular/booking/widget/ShoppingCountView.java
  28. 100 0
      app_modular/appbooking/src/main/res/layout/activity_dish_main.xml
  29. 1 1
      app_modular/appbooking/src/main/res/layout/activity_dish_select.xml
  30. 0 1
      app_modular/appbooking/src/main/res/layout/item_dish_catagory_list.xml
  31. 13 13
      app_modular/appbooking/src/main/res/layout/item_dish_list.xml
  32. 14 3
      app_modular/appcontact/src/main/java/com/uas/appcontact/ui/activity/CompanyContactsActivity.java
  33. 8 4
      app_modular/appcontact/src/main/java/com/uas/appcontact/ui/fragment/ContactsFragment.java
  34. 3 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/activity/ProcessB2BActivity.java
  35. 35 17
      app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/ApprovalAdapter.java
  36. 1 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/model/ApprovalRecord.java
  37. 35 26
      app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/ApprovaPresenter.java
  38. 1 1
      app_modular/apputils/src/main/AndroidManifest.xml
  39. 1 1
      app_modular/apputils/src/main/java/com/modular/apputils/IntentUrlActivity.java
  40. 0 1
      app_modular/apputils/src/main/java/com/modular/apputils/network/Parameter.java
  41. 0 25
      app_modular/apputils/src/main/java/com/modular/apputils/utils/TravelUtils.java
  42. BIN
      app_modular/apputils/src/main/res/drawable-hdpi/icon_empty_lamp.png
  43. BIN
      app_modular/apputils/src/main/res/drawable-xhdpi/icon_add_circular.png
  44. BIN
      app_modular/apputils/src/main/res/drawable-xhdpi/icon_empty_lamp.png
  45. BIN
      app_modular/apputils/src/main/res/drawable-xxhdpi/icon_add_circular.png
  46. BIN
      app_modular/apputils/src/main/res/drawable-xxhdpi/icon_empty_lamp.png
  47. 1 1
      app_modular/apputils/src/main/res/values/color.xml
  48. 2 0
      app_modular/apputils/src/main/res/values/strings.xml
  49. 4 4
      app_modular/appworks/src/main/java/com/uas/appworks/CRM/erp/activity/DeviceMatchActivity.java
  50. 14 5
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/CommonDocDetailsActivity.java
  51. 6 6
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/form/DataFormDetailActivity.java
  52. 40 72
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/form/FormListSelectActivity.java
  53. 1 1
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/form/TravelDataFormDetailActivity.java
  54. 86 82
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/BusinessTravelActivity.java
  55. 104 128
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/BusinessTravelAdapter.java
  56. 44 53
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/BusinessTravel.java
  57. 0 1
      app_modular/appworks/src/main/java/com/uas/appworks/activity/CommonDataFormActivity.java
  58. 5 0
      app_modular/appworks/src/main/java/com/uas/appworks/activity/DeviceQueryActivity.java
  59. 9 1
      app_modular/appworks/src/main/java/com/uas/appworks/model/DeviceMatch.java
  60. 169 0
      app_modular/appworks/src/main/java/com/uas/appworks/utils/TravelUtils.java
  61. BIN
      app_modular/appworks/src/main/res/drawable-hdpi/icon_travel_air.png
  62. BIN
      app_modular/appworks/src/main/res/drawable-hdpi/icon_travel_hotel.png
  63. BIN
      app_modular/appworks/src/main/res/drawable-hdpi/icon_travel_train.png
  64. BIN
      app_modular/appworks/src/main/res/drawable-xhdpi/icon_travel_air.png
  65. BIN
      app_modular/appworks/src/main/res/drawable-xhdpi/icon_travel_hotel.png
  66. BIN
      app_modular/appworks/src/main/res/drawable-xhdpi/icon_travel_train.png
  67. BIN
      app_modular/appworks/src/main/res/drawable-xxhdpi/icon_travel_air.png
  68. BIN
      app_modular/appworks/src/main/res/drawable-xxhdpi/icon_travel_hotel.png
  69. BIN
      app_modular/appworks/src/main/res/drawable-xxhdpi/icon_travel_train.png
  70. 50 8
      app_modular/appworks/src/main/res/layout/activity_business_travel.xml
  71. 101 85
      app_modular/appworks/src/main/res/layout/item_bus_travel_air.xml
  72. 50 42
      app_modular/appworks/src/main/res/layout/item_bus_travel_hotel.xml
  73. 84 0
      app_modular/appworks/src/main/res/layout/item_bus_travel_leader.xml
  74. 51 24
      app_modular/appworks/src/main/res/layout/item_bus_travel_title.xml
  75. 64 51
      app_modular/appworks/src/main/res/layout/item_device_match.xml
  76. 1 1
      app_modular/appworks/src/main/res/layout/pop_click_menu.xml
  77. 1 1
      app_modular/appworks/src/main/res/menu/menu_add_travel.xml
  78. 1 2
      app_modular/appworks/src/main/res/menu/menu_common_docdetails.xml

+ 3 - 1
WeiChat/src/main/AndroidManifest.xml

@@ -558,7 +558,9 @@
         <activity
             android:name=".video.VideoActivity"
             android:theme="@style/Theme.AppCompat.NoActionBar" />
-        <activity android:name=".ui.erp.activity.CompanyActivity" />
+        <activity
+            android:hardwareAccelerated="true"
+            android:name=".ui.erp.activity.CompanyActivity" />
 
         <activity android:name=".ui.circle.PhoneSelectActivity" />
         <activity android:name=".ui.erp.activity.crm.ClientActivity">

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/adapter/WorkMenuParentAdapter.java

@@ -199,7 +199,7 @@ public class WorkMenuParentAdapter extends BaseAdapter {
                     } else if (ApiUtils.getApiModel() instanceof ApiUAS) {
                         String travelCaller = CommonUtil.getSharedPreferences(context, Constants.WORK_TRAVEL_CALLER_CACHE);
                         if (StringUtil.isEmpty(travelCaller)) {
-                            intent.putExtra("caller", "FeePlease!CCSQ");
+                            intent.putExtra("caller", "FeePlease!CCSQ!new");
                         } else {
                             intent.putExtra("caller", travelCaller);
                         }

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

@@ -78,7 +78,6 @@ public class SelectCollisionPresenter {
             } else {
                 switch (selectBean.getResultCode()) {
                     case 0x001:
-                        
                         loadBookingCPersons(selectBean.getTitle());
                         break;
                     default:

+ 2 - 2
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/me/MeFragment.java

@@ -39,7 +39,7 @@ import com.core.utils.FlexJsonUtil;
 import com.core.utils.ToastUtil;
 import com.core.utils.helper.AvatarHelper;
 import com.lidroid.xutils.view.annotation.ViewInject;
-import com.modular.booking.activity.services.DishSelectActivity;
+import com.modular.booking.activity.services.DishMainActivity;
 import com.uas.appme.other.model.Master;
 import com.uas.appme.settings.activity.BaseInfoActivity;
 import com.uas.appme.settings.activity.CheckWagesActivity;
@@ -352,7 +352,7 @@ public class MeFragment extends EasyFragment implements View.OnClickListener {
         picture_selector_rl.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                startActivity(new Intent(ct, DishSelectActivity.class));
+                startActivity(new Intent(ct, DishMainActivity.class));
 //              startActivity(new Intent("com.modular.apputils.activity.SimpleWebActivity")
 //              .putExtra("url","http://qq784602719.imwork.net:13767/Chapter/")
 //              );

+ 2 - 2
WeiChat/src/main/res/layout/pop_crm_list.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.xzjmyk.pm.activity.view.shadow.ShadowLayout
+<RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
@@ -24,4 +24,4 @@
             android:divider="@color/item_line"
             android:dividerHeight="0.1dp"></ListView>
     </LinearLayout>
-</com.xzjmyk.pm.activity.view.shadow.ShadowLayout>
+</RelativeLayout>

+ 5 - 5
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Thu Apr 19 09:52:37 CST 2018
-debugName=360
-versionName=627
-debugCode=360
-versionCode=166
+#Thu Apr 12 18:52:32 CST 2018
+debugName=299
+versionName=628
+debugCode=299
+versionCode=168

+ 1 - 1
app_core/common/src/main/java/com/common/data/JSONUtil.java

@@ -215,7 +215,7 @@ public class JSONUtil {
     public static long getLong(JSONObject object, String... keys) {
         try {
             String i = getDataForJson(object, keys);
-            return Long.valueOf(i);
+            return i==null?0:Long.valueOf(i);
         } catch (Exception e) {
             e.printStackTrace();
             return 0;

+ 6 - 7
app_core/common/src/main/java/com/common/system/ActivityUtils.java

@@ -7,6 +7,7 @@ import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 
+import com.common.LogUtil;
 import com.core.app.MyApplication;
 
 import java.util.List;
@@ -23,7 +24,6 @@ public class ActivityUtils {
 
     /**
      * 判断程序是否打开
-     *
      * @return
      */
     public static boolean isRunningInForeground() {
@@ -31,12 +31,11 @@ public class ActivityUtils {
         ActivityManager activityManager = (ActivityManager) MyApplication.getInstance().getSystemService(Context.ACTIVITY_SERVICE);
         List<ActivityManager.RunningTaskInfo> services = activityManager
                 .getRunningTasks(1);
-        if (services != null && !services.isEmpty()) {
-            ComponentName topActivity = services.get(0).topActivity;
-            if (topActivity != null && topActivity.getPackageName().toString()
-                    .equalsIgnoreCase(MyApplication.getInstance().getPackageName().toString())) {
-                isActivityFound = true;
-            }
+        if (services.get(0).topActivity.getPackageName().toString()
+                .equalsIgnoreCase(MyApplication.getInstance().getPackageName().toString())) {
+            LogUtil.d("isOpenApp",""+services.get(0).topActivity.getPackageName().toString());
+            LogUtil.d("isOpenApp",""+MyApplication.getInstance().getPackageName().toString());
+            isActivityFound = true;
         }
         return isActivityFound;
     }

+ 21 - 11
app_core/common/src/main/java/com/core/model/Approval.java

@@ -20,6 +20,10 @@ import java.util.Map;
  */
 
 public class Approval {
+    public static final String VALUES_YES = "是";
+    public static final String VALUES_NO = "否";
+    public static final String VALUES_UNKNOWN = "未选择";
+
     public static final int
             TITLE = 11//标题
             , MAIN = 12  //主表
@@ -210,7 +214,7 @@ public class Approval {
      * @return 输入类型:0字符输入  1.数字输入  2.日期输入选择  3.下拉选择  4.dbfind
      */
     public int inputType() {
-       if (isNumber())
+        if (isNumber())
             return 1;
         else if (isDftypeEQ("DT", "D")) {
             return 2;
@@ -218,10 +222,10 @@ public class Approval {
             return 3;
         } else if (isDBFind()) {
             return 4;
-        } else if (isDftypeEQ("B", "YN")){
+        } else if (isDftypeEQ("B", "YN")) {
             return 5;
         }
-            return 0;
+        return 0;
     }
 
     public boolean isSelect() {
@@ -248,22 +252,28 @@ public class Approval {
                 }
             }
         } else if ("C".equals(dfType) || "YN".equals(dfType)) {
-            if (values.equals("-1")) values = "是";
-            else if (values.equals("0")) values = "否";
+            if (values.equals("-1")) {
+                values = VALUES_YES;
+            } else if ("YN".equals(dfType) &&values.equals("1")&& type == DETAIL && isNeerInput()) {
+                values = VALUES_UNKNOWN;
+            } else {
+                values = VALUES_NO;
+            }
             if (!StringUtil.isEmpty(oldValues)) {
-                if (oldValues.equals("-1")) oldValues = "是";
-                else if (oldValues.equals("0")) oldValues = "否";
+                if (oldValues.equals("-1")) oldValues = VALUES_YES;
+                else if (oldValues.equals("0")) oldValues = VALUES_NO;
             }
         } else if ("B".equals(dfType)) {
-            if (values.equals("1")) values = "是";
-            else values = "否";
+            if (values.equals("1")) values = VALUES_YES;
+            else values = VALUES_NO;
             if (!StringUtil.isEmpty(oldValues)) {
-                if (oldValues.equals("1")) oldValues = "是";
-                else oldValues = "否";
+                if (oldValues.equals("1")) oldValues = VALUES_YES;
+                else oldValues = VALUES_NO;
             }
         }
     }
 
+
     public void addValues(String str) {
         values = StringUtil.isEmpty(values) ? str : values + str;
     }

+ 2 - 1
app_core/common/src/main/java/com/core/net/http/ViewUtil.java

@@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.common.LogUtil;
+import com.common.config.BaseConfig;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
@@ -649,7 +650,7 @@ public class ViewUtil {
                 if (object != null && object.containsKey("userName")) {
                     String userName = getNameByB2b(object.getString("userName"), phone);
                     if (!StringUtil.isEmpty(userName))
-                        CommonUtil.setSharedPreferences(ct, "erp_emname", userName);
+                        CommonUtil.setSharedPreferences(MyApplication.getInstance(), "erp_emname", userName);
                 }
             }
         } catch (Exception e) {

+ 1 - 1
app_core/common/src/main/java/com/core/net/location/BdLocationHelper.java

@@ -194,7 +194,7 @@ public class BdLocationHelper {
 	}
 
 	public LatLng getLocation() {
-		return latLng;
+		return latLng==null?latLng=new LatLng(0,0):latLng;
 	}
 
 	public String getCityName() {

+ 18 - 15
app_core/common/src/main/java/com/core/utils/BaiduMapUtil.java

@@ -162,8 +162,6 @@ public class BaiduMapUtil {
     }
 
 
-
-
     //计算距离saaa
     public String getDistance(double a1, double a2, double b1, double b2) {
         LatLng a = new LatLng(a1, a2);
@@ -263,19 +261,24 @@ public class BaiduMapUtil {
     }
 
     public void getNearInfo(int radius, int pagerNum, LatLng latLng, OnSearchPoiListener onSearchPoiListener) {
-        this.onSearchPoiListener = onSearchPoiListener;
-        if (option == null)
-            option = new PoiNearbySearchOption();
-        if (mPoiSearch == null)
-            mPoiSearch = PoiSearch.newInstance();
-//        .keyword("公司|大厦")
-        option.keyword("公司")
-                .sortType(PoiSortType.distance_from_near_to_far)
-                .radius(radius)
-                .pageNum(pagerNum)
-                .pageCapacity(1000).location(latLng);
-        mPoiSearch.setOnGetPoiSearchResultListener(poiListener);
-        mPoiSearch.searchNearby(option);
+        if (latLng != null) try {
+            this.onSearchPoiListener = onSearchPoiListener;
+            if (option == null)
+                option = new PoiNearbySearchOption();
+            if (mPoiSearch == null)
+                mPoiSearch = PoiSearch.newInstance();
+            option.keyword("公司")
+                    .sortType(PoiSortType.distance_from_near_to_far)
+                    .radius(radius)
+                    .pageNum(pagerNum)
+                    .pageCapacity(1000)
+                    .location(latLng);
+            mPoiSearch.setOnGetPoiSearchResultListener(poiListener);
+            mPoiSearch.searchNearby(option);
+        } catch (Exception e) {
+
+        }
+
     }
 
     /**

+ 1 - 1
app_core/common/src/main/java/com/core/utils/CommonUtil.java

@@ -106,7 +106,7 @@ public class CommonUtil {
         }
         String baseUrl = getSharedPreferences(ct, "erp_baseurl");
 //        if (BaseConfig.isDebug()){
-//            baseUrl="http://192.168.253.35:8080/ERP/";
+//            baseUrl="http://192.168.253.41:8080/ERP/";
 //        }
 //        baseUrl = "http://192.168.253.52:9000/ERP/";
 

+ 3 - 0
app_core/common/src/main/java/com/core/xmpp/CoreService.java

@@ -15,6 +15,7 @@ import android.support.v7.app.NotificationCompat;
 import android.text.TextUtils;
 import android.util.Log;
 
+import com.common.LogUtil;
 import com.common.preferences.PreferenceUtils;
 import com.common.system.SystemUtil;
 import com.core.app.Constants;
@@ -250,6 +251,7 @@ public class CoreService extends Service {
         public void notifyConnectionClosedOnError(Exception arg0) {
             if (CoreService.DEBUG)
                 Log.e(CoreService.TAG, "连接异常断开");
+            LogUtil.i("arg0="+arg0.getMessage());
             ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_NOT);
         }
 
@@ -257,6 +259,7 @@ public class CoreService extends Service {
         public void notifyConnectionClosed() {
             if (CoreService.DEBUG)
                 Log.e(CoreService.TAG, "连接断开");
+            LogUtil.i("notifyConnectionClosed=");
             ListenerManager.getInstance().notifyAuthStateChange(AuthStateListener.AUTH_STATE_NOT);
         }
 

+ 435 - 431
app_core/common/src/main/java/com/core/xmpp/XMucChatManager.java

@@ -46,439 +46,443 @@ import java.util.Map;
 import java.util.UUID;
 
 public class XMucChatManager {
-    private CoreService mService;
-    private XMPPConnection mConnection;
-    private String mLoginUserId;// 当前登录用户的昵称
-    private String mLoginNickName;// 当前登录用户的昵称
-    private Map<String, MultiUserChat> mMucChatMap;// 存储所有已经加入的聊天室
-    private long mJoinTimeOut;
+	private CoreService mService;
+	private XMPPConnection mConnection;
+	private String mLoginUserId;// 当前登录用户的昵称
+	private String mLoginNickName;// 当前登录用户的昵称
+	private Map<String, MultiUserChat> mMucChatMap;// 存储所有已经加入的聊天室
+	private long mJoinTimeOut;
     private Context context;
-
-    public XMucChatManager(CoreService service, XMPPConnection connection) {
-        Log.d("roamer", "XMucChatManager");
-        mService = service;
-        mConnection = connection;
-        mJoinTimeOut = mConnection.getPacketReplyTimeout();
-        mLoginUserId = StringUtils.parseName(mConnection.getUser());
-        mLoginNickName = MyApplication.getInstance().mLoginUser.getNickName();
-        mMucChatMap = new HashMap<String, MultiUserChat>();
-
-        mConnection.addPacketListener(packetListener, packetFilter);
-        joinExistRoom();
-        MultiUserChat.addInvitationListener(mConnection, new InvitationListener() {
-            @Override
-            public void invitationReceived(XMPPConnection arg0, String arg1, String arg2, String arg3, String arg4, Message arg5) {
-                // 受到聊天室的邀请,就将聊天室加入为好友
-                Log.d("roamer", "受到聊天室的邀请,就将聊天室加入为好友");
-                String roomJIDPrefix = XmppStringUtil.getRoomJIDPrefix(arg1);
-                Friend friend = FriendDao.getInstance().getFriend(mLoginUserId, roomJIDPrefix);
-                MucRoomSimple mucRoomSimple = JSON.parseObject(arg3, MucRoomSimple.class);
-                if (mucRoomSimple == null) {
-                    return;
-                }
-                /* 将房间作为一个好友存到好友表 */
-                if (friend == null) {// 将该房间存到好友表中
-                    friend = new Friend();// 将房间也存为好友
-                    friend.setOwnerId(mLoginUserId);
-                    friend.setUserId(roomJIDPrefix);
-                    friend.setNickName(mucRoomSimple.getName());
-                    friend.setDescription(mucRoomSimple.getDesc());
-                    friend.setRoomFlag(1);
-                    friend.setStatus(Friend.STATUS_FRIEND);
-                    friend.setRoomId(mucRoomSimple.getId());
-                    friend.setRoomCreateUserId(mucRoomSimple.getUserId());
-                    // timeSend作为取群聊离线消息的标志,所以要在这里设置一个初始值
-                    friend.setTimeSend(mucRoomSimple.getTimeSend());
-                    FriendDao.getInstance().createOrUpdateFriend(friend);
-                    // 更新名片盒(可能需要更新)
-                    CardcastUiUpdateUtil.broadcastUpdateUi(mService);
-                }
-                long lastTime = MyApplication.getInstance().mLoginUser.getOfflineTime();
-                Log.d("wang", "lastTime:" + lastTime);
-                if (friend.getTimeSend() > lastTime) {
-                    lastTime = friend.getTimeSend();
-                }
-                int lastSeconds = (int) (CalendarUtil.getSecondMillion() - lastTime);
-                joinMucChat(roomJIDPrefix, mLoginNickName, lastSeconds);
-            }
-        });
-    }
-
-    public void reset() {
-        String userId = StringUtils.parseName(mConnection.getUser());
-        mMucChatMap.clear();
-        if (!mLoginUserId.equals(userId)) {
-            mLoginUserId = userId;
-            mLoginNickName = MyApplication.getInstance().mLoginUser.getNickName();
-        }
-        joinExistRoom();
-    }
-
-    public static String getMucChatServiceName(XMPPConnection connection) {
-        return "@muc." + connection.getServiceName();
-    }
-
-    /**
-     * @param myNickName
-     * @param roomName
-     * @param roomSubject (no use)
-     * @param roomDesc    (no use)
-     * @return 返回房间的Id
-     */
-    public String createMucRoom(String myNickName, String roomName, String roomSubject, String roomDesc) {
-        try {
-            String roomId = UUID.randomUUID().toString().replaceAll("-", "");
-
-            String roomJid = roomId + getMucChatServiceName(mConnection);
-            // 创建聊天室
-            MultiUserChat muc = new MultiUserChat(mConnection, roomJid);
-            muc.create(myNickName);
-
-            // 获得聊天室的配置表单
-            Form form = muc.getConfigurationForm();
-            // 根据原始表单创建一个要提交的新表单。
-            Form submitForm = form.createAnswerForm();
-            // 向要提交的表单添加默认答复
-
-            List<FormField> fields = form.getFields();
-            for (int i = 0; i < fields.size(); i++) {
-                FormField field = (FormField) fields.get(i);
-                if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null) {
-                    // 设置默认值作为答复
+	public XMucChatManager(CoreService service, XMPPConnection connection) {
+		Log.d("roamer","XMucChatManager");
+		mService = service;
+		mConnection = connection;
+		mJoinTimeOut = mConnection.getPacketReplyTimeout();
+		mLoginUserId = StringUtils.parseName(mConnection.getUser());
+		mLoginNickName = MyApplication.getInstance().mLoginUser.getNickName();
+		mMucChatMap = new HashMap<String, MultiUserChat>();
+
+		mConnection.addPacketListener(packetListener, packetFilter);
+		joinExistRoom();
+		MultiUserChat.addInvitationListener(mConnection, new InvitationListener() {
+			@Override
+			public void invitationReceived(XMPPConnection arg0, String arg1, String arg2, String arg3, String arg4, Message arg5) {
+				// 受到聊天室的邀请,就将聊天室加入为好友
+				Log.d("roamer", "受到聊天室的邀请,就将聊天室加入为好友");
+				String roomJIDPrefix = XmppStringUtil.getRoomJIDPrefix(arg1);
+				Friend friend = FriendDao.getInstance().getFriend(mLoginUserId, roomJIDPrefix);
+				MucRoomSimple mucRoomSimple = JSON.parseObject(arg3, MucRoomSimple.class);
+				if (mucRoomSimple == null) {
+					return;
+				}
+				/* 将房间作为一个好友存到好友表 */
+				if (friend == null) {// 将该房间存到好友表中
+					friend = new Friend();// 将房间也存为好友
+					friend.setOwnerId(mLoginUserId);
+					friend.setUserId(roomJIDPrefix);
+					friend.setNickName(mucRoomSimple.getName());
+					friend.setDescription(mucRoomSimple.getDesc());
+					friend.setRoomFlag(1);
+					friend.setStatus(Friend.STATUS_FRIEND);
+					friend.setRoomId(mucRoomSimple.getId());
+					friend.setRoomCreateUserId(mucRoomSimple.getUserId());
+					// timeSend作为取群聊离线消息的标志,所以要在这里设置一个初始值
+					friend.setTimeSend(mucRoomSimple.getTimeSend());
+					FriendDao.getInstance().createOrUpdateFriend(friend);
+					// 更新名片盒(可能需要更新)
+					CardcastUiUpdateUtil.broadcastUpdateUi(mService);
+				}
+				long lastTime = MyApplication.getInstance().mLoginUser.getOfflineTime();
+				Log.d("wang", "lastTime:" + lastTime);
+				if (friend.getTimeSend() > lastTime) {
+					lastTime = friend.getTimeSend();
+				}
+				int lastSeconds = (int) (CalendarUtil.getSecondMillion() - lastTime);
+				joinMucChat(roomJIDPrefix, mLoginNickName, lastSeconds);
+			}
+		});
+	}
+
+	public void reset() {
+		String userId = StringUtils.parseName(mConnection.getUser());
+		mMucChatMap.clear();
+		if (!mLoginUserId.equals(userId)) {
+			mLoginUserId = userId;
+			mLoginNickName = MyApplication.getInstance().mLoginUser.getNickName();
+		}
+		joinExistRoom();
+	}
+
+	public static String getMucChatServiceName(XMPPConnection connection) {
+		return "@muc." + connection.getServiceName();
+	}
+
+	/**
+	 * 
+	 * @param myNickName
+	 * @param roomName
+	 * @param roomSubject
+	 *            (no use)
+	 * @param roomDesc
+	 *            (no use)
+	 * @return 返回房间的Id
+	 */
+	public String createMucRoom(String myNickName, String roomName, String roomSubject, String roomDesc) {
+		try {
+			String roomId = UUID.randomUUID().toString().replaceAll("-", "");
+
+			String roomJid = roomId + getMucChatServiceName(mConnection);
+			// 创建聊天室
+			MultiUserChat muc = new MultiUserChat(mConnection, roomJid);
+			muc.create(myNickName);
+
+			// 获得聊天室的配置表单
+			Form form = muc.getConfigurationForm();
+			// 根据原始表单创建一个要提交的新表单。
+			Form submitForm = form.createAnswerForm();
+			// 向要提交的表单添加默认答复
+
+			List<FormField> fields = form.getFields();
+			for (int i = 0; i < fields.size(); i++) {
+				FormField field = (FormField) fields.get(i);
+				if (!FormField.TYPE_HIDDEN.equals(field.getType()) && field.getVariable() != null) {
+					// 设置默认值作为答复
 //					Log.d("Arison", "defaultAnswer:" + field.getVariable());
-                    submitForm.setDefaultAnswer(field.getVariable());
-                }
-            }
-
-            // 设置聊天室的新拥有者
-            // List owners = new ArrayList();
-            // owners.add("liaonaibo2\\40slook.cc");
-            // owners.add("liaonaibo1\\40slook.cc");
-            // submitForm.setAnswer("muc#roomconfig_roomowners", owners);
-
-            // 设置聊天室的名字
-            submitForm.setAnswer("muc#roomconfig_roomname", roomName);
-            // 设置聊天室描述
-            // if (!TextUtils.isEmpty(roomDesc)) {
-            // submitForm.setAnswer("muc#roomconfig_roomdesc", roomDesc);
-            // }
-            // 登录房间对话
-            submitForm.setAnswer("muc#roomconfig_enablelogging", true);
-            // 允许修改主题
-            // submitForm.setAnswer("muc#roomconfig_changesubject", true);
-            // 允许占有者邀请其他人
-            // submitForm.setAnswer("muc#roomconfig_allowinvites", true);
-            // 最大人数
-            // List<String> maxusers = new ArrayList<String>();
-            // maxusers.add("50");
-            // submitForm.setAnswer("muc#roomconfig_maxusers", maxusers);
-            // 公开的,允许被搜索到
-            // submitForm.setAnswer("muc#roomconfig_publicroom", true);
-            // 设置聊天室是持久聊天室,即将要被保存下来
-            submitForm.setAnswer("muc#roomconfig_persistentroom", true);
-
-            // 是否主持腾出空间(加了这个默认游客进去不能发言)
-            // submitForm.setAnswer("muc#roomconfig_moderatedroom", true);
-            // 房间仅对成员开放
-            // submitForm.setAnswer("muc#roomconfig_membersonly", true);
-            // 不需要密码
-            // submitForm.setAnswer("muc#roomconfig_passwordprotectedroom",
-            // false);
-            // 房间密码
-            // submitForm.setAnswer("muc#roomconfig_roomsecret", "111");
-            // 允许主持 能够发现真实 JID
-            // List<String> whois = new ArrayList<String>();
-            // whois.add("anyone");
-            // submitForm.setAnswer("muc#roomconfig_whois", whois);
-
-            // 管理员
-            // <field var='muc#roomconfig_roomadmins'>
-            // <value>wiccarocks@shakespeare.lit</value>
-            // <value>hecate@shakespeare.lit</value>
-            // </field>
-
-            // 仅允许注册的昵称登录
-            // submitForm.setAnswer("x-muc#roomconfig_reservednick", true);
-            // 允许使用者修改昵称
-            // submitForm.setAnswer("x-muc#roomconfig_canchangenick", false);
-            // 允许用户注册房间
-            // submitForm.setAnswer("x-muc#roomconfig_registration", false);
-            // 发送已完成的表单(有默认值)到服务器来配置聊天室
-            muc.sendConfigurationForm(submitForm);
-
-            // muc.changeSubject(roomSubject);
-            // mMucChatMap.put(roomJid, muc);
-            mMucChatMap.put(roomJid, muc);
-            return roomId;
-        } catch (XMPPException e) {
-            e.printStackTrace();
-        } catch (NoResponseException e) {
-            e.printStackTrace();
-        } catch (SmackException e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    /**
-     * 邀请好友进入房间
-     *
-     * @param roomId
-     * @param userId
-     * @param reason
-     */
-    public void invite(String roomId, String userId, String reason) {
-        String roomJid = roomId + getMucChatServiceName(mConnection);
-        if (mMucChatMap.get(roomJid) != null) {
-            try {
-                mMucChatMap.get(roomJid).invite(userId + "@" + mConnection.getServiceName(), reason);
-            } catch (NotConnectedException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    public MultiUserChat getRoom(String roomJid) {
-        return mMucChatMap.get(roomJid);
-    }
-
-    /**
-     * @param toUserId    要发送消息的房间Id
-     * @param chatMessage 已经存到本地数据库的一条即将发送的消息
-     */
-    public void sendMessage(final String toUserId, final ChatMessage chatMessage) {
-        ThreadManager.getPool().execute(new Runnable() {
-            public void run() {
-                String roomJid = toUserId + getMucChatServiceName(mConnection);
-                MultiUserChat chat = getRoom(roomJid);
-                if (chat == null || !chat.isJoined()) {
-                    ListenerManager.getInstance().notifyMessageSendStateChange(mLoginUserId, toUserId, chatMessage.get_id(),
-                            ChatMessageListener.MESSAGE_SEND_FAILED);
-                    return;
-                }
-                Message msg = new Message();
-                msg.setType(Message.Type.groupchat);
-                msg.setBody(chatMessage.toJsonString(true));
-                msg.setPacketID(chatMessage.getPacketId());
-                msg.setTo(roomJid);
-                DeliveryReceiptManager.addDeliveryReceiptRequest(msg);
-
-                int sendStatus = ChatMessageListener.MESSAGE_SEND_FAILED;
-                // 发送消息
-                try {
-                    chat.sendMessage(msg);
-                    sendStatus = ChatMessageListener.MESSAGE_SEND_ING;
-                } catch (NotConnectedException e) {
-                    e.printStackTrace();
-                } catch (XMPPException e) {
-                    e.printStackTrace();
-                }
-                ListenerManager.getInstance().notifyMessageSendStateChange(mLoginUserId, toUserId, chatMessage.get_id(), sendStatus);
-            }
-        });
-    }
-
-    public void joinMucChat(final String toUserId, String nickName, int lastSeconds) {
-        String roomJid = toUserId + getMucChatServiceName(mConnection);
-        if (mMucChatMap.containsKey(roomJid)) {
-            MultiUserChat mucChat = mMucChatMap.get(roomJid);
-            if (mucChat != null && mucChat.isJoined()) {
-                return;
-            }
-        }
-        final MultiUserChat mucChat = new MultiUserChat(mConnection, roomJid);
-        try {
-            mMucChatMap.put(roomJid, mucChat);
-            DiscussionHistory history = new DiscussionHistory();
-            if (lastSeconds > 0) {
-                history.setSeconds(lastSeconds - 1);// 减去1秒,防止最后一条消息重复(当然有可能导致在这个时间点的其他消息丢失,不会概率极小)
-                // history.setSince(new Date(new Date().getTime() - 300 * 1000));
-            } else {
-                history.setSeconds(0);// request no history
-            }
-            if (StringUtil.isEmpty(nickName)) {
-                return;
-            }
-            mucChat.join(nickName, null, history, mJoinTimeOut);// 必须放在后面,要不然取mMucNickNameMap得时候肯呢过为空,因为这是个异步的
-        } catch (XMPPException e) {
-            e.printStackTrace();
-        } catch (NoResponseException e) {
-            e.printStackTrace();
-        } catch (NotConnectedException e) {
-            e.printStackTrace();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void exitMucChat(String toUserId) {
-        String roomJid = toUserId + getMucChatServiceName(mConnection);
-        if (mMucChatMap.containsKey(roomJid)) {
-            MultiUserChat mucChat = mMucChatMap.get(roomJid);
-            if (mucChat != null && mucChat.isJoined()) {
-                try {
-                    mucChat.leave();
-                } catch (NotConnectedException e) {
-                    e.printStackTrace();
-                }
-                mMucChatMap.remove(roomJid);
-            }
-        }
-    }
-
-    PacketListener packetListener = new PacketListener() {
-        @Override
-        public void processPacket(Packet arg0) throws NotConnectedException {
-            Message message = (Message) arg0;
-            String from = message.getFrom();
-            String to = message.getTo();
-            Log.d("wang", "messageId::" + message.getBody());
-            if (TextUtils.isEmpty(from) || TextUtils.isEmpty(to)) {
-                return;
-            }
-            if (!XmppStringUtil.isJID(from) || !XmppStringUtil.isJID(to)) {
-                return;
-            }
-            if (!StringUtils.parseName(to).equals(mLoginUserId)) {// 不是发给我的,基本上是不可能的情况,还是麻痹的判断下
-                return;
-            }
-            String content = message.getBody();
-            int changeTimeSend = 0;// 如果是历史记录,那么要篡改Json数据中的TimeSend字段,防止多次加入放假获取重复的历史记录
-            //下面这样写会在某些机型上重复收到消息
-            DelayInformation delayInformation = (DelayInformation) message.getExtension("x", "jabber:x:delay");
-            if (delayInformation != null) {// 这是历史记录
-                Log.d("roamer1", "这是历史记录........" + message.getBody() + "delay:" + delayInformation.getStamp().getTime());
-                Date date = delayInformation.getStamp();
-                if (date != null) {
-                    changeTimeSend = (int) (date.getTime() / 1000);
-                    saveGroupMessage(content, false, from, message.getPacketID(), changeTimeSend);
-                    return;
-                }
-
-            }
-            Log.d("roamer1", "........messageBody:" + message.getBody());
-            saveGroupMessage(content, false, from, message.getPacketID(), changeTimeSend);
-        }
-    };
-
-    PacketFilter packetFilter = new PacketFilter() {
-        @Override
-        public boolean accept(Packet arg0) {
-            if (arg0 instanceof Message) {
-                Message message = (Message) arg0;
-                if (message.getType() == Type.groupchat) {
-                    return true;
-                }
-                return false;
-            } else {
-                return false;
-            }
-        }
-    };
-
-    // 自动加入到以前所有已经加入的房间
-    private void joinExistRoom() {
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
+					submitForm.setDefaultAnswer(field.getVariable());
+				}
+			}
+
+			// 设置聊天室的新拥有者
+			// List owners = new ArrayList();
+			// owners.add("liaonaibo2\\40slook.cc");
+			// owners.add("liaonaibo1\\40slook.cc");
+			// submitForm.setAnswer("muc#roomconfig_roomowners", owners);
+
+			// 设置聊天室的名字
+			submitForm.setAnswer("muc#roomconfig_roomname", roomName);
+			// 设置聊天室描述
+			// if (!TextUtils.isEmpty(roomDesc)) {
+			// submitForm.setAnswer("muc#roomconfig_roomdesc", roomDesc);
+			// }
+			// 登录房间对话
+			submitForm.setAnswer("muc#roomconfig_enablelogging", true);
+			// 允许修改主题
+			// submitForm.setAnswer("muc#roomconfig_changesubject", true);
+			// 允许占有者邀请其他人
+			// submitForm.setAnswer("muc#roomconfig_allowinvites", true);
+			// 最大人数
+			// List<String> maxusers = new ArrayList<String>();
+			// maxusers.add("50");
+			// submitForm.setAnswer("muc#roomconfig_maxusers", maxusers);
+			// 公开的,允许被搜索到
+			// submitForm.setAnswer("muc#roomconfig_publicroom", true);
+			// 设置聊天室是持久聊天室,即将要被保存下来
+			submitForm.setAnswer("muc#roomconfig_persistentroom", true);
+
+			// 是否主持腾出空间(加了这个默认游客进去不能发言)
+			// submitForm.setAnswer("muc#roomconfig_moderatedroom", true);
+			// 房间仅对成员开放
+			// submitForm.setAnswer("muc#roomconfig_membersonly", true);
+			// 不需要密码
+			// submitForm.setAnswer("muc#roomconfig_passwordprotectedroom",
+			// false);
+			// 房间密码
+			// submitForm.setAnswer("muc#roomconfig_roomsecret", "111");
+			// 允许主持 能够发现真实 JID
+			// List<String> whois = new ArrayList<String>();
+			// whois.add("anyone");
+			// submitForm.setAnswer("muc#roomconfig_whois", whois);
+
+			// 管理员
+			// <field var='muc#roomconfig_roomadmins'>
+			// <value>wiccarocks@shakespeare.lit</value>
+			// <value>hecate@shakespeare.lit</value>
+			// </field>
+
+			// 仅允许注册的昵称登录
+			// submitForm.setAnswer("x-muc#roomconfig_reservednick", true);
+			// 允许使用者修改昵称
+			// submitForm.setAnswer("x-muc#roomconfig_canchangenick", false);
+			// 允许用户注册房间
+			// submitForm.setAnswer("x-muc#roomconfig_registration", false);
+			// 发送已完成的表单(有默认值)到服务器来配置聊天室
+			muc.sendConfigurationForm(submitForm);
+
+			// muc.changeSubject(roomSubject);
+			// mMucChatMap.put(roomJid, muc);
+			mMucChatMap.put(roomJid, muc);
+			return roomId;
+		} catch (XMPPException e) {
+			e.printStackTrace();
+		} catch (NoResponseException e) {
+			e.printStackTrace();
+		} catch (SmackException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	/**
+	 * 邀请好友进入房间
+	 * 
+	 * @param roomId
+	 * @param userId
+	 * @param reason
+	 */
+	public void invite(String roomId, String userId, String reason) {
+		String roomJid = roomId + getMucChatServiceName(mConnection);
+		if (mMucChatMap.get(roomJid) != null) {
+			try {
+				mMucChatMap.get(roomJid).invite(userId + "@" + mConnection.getServiceName(), reason);
+			} catch (NotConnectedException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public MultiUserChat getRoom(String roomJid) {
+		return mMucChatMap.get(roomJid);
+	}
+
+	/**
+	 * @param toUserId
+	 *            要发送消息的房间Id
+	 * @param chatMessage
+	 *            已经存到本地数据库的一条即将发送的消息
+	 */
+	public void sendMessage(final String toUserId, final ChatMessage chatMessage) {
+		ThreadManager.getPool().execute(new Runnable() {
+			public void run() {
+				String roomJid = toUserId + getMucChatServiceName(mConnection);
+				MultiUserChat chat = getRoom(roomJid);
+				if (chat == null || !chat.isJoined()) {
+					ListenerManager.getInstance().notifyMessageSendStateChange(mLoginUserId, toUserId, chatMessage.get_id(),
+							ChatMessageListener.MESSAGE_SEND_FAILED);
+					return;
+				}
+				Message msg = new Message();
+				msg.setType(Message.Type.groupchat);
+				msg.setBody(chatMessage.toJsonString(true));
+				msg.setPacketID(chatMessage.getPacketId());
+				msg.setTo(roomJid);
+				DeliveryReceiptManager.addDeliveryReceiptRequest(msg);
+
+				int sendStatus = ChatMessageListener.MESSAGE_SEND_FAILED;
+				// 发送消息
+				try {
+					chat.sendMessage(msg);
+					sendStatus = ChatMessageListener.MESSAGE_SEND_ING;
+				} catch (NotConnectedException e) {
+					e.printStackTrace();
+				} catch (XMPPException e) {
+					e.printStackTrace();
+				}
+				ListenerManager.getInstance().notifyMessageSendStateChange(mLoginUserId, toUserId, chatMessage.get_id(), sendStatus);
+			}
+		});
+	}
+
+	public void joinMucChat(final String toUserId, String nickName, int lastSeconds) {
+		String roomJid = toUserId + getMucChatServiceName(mConnection);
+		if (mMucChatMap.containsKey(roomJid)) {
+			MultiUserChat mucChat = mMucChatMap.get(roomJid);
+			if (mucChat != null && mucChat.isJoined()) {
+				return;
+			}
+		}
+		final MultiUserChat mucChat = new MultiUserChat(mConnection, roomJid);
+		try {
+			mMucChatMap.put(roomJid, mucChat);
+			DiscussionHistory history = new DiscussionHistory();
+			if (lastSeconds > 0) {
+				history.setSeconds(lastSeconds - 1);// 减去1秒,防止最后一条消息重复(当然有可能导致在这个时间点的其他消息丢失,不会概率极小)
+				// history.setSince(new Date(new Date().getTime() - 300 * 1000));
+			} else {
+				history.setSeconds(0);// request no history
+			}
+			if (StringUtil.isEmpty(nickName)){
+				return;
+			}
+			mucChat.join(nickName, null, history, mJoinTimeOut);// 必须放在后面,要不然取mMucNickNameMap得时候肯呢过为空,因为这是个异步的
+		} catch (XMPPException e) {
+			e.printStackTrace();
+		} catch (NoResponseException e) {
+			e.printStackTrace();
+		} catch (NotConnectedException e) {
+			e.printStackTrace();
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+	}
+
+	public void exitMucChat(String toUserId) {
+		String roomJid = toUserId + getMucChatServiceName(mConnection);
+		if (mMucChatMap.containsKey(roomJid)) {
+			MultiUserChat mucChat = mMucChatMap.get(roomJid);
+			if (mucChat != null && mucChat.isJoined()) {
+				try {
+					mucChat.leave();
+				} catch (NotConnectedException e) {
+					e.printStackTrace();
+				}
+				mMucChatMap.remove(roomJid);
+			}
+		}
+	}
+
+	PacketListener packetListener = new PacketListener() {
+		@Override
+		public void processPacket(Packet arg0) throws NotConnectedException {
+			Message message = (Message) arg0;
+			String from = message.getFrom();
+			String to = message.getTo();
+           Log.d("wang","messageId::"+message.getBody());
+			if (TextUtils.isEmpty(from) || TextUtils.isEmpty(to)) {
+				return;
+			}
+			if (!XmppStringUtil.isJID(from) || !XmppStringUtil.isJID(to)) {
+				return;
+			}
+			if (!StringUtils.parseName(to).equals(mLoginUserId)) {// 不是发给我的,基本上是不可能的情况,还是麻痹的判断下
+				return;
+			}
+			String content = message.getBody();
+			int changeTimeSend = 0;// 如果是历史记录,那么要篡改Json数据中的TimeSend字段,防止多次加入放假获取重复的历史记录
+			//下面这样写会在某些机型上重复收到消息
+			DelayInformation delayInformation = (DelayInformation) message.getExtension("x", "jabber:x:delay");
+			if (delayInformation != null) {// 这是历史记录
+				Log.d("roamer1","这是历史记录........"+message.getBody()+"delay:"+delayInformation.getStamp().getTime());
+				Date date = delayInformation.getStamp();
+				if (date != null) {
+					changeTimeSend = (int) (date.getTime() / 1000);
+					saveGroupMessage(content, false, from, message.getPacketID(),changeTimeSend);
+					return;
+				}
+
+			}
+			Log.d("roamer1","........messageBody:"+message.getBody());
+			saveGroupMessage(content, false, from, message.getPacketID(),changeTimeSend);
+		}
+	};
+
+	PacketFilter packetFilter = new PacketFilter() {
+		@Override
+		public boolean accept(Packet arg0) {
+			if (arg0 instanceof Message) {
+				Message message = (Message) arg0;
+				if (message.getType() == Type.groupchat) {
+					return true;
+				}
+				return false;
+			} else {
+				return false;
+			}
+		}
+	};
+
+	// 自动加入到以前所有已经加入的房间
+	private void joinExistRoom() {
+		new Thread(new Runnable() {
+			@Override
+			public void run() {
 //				long lastTime = MyApplication.getInstance().mLoginUser.getOfflineTime();
-                long lastTime = PreferenceUtils.getLong(mService, Constants.OFFLINE_TIME);
-                if (lastTime == 1) {
-                    lastTime = MyApplication.getInstance().mLoginUser.getOfflineTime();
-                }
-                Log.d("wang", "joinExistRoom:lasttime::" + lastTime);
-                List<Friend> friends = FriendDao.getInstance().getAllRooms(mLoginUserId);
-                if (friends == null) {
-                    return;
-                }
-                for (int i = 0; i < friends.size(); i++) {
-                    String roomJid = friends.get(i).getUserId();
-                    if (friends.get(i).getTimeSend() > lastTime) {
-                        lastTime = friends.get(i).getTimeSend();
-                    }
-                    int lastSeconds = (int) (CalendarUtil.getSecondMillion() - lastTime);
-                    Log.e("roamer", "RoomJid:" + roomJid + "     RoomName:" + friends.get(i).getNickName() + "   lastSeconds:" + lastSeconds);
-                    String nickName = friends.get(i).getRoomMyNickName();
-                    if (TextUtils.isEmpty(nickName)) {
-                        nickName = mLoginNickName;
-                    }
-                    joinMucChat(roomJid, mLoginNickName, lastSeconds);
-                }
-            }
-        }).start();
-    }
-
-    /**
-     * 保存接收到的聊天信息(群聊)
-     *
-     * @param messageBody
-     * @param isRead
-     * @return
-     */
-    private void saveGroupMessage(String messageBody, boolean isRead, String from, String packetId, int changeTimeSend) {
-        String roomJid = XmppStringUtil.getRoomJID(from);
-        String myNickName = mMucChatMap.get(roomJid).getNickname();
-        String fromUserNick = XmppStringUtil.getRoomUserNick(from);
-        if (TextUtils.isEmpty(fromUserNick)) {// 来自于系统的消息
-            //
-        } else if (fromUserNick.equals(myNickName)) {// 我自己发的消息,不处理
-            //
-        } else {
-            ChatMessage message = new ChatMessage(messageBody);
-            if (!message.validate()) {
-                return;
-            }
-            if (TextUtils.isEmpty(packetId)) {
-                packetId = UUID.randomUUID().toString().replaceAll("-", "");
-            }
-            message.setPacketId(packetId);
-            if (changeTimeSend > 0) {// 始终以延迟消息的时间戳为准
-                Log.e("roamer", "TimeSend:" + message.getTimeSend());
-                Log.e("roamer", "TimeStamp:" + changeTimeSend);
-                message.setTimeSend(changeTimeSend);
-            }
-            mService.notificationMesage(message);
-            if (ChatMessageDao.getInstance().saveNewSingleChatMessage(mLoginUserId, XmppStringUtil.getRoomJIDPrefix(from), message)) {
-                ListenerManager.getInstance().notifyNewMesssage(mLoginUserId, XmppStringUtil.getRoomJIDPrefix(roomJid), message, true);
-            }
-        }
-    }
-
-    // 踢人
-    public boolean kickParticipant(String roomJid, String nickName) {
-        roomJid = roomJid + getMucChatServiceName(mConnection);
-        MultiUserChat mucChat = mMucChatMap.get(roomJid);
-        if (mucChat == null) {
-            return false;
-        }
-        try {
-            mucChat.kickParticipant(nickName, "你被踢出该房间");
-        } catch (XMPPException e) {
-            e.printStackTrace();
-            return false;
-        } catch (NoResponseException e) {
-            e.printStackTrace();
-            return false;
-        } catch (NotConnectedException e) {
-            e.printStackTrace();
-            return false;
-        }
-        return true;
-    }
-
-    // 被踢出
-    public boolean kicked(String roomJid) {
-        MultiUserChat mucChat = mMucChatMap.get(roomJid);
-        if (mucChat == null) {
-            return false;
-        }
-        try {
-            mucChat.leave();
-        } catch (NotConnectedException e) {
-            e.printStackTrace();
-        }
-        mMucChatMap.remove(roomJid);
-        return true;
-    }
+				long lastTime= PreferenceUtils.getLong(mService, Constants.OFFLINE_TIME);
+				if(lastTime==1){
+					lastTime = MyApplication.getInstance().mLoginUser.getOfflineTime();
+				}
+				Log.d("wang","joinExistRoom:lasttime::"+lastTime);
+				List<Friend> friends = FriendDao.getInstance().getAllRooms(mLoginUserId);
+				if (friends == null) {
+					return;
+				}
+				for (int i = 0; i < friends.size(); i++) {
+					String roomJid = friends.get(i).getUserId();
+					if (friends.get(i).getTimeSend() > lastTime) {
+						lastTime = friends.get(i).getTimeSend();
+					}
+					int lastSeconds = (int) (CalendarUtil.getSecondMillion() - lastTime);
+					Log.e("roamer", "RoomJid:" + roomJid + "     RoomName:" + friends.get(i).getNickName() + "   lastSeconds:" + lastSeconds);
+					String nickName = friends.get(i).getRoomMyNickName();
+					if (TextUtils.isEmpty(nickName)) {
+						nickName = mLoginNickName;
+					}
+					joinMucChat(roomJid, mLoginNickName, lastSeconds);
+				}
+			}
+		}).start();
+	}
+
+	/**
+	 * 保存接收到的聊天信息(群聊)
+	 * 
+	 * @param messageBody
+	 * @param isRead
+	 * @return
+	 */
+	private void saveGroupMessage(String messageBody, boolean isRead, String from, String packetId, int changeTimeSend) {
+		String roomJid = XmppStringUtil.getRoomJID(from);
+		String myNickName = mMucChatMap.get(roomJid).getNickname();
+		String fromUserNick = XmppStringUtil.getRoomUserNick(from);
+		if (TextUtils.isEmpty(fromUserNick)) {// 来自于系统的消息
+			//
+		} else if (fromUserNick.equals(myNickName)) {// 我自己发的消息,不处理
+			//
+		} else {
+			ChatMessage message = new ChatMessage(messageBody);
+			if (!message.validate()) {
+				return;
+			}
+			if (TextUtils.isEmpty(packetId)) {
+				packetId = UUID.randomUUID().toString().replaceAll("-", "");
+			}
+			message.setPacketId(packetId);
+			if (changeTimeSend > 0) {// 始终以延迟消息的时间戳为准
+				Log.e("roamer", "TimeSend:" + message.getTimeSend());
+				Log.e("roamer", "TimeStamp:" + changeTimeSend);
+				message.setTimeSend(changeTimeSend);
+			}
+			mService.notificationMesage(message);
+			if (ChatMessageDao.getInstance().saveNewSingleChatMessage(mLoginUserId, XmppStringUtil.getRoomJIDPrefix(from), message)) {
+				ListenerManager.getInstance().notifyNewMesssage(mLoginUserId, XmppStringUtil.getRoomJIDPrefix(roomJid), message, true);
+			}
+		}
+	}
+
+	// 踢人
+	public boolean kickParticipant(String roomJid, String nickName) {
+		roomJid = roomJid + getMucChatServiceName(mConnection);
+		MultiUserChat mucChat = mMucChatMap.get(roomJid);
+		if (mucChat == null) {
+			return false;
+		}
+		try {
+			mucChat.kickParticipant(nickName, "你被踢出该房间");
+		} catch (XMPPException e) {
+			e.printStackTrace();
+			return false;
+		} catch (NoResponseException e) {
+			e.printStackTrace();
+			return false;
+		} catch (NotConnectedException e) {
+			e.printStackTrace();
+			return false;
+		}
+		return true;
+	}
+
+	// 被踢出
+	public boolean kicked(String roomJid) {
+		MultiUserChat mucChat = mMucChatMap.get(roomJid);
+		if (mucChat == null) {
+			return false;
+		}
+		try {
+			mucChat.leave();
+		} catch (NotConnectedException e) {
+			e.printStackTrace();
+		}
+		mMucChatMap.remove(roomJid);
+		return true;
+	}
 
 }

+ 34 - 6
app_core/common/src/main/res/layout/item_approval_tag.xml

@@ -1,20 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:layout_width="match_parent"
-              android:layout_height="wrap_content"
-              android:orientation="vertical">
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
 
     <View
         android:id="@+id/padding"
         android:layout_width="match_parent"
         android:layout_height="@dimen/paddingApp"
-        android:background="@color/item_line"/>
+        android:background="@color/item_line" />
 
     <View
         android:id="@+id/line"
         android:layout_width="match_parent"
         android:layout_height="2px"
-        android:background="@color/item_line"/>
+        android:background="@color/item_line" />
 
     <TextView
         android:id="@+id/tagTv"
@@ -27,5 +27,33 @@
         android:paddingLeft="6dp"
         android:paddingTop="8dp"
         android:text="tagTv"
-        android:textColor="@color/titleBlue"/>
+        android:textColor="@color/titleBlue" />
+
+    <RadioGroup
+        android:id="@+id/valuesRG"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:visibility="gone"
+        android:layout_marginLeft="@dimen/padding"
+        android:orientation="horizontal"
+        android:paddingLeft="@dimen/padding">
+
+        <RadioButton
+            android:id="@+id/yesRB"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginRight="@dimen/padding"
+            android:button="@drawable/oa_checkbox"
+            android:paddingRight="@dimen/padding"
+            android:text="全部采纳" />
+
+        <RadioButton
+            android:id="@+id/notRB"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/padding"
+            android:button="@drawable/oa_checkbox"
+            android:paddingLeft="@dimen/padding"
+            android:text="全部不采纳" />
+    </RadioGroup>
 </LinearLayout>

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

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.xzjmyk.pm.activity.view.shadow.ShadowLayout
+<RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
@@ -12,8 +12,8 @@
         <ListView
             android:id="@+id/mList"
             style="@style/ListViewBasic"
-            android:listSelector="@drawable/selector_pop_items"
+         
             android:layout_height="wrap_content"
             android:dividerHeight="0dp">
         </ListView>
-</com.xzjmyk.pm.activity.view.shadow.ShadowLayout>
+</RelativeLayout>

+ 2 - 0
app_modular/appbooking/src/main/AndroidManifest.xml

@@ -19,6 +19,8 @@
         <activity android:name=".activity.utils.GridSelectActivity" />
         <activity android:name=".activity.utils.GridSelectDateActivity" />
         <activity android:name=".activity.services.DishSelectActivity"></activity>
+
+        <activity android:name=".activity.services.DishMainActivity"></activity>
         <activity android:name=".activity.test.BottomSheetActivity"></activity>
        
     </application>

+ 520 - 0
app_modular/appbooking/src/main/java/com/modular/booking/activity/services/DishMainActivity.java

@@ -0,0 +1,520 @@
+package com.modular.booking.activity.services;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Parcelable;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.AbsListView;
+import android.widget.AdapterView;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.PopupWindow;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.common.LogUtil;
+import com.common.data.ListUtils;
+import com.common.system.DisplayUtil;
+import com.core.base.OABaseActivity;
+import com.core.utils.CommonUtil;
+import com.core.utils.helper.AvatarHelper;
+import com.core.widget.DrawableCenterTextView;
+import com.flipboard.bottomsheet.BottomSheetLayout;
+import com.me.network.app.http.HttpClient;
+import com.me.network.app.http.Method;
+import com.me.network.app.http.rx.ResultListener;
+import com.me.network.app.http.rx.ResultSubscriber;
+import com.modular.booking.R;
+import com.modular.booking.activity.utils.ShoppingCart;
+import com.modular.booking.activity.utils.ShoppingCartPanel;
+import com.modular.booking.adapter.ItemDishCategoryListAdapter;
+import com.modular.booking.adapter.ItemDishPinHeaderAdapter;
+import com.modular.booking.adapter.LayoutShoppingCartItemAdapter;
+import com.modular.booking.model.Product;
+import com.modular.booking.model.ProductCategory;
+import com.modular.booking.model.ShoppingEntity;
+import com.modular.booking.utils.EventMessage;
+import com.modular.booking.utils.RxBus;
+import com.modular.booking.widget.PinnedHeaderListView;
+import com.modular.booking.widget.ShoppingCountView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.hdodenhof.circleimageview.CircleImageView;
+import rx.Subscription;
+import rx.android.schedulers.AndroidSchedulers;
+
+/**
+  * @desc:选择菜品
+  * @author:Arison on 2018/1/24
+  */
+public class DishMainActivity extends OABaseActivity {
+    
+    public static final String TAG = "DishSelectActivity";
+    private CircleImageView iv_header;
+    private TextView tv_title;
+    private TextView tv_sub;
+    private TextView num_tv;
+    private BottomSheetLayout  mBottmSheetLayout;
+    private LinearLayout ll_bottom;
+    private ListView lv_product_category;
+    private PinnedHeaderListView lv_product;
+
+    private ShoppingCartPanel mShoppingCartPanel;
+
+    private Button bt_bottom;
+    private ImageView max_img;
+    private ImageView mBackImageView;
+    private DrawableCenterTextView mSearchTv;
+    private RelativeLayout mRelativeTop;
+    private Drawable drawBg;
+
+    private ImageView ivShopCar;
+    private TextView tvShopSure;
+    private TextView tvTotalPrice;
+    
+    private List<ProductCategory> productCategories=new ArrayList<>();
+    List<ProductCategory> productAllCategorys=new ArrayList<>();
+    private ItemDishCategoryListAdapter itemDishCategoryListAdapter;
+    //private ItemDishPinnedListAdapter itemDishPinnedListAdapter;
+    
+    private ItemDishPinHeaderAdapter itemDishPinHeaderAdapter;
+    
+    
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_dish_main);
+        initView();
+        initEvent();
+        initData();
+    }
+    
+    private void initView(){
+        mShoppingCartPanel = new ShoppingCartPanel(this);
+        lv_product_category= findViewById(R.id.lv_product_category);
+        mBottmSheetLayout=findViewById(R.id.bottom_sheet_layout);
+        lv_product=findViewById(R.id.lv_dish_product);
+        ll_bottom=findViewById(R.id.ll_bottom);
+        bt_bottom=findViewById(R.id.bt_bottom);
+        iv_header =findViewById(R.id.iv_header);
+        max_img = findViewById(R.id.max_img);
+        tv_title =findViewById(R.id.tv_title);
+        tv_sub =findViewById(R.id.tv_sub);
+        ivShopCar=findViewById(R.id.ivShopCar);
+        tvShopSure=findViewById(R.id.tvShopSure);
+        tvTotalPrice=findViewById(R.id.tvTotalPrice);
+        num_tv=findViewById(R.id.num_tv);
+        
+        itemDishCategoryListAdapter=new ItemDishCategoryListAdapter(DishMainActivity.this,productCategories);
+        lv_product_category.setAdapter( itemDishCategoryListAdapter);
+        lv_product_category.setSelection(0);
+        
+        
+//        itemDishPinnedListAdapter=new ItemDishPinnedListAdapter(mContext,productAllCategorys);
+//        itemDishPinnedListAdapter.setAnimTargetView(ivShopCar);
+
+        itemDishPinHeaderAdapter=new ItemDishPinHeaderAdapter(this);
+        itemDishPinHeaderAdapter.setAnimTargetView(num_tv);
+        lv_product.setAdapter(itemDishPinHeaderAdapter);
+
+        Intent data=getIntent();
+        if (data!=null) {
+            String sb_imageurl=data.getStringExtra("headImgUrl");
+            String tvsub=data.getStringExtra("tvSub");
+            String tvtitle=data.getStringExtra("tvTitle");
+            getSupportActionBar().setTitle(tvtitle);
+            tv_title.setText(tvtitle);
+            tv_sub.setText(tvsub);
+            AvatarHelper.getInstance().display(sb_imageurl, iv_header, true);
+            AvatarHelper.getInstance().display(sb_imageurl, max_img, true);
+        }
+
+    }
+    
+    private boolean isClickTrigger=true;
+    
+    private void initEvent(){
+        mBottmSheetLayout.addOnSheetStateChangeListener(new BottomSheetLayout.OnSheetStateChangeListener() {
+            @Override
+            public void onSheetStateChanged(BottomSheetLayout.State state) {
+                LogUtil.d(TAG,"BottomSheetLayout.State:"+state);
+            }
+        });
+        tvShopSure.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                //先确保购物车不为空
+                if (!ListUtils.isEmpty(ShoppingCart.getInstance().getShoppingList())) {
+                    setResult(0x01,new Intent().putParcelableArrayListExtra("data", (ArrayList<? extends Parcelable>) ShoppingCart.getInstance().getShoppingList()));
+                    finish();
+                }else{
+                    ToastMessage("您的购物车是空的哦");
+                }
+            }
+        });
+        
+        ll_bottom.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                showShoppingCartPanel();
+                //showShopWindow(view);
+            }
+        });
+
+        lv_product_category.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                itemDishCategoryListAdapter.setSelectIndex(position);
+                itemDishCategoryListAdapter.notifyDataSetChanged();
+                int productPos = 0;
+                for (int index = 0; index < position; index++) {
+                    productPos += itemDishPinHeaderAdapter.getCountForSection(index) + 1;
+                }
+                isClickTrigger = true;
+                lv_product.setSelection(productPos);
+            }
+        });
+
+   
+        lv_product.setOnScrollListener(new AbsListView.OnScrollListener() {
+            @Override
+            public void onScrollStateChanged(AbsListView absListView, int i) {
+
+            }
+
+            @Override
+            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+                if (isClickTrigger) {
+                    isClickTrigger = false;
+                } else {
+                    int section = itemDishPinHeaderAdapter.getSectionForPosition(firstVisibleItem);
+                    itemDishCategoryListAdapter.setSelectIndex(section);
+                    isClickTrigger = true;//非常关键的一点
+                    itemDishCategoryListAdapter.notifyDataSetChanged();//会触发onScroll事件,导致循环执行
+                    LogUtil.d(TAG,"LastVisiblePosition:"+lv_product_category.getLastVisiblePosition()+" section:"+section
+                    +"FirstVisiblePosition:"+lv_product_category.getFirstVisiblePosition());
+                    if (section>=lv_product_category.getLastVisiblePosition()){
+                        lv_product_category.smoothScrollToPosition(lv_product_category.getLastVisiblePosition()+2);
+                    }
+                    if (section<=lv_product_category.getFirstVisiblePosition()){
+                        lv_product_category.smoothScrollToPosition(lv_product_category.getFirstVisiblePosition()-2);
+                    }
+                    if (firstVisibleItem == 0) {
+                        View firstVisibleItemView = lv_product.getChildAt(0);
+                        if (firstVisibleItemView != null && firstVisibleItemView.getTop() == 0) {
+                            LogUtil.d(TAG,"scroll top"+0);
+                            lv_product_category.smoothScrollToPosition(0);
+                        }
+                    }
+                    if ((firstVisibleItem + visibleItemCount) == totalItemCount) {
+                        View lastVisibleItemView = lv_product.getChildAt(lv_product.getChildCount() - 1);
+                        if (lastVisibleItemView != null && lastVisibleItemView.getBottom() == lv_product.getHeight()) {
+                            LogUtil.d(TAG,"scroll bottom"+itemDishCategoryListAdapter.getCount());
+                            lv_product_category.smoothScrollToPosition(itemDishCategoryListAdapter.getCount()-1);
+                        }
+                    }
+                   
+                }
+
+            }
+        });
+        
+        lv_product.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+                if (view.getTag() instanceof  ItemDishPinHeaderAdapter.ItemViewHolder){
+                    ItemDishPinHeaderAdapter.ItemViewHolder itemViewHolder= ( ItemDishPinHeaderAdapter.ItemViewHolder) view.getTag();
+                    final Product product=itemViewHolder.product;
+                    LogUtil.d(TAG,"product name:"+product.getName());
+                    itemViewHolder.img_product_photo.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            showPopupWindow(view,product);
+                        }
+                    });
+                    itemViewHolder.txt_product_name.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            showPopupWindow(view,product);
+                        }
+                    });
+                    itemViewHolder.txt_product_month_sales.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            showPopupWindow(view,product);
+                        }
+                    });
+                    
+                    itemViewHolder.txt_product_price.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View view) {
+                            showPopupWindow(view,product);
+                        }
+                    });
+                }
+                
+            }
+        });
+        
+        mSubscription= RxBus.getInstance().toObservable()
+                .filter(o -> o instanceof EventMessage)
+                .map(o -> (EventMessage) o)
+                 .observeOn(AndroidSchedulers.mainThread())
+                .doOnNext(o -> onShoppingCartChange(o.getObject()))
+                .subscribe();
+    }
+ 
+    private void initData(){
+          HttpClient httpClient=new HttpClient.Builder("http://192.168.253.200:8080/Chapter/").build();
+                 httpClient.Api().send(new HttpClient.Builder()
+                 .url("data/dish")
+                 .method(Method.GET)
+                 .build(),new ResultSubscriber<Object>(new ResultListener<Object>() {
+          
+                     @Override
+                     public void onResponse(Object o) {
+                       //  LogUtil.d(TAG,o.toString());
+//                         try {
+                             String data=   JSON.parseObject(o.toString()).getString("Data");
+                             JSONArray dishCategories= JSON.parseObject(data).getJSONArray("DishCategories");
+                             JSONArray dishs=JSON.parseObject(data).getJSONArray("Dishs");
+                             List<ProductCategory> productCategorys= JSON.parseArray(dishCategories.toJSONString(), ProductCategory.class);
+                             productCategories.addAll(productCategorys);
+                             itemDishCategoryListAdapter.notifyDataSetChanged();
+                             List<Product> products= JSON.parseArray(dishs.toJSONString(), Product.class);
+                             for (int i = 0; i < productCategorys.size(); i++) {
+                                // LogUtil.d(TAG,"菜类:"+productCategorys.get(i).getName());
+                                 String code=productCategorys.get(i).getCode();  //关联菜单
+                                 String name=productCategorys.get(i).getName();
+                                 productCategorys.get(i).setDishCategoryId(i);
+                                 productAllCategorys.add(productCategorys.get(i));
+                                 //productCategories.add(productCategorys.get(i));
+                                 for (int j = 0; j < products.size(); j++) {
+                                     String dishCategoryCode=products.get(j).getDishCategoryCode();
+                                     if (code.equals(dishCategoryCode)){
+//                                         ProductCategory productCategory=new ProductCategory();
+//                                         productCategory.setType(ProductCategory.ITEM);
+//                                             products.get(j).setDishCategoryName(name);
+//                                             products.get(j).setDishCategoryId(i);
+//                                         productCategory.setProduct(products.get(j));
+//                                         productCategory.setName(products.get(j).getName());
+//                                         productAllCategorys.add(productCategory);
+                                        // productCategories.add(productCategory);
+                                         productCategorys.get(i).getProducts().add(products.get(j));
+                                         productCategorys.get(i).setType(ProductCategory.ITEM);
+                                     }
+                                 }
+                             }
+                         
+                             itemDishPinHeaderAdapter.setItems(productAllCategorys);
+                           // itemDishPinnedListAdapter.notifyDataSetChanged();
+                            LogUtil.prinlnLongMsg(TAG,JSON.toJSONString(productAllCategorys));
+                          
+//                         } catch (Exception e) {
+//                             LogUtil.d(TAG,"发生了异常 e:"+e.toString());
+//                             e.printStackTrace();
+//                         }
+                     }
+                 }));
+
+        refreshBottomUi();
+    }
+
+
+    /**
+     * 显示购物车面板
+     */
+    private void showShoppingCartPanel() {
+        int count = ShoppingCart.getInstance().getTotalQuantity();
+        if (count > 0 && !mBottmSheetLayout.isSheetShowing()) {
+            mShoppingCartPanel.refreshPanel();
+            mBottmSheetLayout.showWithSheetView(mShoppingCartPanel);
+        } else {
+            mBottmSheetLayout.dismissSheet();
+        }
+    }
+    
+    Subscription mSubscription;
+
+    public void onShoppingCartChange(Object o) {
+        refreshBottomUi();
+        LogUtil.d(TAG,"o:"+o.toString());
+        mShoppingCartPanel.refreshPanel();
+        itemDishCategoryListAdapter.notifyDataSetChanged();
+    //   itemDishPinnedListAdapter.notifyDataSetChanged();
+    }
+
+    private void refreshBottomUi() {
+        ShoppingCart shoppingCart = ShoppingCart.getInstance();
+        int totalCount = shoppingCart.getTotalQuantity();
+        double totalPrice = shoppingCart.getTotalPrice();
+        if (totalCount>0) {
+            tvTotalPrice.setText("共¥" + totalPrice);
+            num_tv.setVisibility(View.VISIBLE);
+            num_tv.setText(String.valueOf(totalCount));
+            ivShopCar.setBackgroundResource(R.drawable.icon_shop_car);
+            ivShopCar.setImageDrawable(getResources().getDrawable(R.drawable.icon_shop_car));
+        }else{
+            num_tv.setVisibility(View.INVISIBLE);
+            tvTotalPrice.setText(getString(R.string.tv_shop_empty) );
+            ivShopCar.setBackgroundResource(R.drawable.icon_shop_empty);
+            ivShopCar.setImageDrawable(getResources().getDrawable(R.drawable.icon_shop_empty));
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        // 注册 ---被观察者
+        if (mSubscription != null && !mSubscription.isUnsubscribed()) {
+            mSubscription.unsubscribe();
+        }
+    }
+
+
+
+    private PopupWindow popupWindow = null;
+    ImageView ivIconProduct = null;
+    TextView tvDishDesc = null;
+    TextView tvDishName = null;
+    TextView txtProductMonthSales = null;
+    TextView txtProductPrice = null;
+    TextView ptvShopSure = null;
+    ShoppingCountView shopping_count_view=null;
+    public void showPopupWindow(View parent,Product product) {
+        View view = null;
+        WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
+        if (popupWindow == null) {
+            LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            view = layoutInflater.inflate(R.layout.dialog_dish_product, null);
+            ivIconProduct = (ImageView) view.findViewById( R.id.iv_icon_product );
+            tvDishDesc = (TextView)view.findViewById( R.id.tv_dish_desc );
+            tvDishName = (TextView)view.findViewById( R.id.tv_dish_name );
+            txtProductMonthSales = (TextView)view.findViewById( R.id.txt_product_month_sales );
+            txtProductPrice = (TextView)view.findViewById( R.id.txt_product_price );
+            ptvShopSure = (TextView)view.findViewById( R.id.tvShopSure );
+            shopping_count_view=view.findViewById(R.id.shopping_count_view);
+            popupWindow = new PopupWindow(view,  
+                    windowManager.getDefaultDisplay().getWidth() - CommonUtil.dip2px(mContext,70),
+                    LinearLayout.LayoutParams.MATCH_PARENT);
+        }
+        int num= ShoppingCart.getInstance().getQuantityForProduct(product);
+        if (num>0){
+            ptvShopSure.setVisibility(View.GONE);
+            shopping_count_view.setShoppingCount(num);
+            shopping_count_view.setVisibility(View.VISIBLE);
+        }else{
+            ptvShopSure.setVisibility(View.VISIBLE);
+            shopping_count_view.setVisibility(View.GONE);
+        }
+        AvatarHelper.getInstance().display("http://p0.meituan.net/deal/__16971854__3919079.jpg@380w_214h_1e_1c",ivIconProduct,false);
+        tvDishName.setText(product.getName());
+        txtProductMonthSales.setText("月售0");
+        txtProductPrice.setText("¥"+product.getUnitItems().get(0).getPrice());
+
+        ptvShopSure.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                ptvShopSure.setVisibility(View.GONE);
+                ptvShopSure.setEnabled(false);
+                if (!ShoppingCart.getInstance().add(product)) {
+                }
+                shopping_count_view.setShoppingCount(1);
+                shopping_count_view.setVisibility(View.VISIBLE);
+            }
+        });
+        shopping_count_view.setOnShoppingClickListener(new ShoppingCountView.ShoppingClickListener() {
+            @Override
+            public void onAddClick(int num) {
+                    if (!ShoppingCart.getInstance().add(product)) {
+                    }
+            }
+
+            @Override
+            public void onMinusClick(int num) {
+                if (!ShoppingCart.getInstance().delete(product)) {
+                }
+                if (num==0){
+                   new Handler().postDelayed(new Runnable() {
+                       @Override
+                       public void run() {
+                           ptvShopSure.setVisibility(View.VISIBLE);
+                           ptvShopSure.setEnabled(true);
+                           shopping_count_view.setVisibility(View.GONE);
+                       }
+                   },10);
+                }
+            }
+        });
+        tvDishDesc.setText(product.getName());
+        popupWindow.setFocusable(true);
+        popupWindow.setOutsideTouchable(true);
+        popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+            @Override
+            public void onDismiss() {
+                DisplayUtil.backgroundAlpha(activity, 1f);
+            }
+        });
+        DisplayUtil.backgroundAlpha(this, 0.5f);
+        popupWindow.setBackgroundDrawable(new BitmapDrawable());
+        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+        // 显示的位置为:屏幕的宽度的一半-PopupWindow的高度的一半
+       // popupWindow.showAsDropDown(parent, windowManager.getDefaultDisplay().getWidth(), 0);
+        popupWindow .showAtLocation(activity.getWindow().getDecorView(), Gravity.CENTER, 0, 0);
+        
+    }
+    
+    
+    private PopupWindow pListWindow = null;
+    TextView mClearTxt;
+    ListView lv_data;
+    LayoutShoppingCartItemAdapter layoutShoppingCartItemAdapter;
+    public void showShopWindow(View parent){
+        View view = null;
+        WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
+        if (pListWindow == null) {
+            LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            view = layoutInflater.inflate(R.layout.layout_shopping_cart_panel, null);
+            mClearTxt=view.findViewById(R.id.txt_clear);
+            lv_data=view.findViewById(R.id.lv_data);
+            layoutShoppingCartItemAdapter=new LayoutShoppingCartItemAdapter(mContext);
+            lv_data.setAdapter(layoutShoppingCartItemAdapter);
+            pListWindow= new PopupWindow(view,
+                    windowManager.getDefaultDisplay().getWidth(),
+                    windowManager.getDefaultDisplay().getHeight()/2);
+            
+        }
+        ShoppingCart shoppingCart = ShoppingCart.getInstance();
+        List<ShoppingEntity> entities = shoppingCart.getShoppingList();
+        LogUtil.d("ShopCar", "面板data:"+JSON.toJSONString(entities));
+        layoutShoppingCartItemAdapter.setItems(entities);
+        pListWindow.setFocusable(true);
+        pListWindow.setOutsideTouchable(true);
+        pListWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+            @Override
+            public void onDismiss() {
+                DisplayUtil.backgroundAlpha(activity, 1f);
+            }
+        });
+        DisplayUtil.backgroundAlpha(this, 0.5f);
+        pListWindow.setBackgroundDrawable(new BitmapDrawable());
+        pListWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+        // 显示的位置为:屏幕的宽度的一半-PopupWindow的高度的一半
+        pListWindow.showAsDropDown(parent, windowManager.getDefaultDisplay().getWidth(), 0);
+    }
+    
+}

+ 14 - 7
app_modular/appbooking/src/main/java/com/modular/booking/activity/services/DishSelectActivity.java

@@ -205,23 +205,29 @@ public class DishSelectActivity extends OABaseActivity {
 
             @Override
             public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-//                if (isClickTrigger) {
-//                    isClickTrigger = false;
-//                } else {
+                if (isClickTrigger) {
+                    isClickTrigger = false;
+                } else {
                     if (itemDishPinnedListAdapter.getProductCategories().size() > 0) {
                         if (itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct()!=null){
                             itemDishCategoryListAdapter.setSelectIndex(itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct().getDishCategoryId());
                            // lv_product_category.setItemChecked(itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct().getDishCategoryId(),true);
-                           // lv_product_category.setSelection(itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct().getDishCategoryId());
-                          // itemDishCategoryListAdapter.notifyDataSetChanged();
+                            lv_product_category.setSelection(itemDishPinnedListAdapter.getItem(firstVisibleItem).getProduct().getDishCategoryId());
+                           //itemDishCategoryListAdapter.notifyDataSetChanged();
                         }else{
                             itemDishCategoryListAdapter.setSelectIndex(itemDishPinnedListAdapter.getItem(firstVisibleItem).getDishCategoryId());
                            // lv_product_category.setItemChecked(itemDishPinnedListAdapter.getItem(firstVisibleItem).getDishCategoryId(),true);
-                          // lv_product_category.setSelection(itemDishPinnedListAdapter.getItem(firstVisibleItem).getDishCategoryId());
+                           lv_product_category.setSelection(itemDishPinnedListAdapter.getItem(firstVisibleItem).getDishCategoryId());
                           // itemDishCategoryListAdapter.notifyDataSetChanged();
                         }
+                        new Handler().postDelayed(new Runnable() {
+                            @Override
+                            public void run() {
+                                itemDishCategoryListAdapter.notifyDataSetChanged();
+                            }
+                        },100);
                     }
-//                }
+                }
 
             }
         });
@@ -232,6 +238,7 @@ public class DishSelectActivity extends OABaseActivity {
                 if (view.getTag() instanceof  ItemDishPinnedListAdapter.ItemViewHolder){
                     ItemDishPinnedListAdapter.ItemViewHolder itemViewHolder= (ItemDishPinnedListAdapter.ItemViewHolder) view.getTag();
                     final Product product=itemViewHolder.product;
+                    LogUtil.d(TAG,"product name:"+product.getName());
                     itemViewHolder.img_product_photo.setOnClickListener(new View.OnClickListener() {
                         @Override
                         public void onClick(View view) {

+ 0 - 6
app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishCategoryListAdapter.java

@@ -66,7 +66,6 @@ public class ItemDishCategoryListAdapter extends BaseAdapter {
         if (position == selectIndex) {
             convertView.setBackgroundColor(Color.parseColor("#ffffff"));
         } else {
-            
             convertView.setBackgroundColor(Color.parseColor("#f3f3f3"));
         }
         return convertView;
@@ -74,11 +73,6 @@ public class ItemDishCategoryListAdapter extends BaseAdapter {
 
     private void initializeViews(ProductCategory object, ViewHolder holder,int position) {
         holder.tvName.setText(object.getName());
-//        if (selectIndex==position){
-//            holder.rlLayout.setSelected(true);
-//        }else{
-//            holder.rlLayout.setSelected(false);
-//        }
         holder.modle=object;
     }
 

+ 151 - 0
app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishPinHeaderAdapter.java

@@ -0,0 +1,151 @@
+package com.modular.booking.adapter;
+
+import android.app.Activity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.common.LogUtil;
+import com.common.data.ListUtils;
+import com.core.utils.helper.AvatarHelper;
+import com.modular.booking.R;
+import com.modular.booking.activity.utils.ShoppingCart;
+import com.modular.booking.model.Product;
+import com.modular.booking.model.ProductCategory;
+import com.modular.booking.widget.ShoppingCountView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class ItemDishPinHeaderAdapter extends SectionedBaseAdapter {
+
+    private LayoutInflater layoutInflater;
+    private List<ProductCategory> mCategories=new ArrayList<>();
+    private View mAnimTargetView;
+    public void setAnimTargetView(View animTargetView) {
+        mAnimTargetView = animTargetView;
+    }
+    public ItemDishPinHeaderAdapter(Activity activity) {
+       this. layoutInflater = LayoutInflater.from(activity);
+    }
+
+    public void setItems(List<ProductCategory> categories) {
+        mCategories = categories;
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public Product getItem(int section, int position) {
+        List<Product> products = mCategories.get(section).getProducts();
+        return products.get(position);
+    }
+
+    @Override
+    public long getItemId(int section, int position) {
+        return position;
+    }
+
+    @Override
+    public int getSectionCount() {
+        return mCategories != null ? mCategories.size() : 0;
+    }
+
+    @Override
+    public int getCountForSection(int section) {
+        if (mCategories != null) {
+            List<Product> products = mCategories.get(section).getProducts();
+            if (!ListUtils.isEmpty(products)) {
+                return products.size();
+            }
+        }
+        return 0;
+    }
+
+    @Override
+    public View getItemView(int section, int position, View convertView, ViewGroup parent) {
+        ItemDishPinHeaderAdapter.ItemViewHolder viewHolder;
+           if (convertView==null){
+                convertView = layoutInflater.inflate(
+                R.layout.item_dish_list, null);
+                viewHolder=new  ItemDishPinHeaderAdapter.ItemViewHolder( convertView);
+                convertView.setTag(viewHolder);
+           }else{
+                viewHolder= (ItemViewHolder) convertView.getTag();
+           }
+
+        Product product = getItem(section, position);
+        int quantity = ShoppingCart.getInstance().getQuantityForProduct(product);
+        viewHolder.product=product;
+        AvatarHelper.getInstance().display("http://p0.meituan.net/deal/__16971854__3919079.jpg@380w_214h_1e_1c",  viewHolder. img_product_photo,true);
+        LogUtil.d("ShopCar","---item----"+position);
+        viewHolder. shoppingCountView.setShoppingCount(quantity);
+        viewHolder. shoppingCountView.setAnimTargetView(mAnimTargetView);
+        viewHolder. shoppingCountView.setOnShoppingClickListener(new ShoppingCountView.ShoppingClickListener() {
+            @Override
+            public void onAddClick(int num) {
+                if (!ShoppingCart.getInstance().add(product)) {
+
+                }
+            }
+
+            @Override
+            public void onMinusClick(int num) {
+                if (!ShoppingCart.getInstance().delete(product)) {
+
+                }
+            }
+        });
+        viewHolder.  txt_product_name.setText(product.getName());
+        viewHolder.  txt_product_month_sales.setText("月售0");
+        viewHolder.  txt_product_price.setText("¥"+product.getUnitItems().get(0).getPrice());
+        
+        return convertView;
+    }
+
+    @Override
+    public View getSectionHeaderView(int position, View convertView, ViewGroup parent) {
+        ItemDishPinHeaderAdapter.ItemHeaderHolder viewHolder;
+           if (convertView==null){
+                convertView = layoutInflater.inflate(
+                R.layout.item_dish_list_head, null);
+                viewHolder=new ItemDishPinHeaderAdapter.ItemHeaderHolder(convertView);
+                 convertView.setTag(viewHolder);
+           }else{
+               viewHolder= (ItemHeaderHolder) convertView.getTag();
+           }
+            ProductCategory productCategory = mCategories.get(position);
+            viewHolder.title.setText(productCategory.getName());
+           return   convertView;
+    }
+
+
+
+    class ItemHeaderHolder{
+        TextView title;
+        public ItemHeaderHolder(View convertView) {
+            title=convertView.findViewById(R.id.txt_title);
+        }
+    }
+
+    public class ItemViewHolder{
+        public ImageView img_product_photo;
+        public TextView txt_product_name;
+        public TextView  txt_product_month_sales;
+        public TextView  txt_product_price;
+        public ShoppingCountView shoppingCountView;
+        public RelativeLayout rl_dish_product ;
+        public Product  product;
+        public ItemViewHolder(View convertView) {
+            img_product_photo=convertView.findViewById(R.id.img_product_photo);
+            txt_product_name=convertView.findViewById(R.id.txt_product_name);
+            txt_product_month_sales=convertView.findViewById(R.id.txt_product_month_sales);
+            txt_product_price =convertView.findViewById(R.id.txt_product_price);
+            shoppingCountView=convertView.findViewById(R.id.shopping_count_view);
+            rl_dish_product=convertView.findViewById(R.id.rl_dish_product);
+        }
+    }
+}

+ 10 - 10
app_modular/appbooking/src/main/java/com/modular/booking/adapter/ItemDishPinnedListAdapter.java

@@ -84,25 +84,25 @@ public class ItemDishPinnedListAdapter extends BaseAdapter implements PinnedSect
        ProductCategory productCategory=productCategories.get(position);
        if (productCategory.getType()==ProductCategory.SECTION){
            ItemHeaderHolder viewHolder;
-           if (convertView==null){
+//           if (convertView==null){
                convertView = layoutInflater.inflate(
                        R.layout.item_dish_list_head, null);
                viewHolder=new ItemHeaderHolder(convertView);
                convertView.setTag(viewHolder);
-           }else{
-               viewHolder= (ItemHeaderHolder) convertView.getTag();
-           }
+//           }else{
+//               viewHolder= (ItemHeaderHolder) convertView.getTag();
+//           }
           viewHolder.title.setText(productCategory.getName());
        }else if(productCategory.getType()==ProductCategory.ITEM){
            ItemViewHolder viewHolder;
-           if (convertView==null){
+//           if (convertView==null){
                convertView = layoutInflater.inflate(
                        R.layout.item_dish_list, null);
                viewHolder=new ItemViewHolder( convertView);
                convertView.setTag(viewHolder);
-           }else{
-               viewHolder= (ItemViewHolder) convertView.getTag();
-           }
+//           }else{
+//               viewHolder= (ItemViewHolder) convertView.getTag();
+//           }
        
             final Product product=productCategory.getProduct();
            int quantity = ShoppingCart.getInstance().getQuantityForProduct(product);
@@ -152,13 +152,13 @@ public class ItemDishPinnedListAdapter extends BaseAdapter implements PinnedSect
        public  ShoppingCountView shoppingCountView;
        public  RelativeLayout rl_dish_product ;
        public  Product  product;
-        public ItemViewHolder(View convertView) {
+       public ItemViewHolder(View convertView) {
             img_product_photo=convertView.findViewById(R.id.img_product_photo);
             txt_product_name=convertView.findViewById(R.id.txt_product_name);
             txt_product_month_sales=convertView.findViewById(R.id.txt_product_month_sales);
             txt_product_price =convertView.findViewById(R.id.txt_product_price);
             shoppingCountView=convertView.findViewById(R.id.shopping_count_view);
-          rl_dish_product=convertView.findViewById(R.id.rl_dish_product);
+            rl_dish_product=convertView.findViewById(R.id.rl_dish_product);
         }
     }
 }

+ 211 - 0
app_modular/appbooking/src/main/java/com/modular/booking/adapter/SectionedBaseAdapter.java

@@ -0,0 +1,211 @@
+package com.modular.booking.adapter;
+
+
+import android.util.SparseArray;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+import com.modular.booking.widget.PinnedHeaderListView;
+
+
+public abstract class SectionedBaseAdapter extends BaseAdapter implements PinnedHeaderListView.PinnedSectionedHeaderAdapter {
+
+    private static int HEADER_VIEW_TYPE = 0;
+    private static int ITEM_VIEW_TYPE = 0;
+
+    /**
+     * Holds the calculated values of @{link getPositionInSectionForPosition}
+     */
+    private SparseArray<Integer> mSectionPositionCache;
+    /**
+     * Holds the calculated values of @{link getSectionForPosition}
+     */
+    private SparseArray<Integer> mSectionCache;
+    /**
+     * Holds the calculated values of @{link getCountForSection}
+     */
+    private SparseArray<Integer> mSectionCountCache;
+
+    /**
+     * Caches the item count
+     */
+    private int mCount;
+    /**
+     * Caches the section count
+     */
+    private int mSectionCount;
+
+    public SectionedBaseAdapter() {
+        super();
+        mSectionCache = new SparseArray<Integer>();
+        mSectionPositionCache = new SparseArray<Integer>();
+        mSectionCountCache = new SparseArray<Integer>();
+        mCount = -1;
+        mSectionCount = -1;
+    }
+
+    @Override
+    public void notifyDataSetChanged() {
+        mSectionCache.clear();
+        mSectionPositionCache.clear();
+        mSectionCountCache.clear();
+        mCount = -1;
+        mSectionCount = -1;
+        super.notifyDataSetChanged();
+    }
+
+    @Override
+    public void notifyDataSetInvalidated() {
+        mSectionCache.clear();
+        mSectionPositionCache.clear();
+        mSectionCountCache.clear();
+        mCount = -1;
+        mSectionCount = -1;
+        super.notifyDataSetInvalidated();
+    }
+
+    @Override
+    public final int getCount() {
+        if (mCount >= 0) {
+            return mCount;
+        }
+        int count = 0;
+        for (int i = 0; i < internalGetSectionCount(); i++) {
+            count += internalGetCountForSection(i);
+            count++; // for the header view
+        }
+        mCount = count;
+        return count;
+    }
+
+    @Override
+    public final Object getItem(int position) {
+        return getItem(getSectionForPosition(position), getPositionInSectionForPosition(position));
+    }
+
+    @Override
+    public final long getItemId(int position) {
+        return getItemId(getSectionForPosition(position), getPositionInSectionForPosition(position));
+    }
+
+    @Override
+    public final View getView(int position, View convertView, ViewGroup parent) {
+        if (isSectionHeader(position)) {
+            return getSectionHeaderView(getSectionForPosition(position), convertView, parent);
+        }
+        return getItemView(getSectionForPosition(position), getPositionInSectionForPosition(position), convertView, parent);
+    }
+
+    @Override
+    public final int getItemViewType(int position) {
+        if (isSectionHeader(position)) {
+            return getItemViewTypeCount() + getSectionHeaderViewType(getSectionForPosition(position));
+        }
+        return getItemViewType(getSectionForPosition(position), getPositionInSectionForPosition(position));
+    }
+
+    @Override
+    public final int getViewTypeCount() {
+        return getItemViewTypeCount() + getSectionHeaderViewTypeCount();
+    }
+
+    public final int getSectionForPosition(int position) {
+        // first try to retrieve values from cache
+        Integer cachedSection = mSectionCache.get(position);
+        if (cachedSection != null) {
+            return cachedSection;
+        }
+        int sectionStart = 0;
+        for (int i = 0; i < internalGetSectionCount(); i++) {
+            int sectionCount = internalGetCountForSection(i);
+            int sectionEnd = sectionStart + sectionCount + 1;
+            if (position >= sectionStart && position < sectionEnd) {
+                mSectionCache.put(position, i);
+                return i;
+            }
+            sectionStart = sectionEnd;
+        }
+        return 0;
+    }
+
+    public int getPositionInSectionForPosition(int position) {
+        // first try to retrieve values from cache
+        Integer cachedPosition = mSectionPositionCache.get(position);
+        if (cachedPosition != null) {
+            return cachedPosition;
+        }
+        int sectionStart = 0;
+        for (int i = 0; i < internalGetSectionCount(); i++) {
+            int sectionCount = internalGetCountForSection(i);
+            int sectionEnd = sectionStart + sectionCount + 1;
+            if (position >= sectionStart && position < sectionEnd) {
+                int positionInSection = position - sectionStart - 1;
+                mSectionPositionCache.put(position, positionInSection);
+                return positionInSection;
+            }
+            sectionStart = sectionEnd;
+        }
+        return 0;
+    }
+
+    public final boolean isSectionHeader(int position) {
+        int sectionStart = 0;
+        for (int i = 0; i < internalGetSectionCount(); i++) {
+            if (position == sectionStart) {
+                return true;
+            } else if (position < sectionStart) {
+                return false;
+            }
+            sectionStart += internalGetCountForSection(i) + 1;
+        }
+        return false;
+    }
+
+    public int getItemViewType(int section, int position) {
+        return ITEM_VIEW_TYPE;
+    }
+
+    public int getItemViewTypeCount() {
+        return 1;
+    }
+
+    public int getSectionHeaderViewType(int section) {
+        return HEADER_VIEW_TYPE;
+    }
+
+    public int getSectionHeaderViewTypeCount() {
+        return 1;
+    }
+
+    public abstract Object getItem(int section, int position);
+
+    public abstract long getItemId(int section, int position);
+
+    public abstract int getSectionCount();
+
+    public abstract int getCountForSection(int section);
+
+    public abstract View getItemView(int section, int position, View convertView, ViewGroup parent);
+
+    public abstract View getSectionHeaderView(int section, View convertView, ViewGroup parent);
+
+    private int internalGetCountForSection(int section) {
+        Integer cachedSectionCount = mSectionCountCache.get(section);
+        if (cachedSectionCount != null) {
+            return cachedSectionCount;
+        }
+        int sectionCount = getCountForSection(section);
+        mSectionCountCache.put(section, sectionCount);
+        return sectionCount;
+    }
+
+    private int internalGetSectionCount() {
+        if (mSectionCount >= 0) {
+            return mSectionCount;
+        }
+        mSectionCount = getSectionCount();
+        return mSectionCount;
+    }
+
+}

+ 0 - 3
app_modular/appbooking/src/main/java/com/modular/booking/model/ProductCategory.java

@@ -19,10 +19,7 @@ public class ProductCategory implements Parcelable {
     private String  ParentCode;
     private String  Code;
     private String  Name;
-    
     private Product product;
-    
-    
     private List<Product> products=new ArrayList<>();
 
     public int getDishCategoryId() {

+ 207 - 0
app_modular/appbooking/src/main/java/com/modular/booking/widget/PinnedHeaderListView.java

@@ -0,0 +1,207 @@
+package com.modular.booking.widget;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AbsListView;
+import android.widget.AbsListView.OnScrollListener;
+import android.widget.AdapterView;
+import android.widget.HeaderViewListAdapter;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+
+import com.modular.booking.adapter.SectionedBaseAdapter;
+
+
+public class PinnedHeaderListView extends ListView implements OnScrollListener {
+
+    private OnScrollListener mOnScrollListener;
+
+    public static interface PinnedSectionedHeaderAdapter {
+        public boolean isSectionHeader(int position);
+
+        public int getSectionForPosition(int position);
+
+        public View getSectionHeaderView(int section, View convertView, ViewGroup parent);
+
+        public int getSectionHeaderViewType(int section);
+
+        public int getCount();
+
+    }
+
+    private PinnedSectionedHeaderAdapter mAdapter;
+    private View mCurrentHeader;
+    private int mCurrentHeaderViewType = 0;
+    private float mHeaderOffset;
+    private boolean mShouldPin = true;
+    private int mCurrentSection = 0;
+    private int mWidthMode;
+    private int mHeightMode;
+
+    public PinnedHeaderListView(Context context) {
+        super(context);
+        super.setOnScrollListener(this);
+    }
+
+    public PinnedHeaderListView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        super.setOnScrollListener(this);
+    }
+
+    public PinnedHeaderListView(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+        super.setOnScrollListener(this);
+    }
+
+    public void setPinHeaders(boolean shouldPin) {
+        mShouldPin = shouldPin;
+    }
+
+    @Override
+    public void setAdapter(ListAdapter adapter) {
+        mCurrentHeader = null;
+        mAdapter = (PinnedSectionedHeaderAdapter) adapter;
+        super.setAdapter(adapter);
+    }
+
+    @Override
+    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+        if (mOnScrollListener != null) {
+            mOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
+        }
+
+        if (mAdapter == null || mAdapter.getCount() == 0 || !mShouldPin || (firstVisibleItem < getHeaderViewsCount())) {
+            mCurrentHeader = null;
+            mHeaderOffset = 0.0f;
+            for (int i = firstVisibleItem; i < firstVisibleItem + visibleItemCount; i++) {
+                View header = getChildAt(i);
+                if (header != null) {
+                    header.setVisibility(VISIBLE);
+                }
+            }
+            return;
+        }
+
+        firstVisibleItem -= getHeaderViewsCount();
+
+        int section = mAdapter.getSectionForPosition(firstVisibleItem);
+        int viewType = mAdapter.getSectionHeaderViewType(section);
+        mCurrentHeader = getSectionHeaderView(section, mCurrentHeaderViewType != viewType ? null : mCurrentHeader);
+        ensurePinnedHeaderLayout(mCurrentHeader);
+        mCurrentHeaderViewType = viewType;
+
+        mHeaderOffset = 0.0f;
+
+        for (int i = firstVisibleItem; i < firstVisibleItem + visibleItemCount; i++) {
+            if (mAdapter.isSectionHeader(i)) {
+                View header = getChildAt(i - firstVisibleItem);
+                float headerTop = header.getTop();
+                float pinnedHeaderHeight = mCurrentHeader.getMeasuredHeight();
+                header.setVisibility(VISIBLE);
+                if (pinnedHeaderHeight >= headerTop && headerTop > 0) {
+                    mHeaderOffset = headerTop - header.getHeight();
+                } else if (headerTop <= 0) {
+                    header.setVisibility(INVISIBLE);
+                }
+            }
+        }
+
+        invalidate();
+    }
+
+    @Override
+    public void onScrollStateChanged(AbsListView view, int scrollState) {
+        if (mOnScrollListener != null) {
+            mOnScrollListener.onScrollStateChanged(view, scrollState);
+        }
+    }
+
+    private View getSectionHeaderView(int section, View oldView) {
+        boolean shouldLayout = section != mCurrentSection || oldView == null;
+
+        View view = mAdapter.getSectionHeaderView(section, oldView, this);
+        if (shouldLayout) {
+            // a new section, thus a new header. We should lay it out again
+            ensurePinnedHeaderLayout(view);
+            mCurrentSection = section;
+        }
+        return view;
+    }
+
+    private void ensurePinnedHeaderLayout(View header) {
+        if (header.isLayoutRequested()) {
+            int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), mWidthMode);
+
+            int heightSpec;
+            ViewGroup.LayoutParams layoutParams = header.getLayoutParams();
+            if (layoutParams != null && layoutParams.height > 0) {
+                heightSpec = MeasureSpec.makeMeasureSpec(layoutParams.height, MeasureSpec.EXACTLY);
+            } else {
+                heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+            }
+            header.measure(widthSpec, heightSpec);
+            header.layout(0, 0, header.getMeasuredWidth(), header.getMeasuredHeight());
+        }
+    }
+
+    @Override
+    protected void dispatchDraw(Canvas canvas) {
+        super.dispatchDraw(canvas);
+        if (mAdapter == null || !mShouldPin || mCurrentHeader == null)
+            return;
+        int saveCount = canvas.save();
+        canvas.translate(0, mHeaderOffset);
+        canvas.clipRect(0, 0, getWidth(), mCurrentHeader.getMeasuredHeight()); // needed
+        // for
+        // <
+        // HONEYCOMB
+        mCurrentHeader.draw(canvas);
+        canvas.restoreToCount(saveCount);
+    }
+
+    @Override
+    public void setOnScrollListener(OnScrollListener l) {
+        mOnScrollListener = l;
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
+        mWidthMode = MeasureSpec.getMode(widthMeasureSpec);
+        mHeightMode = MeasureSpec.getMode(heightMeasureSpec);
+    }
+
+    public void setOnItemClickListener(OnItemClickListener listener) {
+        super.setOnItemClickListener(listener);
+    }
+
+    public static abstract class OnItemClickListener implements AdapterView.OnItemClickListener {
+        @Override
+        public void onItemClick(AdapterView<?> adapterView, View view, int rawPosition, long id) {
+            SectionedBaseAdapter adapter;
+            if (adapterView.getAdapter().getClass().equals(HeaderViewListAdapter.class)) {
+                HeaderViewListAdapter wrapperAdapter = (HeaderViewListAdapter) adapterView.getAdapter();
+                adapter = (SectionedBaseAdapter) wrapperAdapter.getWrappedAdapter();
+            } else {
+                adapter = (SectionedBaseAdapter) adapterView.getAdapter();
+            }
+            int section = adapter.getSectionForPosition(rawPosition);
+            int position = adapter.getPositionInSectionForPosition(rawPosition);
+
+            if (position == -1) {
+                onSectionClick(adapterView, view, section, id);
+            } else {
+                onItemClick(adapterView, view, section, position, id);
+            }
+        }
+
+        public abstract void onItemClick(AdapterView<?> adapterView, View view, int section, int position, long id);
+
+        public abstract void onSectionClick(AdapterView<?> adapterView, View view, int section, long id);
+
+    }
+}

+ 17 - 14
app_modular/appbooking/src/main/java/com/modular/booking/widget/ShoppingCountView.java

@@ -347,17 +347,17 @@ public class ShoppingCountView extends View {
         animatorAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
             @Override
             public void onAnimationUpdate(ValueAnimator valueAnimator) {
-            mAlpha = (Integer) valueAnimator.getAnimatedValue();
-            if (mIsExpand) {
-                if (mAlpha == 255) {
-                    mState = STATE_HAVE_MINUS;
-                }
-            } else {
-                if (mAlpha == 0) {
-                    mState = STATE_NONE_MINUS;
+                mAlpha = (Integer) valueAnimator.getAnimatedValue();
+                if (mIsExpand) {
+                    if (mAlpha == 255) {
+                        mState = STATE_HAVE_MINUS;
+                    }
+                } else {
+                    if (mAlpha == 0) {
+                        mState = STATE_NONE_MINUS;
+                    }
                 }
             }
-            }
         });
         animatorList.add(animatorAlpha);
 
@@ -457,6 +457,7 @@ public class ShoppingCountView extends View {
                         parent.removeView(animLayout);
                     }
                 });
+                animation.cancel();
             }
         });
         animView.startAnimation(animation);
@@ -491,7 +492,8 @@ public class ShoppingCountView extends View {
         v.buildDrawingCache();
         Bitmap animBitmap = v.getDrawingCache();
         ImageView ivAnim = new ImageView(getContext());
-        ivAnim.setImageBitmap(animBitmap);
+        ivAnim.setImageResource(R.drawable.icon_add);
+        //ivAnim.setImageBitmap(animBitmap);
         return ivAnim;
     }
 
@@ -516,8 +518,9 @@ public class ShoppingCountView extends View {
     private void setAnimStartLoc(int[] startLoc, View animView) {
         LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                 LinearLayout.LayoutParams.WRAP_CONTENT);
-        lp.leftMargin = startLoc[0];
-        lp.topMargin = startLoc[1];
+        lp.leftMargin = startLoc[0]+dp2px(12);
+        lp.topMargin = startLoc[1]+dp2px(2);
+      
         animView.setLayoutParams(lp);
     }
 
@@ -546,12 +549,12 @@ public class ShoppingCountView extends View {
         TranslateAnimation translateX = new TranslateAnimation(0, offset[0], 0, 0);
         TranslateAnimation translateY = new TranslateAnimation(0, 0, 0, offset[1]);
         translateY.setInterpolator(new AccelerateInterpolator());
-        ScaleAnimation scaleAnimation = new ScaleAnimation(1, 0, 1, 0);
+        ScaleAnimation scaleAnimation = new ScaleAnimation(1, 0.3f, 1, 0.3f);
         scaleAnimation.setInterpolator(new AccelerateInterpolator());
         as.addAnimation(scaleAnimation);
         as.addAnimation(translateX);
         as.addAnimation(translateY);
-        as.setDuration(500);
+        as.setDuration(1200);
         return as;
     }
 

+ 100 - 0
app_modular/appbooking/src/main/res/layout/activity_dish_main.xml

@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="#EDEDED">
+    <include layout="@layout/include_add_top" android:id="@+id/dish_layout_top"></include>
+    <com.flipboard.bottomsheet.BottomSheetLayout
+        android:id="@+id/bottom_sheet_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_below="@+id/dish_layout_top"
+        android:layout_marginBottom="50dp">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <ListView
+            android:id="@+id/lv_product_category"
+            android:layout_width="100dp"
+            android:layout_height="match_parent"
+          />
+        <com.modular.booking.widget.PinnedHeaderListView
+            android:id="@+id/lv_dish_product"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="@color/white"
+            android:fadingEdge="none"
+            android:scrollbars="none"
+            android:scrollingCache="false"
+            android:cacheColorHint="#00000000" />
+    </LinearLayout>
+    </com.flipboard.bottomsheet.BottomSheetLayout>
+
+    <Button
+        android:id="@+id/bt_bottom"
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        android:visibility="gone"
+        android:layout_alignParentBottom="true" />
+    <!--底部购物车布局-->
+    <FrameLayout
+        android:id="@+id/rl_bottom"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:id="@+id/ll_bottom"
+            android:background="#CC000000"
+            android:layout_width="match_parent"
+            android:orientation="horizontal"
+            android:layout_gravity="bottom"
+            android:layout_height="50dp"
+            android:weightSum="3">
+            <TextView 
+            android:id="@+id/tvTotalPrice"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="70dp"
+            android:textColor="@color/gray_light" 
+            android:layout_gravity="center_vertical"
+            android:layout_weight="2"
+            android:text="@string/tv_shop_empty"/>
+            <TextView
+                android:id="@+id/tvShopSure"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:background="@drawable/shape_btn_blue_gradient"
+                android:textColor="@color/white"
+                android:layout_gravity="right"
+                android:gravity="center"
+                android:text="选好了"/>
+        </LinearLayout>
+       <FrameLayout
+           android:layout_width="wrap_content"
+           android:layout_height="wrap_content">
+  
+           <ImageView
+               android:id="@+id/ivShopCar"
+               android:layout_width="60dp"
+               android:layout_height="60dp"
+               android:layout_gravity="bottom"
+               android:layout_marginLeft="7dp"
+               android:layout_marginBottom="7dp"
+               android:src="@drawable/icon_shop_empty"/>
+           <TextView
+               android:id="@+id/num_tv"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:layout_gravity="top|right"
+               android:background="@drawable/tab_unread_bg"
+               android:gravity="center"
+               android:text="1"
+               android:textColor="@android:color/white"
+               android:textSize="10.0dip" />
+       </FrameLayout>
+    </FrameLayout>
+</RelativeLayout>

+ 1 - 1
app_modular/appbooking/src/main/res/layout/activity_dish_select.xml

@@ -25,7 +25,7 @@
         <com.core.widget.PinnedSectionListView
             android:id="@+id/lv_dish_product"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:background="@color/white"
             android:fadingEdge="none"
             android:scrollbars="none"

+ 0 - 1
app_modular/appbooking/src/main/res/layout/item_dish_catagory_list.xml

@@ -6,7 +6,6 @@
     android:paddingLeft="10dp"
     android:paddingRight="10dp"
     android:paddingTop="8dp"
-
     android:paddingBottom="8dp">
     <TextView
         android:id="@+id/tv_name"

+ 13 - 13
app_modular/appbooking/src/main/res/layout/item_dish_list.xml

@@ -71,19 +71,19 @@
                 android:layout_alignParentRight="true"
                 android:visibility="gone"
                 android:textSize="14sp" />-->
-     <com.modular.booking.widget.ShoppingCountView
-         android:id="@+id/shopping_count_view"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:layout_alignTop="@id/txt_product_price"
-         android:layout_alignParentRight="true"
-         android:layout_alignParentEnd="true"
-         app:scv_add_btn_bg_color="#3499DF"
-         app:scv_add_btn_text_color="@color/white"
-         app:scv_minus_btn_bg_color="@color/white"
-         app:scv_minus_btn_text_color="#3499DF"
-         android:visibility="visible">
-     </com.modular.booking.widget.ShoppingCountView>
+            <com.modular.booking.widget.ShoppingCountView
+                android:id="@+id/shopping_count_view"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignTop="@id/txt_product_price"
+                android:layout_alignParentRight="true"
+                android:layout_alignParentEnd="true"
+                app:scv_add_btn_bg_color="#3499DF"
+                app:scv_add_btn_text_color="@color/white"
+                app:scv_minus_btn_bg_color="@color/white"
+                app:scv_minus_btn_text_color="#3499DF"
+                android:visibility="visible">
+            </com.modular.booking.widget.ShoppingCountView>
         </RelativeLayout>
 
     </LinearLayout>

+ 14 - 3
app_modular/appcontact/src/main/java/com/uas/appcontact/ui/activity/CompanyContactsActivity.java

@@ -622,7 +622,15 @@ public class CompanyContactsActivity extends BaseActivity {
                     if (!ListUtils.isEmpty(searchData)) {
                         popupWindow = null;
                         showPopupWindow(voiceSearchView);
+                        //隐藏
+                        mRefreshLayout.getLayout().setVisibility(View.INVISIBLE);
+                    }else{
+                        //显示
+                        mRefreshLayout.getLayout().setVisibility(View.VISIBLE);
                     }
+                }else{
+                    //显示
+                    mRefreshLayout.getLayout().setVisibility(View.VISIBLE);
                 }
             }
 
@@ -896,13 +904,14 @@ public class CompanyContactsActivity extends BaseActivity {
         if (popupWindow == null) {
             LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             view = layoutInflater.inflate(R.layout.pop_crm_list, null);
-            ListView plist = (ListView) view.findViewById(R.id.mList);
+            final ListView plist =  view.findViewById(R.id.mList);
             final MySimpleAdapter adapter = new MySimpleAdapter(
                     this,
                     searchData,
                     R.layout.item_pop_employee,
                     new String[]{"item_name", "item_sub"}, new int[]{R.id.name_tv, R.id.sub_tv});
             plist.setAdapter(adapter);
+          
             plist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                 @Override
                 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@@ -931,15 +940,18 @@ public class CompanyContactsActivity extends BaseActivity {
                 }
             });
             popupWindow = new PopupWindow(view, windowManager.getDefaultDisplay().getWidth(), windowManager.getDefaultDisplay().getHeight() / 3);
+          
         }
         // 使其聚集
         popupWindow.setFocusable(true);
         // 设置允许在外点击消失
-        //popupWindow.setOutsideTouchable(true);
+        popupWindow.setOutsideTouchable(false);
         popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
             @Override
             public void onDismiss() {
                 DisplayUtil.backgroundAlpha(ct, 1f);
+                //显示
+                mRefreshLayout.getLayout().setVisibility(View.VISIBLE);
             }
         });
         DisplayUtil.backgroundAlpha(this, 1f);
@@ -948,7 +960,6 @@ public class CompanyContactsActivity extends BaseActivity {
         popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
         popupWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);
         popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
-        ;
         // 显示的位置为:屏幕的宽度的一半-PopupWindow的高度的一半
         popupWindow.showAsDropDown(parent, windowManager.getDefaultDisplay().getWidth(), 0);
     }

+ 8 - 4
app_modular/appcontact/src/main/java/com/uas/appcontact/ui/fragment/ContactsFragment.java

@@ -230,8 +230,10 @@ public class ContactsFragment extends EasyFragment
 
 
     void showLoading() {
-        if (!refreshListView.isRefreshing() && isVisible) {
-            progressDialog.show();
+        if (refreshListView!=null) {
+            if (!refreshListView.isRefreshing() && isVisible) {
+                progressDialog.show();
+            }
         }
     }//显示刷新
 
@@ -239,8 +241,10 @@ public class ContactsFragment extends EasyFragment
         if (progressDialog != null && progressDialog.isShowing()) {
             progressDialog.dismiss();
         }
-        if (refreshListView.isRefreshing()) {
-            refreshListView.onRefreshComplete();
+        if (refreshListView!=null) {
+            if (refreshListView.isRefreshing()) {
+                refreshListView.onRefreshComplete();
+            }
         }
     }//关闭刷新
 

+ 3 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/ProcessB2BActivity.java

@@ -454,6 +454,7 @@ public class ProcessB2BActivity extends BaseActivity implements View.OnClickList
         params.put("emuu", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "b2b_uu"));
         params.put("enuu", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "companyEnUu"));
         params.put("count", "1000");
+        params.put("sessionId",CommonUtil.getB2BSession(MyApplication.getInstance()));
         params.put("page", page);
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
         headers.put("Cookie", ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().getCookie());
@@ -469,6 +470,7 @@ public class ProcessB2BActivity extends BaseActivity implements View.OnClickList
         params.put("enuu", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "companyEnUu"));
         params.put("count", "1000");
         params.put("page", pageDone);
+        params.put("sessionId",CommonUtil.getB2BSession(MyApplication.getInstance()));
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
         headers.put("Cookie", ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().getCookie());
         ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, SUSSCESS_already, null, null, "get");
@@ -480,6 +482,7 @@ public class ProcessB2BActivity extends BaseActivity implements View.OnClickList
         Map<String, Object> params = new HashMap<>();
         params.put("count", String.valueOf(page * 30));
         params.put("page", 1);
+        params.put("sessionId",CommonUtil.getB2BSession(MyApplication.getInstance()));
         params.put("isMobile", "1");
         params.put("_do", "1");
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();

+ 35 - 17
app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/ApprovalAdapter.java

@@ -283,6 +283,7 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
     }
 
     private void bindTAGView(TagViewHolder holder, final int position) {
+        holder.valuesRG.setVisibility(View.GONE);
         String name = approvals.get(position).getCaption();
         if (approvals.get(position).getType() == Approval.ENCLOSURE) {//附件列表
             holder.line.setVisibility(View.GONE);
@@ -295,7 +296,7 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
                 }
             });
         } else {
-            if (ListUtils.getSize(approvals) > position + 1 && position > 0) {
+            if (ListUtils.getSize(approvals) > position + 1 && position > 0) {//标题
                 if (approvals.get(position + 1).getType() == approvals.get(position - 1).getType()) {
                     holder.line.setVisibility(View.VISIBLE);
                     holder.padding.setVisibility(View.GONE);
@@ -306,6 +307,19 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
                         holder.nameTv.setTextColor(ct.getResources().getColor(R.color.text_normal));
                     } else {
                         holder.nameTv.setTextColor(ct.getResources().getColor(R.color.titleBlue));
+                        if (!TextUtils.isEmpty(approvals.get(position).getValues())) {
+                            holder.valuesRG.setOnCheckedChangeListener(null);
+                            if (approvals.get(position).getValues().equals(Approval.VALUES_YES)) {
+                                holder.yesRB.setChecked(true);
+                                holder.notRB.setChecked(false);
+                            } else if (approvals.get(position).getValues().equals(Approval.VALUES_NO)) {
+                                holder.yesRB.setChecked(false);
+                                holder.notRB.setChecked(true);
+                            }
+                            holder.valuesRG.setVisibility(View.VISIBLE);
+                            holder.valuesRG.setTag(position);
+                            holder.valuesRG.setOnCheckedChangeListener(mOnCheckedChangeListener);
+                        }
                     }
                 }
             }
@@ -347,6 +361,7 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
             @Override
             public void onProgress(long allProress, long progress) {
             }
+
             @Override
             public void onSuccess(final File file) {
                 LogUtil.i("onSuccess=" + (file == null ? "" : file.getPath()));
@@ -438,10 +453,10 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
                 case 5:
                     setViewShowAble(false, holder.valueEt);
                     setViewShowAble(true, holder.valuesRG);
-                    if (approval.getValues().equals("是") || approval.getValues().equals("0")) {
+                    if (approval.getValues().equals(Approval.VALUES_YES) || approval.getValues().equals("0")) {
                         holder.yesRB.setChecked(true);
                         holder.notRB.setChecked(false);
-                    } else {
+                    } else if (approval.getValues().equals(Approval.VALUES_NO)) {
                         holder.yesRB.setChecked(false);
                         holder.notRB.setChecked(true);
                     }
@@ -487,22 +502,20 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
                 int position = (int) group.getTag();
                 if (ListUtils.getSize(approvals) > position) {
                     Approval approval = approvals.get(position);
-                    if (approval.inputType() == 5) {
-                        LogUtil.i("checkedId" + approval.getValues());
-                        if (checkedId == R.id.yesRB) {
-                            if (!"是".equals(approval.getValues())) {
-                                approval.setValues("是");
-//                                notifyItemChanged(position);
-                            }
-                            LogUtil.i("checkedId == R.id.yesRB ");
-                        } else {
-                            LogUtil.i("checkedId !!!!!!= R.id.yesRB ");
-                            if (!"否".equals(approval.getValues())) {
-                                approval.setValues("否");
-//                                notifyItemChanged(position);
+                    boolean select = checkedId == R.id.yesRB;
+                    if (approval.getType() == Approval.TAG) {//全部采纳和全部不采纳
+                        approval.setValues(select ? Approval.VALUES_YES : Approval.VALUES_NO);
+                        for (int i = position + 1; i < ListUtils.getSize(approvals); i++) {
+                            approval = approvals.get(i);
+                            if (approval.getType() == Approval.DETAIL && approval.inputType() == 5 && approval.isNeerInput()) {
+                                approval.setValues(select ? Approval.VALUES_YES : Approval.VALUES_NO);
+                                notifyItemChanged(i);
                             }
                         }
-
+                    } else {
+                        if (approval.inputType() == 5) {
+                            approval.setValues(select ? Approval.VALUES_YES : Approval.VALUES_NO);
+                        }
                     }
                 }
             }
@@ -588,6 +601,8 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
     private class TagViewHolder extends RecyclerView.ViewHolder {
         TextView nameTv;
         View padding, line;
+        RadioGroup valuesRG;
+        RadioButton yesRB, notRB;
 
         public TagViewHolder(ViewGroup parent) {
             this(LayoutInflater.from(ct).inflate(R.layout.item_approval_tag, parent, false));
@@ -598,6 +613,9 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
             nameTv = (TextView) itemView.findViewById(R.id.tagTv);
             padding = itemView.findViewById(R.id.padding);
             line = itemView.findViewById(R.id.line);
+            valuesRG = itemView.findViewById(R.id.valuesRG);
+            yesRB = itemView.findViewById(R.id.yesRB);
+            notRB = itemView.findViewById(R.id.notRB);
         }
     }
 

+ 1 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/model/ApprovalRecord.java

@@ -17,6 +17,7 @@ public class ApprovalRecord {
     public String chcheNode = "";
     public String imid = "";
     public String status = "";
+    public String currentNodeMan = "";//当前节点的人员编号
     public String nodeName = "";
     public String needInputKeys = "";
     public String showNeedMessage = "";//保存必填字段时候,,没有填写时候提示信息

+ 35 - 26
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/ApprovaPresenter.java

@@ -4,7 +4,7 @@ import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.Looper;
-import android.util.Log;
+import android.text.TextUtils;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -33,7 +33,6 @@ import com.modular.apputils.utils.MathUtil;
 import com.uas.appworks.OA.erp.activity.form.DataFormFieldActivity;
 import com.core.widget.view.selectcalendar.bean.Data;
 
-import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -559,9 +558,9 @@ public class ApprovaPresenter implements OnHttpResultListener {
 
     @Override
     public void error(int what, String message, Bundle bundle) {
+        LogUtil.i("message=" + message);
         if (endActivity) return;
         iApproval.dimssLoading();
-        LogUtil.i("message=" + message);
         switch (what) {
             case LOAD_AGREE:
                 if (message.contains("程序错误")) {
@@ -572,14 +571,12 @@ public class ApprovaPresenter implements OnHttpResultListener {
             case LOAD_PROCESS_UPDATE:
             case LOAD_NEXT_STEPOFP_INSTANCE:
             case LOAD_TAKE_OVER_OTHER:
-                submit = false;
                 break;
         }
+        submit = false;
         String errorKey = "exceptionInfo";
         if (JSONUtil.validate(message) && !StringUtil.isEmpty(JSONUtil.getText(parseObject(message), errorKey))) {
-            LogUtil.i("new JsonValidator().validate(message) && !StringUtil.isEmpty(JSONUtil.getText(parseObject(message), errorKey)");
             String remain = JSONUtil.getText(parseObject(message), errorKey);
-            LogUtil.i("remain=" + remain);
             iApproval.showToast(remain, R.color.load_submit);
         } else {
             iApproval.showToast(message, R.color.load_submit);
@@ -597,7 +594,6 @@ public class ApprovaPresenter implements OnHttpResultListener {
                     public void run() {
                         try {
                             handlerFormandGriddataInThread(JSONUtil.getJSONObject(object, "datas"));
-
                         } catch (Exception e) {
                             LogUtil.i("handlerFormandGriddataInThread =" + e.getMessage());
                             loading = false;
@@ -709,9 +705,9 @@ public class ApprovaPresenter implements OnHttpResultListener {
             JSONObject currentnode = JSONUtil.getJSONObject(object, "currentnode");
             if (currentnode != null) {
                 String recordName = JSONUtil.getText(currentnode, "jp_launcherName");
-                String nodeDealMan = JSONUtil.getText(currentnode, "jp_nodeDealMan");
+                record.currentNodeMan = JSONUtil.getText(currentnode, "jp_nodeDealMan");
                 String launcherCode = JSONUtil.getText(currentnode, "jp_launcherId");
-                iApproval.nodeDealMan(nodeDealMan);
+                iApproval.nodeDealMan(record.currentNodeMan);
                 String nodeName = JSONUtil.getText(currentnode, "jp_nodeName");
                 int keyValue = JSONUtil.getInt(currentnode, "jp_keyValue");
                 record.title = record.callerName = JSONUtil.getText(currentnode, "jp_name");
@@ -776,9 +772,17 @@ public class ApprovaPresenter implements OnHttpResultListener {
                                 false, i == 0);
                         if (!ListUtils.isEmpty(detailedApproval)) {
                             Approval approval = new Approval(Approval.TAG);
+
+                            if (!TextUtils.isEmpty(record.currentNodeMan)
+                                    && record.caller.toUpperCase().equals("INQUIRY")
+                                    && isApprovaling()
+                                    && CommonUtil.getEmcode().equals(record.currentNodeMan)) {
+                                approval.setValues("初始化");
+                            }
                             approval.setCaption(i == 0 ? record.getCallerName() + " 明细" : "");
                             detailedApproval.add(0, approval);
                             detailedList.addAll(detailedApproval);
+
                         }
                     }
                 }
@@ -954,23 +958,24 @@ public class ApprovaPresenter implements OnHttpResultListener {
                 }
             }
             boolean mergeAble = appwidth == 1 || (approval.isDftypeEQ("MT"));
-            approval.data2Values();
             approval.setMustInput(true);
             if (!StringUtil.isEmpty(record.needInputKeys)
                     && ("," + record.needInputKeys + ",").contains("," + valueKey + ",")) {
                 approval.setNeerInput(true);
                 if (approval.getDatas().size() <= 0) {
                     if (approval.isDftypeEQ("YN", "C")) {
-                        approval.getDatas().add(new Approval.Data("-1", "是"));
-                        approval.getDatas().add(new Approval.Data("0", "否"));
+                        approval.getDatas().add(new Approval.Data("-1", Approval.VALUES_YES));
+                        approval.getDatas().add(new Approval.Data("0", Approval.VALUES_NO));
                     } else if (approval.isDftypeEQ("B")) {
-                        approval.getDatas().add(new Approval.Data("1", "是"));
-                        approval.getDatas().add(new Approval.Data("0", "否"));
+                        approval.getDatas().add(new Approval.Data("1", Approval.VALUES_YES));
+                        approval.getDatas().add(new Approval.Data("0", Approval.VALUES_NO));
                     }
                 }
             }
-            if (!isApprovaling())
+            if (!isApprovaling()){
                 approval.setNeerInput(false);
+            }
+            approval.data2Values();
             if ((!approval.isNeerInput() && StringUtil.isEmpty(approval.getValues())) || !showAble || approval.getValues().equals("null") || !showAble || approval.getValues().equals("(null)")) {
                 continue;//如果不是要输入的对象,同时显示值为空,需要隐藏去
             }
@@ -1578,18 +1583,22 @@ public class ApprovaPresenter implements OnHttpResultListener {
                     }
                     return null;
                 } else {
-                    boolean isputed = false;
-                    for (Approval.Data data : approval.getDatas()) {
-                        isputed = false;
-                        if (data.display.equals(approval.getValues())) {
-                            formstore.put(approval.getValuesKey(),
-                                    StringUtil.isEmpty(data.value) ? approval.getValues() : data.value);
-                            isputed = true;
-                            break;
+                    if (approval.getValues().equals(Approval.VALUES_UNKNOWN)) {
+                        formstore.put(approval.getValuesKey(), "1");//添加特殊字符判断
+                    } else {
+                        boolean isputed = false;
+                        for (Approval.Data data : approval.getDatas()) {
+                            isputed = false;
+                            if (data.display.equals(approval.getValues())) {
+                                formstore.put(approval.getValuesKey(),
+                                        StringUtil.isEmpty(data.value) ? approval.getValues() : data.value);
+                                isputed = true;
+                                break;
+                            }
+                        }
+                        if (!isputed) {
+                            formstore.put(approval.getValuesKey(), approval.getValues());
                         }
-                    }
-                    if (!isputed) {
-                        formstore.put(approval.getValuesKey(), approval.getValues());
                     }
                 }
             }

+ 1 - 1
app_modular/apputils/src/main/AndroidManifest.xml

@@ -42,7 +42,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
-        <activity android:name=".IntentUrlActivity">
+        <activity android:name=".IntentUrlActivity" >
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
 

+ 1 - 1
app_modular/apputils/src/main/java/com/modular/apputils/IntentUrlActivity.java

@@ -35,7 +35,7 @@ public class IntentUrlActivity extends Activity {
                 public void run() {
                     openIntentUrl(action, i_getvalue);
                 }
-            }, 200);
+            }, 2000);
         }
     }
 

+ 0 - 1
app_modular/apputils/src/main/java/com/modular/apputils/network/Parameter.java

@@ -17,7 +17,6 @@ import java.util.Map;
 
 public class Parameter {
 
-
     public static final String MEDIA_TYPE_XWWW = "application/x-www-form-urlencoded;charset=utf-8";
     public static final String MEDIA_TYPE_JSON = "application/json;charset=utf-8";
     public static final String MEDIA_TYPE_PLAIN = "text/plain;charset=utf-8";

+ 0 - 25
app_modular/apputils/src/main/java/com/modular/apputils/utils/TravelUtils.java

@@ -1,25 +0,0 @@
-package com.modular.apputils.utils;
-
-import android.text.TextUtils;
-
-import com.common.data.TextUtil;
-
-/**
- * Created by Bitlike on 2018/3/23.
- */
-
-public class TravelUtils {
-
-    //TODO 差旅卡号
-    public static String getTraveCode(String cusCode, String master) {
-        if (TextUtils.isEmpty(cusCode)) {
-            switch (master) {
-                default:
-                    return master;
-            }
-        } else {
-            return cusCode;
-        }
-
-    }
-}

BIN
app_modular/apputils/src/main/res/drawable-hdpi/icon_empty_lamp.png


BIN
app_modular/apputils/src/main/res/drawable-xhdpi/icon_add_circular.png


BIN
app_modular/apputils/src/main/res/drawable-xhdpi/icon_empty_lamp.png


BIN
app_modular/apputils/src/main/res/drawable-xxhdpi/icon_add_circular.png


BIN
app_modular/apputils/src/main/res/drawable-xxhdpi/icon_empty_lamp.png


+ 1 - 1
app_modular/apputils/src/main/res/values/color.xml

@@ -6,5 +6,5 @@
     <color name="reactivity">#ef613b</color>
     <color name="indianred_pass">#c84421</color>
     <color name="cui">#5bbcaf</color>
-    <color name="cui_yellow">#89FC71</color>
+    <color name="cui_yellow">#EDFC71</color>
 </resources>

+ 2 - 0
app_modular/apputils/src/main/res/values/strings.xml

@@ -3,4 +3,6 @@
     <string name="str_error_wechat_pay_success">支付成功</string>
     <string name="str_error_wechat_pay_fail">支付失败</string>
     <string name="str_error_wechat_pay_cancel">支付已取消</string>
+    <string name="click_to"><u>点击前往</u></string>
+    <string name="administrators_phone"><u>13430818775</u></string>
 </resources>

+ 4 - 4
app_modular/appworks/src/main/java/com/uas/appworks/CRM/erp/activity/DeviceMatchActivity.java

@@ -59,7 +59,6 @@ public class DeviceMatchActivity extends BaseNetActivity implements View.OnClick
     @Override
     protected void init() throws Exception {
         initView();
-//        loadData("De_0126", "SMT-01", "A1", "生产机型1");
     }
 
     private void initView() {
@@ -173,6 +172,7 @@ public class DeviceMatchActivity extends BaseNetActivity implements View.OnClick
                 object = array.getJSONObject(i);
                 matche = new DeviceMatch();
                 matche.setCode(JSONUtil.getText(object, "DM_CODE"));
+                matche.setSpec(JSONUtil.getText(object, "DE_SPEC"));
                 matche.setName(JSONUtil.getText(object, "DE_NAME"));
                 matche.setExistqty(JSONUtil.getText(object, "EXISTQTY"));
                 matche.setLackqty(JSONUtil.getText(object, "LACKQTY"));
@@ -215,7 +215,7 @@ public class DeviceMatchActivity extends BaseNetActivity implements View.OnClick
         @Override
         public void onBindViewHolder(ViewHolder holder, int position) {
             DeviceMatch match = matches.get(position);
-            holder.codeTv.setText(match.getCode());
+            holder.specTv.setText(match.getSpec());
             holder.nameTv.setText(match.getName());
             holder.existqtyTv.setText(match.getExistqty());
             holder.lackqtyTv.setText(match.getLackqty());
@@ -228,14 +228,14 @@ public class DeviceMatchActivity extends BaseNetActivity implements View.OnClick
 
 
         class ViewHolder extends RecyclerView.ViewHolder {
-            private TextView codeTv;
+            private TextView specTv;
             private TextView nameTv;
             private TextView existqtyTv;
             private TextView lackqtyTv;
 
             public ViewHolder(View itemView) {
                 super(itemView);
-                codeTv = itemView.findViewById(R.id.codeTv);
+                specTv = itemView.findViewById(R.id.specTv);
                 nameTv = itemView.findViewById(R.id.nameTv);
                 existqtyTv = itemView.findViewById(R.id.existqtyTv);
                 lackqtyTv = itemView.findViewById(R.id.lackqtyTv);

+ 14 - 5
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/CommonDocDetailsActivity.java

@@ -49,7 +49,6 @@ import com.core.widget.SquareCenterImageView;
 import com.core.widget.view.MyGridView;
 import com.nostra13.universalimageloader.core.ImageLoader;
 import com.uas.appworks.CRM.erp.activity.DeviceDataFormAddActivity;
-import com.uas.appworks.CRM.erp.activity.TravelBusinessActivity;
 import com.uas.appworks.OA.erp.activity.form.DataFormDetailActivity;
 import com.uas.appworks.OA.erp.activity.form.FormListSelectActivity;
 import com.uas.appworks.OA.erp.adapter.ComDocGriddataOutAdapter;
@@ -132,6 +131,7 @@ public class CommonDocDetailsActivity extends BaseActivity {
     private String real_status;
     private String emCode;
     private String mTitle;
+    private String statusKey;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -154,6 +154,7 @@ public class CommonDocDetailsActivity extends BaseActivity {
         if (intent != null) {
             device = intent.getBooleanExtra("device", false);
             message = intent.getBooleanExtra("message", false);
+            statusKey=intent.getStringExtra("statusKey");
         }
 
         platform = ApiUtils.getApiModel() instanceof ApiPlatform;
@@ -347,7 +348,10 @@ public class CommonDocDetailsActivity extends BaseActivity {
                     onBackPressed();
                 } else {
                     LogUtil.d("非正常返回...");
-                    startActivity(new Intent(mContext, FormListSelectActivity.class).putExtra("caller", mCaller).putExtra("title", mTitle));
+                    startActivity(new Intent(mContext, FormListSelectActivity.class)
+                            .putExtra("caller", mCaller)
+                            .putExtra("statusKey",statusKey)
+                            .putExtra("title", mTitle));
                     finish();
                 }
             }
@@ -1181,8 +1185,11 @@ public class CommonDocDetailsActivity extends BaseActivity {
                 if (ActivityUtils.isExsitMianActivity(mContext, FormListSelectActivity.class)) {
                     LogUtil.d("正常返回...");
                     if ("1".equals(update)) {
-                        startActivity(new Intent(mContext, FormListSelectActivity.class).putExtra("caller", mCaller)
-                                .putExtra("update", update).putExtra("title", mTitle));
+                        startActivity(new Intent(mContext, FormListSelectActivity.class)
+                                .putExtra("caller", mCaller)
+                                .putExtra("update", update)
+                                .putExtra("statusKey",statusKey)
+                                .putExtra("title", mTitle));
                         finish();
                     } else {
                         onBackPressed();
@@ -1196,7 +1203,9 @@ public class CommonDocDetailsActivity extends BaseActivity {
                     }
                     startActivity(
                             new Intent(mContext, FormListSelectActivity.class)
-                                    .putExtra("caller", mCaller).putExtra("title", mTitle));
+                                    .putExtra("caller", mCaller)
+                                    .putExtra("statusKey",statusKey)
+                                    .putExtra("title", mTitle));
                     finish();
                 }
             }

File diff suppressed because it is too large
+ 6 - 6
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/form/DataFormDetailActivity.java


+ 40 - 72
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/form/FormListSelectActivity.java

@@ -154,6 +154,7 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
     private String caller;
     private String status;
     private int currentPosition;
+    private String statusKey;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -164,42 +165,22 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
         mEmptyLayout = new EmptyLayout(this, mlistview.getRefreshableView());
         mEmptyLayout.setEmptyButtonClickListener(mErrorClickListener);
         initView();
-        LogUtil.d("onCreate()");
         initData();
     }
 
     private void initIDs() {
-        mlistview = (PullToRefreshListView) findViewById(R.id.lv_sale_list);
-        voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
-        ivDeleteText = (ImageView) findViewById(R.id.iv_DeleteText);
+        mlistview = findViewById(R.id.lv_sale_list);
+        voiceSearchView =findViewById(R.id.voiceSearchView);
+        ivDeleteText = findViewById(R.id.iv_DeleteText);
     }
 
-
+    private static final String TAG = "FormListSelectActivity";
     private void initView() {
         Intent intent = getIntent();
         caller = intent.getStringExtra("caller");
         from = intent.getStringExtra("from");
-        if ("Ask4Leave".equals(caller)) {
-            getSupportActionBar().setTitle("请假单");
-        }
-        if ("SpeAttendance".equals(caller)) {
-            getSupportActionBar().setTitle("特殊考勤");
-        }
-        if ("FeePlease!CCSQ".equals(caller) || "FeePlease!CCSQ!new".equals(caller)) {
-            getSupportActionBar().setTitle("出差单");
-        }
-        if ("Workovertime".equals(caller) || "ExtraWork$".equals(caller)) {
-            getSupportActionBar().setTitle("加班单");
-        }
-        if ("MaterielApply".equals(caller)) {
-            getSupportActionBar().setTitle("物料申请单");
-        } else if ("MainTain".equals(caller)) {
-            getSupportActionBar().setTitle("维修申请单");
-        }
-        if ("FeePlease!FYBX".equals(caller)) {
-            getSupportActionBar().setTitle("费用报销");
-        }
-
+        statusKey  =intent.getStringExtra("statusKey");
+        LogUtil.d(TAG,"statusKey:"+statusKey);
         if (!StringUtil.isEmpty(intent.getStringExtra("title"))) {
             getSupportActionBar().setTitle(intent.getStringExtra("title"));
         }
@@ -208,12 +189,13 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
         String master = CommonUtil.getSharedPreferences(
                 FormListSelectActivity.this, "master");
         key = user + master + caller;
-        // getSupportActionBar().setTitle(intent.getStringExtra("mTitle"));
         calendar = Calendar.getInstance();
         sBroadcast = new StateBroadcast();
+        
         IntentFilter intentFilter = new IntentFilter();
         intentFilter.addAction("com.erp.sale.dataupdate");
         registerReceiver(sBroadcast, intentFilter);
+        
         mlistview.setFilterTouchEvents(false);
         mlistview.setMode(PullToRefreshBase.Mode.BOTH);
         mlistview.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
@@ -226,9 +208,6 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
                 }
                 cur = 1;
                 mlistview.setMode(PullToRefreshBase.Mode.BOTH);
-//                if (adapter != null) {
-//                    adapter.notifyDataSetChanged();
-//                }
                 mEmptyLayout.showLoading();
                 String where = CommonUtil.getSharedPreferences(
                         FormListSelectActivity.this, "where");
@@ -236,11 +215,9 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
                         FormListSelectActivity.this, key);
 
                 if ("Ask4Leave".equals(caller)) {
-
                     condition = "va_emcode='" + CommonUtil.getSharedPreferences(ct, "erp_username") + "'";
 
                 } else if ("SpeAttendance".equals(caller)) {
-
                     condition = "sa_appmancode='" + CommonUtil.getSharedPreferences(ct, "erp_username") + "'";
 
                 } else if ("Workovertime".equals(caller) || "ExtraWork$".equals(caller)) {
@@ -303,9 +280,7 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
             }
         });
 
-        /**
-         * 搜索框监听事件
-         */
+     
 
         voiceSearchView.addTextChangedListener(new TextWatcher() {
             @Override
@@ -335,7 +310,8 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
             }
         });
 
-        /** @注释:已显示单据点击监听 */
+        
+        
         mlistview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
 
             @Override
@@ -344,29 +320,30 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
                 currentPosition = position;
                 String keyField = (String) rMap.get("keyField");
                 String pfField = (String) rMap.get("pfField");
-                String statusKey = "";
-
-                if ("Ask4Leave".equals(caller)) {
-                    statusKey = "va_status";
-                } else if ("SpeAttendance".equals(caller)) {
-                    statusKey = "sa_status";
-                } else if ("Workovertime".equals(caller) || "ExtraWork$".equals(caller)) {
-                    statusKey = "wo_status";
-                } else if ("FeePlease!CCSQ".equals(caller) || "FeePlease!CCSQ!new".equals(caller)) {
-                    statusKey = "fp_status";
-                } else if ("StandbyApplication".equals(caller)) {
-                    statusKey = "sa_status";
-                } else if ("MaterielApply".equals(caller)) {
-                    statusKey = "ama_status";
-                } else if ("MainTain".equals(caller)) {
-                    statusKey = "mt_status";
-                    getSupportActionBar().setTitle("维修申请单");
-                } else if ("FeePlease!FYBX".equals(caller)) {
-                    statusKey = "fp_status";
-                } else {
-                    statusKey = "ct_status";
+//                String statusKey="";
+//                if ("Ask4Leave".equals(caller)) {
+//                    statusKey = "va_status";
+//                } else if ("SpeAttendance".equals(caller)) {
+//                    statusKey = "sa_status";
+//                } else if ("Workovertime".equals(caller) || "ExtraWork$".equals(caller)) {
+//                    statusKey = "wo_status";
+//                } else if ("FeePlease!CCSQ".equals(caller) || "FeePlease!CCSQ!new".equals(caller)) {
+//                    statusKey = "fp_status";
+//                } else if ("StandbyApplication".equals(caller)) {
+//                    statusKey = "sa_status";
+//                } else if ("MaterielApply".equals(caller)) {
+//                    statusKey = "ama_status";
+//                } else if ("MainTain".equals(caller)) {
+//                    statusKey = "mt_status";
+//                    getSupportActionBar().setTitle("维修申请单");
+//                } else if ("FeePlease!FYBX".equals(caller)) {
+//                    statusKey = "fp_status";
+//                } else {
+//                    statusKey = "ct_status";
+//                }
+                if (StringUtil.isEmpty(statusKey)){
+                    statusKey="ct_status";
                 }
-                //防错处理
                 if (StringUtil.isEmpty(pfField)) {
                     pfField = keyField;
                 }
@@ -375,22 +352,17 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
                 }
                 List<Object> rList = (List<Object>) rMap.get("listdata");
                 @SuppressWarnings("unchecked")
-                Map<String, Object> itemMap = (Map<String, Object>) rList
-                        .get(position - 1);
+                Map<String, Object> itemMap = (Map<String, Object>) rList.get(position - 1);
                 int keyId = 0;
                 if (itemMap.get(keyField) != null) {
-                    keyId = Integer.valueOf(itemMap.get(keyField)
-                            .toString());
+                    keyId = Integer.valueOf(itemMap.get(keyField).toString());
                 }
-
                 if (itemMap.get(statusKey) == null) {
                     ToastMessage("单据状态为空!");
                     return;
                 }
-                LogUtil.d("状态:" + itemMap.get(statusKey)
-                        .toString());
-                status = itemMap.get(statusKey)
-                        .toString();
+                LogUtil.d("状态:" + itemMap.get(statusKey).toString());
+                status = itemMap.get(statusKey).toString();
                 Intent it_detail = null;
                 if ("SignMain".equals(from)) {
                     if ("Ask4Leave".equals(caller)) {
@@ -442,8 +414,6 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
         mEmptyLayout.setShowErrorButton(false);
         mEmptyLayout.setShowLoadingButton(false);
         isdelete = false;
-
-
     }
 
 
@@ -523,7 +493,6 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
     protected void onDestroy() {
         super.onDestroy();
         unregisterReceiver(sBroadcast);
-        LogUtil.d("onDestroy()");
     }
 
     public class GetSaleData implements Runnable {
@@ -748,8 +717,7 @@ public class FormListSelectActivity extends BaseActivity implements View.OnClick
                         ly.addView(rLayout);
 
 
-                        ly.setBackgroundDrawable(ct.getResources().getDrawable(
-                                R.drawable.shape_linear_detail));
+                        ly.setBackgroundDrawable(ct.getResources().getDrawable(R.drawable.shape_linear_detail));
                         convertView.setTag(tViews);
                     }
                 }

+ 1 - 1
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/form/TravelDataFormDetailActivity.java

@@ -1110,7 +1110,7 @@ public class TravelDataFormDetailActivity extends BaseActivity implements View.O
                             data.getType().equals("DF")) {
                         model.editText.setKeyListener(null);
                         model.editText.setFocusable(false);
-                        model.editText.setHint("请选择(必选)");
+                        model.editText.setHint("F".equals(data.getReadonly())?"请选择(必选)":"请选择");
                     }
                     if (data.isEditing()) {
                         model.editText.setEnabled(true);

+ 86 - 82
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/BusinessTravelActivity.java

@@ -2,13 +2,17 @@ package com.uas.appworks.OA.platform.activity;
 
 import android.content.Intent;
 import android.support.v7.widget.LinearLayoutManager;
+import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.PopupWindow;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
 
+import com.afollestad.materialdialogs.MaterialDialog;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -17,24 +21,32 @@ import com.common.config.BaseConfig;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
+import com.common.data.TextUtil;
 import com.common.hmac.Md5Util;
 import com.common.system.DisplayUtil;
+import com.common.system.SystemUtil;
+import com.core.app.Constants;
+import com.core.app.MyApplication;
 import com.core.net.utils.NetUtils;
 import com.core.utils.CommonUtil;
 import com.core.utils.IntentUtils;
 import com.core.utils.ToastUtil;
+import com.iflytek.cloud.thirdparty.B;
+import com.iflytek.cloud.thirdparty.V;
 import com.me.network.app.http.Method;
 import com.modular.apputils.activity.BaseNetActivity;
 import com.modular.apputils.listener.OnSmartHttpListener;
 import com.modular.apputils.network.Parameter;
 import com.modular.apputils.network.Tags;
-import com.modular.apputils.utils.TravelUtils;
 import com.modular.apputils.widget.EmptyRecyclerView;
 import com.modular.apputils.widget.SpaceItemDecoration;
 import com.module.recyclerlibrary.ui.refresh.BaseRefreshLayout;
 import com.uas.appworks.OA.platform.adapter.BusinessTravelAdapter;
 import com.uas.appworks.OA.platform.model.BusinessTravel;
 import com.uas.appworks.R;
+import com.uas.appworks.utils.TravelUtils;
+
+import org.xbill.DNS.Master;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
@@ -46,9 +58,15 @@ import java.util.Map;
 public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHttpListener {
     private BaseRefreshLayout mRefreshLayout;
     private EmptyRecyclerView mRecyclerView;
+    private RelativeLayout remainRl;
+    private TextView remainTag;
+    private TextView remainTv;
     private BusinessTravelAdapter mAdapter;
     private boolean isLead = false;
     private String cusCode;
+    private String appSceret;
+    private String appkey;
+    private MaterialDialog mDialog;
 
     @Override
     protected int getLayoutId() {
@@ -61,19 +79,20 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
         loadData();
     }
 
+
     @Override
     public boolean onPrepareOptionsMenu(Menu menu) {
-        LogUtil.i("onPrepareOptionsMenu=" + isLead);
-        if (isLead) {
-            getMenuInflater().inflate(R.menu.menu_add_travel, menu);
-        }
+//        if (isLead && !isHasMenu) {
+//            isHasMenu = true;
+//            getMenuInflater().inflate(R.menu.menu_add_travel, menu);
+//        }
         return super.onPrepareOptionsMenu(menu);
     }
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         if (R.id.addTravel == item.getItemId()) {
-            reserve();
+            TravelUtils.showSelect(ct, appkey, appSceret, new BusinessTravel());
         }
         return super.onOptionsItemSelected(item);
     }
@@ -87,6 +106,29 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
         LogUtil.i("BusinessTravelActivity");
         mRefreshLayout = findViewById(R.id.mRefreshLayout);
         mRecyclerView = findViewById(R.id.mRecyclerView);
+        remainRl = findViewById(R.id.remainRl);
+        remainTag = findViewById(R.id.remainTag);
+        remainTv = findViewById(R.id.remainTv);
+
+        remainTv.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                CharSequence remain = remainTv.getText();
+                if (!TextUtils.isEmpty(remain)) {
+                    LogUtil.i("remain=" + remain);
+                    if (remain.toString().equals(getString(R.string.click_to))) {
+                        Intent intent = new Intent("com.modular.form.TravelDataFormDetailActivity");
+                        String travelCaller = CommonUtil.getSharedPreferences(ct, Constants.WORK_TRAVEL_CALLER_CACHE);
+                        intent.putExtra("caller", TextUtils.isEmpty(travelCaller) ? "FeePlease!CCSQ!new" : travelCaller);
+                        startActivity(intent);
+                    } else {
+                        SystemUtil.phoneAction(BusinessTravelActivity.this, remain.toString());
+
+                    }
+                }
+
+            }
+        });
         mRefreshLayout.setEnabledPullUp(false);
         mRefreshLayout.setOnRefreshListener(new BaseRefreshLayout.onRefreshListener() {
             @Override
@@ -114,7 +156,6 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
         window.setOutsideTouchable(false);
         window.setFocusable(true);
         int actionBarHeight = getSupportActionBar().getHeight() + DisplayUtil.dip2px(ct, 10);
-
         window.showAtLocation(getWindow().getDecorView(), Gravity.TOP, 0, actionBarHeight);
         window.setOnDismissListener(new PopupWindow.OnDismissListener() {
             @Override
@@ -158,50 +199,76 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
 
 
     private void handlerData(String message) throws Exception {
-        LogUtil.i("handlerData");
+
         JSONObject object = JSON.parseObject(message);
         int isLead = JSONUtil.getInt(object, "isLead");
         cusCode = JSONUtil.getText(object, "travelCard");
+        appkey = JSONUtil.getText(object, "appKey");
+        appSceret = JSONUtil.getText(object, "appSceret");
         //表示可以预定
-        this.isLead = isLead > 0;
-        if (this.isLead) {
-            supportInvalidateOptionsMenu();
-        }
+        this.isLead = isLead > 0 && !TextUtils.isEmpty(appkey);
         JSONArray listdata = JSONUtil.getJSONArray(object, "listdata");
         List<BusinessTravel> models = new ArrayList<>();
+        if (this.isLead) {
+            BusinessTravel model=new BusinessTravel();
+            model.setType(BusinessTravel.LEADER);
+            models.add(model);
+        }
         String cttpid = JSONUtil.getText(object, "em_iccode");
         for (int i = 0; i < listdata.size(); i++) {
             JSONObject data = listdata.getJSONObject(i);
+            String fp_id = JSONUtil.getText(data, "FP_ID");
             long startTime = JSONUtil.getLong(data, "FP_PRESTARTDATE");
             long endTime = JSONUtil.getLong(data, "FP_PREENDDATE");
             JSONArray reimbursements = JSONUtil.getJSONArray(data, "reimbursement");
             List<BusinessTravel> gridModels = new ArrayList<>();
             for (int j = 0; j < reimbursements.size(); j++) {
-                BusinessTravel e = new BusinessTravel(cttpid, startTime, endTime, reimbursements.getJSONObject(j));
+                BusinessTravel e = new BusinessTravel(cttpid, fp_id, startTime, endTime, reimbursements.getJSONObject(j));
                 if (e.getType() != BusinessTravel.TITLE) {
                     gridModels.add(e);
                 }
             }
             if (!ListUtils.isEmpty(gridModels)) {
-                models.add(new BusinessTravel(JSONUtil.getText(data, "FP_CODEDoc")));
+                models.add(BusinessTravel.createTitle(data));
                 models.addAll(gridModels);
             }
         }
-        setAdapter(models);
+        //判断
+        if (TextUtils.isEmpty(appkey)) {
+            remainRl.setVisibility(View.VISIBLE);
+            mRefreshLayout.setVisibility(View.GONE);
+            remainTag.setText("您的账号未开通商旅服务,请联系负责人");
+            remainTv.setText(R.string.administrators_phone);
+        } else {
+            remainRl.setVisibility(View.GONE);
+            mRefreshLayout.setVisibility(View.VISIBLE);
+            setAdapter(models);
+        }
+        if (BaseConfig.isDebug()) {
+            LogUtil.i("message=" + message);
+        }
     }
 
 
     private void setAdapter(List<BusinessTravel> models) {
         if (mAdapter == null) {
-            mAdapter = new BusinessTravelAdapter(ct, cusCode, models);
-            mRecyclerView.addItemDecoration(new SpaceItemDecoration(30));
+            mAdapter = new BusinessTravelAdapter(ct, appkey, appSceret, models);
+            mRecyclerView.addItemDecoration(new SpaceItemDecoration(10));
             mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
             mRecyclerView.setAdapter(mAdapter);
         } else {
             mAdapter.setModels(models);
         }
-        if (ListUtils.isEmpty(models) && isLead) {
-            showPop();
+        if (ListUtils.isEmpty(models)) {
+            if (!isLead) {
+                remainRl.setVisibility(View.VISIBLE);
+                mRefreshLayout.setVisibility(View.GONE);
+                remainTag.setText("请先录入出差单");
+                remainTv.setText(R.string.click_to);
+            } else {
+                remainRl.setVisibility(View.GONE);
+                mRefreshLayout.setVisibility(View.VISIBLE);
+            }
         }
     }
 
@@ -213,67 +280,4 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
         }
     }
 
-
-    private void reserve() {
-        Map<String, Object> map = new HashMap<>();
-        map.put("traverorderno", "RES56884");
-        map.put("product", "index");
-        map.put("costname", "成本中心");
-        map.put("proname", "所属项目");
-        String from = "";
-        String fromcode = "";
-        String arrive = "";
-        String arrivecode = "";
-
-        Map<String, String> routeMap = new HashMap<>();
-        routeMap.put("from", from);
-        routeMap.put("fromcode", fromcode);
-        routeMap.put("arrive", arrive);
-        routeMap.put("arrivecode", arrivecode);
-        routeMap.put("startdate", DateFormatUtil.long2Str(System.currentTimeMillis(), DateFormatUtil.YMD));
-        routeMap.put("arrivedate", DateFormatUtil.long2Str(System.currentTimeMillis() + 24 * 60 * 60 * 1000, DateFormatUtil.YMD));
-        routeMap.put("isCanModify", "1");
-        map.put("route", routeMap);
-
-        //个人中心
-        Map<String, String> custinfoMap = new HashMap<>();
-        custinfoMap.put("backUrl", CommonUtil.getAppBaseUrl(ct));
-        custinfoMap.put("isNeedPush", "1");
-        custinfoMap.put("cusCode", TravelUtils.getTraveCode(cusCode, CommonUtil.getMaster()));//TODO 差旅卡号
-        custinfoMap.put("emCode", CommonUtil.getEmcode());
-        custinfoMap.put("outOrderno", String.valueOf(-1));
-        map.put("custinfo", custinfoMap);
-        String p = JSONUtil.map2JSON(map);
-        turn2Web(p);
-    }
-
-    private void turn2Web(String p) {
-        if (NetUtils.isNetWorkConnected(ct)) {
-            String appkey = "y8gd87dsdkencgzk394k7s5c78io35c";
-            String appSceret = "e212e142a5c9e0590eefb7d9f1bc91d7";
-            String baseUrl = "http://124.254.45.234:8082/oa/caslogin/";
-            if (!BaseConfig.isDebug()) {
-                appkey = "fjdsfnvg6523fsgjkff879fidsf";
-                appSceret = "9891ca5330271eba81ec1332e740c210";
-                baseUrl = "http://h5.auvgo.com/";
-            }
-            String username = CommonUtil.getEmcode();
-            String data = appkey + username.toUpperCase() + appSceret;
-            String key = Md5Util.toMD5(appSceret).toUpperCase();
-            String sign = Md5Util.toMD5(key + data);
-            StringBuilder urlBuilder = new StringBuilder(baseUrl);
-            urlBuilder.append(appkey + "/");
-            urlBuilder.append(username + "/");
-            urlBuilder.append(sign);
-            try {
-                urlBuilder.append("?p=" + URLEncoder.encode(p, "UTF-8"));
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-            LogUtil.i(urlBuilder.toString());
-            IntentUtils.linkCommonWeb(ct, urlBuilder.toString(), "行旅国际", "", "", false, false, false);
-        } else {
-            ToastUtil.showToast(ct, R.string.networks_out);
-        }
-    }
 }

+ 104 - 128
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/BusinessTravelAdapter.java

@@ -6,10 +6,13 @@ import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 
+import com.afollestad.materialdialogs.MaterialDialog;
 import com.alibaba.fastjson.JSON;
 import com.common.LogUtil;
 import com.common.config.BaseConfig;
@@ -23,13 +26,14 @@ import com.core.net.utils.NetUtils;
 import com.core.utils.CommonUtil;
 import com.core.utils.IntentUtils;
 import com.core.utils.ToastUtil;
-import com.modular.apputils.utils.TravelUtils;
 import com.modular.apputils.widget.TravelDirectionView;
 import com.uas.appworks.OA.platform.model.BusinessTravel;
 import com.uas.appworks.R;
+import com.uas.appworks.utils.TravelUtils;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -39,14 +43,19 @@ import java.util.Map;
  */
 
 public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener {
+    private final String DONE_SUBMIT = "预约/订票";
+    private final String DONE_CANCEL = "查看详情";
+
     private Context ct;
     private List<BusinessTravel> models;
     private String currentName;
-    private String cusCode;
+    private String appkey = null;
+    private String appSceret = null;
 
-    public BusinessTravelAdapter(Context ct,String cusCode, List<BusinessTravel> models) {
+    public BusinessTravelAdapter(Context ct, String appkey, String appSceret, List<BusinessTravel> models) {
         this.ct = ct;
-        this.cusCode = cusCode;
+        this.appkey = appkey;
+        this.appSceret = appSceret;
         this.models = models;
         this.currentName = CommonUtil.getName();
     }
@@ -79,9 +88,12 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         switch (viewType) {
             case BusinessTravel.AIR:
             case BusinessTravel.TRAIN:
+            case BusinessTravel.UNKOWN:
                 return new AirViewHolder(parent);
             case BusinessTravel.HOTEL:
                 return new HotelViewHolder(parent);
+            case BusinessTravel.LEADER:
+                return new LeaderViewHolder(parent);
             default:
                 return new TitleViewHolder(parent);
         }
@@ -92,7 +104,7 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         if (holder != null) {
             BusinessTravel model = models.get(position);
             if (holder instanceof TitleViewHolder) {
-                bindTitleView((TitleViewHolder) holder, model);
+                bindTitleView((TitleViewHolder) holder, model, position);
             } else if (holder instanceof BaseViewHlder) {
                 bindBaseView((BaseViewHlder) holder, model, position);
                 if (holder instanceof AirViewHolder) {
@@ -100,30 +112,63 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                 } else if (holder instanceof HotelViewHolder) {
                     bindHotelView((HotelViewHolder) holder, model);
                 }
+            } else if (holder instanceof LeaderViewHolder) {
+                bindLeaderHolder((LeaderViewHolder) holder);
             }
 
         }
     }
 
-    private void bindTitleView(TitleViewHolder holder, BusinessTravel model) {
+    private void bindLeaderHolder(LeaderViewHolder holder) {
+        holder.clickAir.setOnClickListener(this);
+        holder.clickHotel.setOnClickListener(this);
+        holder.clickTrain.setOnClickListener(this);
+
+    }
+
+    private void bindTitleView(TitleViewHolder holder, BusinessTravel model, int position) {
         holder.codeTv.setText(model.getCode());
+        holder.addMoreTv.setTag(R.id.tag_key, model);
+        holder.addMoreTv.setTag(R.id.tag_key2, position);
+        holder.addMoreTv.setOnClickListener(this);
+        if (position == 0) {
+            holder.titleLine.setVisibility(View.GONE);
+        } else {
+            holder.titleLine.setVisibility(View.VISIBLE);
+        }
     }
 
-    private final String DONE_SUBMIT = "预约/订票";
-    private final String DONE_CANCEL = "查看详情";
 
     private void bindBaseView(BaseViewHlder holder, BusinessTravel model, int position) {
         holder.codeTv.setText(model.getTitleAndCode());
-        holder.statusTv.setText(model.getStatus());
+        String status = model.getStatus();
+        holder.statusTv.setText(status);
+        if (status.equals(BusinessTravel.EMPTY_STATUS)) {
+            holder.orderInfoRl.setVisibility(View.GONE);
+            holder.userInfoRl.setVisibility(View.GONE);
+            holder.line.setVisibility(View.GONE);
+            model.setExpand(true);
+            holder.subRl.setTag(R.id.tag_key, model);
+            holder.subRl.setTag(R.id.tag_key2, position);
+            holder.subRl.setOnClickListener(this);
+        } else {
+            holder.orderInfoRl.setVisibility(View.VISIBLE);
+            holder.userInfoRl.setVisibility(View.VISIBLE);
+            holder.line.setVisibility(View.VISIBLE);
+            holder.subRl.setOnClickListener(null);
+        }
         holder.nameTv.setText(currentName == null ? "**" : currentName);
         holder.idCardTv.setText(model.getCttpid());
         holder.seatTv.setText(model.getSeat());
-        holder.realFeeTv.setText(model.getRealFee());
+        String realFee = model.getRealFee();
+        realFee = TextUtils.isEmpty(realFee) ? "" : (realFee + "元");
+        holder.realFeeTv.setText(realFee);
         holder.payTypeTv.setText(model.getPayType());
         holder.levelTv.setText(model.getLevel());
         holder.expecteFeeTv.setText(model.getExpecteFee());
         holder.idTypeTv.setText("二代身份证");
-        holder.dateTv.setText(model.getDate());
+        String date = DateFormatUtil.long2Str(model.getStartTime(), DateFormatUtil.YMD);
+        holder.dateTv.setText(date);
         if (StringUtil.isEmpty(model.getStatus()) || StringUtil.isEmpty(model.getCode())) {
             holder.doneTv.setText(DONE_SUBMIT);
             holder.doneTv.setBackgroundResource(R.drawable.text_frame_radian_hint_bg);
@@ -156,9 +201,9 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         holder.toTimeTv.setText(DateFormatUtil.long2Str(model.getEndTime(), "HH:mm"));
         //行程
 
-        if (TextUtils.isEmpty(fromCity)||TextUtils.isEmpty(toCity)){
+        if (TextUtils.isEmpty(fromCity) || TextUtils.isEmpty(toCity)) {
             holder.tripTv.setText(fromCity + "" + toCity);
-        }else{
+        } else {
             holder.tripTv.setText(fromCity + "-" + toCity);
         }
         holder.mTravelDirectionView.setData(model.getFlightCode(), model.getAllTime());
@@ -183,8 +228,8 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         if (!StringUtil.isEmpty(model.getCode()) && !StringUtil.isEmpty(model.getStatus())) {
             holder.roomsTv.setText("1间");
         }
-        holder.addressTv.setText(model.getHotelAddress());
-        holder.dateTv.setText(DateFormatUtil.long2Str(DateFormatUtil.YMD));
+        String address = TextUtils.isEmpty(model.getHotelAddress()) ? model.getHotelCity() : model.getHotelAddress();
+        holder.addressTv.setText(address);
         holder.numberSubTv.setText(model.getNumber() + "人");
     }
 
@@ -197,6 +242,8 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
 
     private class TitleViewHolder extends RecyclerView.ViewHolder {
         TextView codeTv;
+        ImageView addMoreTv;
+        View titleLine;
 
         public TitleViewHolder(ViewGroup viewGroup) {
             this(getInflater().inflate(R.layout.item_bus_travel_title, viewGroup, false));
@@ -205,6 +252,27 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         public TitleViewHolder(View itemView) {
             super(itemView);
             codeTv = itemView.findViewById(R.id.codeTv);
+            titleLine = itemView.findViewById(R.id.titleLine);
+            addMoreTv = itemView.findViewById(R.id.addMoreTv);
+        }
+    }
+
+
+    private class LeaderViewHolder extends RecyclerView.ViewHolder {
+        private LinearLayout clickTrain;
+        private LinearLayout clickAir;
+        private LinearLayout clickHotel;
+
+
+        public LeaderViewHolder(ViewGroup viewGroup) {
+            this(getInflater().inflate(R.layout.item_bus_travel_leader, viewGroup, false));
+        }
+
+        public LeaderViewHolder(View itemView) {
+            super(itemView);
+            clickTrain = itemView.findViewById(R.id.clickTrain);
+            clickAir = itemView.findViewById(R.id.clickAir);
+            clickHotel = itemView.findViewById(R.id.clickHotel);
         }
     }
 
@@ -214,7 +282,6 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                 whenLongTv,
                 numberSubTv,//人数
                 numberTv,
-                dateTv,
                 addressTv,  //地址
                 roomsTv;//房间人数
 
@@ -227,7 +294,6 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
             businessNameTv = (TextView) itemView.findViewById(R.id.businessNameTv);
             whenLongTv = (TextView) itemView.findViewById(R.id.whenLongTv);
             numberTv = (TextView) itemView.findViewById(R.id.numberTv);
-            dateTv = (TextView) itemView.findViewById(R.id.dateTv);
             roomsTv = (TextView) itemView.findViewById(R.id.roomsTv);
             addressTv = (TextView) itemView.findViewById(R.id.addressTv);
             numberSubTv = (TextView) itemView.findViewById(R.id.numberSubTv);
@@ -249,10 +315,16 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                 idTypeTv, //身份类型
                 dateTv;//入住时间|返程时间
         RelativeLayout subRl;
+        RelativeLayout userInfoRl;
+        RelativeLayout orderInfoRl;
+        View line;
 
         public BaseViewHlder(View itemView) {
             super(itemView);
             subRl = (RelativeLayout) itemView.findViewById(R.id.subRl);
+            orderInfoRl = (RelativeLayout) itemView.findViewById(R.id.orderInfoRl);
+            line = itemView.findViewById(R.id.line);
+            userInfoRl = (RelativeLayout) itemView.findViewById(R.id.userInfoRl);
             codeTv = (TextView) itemView.findViewById(R.id.codeTv);
             statusTv = (TextView) itemView.findViewById(R.id.statusTv);
             nameTv = (TextView) itemView.findViewById(R.id.nameTv);
@@ -303,124 +375,28 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
 
     @Override
     public void onClick(View v) {
-        BusinessTravel model = (BusinessTravel) v.getTag(R.id.tag_key);
-        int position = (int) v.getTag(R.id.tag_key2);
         int id = v.getId();
         if (id == R.id.expandTv) {
+            int position = (int) v.getTag(R.id.tag_key2);
+            BusinessTravel model = (BusinessTravel) v.getTag(R.id.tag_key);
             model.setExpand(!model.isExpand());
             notifyItemChanged(position);
-        } else if (R.id.doneTv == id && v instanceof TextView) {
-            TextView doneTv = (TextView) v;
-            String doneMessage = StringUtil.getText(doneTv);
-            if (doneMessage.equals(DONE_CANCEL)) {
-                cancel(model);
-            } else {
-                reserve(model);
-            }
-        } else if (R.id.changeTv == id) {
-            change(model);
+        } else if (R.id.doneTv == id || R.id.subRl == id || R.id.addMoreTv == id) {
+            BusinessTravel model = (BusinessTravel) v.getTag(R.id.tag_key);
+            TravelUtils.reserve(ct, appkey, appSceret, model);
+        } else if (R.id.clickAir == id) {
+            TravelUtils.reserve(ct, appkey, appSceret, getLeaderModel(BusinessTravel.AIR));
+        } else if (R.id.clickHotel == id) {
+            TravelUtils.reserve(ct, appkey, appSceret, getLeaderModel(BusinessTravel.HOTEL));
+        } else if (R.id.clickTrain == id) {
+            TravelUtils.reserve(ct, appkey, appSceret, getLeaderModel(BusinessTravel.TRAIN));
         }
     }
 
-
-    private void cancel(BusinessTravel model) {
-        reserve(model);
-    }
-
-    private void reserve(BusinessTravel model) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("traverorderno", "RES56884");
-        map.put("product", model.getProduct());
-        map.put("costname", "成本中心");
-        map.put("proname", "所属项目");
-        String from = "";
-        String fromcode = "";
-        String arrive = "";
-        String arrivecode = "";
-        switch (model.getType()) {
-            case BusinessTravel.AIR:
-                from = model.getAirStarting();
-                fromcode = model.getAirStartingCode();
-                arrive = model.getAirDestination();
-                arrivecode = model.getAirDestinationCode();
-                break;
-            case BusinessTravel.TRAIN:
-                from = model.getTrainStarting();
-                fromcode = model.getTrainStartingCode();
-                arrive = model.getTrainDestination();
-                arrivecode = model.getTrainDestinationCode();
-                break;
-            case BusinessTravel.HOTEL:
-                from = model.getHotelCity();
-                fromcode = model.getHotelCityCode();
-                break;
-        }
-        Map<String, String> routeMap = new HashMap<>();
-        routeMap.put("from", from);
-        routeMap.put("fromcode", fromcode);
-        routeMap.put("arrive", arrive);
-        routeMap.put("arrivecode", arrivecode);
-        routeMap.put("startdate", DateFormatUtil.long2Str(model.getStartTime(), DateFormatUtil.YMD));
-        routeMap.put("arrivedate", DateFormatUtil.long2Str(model.getEndTime(), DateFormatUtil.YMD));
-        routeMap.put("isCanModify", "1");
-        map.put("route", routeMap);
-
-        //个人中心
-        Map<String, String> custinfoMap = new HashMap<>();
-        custinfoMap.put("backUrl", CommonUtil.getAppBaseUrl(ct));
-        custinfoMap.put("isNeedPush", "1");
-        custinfoMap.put("cusCode", /*URY*/CommonUtil.getMaster());
-        custinfoMap.put("emCode", CommonUtil.getEmcode());
-        custinfoMap.put("outOrderno", String.valueOf(model.getId()));
-        map.put("custinfo", custinfoMap);
-        String p = JSONUtil.map2JSON(map);
-        LogUtil.i("p=" + p);
-        turn2Web(p);
-    }
-
-    private void change(BusinessTravel model) {
-        LogUtil.i("点击了改签");
-        Map<String, Object> map = new HashMap<>();
-        map.put("traverorderno", model.getCode());
-        map.put("product", "airgq");
-        map.put("costname", "成本中心");
-        map.put("proname", "UU互联差旅订票");
-        map.put("fpd_id", model.getId());
-        map.put("master", CommonUtil.getMaster());
-        map.put("baseUrl", CommonUtil.getAppBaseUrl(ct));
-        map.put("emCode",  TravelUtils.getTraveCode(cusCode,CommonUtil.getMaster()));
-        String p = JSONUtil.map2JSON(map);
-        turn2Web(p);
-    }
-
-    private void turn2Web(String p) {
-        if (NetUtils.isNetWorkConnected(ct)) {
-            String appkey = "y8gd87dsdkencgzk394k7s5c78io35c";
-            String appSceret = "e212e142a5c9e0590eefb7d9f1bc91d7";
-            String baseUrl = "http://124.254.45.234:8082/oa/caslogin/";
-            if (!BaseConfig.isDebug()) {
-                appkey = "fjdsfnvg6523fsgjkff879fidsf";
-                appSceret = "9891ca5330271eba81ec1332e740c210";
-                baseUrl = "http://h5.auvgo.com/";
-            }
-            String username = CommonUtil.getEmcode();
-            String data = appkey + username.toUpperCase() + appSceret;
-            String key = Md5Util.toMD5(appSceret).toUpperCase();
-            String sign = Md5Util.toMD5(key + data);
-            StringBuilder urlBuilder = new StringBuilder(baseUrl);
-            urlBuilder.append(appkey + "/");
-            urlBuilder.append(username + "/");
-            urlBuilder.append(sign);
-            try {
-                urlBuilder.append("?p=" + URLEncoder.encode(p, "UTF-8"));
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-            LogUtil.i(urlBuilder.toString());
-            IntentUtils.linkCommonWeb(ct, urlBuilder.toString(), "行旅国际", "", "", false, false, false);
-        } else {
-            ToastUtil.showToast(ct, R.string.networks_out);
-        }
+    private BusinessTravel getLeaderModel(int type) {
+        BusinessTravel model = new BusinessTravel();
+        model.setType(type);
+        return model;
     }
 
 }

+ 44 - 53
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/BusinessTravel.java

@@ -3,11 +3,9 @@ package com.uas.appworks.OA.platform.model;
 import android.text.TextUtils;
 
 import com.alibaba.fastjson.JSONObject;
-import com.common.config.BaseConfig;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.StringUtil;
-import com.common.data.TextUtil;
 
 
 /**
@@ -15,11 +13,15 @@ import com.common.data.TextUtil;
  */
 
 public class BusinessTravel {
+    public static final String EMPTY_STATUS = "未购票";
     public static final int TITLE = 1;
+    public static final int UNKOWN = 0;
     public static final int AIR = 2;
     public static final int TRAIN = 3;
     public static final int HOTEL = 4;
+    public static final int LEADER = 5;
     private boolean expand;
+    private String fpId;//主表id
     private int id;//明细id
     private int type;
     private int number;
@@ -54,15 +56,26 @@ public class BusinessTravel {
     private String flightCode;
     private String hotelAddress;
 
+    public BusinessTravel() {
 
-    public BusinessTravel(String titleCode) {
-        this.type = TITLE;
-        code = titleCode;
     }
 
-    public BusinessTravel(String cttpid, long dfStartTime, long dfEndTime, JSONObject reimbursement) {
+    public static BusinessTravel createTitle(JSONObject object) {
+        BusinessTravel businessTravel = new BusinessTravel();
+        businessTravel.type = TITLE;
+        businessTravel.fpId = JSONUtil.getText(object, "FP_ID");
+        businessTravel.code = JSONUtil.getText(object, "FP_CODE");
+        businessTravel.startTime = JSONUtil.getLong(object, "FP_PRESTARTDATE");
+        businessTravel.endTime = JSONUtil.getLong(object, "FP_PREENDDATE");
+        return businessTravel;
+
+    }
+
+
+    public BusinessTravel(String cttpid, String fpId, long dfStartTime, long dfEndTime, JSONObject reimbursement) {
         try {
             title = JSONUtil.getText(reimbursement, "FPD_RES_TYPE");
+            this.fpId = fpId;
             endTime = JSONUtil.getLong(reimbursement, "FPD_END_TIME");
             startTime = JSONUtil.getLong(reimbursement, "FPD_START_TIME");
             if (startTime <= 0 && dfStartTime > 0) {
@@ -91,11 +104,6 @@ public class BusinessTravel {
                     hotelCity = JSONUtil.getText(reimbursement, "FPD_HOTEL_CITY");
                     hotelCityCode = JSONUtil.getText(reimbursement, "FPD_CITYCODE5");
                     hotelAddress = JSONUtil.getText(reimbursement, "FPD_HOTEL_ADDRESS");
-                    if (BaseConfig.isDebug()) {
-                        hotelCity = "艺龙测试";
-                        hotelCityCode = "5389";
-
-                    }
                     if (endTime == startTime) {
                         endTime = startTime + 86400000;
                     } else if (DateFormatUtil.long2Str(endTime, DateFormatUtil.YMD).equals(DateFormatUtil.long2Str(startTime, DateFormatUtil.YMD))) {
@@ -103,7 +111,7 @@ public class BusinessTravel {
                     }
                     break;
                 default:
-                    this.type = TITLE;
+                    this.type = UNKOWN;
             }
             flightCode = JSONUtil.getText(reimbursement, "FPD_FLIGHT_CODE");
             status = JSONUtil.getText(reimbursement, "FPD_STATUS");
@@ -127,15 +135,18 @@ public class BusinessTravel {
         }
     }
 
+    public String getFpId() {
+        return fpId;
+    }
 
     public String getProduct() {
-        switch (title) {
-            case "火车票":
+        switch (type) {
+            case AIR:
+                return "air";
+            case TRAIN:
                 return "train";
-            case "住宿":
+            case HOTEL:
                 return "hotel";
-            case "飞机票":
-                return "air";
             default:
                 return "center";
         }
@@ -150,9 +161,6 @@ public class BusinessTravel {
         return type == AIR ? StringUtil.getMessage(airDestination) : StringUtil.getMessage(trainDestination);
     }
 
-    public String getDate() {
-        return type == AIR ? (DateFormatUtil.long2Str(startTime, "yyyy-MM-dd")) : (DateFormatUtil.long2Str(startTime, "yyyy-MM-dd"));
-    }
 
     public String getTitleAndCode() {
         return title + "   " + (StringUtil.isEmpty(code) ? "" : code);
@@ -181,12 +189,16 @@ public class BusinessTravel {
         return type;
     }
 
+    public void setType(int type) {
+        this.type = type;
+    }
+
     public int getNumber() {
         return number;
     }
 
     public long getStartTime() {
-        return startTime;
+        return startTime <= 0 ? System.currentTimeMillis() : startTime;
     }
 
     public long getEndTime() {
@@ -202,7 +214,7 @@ public class BusinessTravel {
     }
 
     public String getStatus() {
-        return status == null ? "未购票" : status;
+        return TextUtils.isEmpty(status) ? EMPTY_STATUS : status;
     }
 
     public String getOrderType() {
@@ -214,7 +226,7 @@ public class BusinessTravel {
     }
 
     public String getRealFee() {
-        return TextUtils.isEmpty(realFee) ? "" : (realFee + "元");
+        return TextUtils.isEmpty(realFee) ? "" : realFee;
     }
 
     public String getExpecteFee() {
@@ -246,62 +258,41 @@ public class BusinessTravel {
     }
 
     public String getAirStarting() {
-        return airStarting;
+        return  airStarting;
     }
 
     public String getAirStartingCode() {
-        return StringUtil.isEmpty(airStartingCode) ? (getTestAir(airStarting)) : airStartingCode;
+        return StringUtil.isEmpty(airStartingCode) ? "" : airStartingCode;
     }
 
 
-    private String getTestAir(String air) {
-        if (!BaseConfig.isDebug()) {
-            return "";
-        } else if (air.equals("南宁")) {
-            return "NNG";
-        } else if (air.equals("深圳")) {
-            return "SZX";
-        }
-        return "";
-    }
-
     public String getAirDestination() {
-        return airDestination;
+        return   airDestination;
     }
 
     public String getAirDestinationCode() {
-        return StringUtil.isEmpty(airDestinationCode) ? (getTestAir(airDestination)) : airDestinationCode;
+        return StringUtil.isEmpty(airDestinationCode) ? "" : airDestinationCode;
     }
 
     public String getTrainStarting() {
-        return trainStarting;
+        return   trainStarting;
     }
 
     public String getTrainStartingCode() {
-        return StringUtil.isEmpty(trainStartingCode) ? (getTestTrain(trainStarting)) : trainStartingCode;
+        return StringUtil.isEmpty(trainStartingCode) ? "" : trainStartingCode;
     }
 
     public String getTrainDestination() {
-        return trainDestination;
+        return   trainDestination;
     }
 
     public String getTrainDestinationCode() {
-        return StringUtil.isEmpty(trainDestinationCode) ? (getTestTrain(trainDestination)) : trainDestinationCode;
+        return StringUtil.isEmpty(trainDestinationCode) ? "" : trainDestinationCode;
     }
 
-    private String getTestTrain(String train) {
-        if (!BaseConfig.isDebug()) {
-            return "";
-        } else if (train.equals("南宁")) {
-            return "2102";
-        } else if (train.equals("深圳")) {
-            return "2003";
-        }
-        return "";
-    }
 
     public String getHotelCity() {
-        return hotelCity;
+        return   hotelCity;
     }
 
     public String getHotelCityCode() {

+ 0 - 1
app_modular/appworks/src/main/java/com/uas/appworks/activity/CommonDataFormActivity.java

@@ -2441,7 +2441,6 @@ public class CommonDataFormActivity extends BaseActivity implements View.OnClick
                         ToastMessage(item.getName() + "不能为空!");
                         return;
                     }
-
                     //日期格式判断
                     if (!StringUtil.isEmpty(startDate) && !StringUtil.isEmpty(endDate)) {
                         if (key.equals(startDate)) {

+ 5 - 0
app_modular/appworks/src/main/java/com/uas/appworks/activity/DeviceQueryActivity.java

@@ -381,6 +381,11 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
             mConditionBeans.add(schemeConditionBean);
             mfuzzyConditionBeans.add(schemeConditionBean);
 
+            schemeConditionBean = initCondition("设备规格", "de_spec", "S");
+            mConditionBeans.add(schemeConditionBean);
+            mfuzzyConditionBeans.add(schemeConditionBean);
+
+
             schemeConditionBean = initCondition("设备种类", "de_kind", "S");
             mConditionBeans.add(schemeConditionBean);
             mfuzzyConditionBeans.add(schemeConditionBean);

+ 9 - 1
app_modular/appworks/src/main/java/com/uas/appworks/model/DeviceMatch.java

@@ -6,12 +6,20 @@ package com.uas.appworks.model;
 
 public class DeviceMatch {
     //机型、机型设备列表名称、现有匹配设备数量、欠缺设备数量
-    private String code, name, existqty, lackqty;
+    private String code, name, existqty, lackqty,spec;
+
+    public String getSpec() {
+        return spec==null?"":spec;
+    }
 
     public String getCode() {
         return code == null ? "" : code;
     }
 
+    public void setSpec(String spec) {
+        this.spec = spec;
+    }
+
     public void setCode(String code) {
         this.code = code;
     }

+ 169 - 0
app_modular/appworks/src/main/java/com/uas/appworks/utils/TravelUtils.java

@@ -0,0 +1,169 @@
+package com.uas.appworks.utils;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Debug;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.afollestad.materialdialogs.MaterialDialog;
+import com.alibaba.fastjson.JSON;
+import com.common.LogUtil;
+import com.common.config.BaseConfig;
+import com.common.data.DateFormatUtil;
+import com.common.data.JSONUtil;
+import com.common.data.StringUtil;
+import com.common.data.TextUtil;
+import com.common.hmac.Md5Util;
+import com.core.app.MyApplication;
+import com.core.net.utils.NetUtils;
+import com.core.utils.CommonUtil;
+import com.core.utils.IntentUtils;
+import com.core.utils.ToastUtil;
+import com.modular.apputils.R;
+import com.uas.appworks.OA.platform.model.BusinessTravel;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by Bitlike on 2018/3/23.
+ */
+
+public class TravelUtils {
+
+    public static void reserve(Context ct, String appkey, String appSceret, BusinessTravel model) {
+        if (model.getType() == BusinessTravel.UNKOWN || BusinessTravel.TITLE == model.getType()) {
+            showSelect(ct, appkey, appSceret, model);
+            return;
+        }
+        LogUtil.i("model=" + JSON.toJSONString(model));
+        Map<String, Object> map = new HashMap<>();
+        map.put("traverorderno", "RES56884");
+        map.put("product", model.getProduct());
+        map.put("costname", "成本中心");
+        map.put("proname", "所属项目");
+        String from = "";
+        String fromcode = "";
+        String arrive = "";
+        String arrivecode = "";
+        switch (model.getType()) {
+            case BusinessTravel.AIR:
+                from = model.getAirStarting();
+                fromcode = model.getAirStartingCode();
+                arrive = model.getAirDestination();
+                arrivecode = model.getAirDestinationCode();
+                break;
+            case BusinessTravel.TRAIN:
+                from = model.getTrainStarting();
+                fromcode = model.getTrainStartingCode();
+                arrive = model.getTrainDestination();
+                arrivecode = model.getTrainDestinationCode();
+                break;
+            case BusinessTravel.HOTEL:
+                from = model.getHotelCity();
+                fromcode = model.getHotelCityCode();
+                break;
+        }
+        if (TextUtils.isEmpty(fromcode)) {
+            from = "";
+        }
+        if (TextUtils.isEmpty(arrivecode)) {
+            arrive = "";
+        }
+
+        Map<String, String> routeMap = new HashMap<>();
+        routeMap.put("from", from);
+        routeMap.put("fromcode", fromcode);
+        routeMap.put("arrive", arrive);
+        routeMap.put("arrivecode", arrivecode);
+        routeMap.put("startdate", DateFormatUtil.long2Str(model.getStartTime(), DateFormatUtil.YMD));
+        routeMap.put("arrivedate", DateFormatUtil.long2Str(model.getEndTime(), DateFormatUtil.YMD));
+        routeMap.put("isCanModify", "1");
+        map.put("route", routeMap);
+
+        //个人中心
+        Map<String, String> otherJSON = new HashMap<>();
+        otherJSON.put("fpid", model.getFpId() == null ? "" : model.getFpId());
+        Map<String, String> custinfoMap = new HashMap<>();
+        custinfoMap.put("backUrl", CommonUtil.getAppBaseUrl(ct));
+        custinfoMap.put("isNeedPush", "1");
+        custinfoMap.put("cusCode", /*URY*/CommonUtil.getMaster());
+        custinfoMap.put("emCode", CommonUtil.getEmcode());
+        custinfoMap.put("outOrderno", model.getId() <= 0 ? "-1" : String.valueOf(model.getId()));
+        map.put("otherContent", StringUtil.toHttpString(JSONUtil.map2JSON(otherJSON)));
+        map.put("custinfo", custinfoMap);
+        String p = JSONUtil.map2JSON(map);
+        LogUtil.i("p=" + p);
+        if (NetUtils.isNetWorkConnected(ct)) {
+            String baseUrl = null;
+//            if (BaseConfig.isDebug()) {
+//                appkey = "y8gd87dsdkencgzk394k7s5c78io35c";
+//                appSceret = "e212e142a5c9e0590eefb7d9f1bc91d7";
+//                baseUrl = "http://124.254.45.234:8082/oa/caslogin/";
+//            } else {
+                baseUrl = "http://h5.auvgo.com/oa/caslogin/";
+                if (TextUtils.isEmpty(appkey)) {
+                    appkey = "fjdsfnvg6523fsgjkff879fidsf";
+                }
+                if (TextUtils.isEmpty(appSceret)) {
+                    appSceret = "9891ca5330271eba81ec1332e740c210";
+                }
+//            }
+            String username = CommonUtil.getEmcode();
+            String data = appkey + username.toUpperCase() + appSceret;
+            String key = Md5Util.toMD5(appSceret).toUpperCase();
+            String sign = Md5Util.toMD5(key + data);
+            StringBuilder urlBuilder = new StringBuilder(baseUrl);
+            urlBuilder.append(appkey + "/");
+            urlBuilder.append(username + "/");
+            urlBuilder.append(sign);
+            try {
+                urlBuilder.append("?p=" + URLEncoder.encode(p, "UTF-8"));
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+            LogUtil.i(urlBuilder.toString());
+            IntentUtils.linkCommonWeb(ct, urlBuilder.toString(), "行旅国际", "", "", false, false, false);
+        } else {
+            ToastUtil.showToast(ct, R.string.networks_out);
+        }
+    }
+
+    public static void showSelect(final Context ct, final String appkey, final String appSceret, final BusinessTravel model) {
+        List<String> items = new ArrayList<>();
+        items.add("火车票");
+        items.add("飞机票");
+        items.add("住宿");
+        MaterialDialog mDialog = new MaterialDialog.Builder(ct)
+                .title("选择预订类型")
+                .items(items)
+                .itemsCallbackSingleChoice(0, new MaterialDialog.ListCallbackSingleChoice() {
+                    @Override
+                    public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
+                        LogUtil.i("text=" + text);
+                        switch (text.toString()) {
+                            case "火车票":
+                                model.setType(BusinessTravel.TRAIN);
+                                break;
+                            case "住宿":
+                                model.setType(BusinessTravel.HOTEL);
+                                break;
+                            case "飞机票":
+                                model.setType(BusinessTravel.AIR);
+                                break;
+                        }
+                        reserve(ct, appkey, appSceret, model);
+                        return true;
+                    }
+                }).positiveText(MyApplication.getInstance().getString(com.uas.appworks.R.string.common_sure)).show();
+
+        mDialog.show();
+    }
+
+
+}

BIN
app_modular/appworks/src/main/res/drawable-hdpi/icon_travel_air.png


BIN
app_modular/appworks/src/main/res/drawable-hdpi/icon_travel_hotel.png


BIN
app_modular/appworks/src/main/res/drawable-hdpi/icon_travel_train.png


BIN
app_modular/appworks/src/main/res/drawable-xhdpi/icon_travel_air.png


BIN
app_modular/appworks/src/main/res/drawable-xhdpi/icon_travel_hotel.png


BIN
app_modular/appworks/src/main/res/drawable-xhdpi/icon_travel_train.png


BIN
app_modular/appworks/src/main/res/drawable-xxhdpi/icon_travel_air.png


BIN
app_modular/appworks/src/main/res/drawable-xxhdpi/icon_travel_hotel.png


BIN
app_modular/appworks/src/main/res/drawable-xxhdpi/icon_travel_train.png


+ 50 - 8
app_modular/appworks/src/main/res/layout/activity_business_travel.xml

@@ -1,18 +1,60 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/mRefreshLayout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/base_bg"
-    app:enablePullDown="true"
-    app:enablePullUp="true"
     tools:context="com.uas.appworks.OA.platform.activity.BusinessTravelActivity">
 
-    <com.modular.apputils.widget.EmptyRecyclerView
-        android:id="@+id/mRecyclerView"
+    <RelativeLayout
+        android:id="@+id/remainRl"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:visibility="gone"
+        android:orientation="horizontal"
+       >
+
+        <ImageView
+            android:id="@+id/remainImg"
+            android:src="@drawable/icon_empty_lamp"
+            android:layout_width="60dp"
+            android:layout_centerHorizontal="true"
+            android:layout_height="60dp" />
+
+        <TextView
+            android:id="@+id/remainTag"
+            android:layout_below="@id/remainImg"
+            android:layout_width="wrap_content"
+            android:textSize="@dimen/text_min"
+            android:layout_marginTop="@dimen/padding"
+            android:layout_height="wrap_content" />
+
+        <TextView
+            android:id="@+id/remainTv"
+            android:layout_alignTop="@id/remainTag"
+            android:layout_toRightOf="@id/remainTag"
+            android:layout_width="wrap_content"
+            android:textColor="#D13F57"
+            android:textSize="@dimen/text_min"
+            android:layout_marginLeft="@dimen/paddingMin"
+            android:layout_height="wrap_content" />
+
+    </RelativeLayout>
+
+    <com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout
+        android:id="@+id/mRefreshLayout"
         android:layout_width="match_parent"
-        android:layout_height="match_parent" />
+        android:layout_height="match_parent"
+        app:enablePullDown="true"
+        android:visibility="gone"
+        app:enablePullUp="true">
+
+        <com.modular.apputils.widget.EmptyRecyclerView
+            android:id="@+id/mRecyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
 
-</com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout>
+    </com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout>
+</FrameLayout>

+ 101 - 85
app_modular/appworks/src/main/res/layout/item_bus_travel_air.xml

@@ -18,8 +18,8 @@
             android:id="@+id/codeTv"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginLeft="@dimen/padding"
             android:layout_marginBottom="@dimen/padding"
+            android:layout_marginLeft="@dimen/padding"
             android:gravity="center_horizontal"
             android:text="单程机票:671283"
             android:textColor="@color/white"
@@ -39,108 +39,120 @@
         <View
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
+            android:id="@+id/line"
             android:layout_below="@id/codeTv"
             android:background="@color/item_line" />
 
-        <LinearLayout
-            android:id="@+id/fromLL"
-            android:layout_width="wrap_content"
+        <RelativeLayout
+            android:id="@+id/orderInfoRl"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_below="@id/codeTv"
-            android:layout_marginLeft="20dp"
-            android:layout_marginRight="@dimen/padding"
-            android:layout_marginTop="@dimen/padding"
-            android:gravity="center_horizontal"
-            android:orientation="vertical">
-
-            <TextView
-                android:id="@+id/fromCityTv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="上海"
-                android:textColor="@color/white"
-                android:textSize="@dimen/textXXL" />
-
-            <TextView
-                android:id="@+id/startDateTv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_below="@id/fromCityTv"
-                android:lines="1"
-                android:text="2017-12-12"
-                android:textColor="@color/white"
-                android:textSize="@dimen/text_main" />
-
-            <TextView
-                android:id="@+id/startTimeTv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="07:20"
-                android:textColor="@color/white"
-                android:textSize="@dimen/text_main" />
-
-        </LinearLayout>
+            android:layout_marginTop="@dimen/padding">
 
-        <LinearLayout
-            android:id="@+id/toLL"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentRight="true"
-            android:layout_alignTop="@id/fromLL"
-            android:layout_marginLeft="@dimen/padding"
-            android:layout_marginRight="20dp"
-            android:gravity="center_horizontal"
-            android:orientation="vertical">
-
-            <TextView
-                android:id="@+id/toCityTv"
+            <LinearLayout
+                android:id="@+id/fromLL"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_alignParentRight="true"
                 android:layout_below="@id/codeTv"
-                android:text="深圳"
-                android:textColor="@color/white"
-                android:textSize="@dimen/textXXL" />
-
-            <TextView
-                android:id="@+id/toDateTv"
+                android:layout_marginLeft="20dp"
+                android:layout_marginRight="@dimen/padding"
+                android:layout_marginTop="@dimen/padding"
+                android:gravity="center_horizontal"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/fromCityTv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="上海"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/textXXL" />
+
+                <TextView
+                    android:id="@+id/startDateTv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_below="@id/fromCityTv"
+                    android:lines="1"
+                    android:text="2017-12-12"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/text_main" />
+
+                <TextView
+                    android:id="@+id/startTimeTv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="07:20"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/text_main" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/toLL"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_alignParentRight="true"
-                android:layout_below="@id/fromCityTv"
-                android:gravity="center"
-                android:lines="1"
-                android:text="2017-12-12"
-                android:textColor="@color/white"
-                android:textSize="@dimen/text_main" />
-
-            <TextView
-                android:id="@+id/toTimeTv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
+                android:layout_alignTop="@id/fromLL"
+                android:layout_marginLeft="@dimen/padding"
+                android:layout_marginRight="20dp"
                 android:gravity="center_horizontal"
-                android:text="07:20"
-                android:textColor="@color/white"
-                android:textSize="@dimen/text_main" />
-        </LinearLayout>
-
-
-        <com.modular.apputils.widget.TravelDirectionView
-            android:id="@+id/mTravelDirectionView"
-            android:layout_width="match_parent"
-            android:layout_height="60dp"
-            android:layout_alignTop="@id/fromLL"
-            android:layout_toLeftOf="@id/toLL"
-            android:layout_toRightOf="@id/fromLL"
-            app:time="2小时20分"
-            app:timeSize="@dimen/text_hine"
-            app:title="D7890"
-            app:titleSize="@dimen/text_main" />
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/toCityTv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentRight="true"
+                    android:layout_below="@id/codeTv"
+                    android:text="深圳"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/textXXL" />
+
+                <TextView
+                    android:id="@+id/toDateTv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_alignParentRight="true"
+                    android:layout_below="@id/fromCityTv"
+                    android:gravity="center"
+                    android:lines="1"
+                    android:text="2017-12-12"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/text_main" />
+
+                <TextView
+                    android:id="@+id/toTimeTv"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:gravity="center_horizontal"
+                    android:text="07:20"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/text_main" />
+            </LinearLayout>
+
+
+            <com.modular.apputils.widget.TravelDirectionView
+                android:id="@+id/mTravelDirectionView"
+                android:layout_width="match_parent"
+                android:layout_height="60dp"
+                android:layout_alignTop="@id/fromLL"
+                android:layout_toLeftOf="@id/toLL"
+                android:layout_toRightOf="@id/fromLL"
+                app:time="2小时20分"
+                app:timeSize="@dimen/text_hine"
+                app:title="D7890"
+                app:titleSize="@dimen/text_main" />
+
+
+        </RelativeLayout>
 
 
     </RelativeLayout>
 
     <RelativeLayout
+        android:id="@+id/userInfoRl"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@color/white"
@@ -207,6 +219,10 @@
             android:layout_marginLeft="30dp"
             android:layout_toRightOf="@id/seatTv"
             android:text="54元"
+            android:lines="1"
+            android:paddingRight="3dp"
+            android:ellipsize="end"
+            android:layout_toLeftOf="@+id/payTypeTv"
             android:textColor="@color/indianred"
             android:textSize="@dimen/text_main" />
 

+ 50 - 42
app_modular/appworks/src/main/res/layout/item_bus_travel_hotel.xml

@@ -17,10 +17,10 @@
             android:id="@+id/codeTv"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_marginBottom="@dimen/padding"
             android:layout_marginLeft="@dimen/padding"
             android:gravity="center_horizontal"
             android:text="住宿"
-            android:layout_marginBottom="@dimen/padding"
             android:textColor="@color/white"
             android:textSize="@dimen/text_hine" />
 
@@ -39,56 +39,64 @@
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
             android:layout_below="@id/codeTv"
+            android:id="@+id/line"
             android:background="@color/item_line" />
 
-        <TextView
-            android:id="@+id/levelTv"
-            android:layout_width="wrap_content"
+        <RelativeLayout
+            android:id="@+id/orderInfoRl"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_alignLeft="@id/codeTv"
             android:layout_below="@id/codeTv"
-            android:layout_marginTop="@dimen/padding"
-            android:text="标准单人间"
-            android:textColor="@color/white"
-            android:textSize="@dimen/textXXL" />
-
-        <TextView
-            android:id="@+id/businessNameTv"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignTop="@id/levelTv"
-            android:layout_marginLeft="@dimen/padding"
-            android:layout_toRightOf="@id/levelTv"
-            android:text="香格里拉酒店"
-            android:textColor="@color/white"
-            android:textSize="@dimen/text_main" />
-
-        <TextView
-            android:id="@+id/whenLongTv"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignLeft="@id/levelTv"
-            android:layout_below="@id/businessNameTv"
-            android:layout_marginTop="@dimen/padding"
-            android:text="入住:12-10     离店:12-12    共两晚"
-            android:textColor="@color/white"
-            android:textSize="@dimen/text_hine" />
-
-        <TextView
-            android:id="@+id/numberTv"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignLeft="@id/whenLongTv"
-            android:layout_below="@id/whenLongTv"
-            android:layout_marginTop="@dimen/padding"
-            android:text="1人"
-            android:textColor="@color/white"
-            android:textSize="@dimen/text_hine" />
+            android:layout_marginTop="@dimen/padding">
+
+            <TextView
+                android:id="@+id/levelTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignLeft="@id/codeTv"
+                android:text="标准单人间"
+                android:textColor="@color/white"
+                android:textSize="@dimen/textXXL" />
+
+            <TextView
+                android:id="@+id/businessNameTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignTop="@id/levelTv"
+                android:layout_marginLeft="@dimen/padding"
+                android:layout_toRightOf="@id/levelTv"
+                android:text="香格里拉酒店"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_main" />
+
+            <TextView
+                android:id="@+id/whenLongTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignLeft="@id/levelTv"
+                android:layout_below="@id/businessNameTv"
+                android:layout_marginTop="@dimen/padding"
+                android:text="入住:12-10     离店:12-12    共两晚"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_hine" />
+
+            <TextView
+                android:id="@+id/numberTv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignLeft="@id/whenLongTv"
+                android:layout_below="@id/whenLongTv"
+                android:layout_marginTop="@dimen/padding"
+                android:text="1人"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_hine" />
+        </RelativeLayout>
 
 
     </RelativeLayout>
 
     <RelativeLayout
+        android:id="@+id/userInfoRl"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@color/white"

+ 84 - 0
app_modular/appworks/src/main/res/layout/item_bus_travel_leader.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="70dp"
+    android:background="@color/white"
+    android:gravity="center_vertical"
+    android:paddingTop="@dimen/padding"
+    android:paddingBottom="@dimen/padding"
+    android:orientation="horizontal">
+
+    <LinearLayout
+        android:id="@+id/clickTrain"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_horizontal"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:src="@drawable/icon_travel_train" />
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:textColor="@color/text_main"
+            android:textSize="@dimen/text_main"
+            android:text="订火车" />
+
+    </LinearLayout>
+
+
+    <LinearLayout
+        android:id="@+id/clickAir"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_horizontal"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:src="@drawable/icon_travel_air" />
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:textColor="@color/text_main"
+            android:textSize="@dimen/text_main"
+            android:text="订飞机" />
+
+    </LinearLayout>
+
+
+    <LinearLayout
+        android:id="@+id/clickHotel"
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_horizontal"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:src="@drawable/icon_travel_hotel" />
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:textColor="@color/text_main"
+            android:textSize="@dimen/text_main"
+            android:text="订酒店" />
+
+    </LinearLayout>
+</LinearLayout>

+ 51 - 24
app_modular/appworks/src/main/res/layout/item_bus_travel_title.xml

@@ -2,32 +2,59 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:background="@color/white"
+    android:background="@color/base_bg"
     android:gravity="center_vertical"
-    android:orientation="horizontal">
+    android:orientation="vertical">
 
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginBottom="@dimen/padding"
-        android:layout_marginTop="@dimen/padding"
-        android:gravity="center_horizontal"
-        android:paddingLeft="10dp"
-        android:paddingRight="10dp"
-        android:text="出差单号"
-        android:textColor="@color/hint_text_color"
-        android:textSize="@dimen/text_hine" />
+    <View
+        android:id="@+id/titleLine"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/padding" />
 
-    <TextView
-        android:id="@+id/codeTv"
-        android:layout_width="wrap_content"
+    <RelativeLayout
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="@dimen/padding"
-        android:layout_marginTop="@dimen/padding"
-        android:gravity="center_horizontal"
-        android:paddingLeft="10dp"
-        android:paddingRight="10dp"
-        android:text="出差单号"
-        android:textColor="@color/black"
-        android:textSize="@dimen/text_main" />
+        android:background="@color/white"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <TextView
+            android:id="@+id/tag"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:gravity="center_horizontal"
+            android:paddingLeft="10dp"
+            android:paddingRight="10dp"
+            android:text="出差单号"
+            android:textColor="@color/hint_text_color"
+            android:textSize="@dimen/text_hine" />
+
+        <ImageView
+            android:id="@+id/addMoreTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_centerVertical="true"
+            android:padding="4dp"
+            android:src="@drawable/icon_add_circular" />
+
+        <TextView
+            android:id="@+id/codeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="@dimen/padding"
+            android:layout_marginTop="@dimen/padding"
+            android:layout_toLeftOf="@id/addMoreTv"
+            android:layout_toRightOf="@id/tag"
+            android:gravity="left"
+            android:paddingLeft="10dp"
+            android:paddingRight="10dp"
+            android:text="出差单号"
+            android:textColor="@color/black"
+            android:textSize="@dimen/text_main" />
+    </RelativeLayout>
+
 </LinearLayout>

+ 64 - 51
app_modular/appworks/src/main/res/layout/item_device_match.xml

@@ -4,33 +4,10 @@
     android:layout_height="wrap_content">
 
 
-    <TextView
-        android:id="@+id/codeTag"
-        android:layout_width="90dp"
-        android:layout_height="36dp"
-        android:layout_gravity="left"
-        android:layout_marginRight="10dp"
-        android:ellipsize="end"
-        android:gravity="center_vertical"
-        android:maxLines="2"
-        android:paddingLeft="@dimen/paddingMin"
-        android:text="机型"
-        android:textSize="14sp" />
-
-    <TextView
-        android:id="@+id/codeTv"
-        android:layout_width="match_parent"
-        android:layout_height="36dp"
-        android:layout_toRightOf="@id/codeTag"
-        android:gravity="center_vertical"
-        android:paddingLeft="10dp"
-        android:textSize="14sp" />
-
     <TextView
         android:id="@+id/nameTag"
-        android:layout_width="90dp"
+        android:layout_width="wrap_content"
         android:layout_height="36dp"
-        android:layout_below="@id/codeTag"
         android:layout_gravity="left"
         android:layout_marginRight="10dp"
         android:ellipsize="end"
@@ -51,8 +28,8 @@
         android:textSize="14sp" />
 
     <TextView
-        android:id="@+id/existqtyTag"
-        android:layout_width="90dp"
+        android:id="@+id/specTag"
+        android:layout_width="wrap_content"
         android:layout_height="36dp"
         android:layout_below="@id/nameTag"
         android:layout_gravity="left"
@@ -61,40 +38,76 @@
         android:gravity="center_vertical"
         android:maxLines="2"
         android:paddingLeft="@dimen/paddingMin"
-        android:text="匹配设备数量"
+        android:text="设备规格"
         android:textSize="14sp" />
 
     <TextView
-        android:id="@+id/existqtyTv"
+        android:id="@+id/specTv"
         android:layout_width="match_parent"
         android:layout_height="36dp"
-        android:layout_alignTop="@id/existqtyTag"
-        android:layout_toRightOf="@id/existqtyTag"
+        android:layout_toRightOf="@id/specTag"
+        android:layout_alignTop="@id/specTag"
         android:gravity="center_vertical"
         android:paddingLeft="10dp"
         android:textSize="14sp" />
 
-    <TextView
-        android:id="@+id/lackqtyTag"
-        android:layout_width="90dp"
-        android:layout_height="36dp"
-        android:layout_below="@id/existqtyTag"
-        android:layout_gravity="left"
-        android:layout_marginRight="10dp"
-        android:ellipsize="end"
-        android:gravity="center_vertical"
-        android:maxLines="2"
-        android:paddingLeft="@dimen/paddingMin"
-        android:text="欠缺设备数量"
-        android:textSize="14sp" />
 
-    <TextView
-        android:id="@+id/lackqtyTv"
+    <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="36dp"
-        android:layout_alignTop="@id/lackqtyTag"
-        android:layout_toRightOf="@id/lackqtyTag"
-        android:gravity="center_vertical"
-        android:paddingLeft="10dp"
-        android:textSize="14sp" />
+        android:layout_height="wrap_content"
+        android:layout_below="@id/specTag"
+        android:orientation="horizontal">
+
+
+        <TextView
+            android:id="@+id/existqtyTag"
+            android:layout_width="wrap_content"
+            android:layout_height="36dp"
+            android:layout_gravity="left"
+            android:layout_marginRight="10dp"
+            android:ellipsize="end"
+            android:gravity="center_vertical"
+            android:maxLines="2"
+            android:paddingLeft="@dimen/paddingMin"
+            android:text="匹配数量"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/existqtyTv"
+            android:layout_width="0dp"
+            android:layout_height="36dp"
+            android:layout_alignTop="@id/existqtyTag"
+            android:layout_marginRight="@dimen/padding"
+            android:layout_toRightOf="@id/existqtyTag"
+            android:layout_weight="3"
+            android:gravity="center_vertical"
+            android:paddingLeft="10dp"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/lackqtyTag"
+            android:layout_width="wrap_content"
+            android:layout_height="36dp"
+            android:layout_below="@id/existqtyTag"
+            android:layout_gravity="left"
+            android:layout_marginRight="10dp"
+            android:ellipsize="end"
+            android:gravity="center_vertical"
+            android:maxLines="2"
+            android:paddingLeft="@dimen/paddingMin"
+            android:text="欠缺数量"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/lackqtyTv"
+            android:layout_width="0dp"
+            android:layout_height="36dp"
+            android:layout_alignTop="@id/lackqtyTag"
+            android:layout_toRightOf="@id/lackqtyTag"
+            android:layout_weight="3"
+            android:gravity="center_vertical"
+            android:paddingLeft="10dp"
+            android:textSize="14sp" />
+    </LinearLayout>
+
 </RelativeLayout>

+ 1 - 1
app_modular/appworks/src/main/res/layout/pop_click_menu.xml

@@ -19,7 +19,7 @@
         android:layout_toLeftOf="@id/clickImage"
         android:gravity="right"
         android:padding="@dimen/padding"
-        android:text="点击这里预定"
+        android:text="点击右上角预订"
         android:textColor="#5f95dd"
         android:textSize="@dimen/textXXL" />
 

+ 1 - 1
app_modular/appworks/src/main/res/menu/menu_add_travel.xml

@@ -3,6 +3,6 @@
     xmlns:app="http://schemas.android.com/apk/res-auto">
 
     <item android:id="@+id/addTravel"
-        android:title="预"
+        android:title="预"
         app:showAsAction="always"/>
 </menu>

+ 1 - 2
app_modular/appworks/src/main/res/menu/menu_common_docdetails.xml

@@ -3,8 +3,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto">
     <item
         android:id="@+id/toTravel"
-        android:title="转差旅"
-
+        android:title="去预订"
         app:showAsAction="ifRoom"/>
     <item
         android:id="@+id/add_item"

Some files were not shown because too many files changed in this diff