Browse Source

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

# Conflicts:
#	WeiChat/version.properties
#	app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/PurchaseDetailsActivity.java
raomeng 8 years ago
parent
commit
54a9c7218d
31 changed files with 1078 additions and 475 deletions
  1. 2 1
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/circle/BusinessCircleActivity.java
  2. 3 3
      WeiChat/version.properties
  3. 2 3
      app_core/common/src/main/java/com/common/LogUtil.java
  4. 3 1
      app_core/common/src/main/java/com/core/app/Constants.java
  5. 8 3
      app_core/common/src/main/java/com/core/dao/MessageDao.java
  6. 2 2
      app_core/common/src/main/java/com/core/db/DBOpenHelper.java
  7. 24 1
      app_core/common/src/main/java/com/core/model/MessageModel.java
  8. 1 0
      app_core/common/src/main/java/com/core/net/http/ViewUtil.java
  9. 1 1
      app_core/common/src/main/java/com/core/utils/CommonUtil.java
  10. 5 5
      app_core/common/src/main/java/com/core/utils/OpenFilesUtils.java
  11. 0 0
      app_core/common/src/main/res/drawable/edit_hint_right_angle.xml
  12. 1 0
      app_modular/appmessages/src/main/AndroidManifest.xml
  13. 212 160
      app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MessageWebActivity.java
  14. 61 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MsgThirdWebActivity.java
  15. 19 8
      app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MsgsSecondCommonActivity.java
  16. 2 2
      app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/ApprovalAdapter.java
  17. 2 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java
  18. 3 2
      app_modular/apputils/src/main/java/com/modular/apputils/activity/BaseNetActivity.java
  19. 4 3
      app_modular/apputils/src/main/java/com/modular/apputils/utils/SwitchUtil.java
  20. 24 0
      app_modular/apputils/src/main/res/drawable/edit_hint_right_angle.xml
  21. 10 0
      app_modular/apputils/src/main/res/drawable/edit_white_right_angle.xml
  22. 19 4
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/CommonDocDetailsActivity.java
  23. 23 21
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/adapter/CommonDocMainMsgAdapter.java
  24. 18 29
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/BusinessTravelActivity.java
  25. 152 64
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/PurchaseDetailsActivity.java
  26. 61 15
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/BusinessTravelAdapter.java
  27. 83 48
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/PurchaseDetailsAdapter.java
  28. 16 0
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/BusinessTravel.java
  29. 57 44
      app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/Purchase.java
  30. 119 8
      app_modular/appworks/src/main/res/layout/item_ls_purchase.xml
  31. 141 47
      app_modular/appworks/src/main/res/layout/item_purchase.xml

+ 2 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/circle/BusinessCircleActivity.java

@@ -31,6 +31,7 @@ import com.alibaba.fastjson.JSON;
 import com.android.volley.Response;
 import com.android.volley.Response.ErrorListener;
 import com.android.volley.VolleyError;
+import com.common.LogUtil;
 import com.common.preferences.PreferenceUtils;
 import com.common.system.DisplayUtil;
 import com.common.ui.CameraUtil;
@@ -695,7 +696,7 @@ public class BusinessCircleActivity extends BaseActivity implements showCEView {
         }, new StringJsonArrayRequest.Listener<PublicMessage>() {
             @Override
             public void onResponse(ArrayResult<PublicMessage> result) {
-                Log.i("Arison", "商务信息:" + JSON.toJSONString(result));
+                LogUtil.prinlnLongMsg("Arison", "商务信息:" + JSON.toJSONString(result));
                 boolean success = Result.defaultParser(mContext, result, true);
                 if (success) {
                     List<PublicMessage> datas = result.getData();

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Fri Jan 19 09:10:08 CST 2018
-debugName=513
+#Thu Jan 18 15:27:21 CST 2018
+debugName=475
 versionName=624
-debugCode=513
+debugCode=475
 versionCode=163

+ 2 - 3
app_core/common/src/main/java/com/common/LogUtil.java

@@ -40,9 +40,8 @@ public class LogUtil {
 	}
 
 	public static void i(String msg) {
-		if (BaseConfig.showLogAble() && msg != null && msg.length() > 0) {
-			Log.i("gongpengming", msg);
-		}
+		prinlnLongMsg("gongpengming", msg);
+
 	}
 
 	public static void i(String tag, String msg) {

+ 3 - 1
app_core/common/src/main/java/com/core/app/Constants.java

@@ -253,7 +253,9 @@ public class Constants {
             + "type varchar(20),"//类型
             + "hierarchy integer,"//类型
             + "readTime integer,"//阅读时间
-            + "isReaded integer"//阅读状态,1阅读
+            + "isReaded integer,"//阅读状态,1阅读
+            + "caller varchar(20),"//
+            + "keyValue integer"//
             + ")";
     //考勤地址表
     public static final String WORK_LOCATION = "CREATE TABLE work_location ("

+ 8 - 3
app_core/common/src/main/java/com/core/dao/MessageDao.java

@@ -263,7 +263,7 @@ public class MessageDao {
             String emcode = CommonUtil.getEmcode();
             if (StringUtil.isEmpty(master) || StringUtil.isEmpty(emcode)) return messageModels;
             db = DatabaseManager.getInstance().openDatabase();
-            String[] columns = {"id", "count", "title", "subTitle", "time", "type", "isReaded", "readTime"};
+            String[] columns = {"id", "count", "title", "subTitle", "time", "type", "isReaded", "readTime","caller","keyValue"};
 //TODO
             String selection = "hierarchy=? and master=? and emcode=?  and  isReaded!=? ";
             String[] selectArgs = {String.valueOf(0), master, emcode, String.valueOf(3)};
@@ -295,7 +295,7 @@ public class MessageDao {
             String emcode = CommonUtil.getEmcode();
             if (StringUtil.isEmpty(master) || StringUtil.isEmpty(emcode)) return messageModels;
             db = DatabaseManager.getInstance().openDatabase();
-            String[] columns = {"id", "count", "title", "subTitle", "time", "type", "isReaded", "readTime"};
+            String[] columns = {"id", "count", "title", "subTitle", "time", "type", "isReaded", "readTime","caller","keyValue"};
             Cursor c = null;
             String selection;
             if (platform) {
@@ -328,7 +328,6 @@ public class MessageDao {
         SQLiteDatabase db = null;
         long i = 0;
         try {
-            String readTime = TimeUtils.f_long_2_str(System.currentTimeMillis());
             String master = CommonUtil.getMaster();
             String emcode = CommonUtil.getEmcode();
             if (StringUtil.isEmpty(master) || StringUtil.isEmpty(emcode)) return false;
@@ -487,7 +486,11 @@ public class MessageDao {
             int isReaded = c.getInt(c.getColumnIndex("isReaded"));
             String readTime = c.getString(c.getColumnIndex("readTime"));
             int readStatus = c.getInt(c.getColumnIndex("isReaded"));
+            String caller = c.getString(c.getColumnIndex("caller"));
+            int keyValue = c.getInt(c.getColumnIndex("keyValue"));
             model = new MessageModel(id, hierarchy, count, title, subTitle, time, type, (isReaded == 1 || isReaded == 3), readStatus, readTime);
+           model.setCaller(caller);
+           model.setKeyValue(keyValue);
             messageModels.add(model);
         }
         return messageModels;
@@ -505,6 +508,8 @@ public class MessageDao {
         values.put("title", m.getTitle());
         values.put("subTitle", m.getSubTitle());
         values.put("hierarchy", m.getHierarchy());
+        values.put("caller", m.getCaller());
+        values.put("keyValue", m.getKeyValue());
         return values;
     }
 

+ 2 - 2
app_core/common/src/main/java/com/core/db/DBOpenHelper.java

@@ -13,8 +13,8 @@ import com.core.app.Constants;
  * @注释:建立数据库
  */
 public class DBOpenHelper extends SQLiteOpenHelper {
-    //TODO  上一个发布版本是87
-    private static final int DATABASE_VERSION = 88;
+    //TODO  上一个发布版本是88
+    private static final int DATABASE_VERSION = 89;
     public static String dataBaseName = "erp.db";
     public Context context;
 

+ 24 - 1
app_core/common/src/main/java/com/core/model/MessageModel.java

@@ -23,10 +23,13 @@ public class MessageModel implements Parcelable {
     private int readStatus;//阅读状态
     private String readTime;
 
+    private String caller;
+    private int keyValue;
+
     public MessageModel() {
     }
 
-    public MessageModel(int id, int hierarchy, int count,  String title, String subTitle, String time, String type, boolean isReaded, int readStatus, String readTime) {
+    public MessageModel(int id, int hierarchy, int count, String title, String subTitle, String time, String type, boolean isReaded, int readStatus, String readTime) {
         this.id = id;
         this.hierarchy = hierarchy;
         this.count = count;
@@ -51,6 +54,9 @@ public class MessageModel implements Parcelable {
         isReaded = in.readByte() != 0;
         readStatus = in.readInt();
         readTime = in.readString();
+        caller = in.readString();
+        keyValue = in.readInt();
+
     }
 
     @Override
@@ -66,6 +72,8 @@ public class MessageModel implements Parcelable {
         dest.writeByte((byte) (isReaded ? 1 : 0));
         dest.writeInt(readStatus);
         dest.writeString(readTime);
+        dest.writeString(caller);
+        dest.writeInt(keyValue);
     }
 
     @Override
@@ -153,6 +161,21 @@ public class MessageModel implements Parcelable {
         isReaded = readed;
     }
 
+    public String getCaller() {
+        return caller;
+    }
+
+    public void setCaller(String caller) {
+        this.caller = caller;
+    }
+
+    public int getKeyValue() {
+        return keyValue;
+    }
+
+    public void setKeyValue(int keyValue) {
+        this.keyValue = keyValue;
+    }
 
     /**
      * 1crm/CRM提醒

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

@@ -1046,6 +1046,7 @@ public class ViewUtil {
                                     String password) {
         mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_progress_erp));
         url = url + "mobile/login.action";
+//        url = CommonUtil.getAppBaseUrl(MyApplication.getInstance()) + "mobile/login.action";
         Map<String, String> params = new HashMap<String, String>();
         params.put("username", username);
         params.put("password", password);

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

@@ -101,7 +101,7 @@ public class CommonUtil {
         }
         String baseUrl = getSharedPreferences(ct, "erp_baseurl");
 //        if (BaseConfig.isDebug()){
-//            baseUrl="http://192.168.253.203:8090/ERP/";
+//            baseUrl="http://192.168.253.97:8080/ERP/";
 //        }
 //        baseUrl="http://192.168.253.203:8090/ERP/
 

+ 5 - 5
app_core/common/src/main/java/com/core/utils/OpenFilesUtils.java

@@ -286,18 +286,18 @@ public class OpenFilesUtils {
             int status = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS));
             switch (status) {
                 case DownloadManager.STATUS_PAUSED:
-                    showFileToast(">>>下载暂停");
+                    showFileToast(">>>浏览暂停");
                 case DownloadManager.STATUS_PENDING:
-                    showFileToast(">>>下载延迟");
+                    showFileToast(">>>浏览出现延迟");
                 case DownloadManager.STATUS_RUNNING:
-                    showFileToast(">>>正在下载");
+                    showFileToast(">>>正在生成附件浏览");
                     break;
                 case DownloadManager.STATUS_SUCCESSFUL:
-                    showFileToast(">>>下载完成");
+                    showFileToast(">>>正在打开文件");
                     //下载完成安装克定义自动执行打开文件操作
                     break;
                 case DownloadManager.STATUS_FAILED:
-                    showFileToast(">>>下载失败");
+                    showFileToast(">>>浏览失败");
                     break;
             }
         }

+ 0 - 0
app_core/common/src/main/res/drawable-xxhdpi/edit_hint_right_angle.xml → app_core/common/src/main/res/drawable/edit_hint_right_angle.xml


+ 1 - 0
app_modular/appmessages/src/main/AndroidManifest.xml

@@ -8,6 +8,7 @@
         android:supportsRtl="true">
         <activity android:name=".activity.MsgsSecondCommonActivity" />
         <activity android:name=".activity.PlatMsgThirdActivity" />
+        <activity android:name=".activity.MsgThirdWebActivity" />
         <activity android:name=".activity.ProcessB2BActivity">
             <intent-filter>
                 <action android:name="com.modular.work.ProcessB2BActivity" />

+ 212 - 160
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MessageWebActivity.java

@@ -1,5 +1,6 @@
 package com.modular.appmessages.activity;
 
+import android.content.Context;
 import android.content.Intent;
 import android.graphics.Bitmap;
 import android.net.http.SslError;
@@ -8,8 +9,14 @@ import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.webkit.CookieManager;
+import android.webkit.CookieSyncManager;
+import android.webkit.JsPromptResult;
+import android.webkit.JsResult;
 import android.webkit.SslErrorHandler;
 import android.webkit.WebChromeClient;
+import android.webkit.WebResourceRequest;
+import android.webkit.WebResourceResponse;
 import android.webkit.WebSettings;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
@@ -18,177 +25,222 @@ import android.widget.ZoomButtonsController;
 
 import com.common.LogUtil;
 import com.common.system.SystemUtil;
+import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
 import com.core.utils.IntentUtils;
+import com.core.utils.ToastUtil;
 import com.modular.appmessages.R;
 import com.umeng.socialize.ShareAction;
 import com.umeng.socialize.bean.SHARE_MEDIA;
 import com.umeng.socialize.media.UMImage;
 
+import org.apache.http.cookie.Cookie;
+
 import java.lang.reflect.Field;
 
 public class MessageWebActivity extends BaseActivity {
 
 
-	private WebView webViewRefresh;
-	private ProgressBar progressBar;
-	private String url;
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-		setContentView(R.layout.activity_message_web);
-		webViewRefresh = (WebView) findViewById(R.id.webView);
-		progressBar = (ProgressBar) findViewById(R.id.progressBar);
-		initView();
-		initData();
-	}
-
-
-	@Override
-	public boolean onCreateOptionsMenu(Menu menu) {
-		if (getIntent() != null && getIntent().getBooleanExtra(IntentUtils.KEY_NEER_SHARE, false)) {
-			getMenuInflater().inflate(R.menu.menu_about, menu);
-		}
-		return true;
-	}
-
-	@Override
-	public boolean onOptionsItemSelected(MenuItem item) {
-		if (R.id.app_about == item.getItemId()) {
-			String title = getSupportActionBar().getTitle().toString();
-			String content = null;
-			String imageUrl = null;
-			Intent intent = getIntent();
-			if (intent != null) {
-				content = intent.getStringExtra(IntentUtils.KEY_SHARE_CONTENT);
-				imageUrl = intent.getStringExtra(IntentUtils.KEY_SHARE_IMAGE);
-			}
-			if (content == null) {
-				content = "UU互联 Android客户端" + SystemUtil.getVersionName(mContext);
-				imageUrl = "http://img.my.csdn.net/uploads/201609/30/1475204542_1365.png";
-			}
-			LogUtil.i("url="+url);
-			LogUtil.i("content="+content);
-			LogUtil.i("imageUrl="+imageUrl);
-			new ShareAction(activity).setDisplayList(
-					SHARE_MEDIA.SINA,
-					SHARE_MEDIA.QQ,
-					SHARE_MEDIA.QZONE,
-					SHARE_MEDIA.WEIXIN,
-					SHARE_MEDIA.WEIXIN_CIRCLE,
-					SHARE_MEDIA.WEIXIN_FAVORITE,
-					SHARE_MEDIA.MORE)
-					.withTitle(title)
-					.withText(content)
-					.withMedia(new UMImage(activity, imageUrl))
-					.withTargetUrl(url)
-					.setCallback(CommonUtil.umShareListener)
-					.open();
-		}
-		return super.onOptionsItemSelected(item);
-	}
-
-	private void initView() {
-		webViewRefresh.getSettings().setJavaScriptEnabled(true);
-		webViewRefresh.getSettings().setSupportZoom(true);
-		webViewRefresh.getSettings().setBuiltInZoomControls(true);
-		webViewRefresh.getSettings().setUseWideViewPort(true);
-		webViewRefresh.getSettings().setDomStorageEnabled(true);
-		webViewRefresh.getSettings().setLoadWithOverviewMode(true);
-		webViewRefresh.getSettings().setDefaultTextEncodingName("utf-8");
-		webViewRefresh.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
-		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-			webViewRefresh.getSettings().setDisplayZoomControls(false);
-		} else {
-			setZoomControlGone();
-		}
-		webViewRefresh.clearCache(true);
-		webViewRefresh.clearHistory();
-		webViewRefresh.setWebViewClient(new WebViewClient() {
-			public boolean shouldOverrideUrlLoading(WebView view, String url) {
-				view.loadUrl(url);
-				return true;
-			}
-
-			@Override
-			public void onPageStarted(WebView view, String url, Bitmap favicon) {
-				if (progressBar.getVisibility() == View.GONE) {
-					progressBar.setVisibility(View.VISIBLE);
-				}
-			}
-
-			@Override
-			public void onPageFinished(WebView view, String url) {
-				if (progressBar.getVisibility() == View.VISIBLE) {
-					progressBar.setVisibility(View.GONE);
-				}
-			}
-
-			@Override
-			public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
-				handler.proceed();
-			}
-		});
-		webViewRefresh.setWebChromeClient(new WebChromeClient() {
-			@Override
-			public void onProgressChanged(WebView view, int newProgress) {
-				progressBar.setProgress(newProgress);
-				if (newProgress == 100) {
-					progressBar.setProgress(newProgress);
-					progressBar.setVisibility(View.GONE);
-				}
-				super.onProgressChanged(view, newProgress);
-			}
-		});
-//        webViewRefresh.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<WebView>() {
-//            @Override
-//            public void onRefresh(PullToRefreshBase<WebView> refreshView) {
-//                loadData();
-//            }
-//        });
-	}
-
-	public void setZoomControlGone() {
-		Class classType;
-		Field field;
-		try {
-			classType = WebView.class;
-			field = classType.getDeclaredField("mZoomButtonsController");
-			field.setAccessible(true);
-			ZoomButtonsController mZoomButtonsController = new ZoomButtonsController(webViewRefresh);
-			mZoomButtonsController.getZoomControls().setVisibility(View.GONE);
-			try {
-				field.set(webViewRefresh, mZoomButtonsController);
-			} catch (IllegalArgumentException e) {
-				e.printStackTrace();
-			} catch (IllegalAccessException e) {
-				e.printStackTrace();
-			}
-		} catch (SecurityException e) {
-			e.printStackTrace();
-		} catch (NoSuchFieldException e) {
-			e.printStackTrace();
-		}
-	}
-
-	private void initData() {
-		Intent intent = getIntent();
-		if (intent != null) {
-			url = intent.getStringExtra(IntentUtils.KEY_URL);
-			String title = intent.getStringExtra(IntentUtils.KEY_TITLE);
-			if (title != null) {
-				getSupportActionBar().setTitle(title);
-			}
-		}
-		loadData();
-	}
-
-	private void loadData() {
-		if (url != null) {
-			webViewRefresh.loadUrl(url);
-		}
-
-	}
+    protected WebView webViewRefresh;
+    protected ProgressBar progressBar;
+    protected String url;
+    private boolean needCookie;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_message_web);
+        webViewRefresh = (WebView) findViewById(R.id.webView);
+        progressBar = (ProgressBar) findViewById(R.id.progressBar);
+        initView();
+        initData();
+    }
+
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        if (getIntent() != null && getIntent().getBooleanExtra(IntentUtils.KEY_NEER_SHARE, false)) {
+            getMenuInflater().inflate(R.menu.menu_about, menu);
+        }
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (R.id.app_about == item.getItemId()) {
+            String title = getSupportActionBar().getTitle().toString();
+            String content = null;
+            String imageUrl = null;
+            Intent intent = getIntent();
+            if (intent != null) {
+                content = intent.getStringExtra(IntentUtils.KEY_SHARE_CONTENT);
+                imageUrl = intent.getStringExtra(IntentUtils.KEY_SHARE_IMAGE);
+            }
+            if (content == null) {
+                content = "UU互联 Android客户端" + SystemUtil.getVersionName(mContext);
+                imageUrl = "http://img.my.csdn.net/uploads/201609/30/1475204542_1365.png";
+            }
+            LogUtil.i("url=" + url);
+            LogUtil.i("content=" + content);
+            LogUtil.i("imageUrl=" + imageUrl);
+            new ShareAction(activity).setDisplayList(
+                    SHARE_MEDIA.SINA,
+                    SHARE_MEDIA.QQ,
+                    SHARE_MEDIA.QZONE,
+                    SHARE_MEDIA.WEIXIN,
+                    SHARE_MEDIA.WEIXIN_CIRCLE,
+                    SHARE_MEDIA.WEIXIN_FAVORITE,
+                    SHARE_MEDIA.MORE)
+                    .withTitle(title)
+                    .withText(content)
+                    .withMedia(new UMImage(activity, imageUrl))
+                    .withTargetUrl(url)
+                    .setCallback(CommonUtil.umShareListener)
+                    .open();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    protected void initView() {
+        webViewRefresh.getSettings().setJavaScriptEnabled(true);
+        webViewRefresh.getSettings().setSupportZoom(true);
+        webViewRefresh.getSettings().setBuiltInZoomControls(true);
+        webViewRefresh.getSettings().setUseWideViewPort(true);
+        webViewRefresh.getSettings().setDomStorageEnabled(true);
+        webViewRefresh.getSettings().setLoadWithOverviewMode(true);
+        webViewRefresh.getSettings().setDefaultTextEncodingName("utf-8");
+        webViewRefresh.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+            webViewRefresh.getSettings().setDisplayZoomControls(false);
+        } else {
+            setZoomControlGone();
+        }
+        webViewRefresh.clearCache(true);
+        webViewRefresh.clearHistory();
+        webViewRefresh.setWebViewClient(getWebViewClient());
+        webViewRefresh.setWebChromeClient(getWebChromeClient());
+    }
+
+
+    protected WebChromeClient getWebChromeClient() {
+        return new WebChromeClient() {
+            @Override
+            public void onProgressChanged(WebView view, int newProgress) {
+                progressBar.setProgress(newProgress);
+                if (newProgress == 100) {
+                    progressBar.setProgress(newProgress);
+                    progressBar.setVisibility(View.GONE);
+                }
+                super.onProgressChanged(view, newProgress);
+            }
+        };
+    }
+    protected WebViewClient getWebViewClient() {
+        return new WebViewClient() {
+            public boolean shouldOverrideUrlLoading(WebView view, String url) {
+                LogUtil.i("shouldOverrideUrlLoading url=" + url);
+                if (needCookie) {
+                    synCookies(ct, url);
+                }
+                view.loadUrl(url);
+                return true;
+            }
+
+            @Override
+            public void onPageStarted(WebView view, String url, Bitmap favicon) {
+                LogUtil.i("onPageStarted url=" + url);
+                if (progressBar.getVisibility() == View.GONE) {
+                    progressBar.setVisibility(View.VISIBLE);
+                }
+            }
+
+
+            @Override
+            public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
+                ToastUtil.showToast(ct,"Cookie已经过期,请重新登陆");
+                super.onReceivedHttpError(view, request, errorResponse);
+            }
+
+            @Override
+            public void onPageFinished(WebView view, String url) {
+                if (progressBar.getVisibility() == View.VISIBLE) {
+                    progressBar.setVisibility(View.GONE);
+                }
+            }
+
+            @Override
+            public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
+                handler.proceed();
+            }
+        };
+    }
+
+    public void setZoomControlGone() {
+        Class classType;
+        Field field;
+        try {
+            classType = WebView.class;
+            field = classType.getDeclaredField("mZoomButtonsController");
+            field.setAccessible(true);
+            ZoomButtonsController mZoomButtonsController = new ZoomButtonsController(webViewRefresh);
+            mZoomButtonsController.getZoomControls().setVisibility(View.GONE);
+            try {
+                field.set(webViewRefresh, mZoomButtonsController);
+            } catch (IllegalArgumentException e) {
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        } catch (SecurityException e) {
+            e.printStackTrace();
+        } catch (NoSuchFieldException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    private void initData() {
+        Intent intent = getIntent();
+        if (intent != null) {
+            url = intent.getStringExtra(IntentUtils.KEY_URL);
+            String title = intent.getStringExtra(IntentUtils.KEY_TITLE);
+            needCookie = intent.getBooleanExtra(IntentUtils.KEY_NEER_COOKIE, false);
+            if (title != null) {
+                getSupportActionBar().setTitle(title);
+            }
+            if (needCookie) {
+                synCookies(ct, url);
+            }
+        }
+        loadData();
+    }
+
+    private void loadData() {
+        if (url != null) {
+            webViewRefresh.loadUrl(url);
+        }
+
+    }
+
+
+    /**
+     * 同步一下cookie
+     */
+    public void synCookies(Context context, String url) {
+        CookieSyncManager.createInstance(context);
+        CookieManager cookieManager = CookieManager.getInstance();
+        cookieManager.setAcceptCookie(true);
+        cookieManager.removeSessionCookie();//移除
+        Cookie sessionCookie = MyApplication.cookieERP;
+        if (sessionCookie!=null){
+            String cookieStr = sessionCookie.getName() + "="
+                    + sessionCookie.getValue() + "; domain="
+                    + sessionCookie.getDomain() + "; path="
+                    + sessionCookie.getPath();
+            cookieManager.setCookie(url, cookieStr);//cookies是在HttpClient中获得的cookie
+            CookieSyncManager.getInstance().sync();
+        }
+
+    }
 }

+ 61 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MsgThirdWebActivity.java

@@ -0,0 +1,61 @@
+package com.modular.appmessages.activity;
+
+import android.content.Intent;
+import android.view.View;
+import android.webkit.JsResult;
+import android.webkit.WebChromeClient;
+import android.webkit.WebView;
+
+import com.common.LogUtil;
+import com.core.utils.IntentUtils;
+import com.uas.appworks.OA.erp.activity.CommonDocDetailsActivity;
+
+/**
+ * Created by Bitlike on 2018/1/16.
+ */
+public class MsgThirdWebActivity extends MessageWebActivity {
+    @Override
+    protected WebChromeClient getWebChromeClient() {
+        return new WebChromeClient() {
+            @Override
+            public void onProgressChanged(WebView view, int newProgress) {
+                progressBar.setProgress(newProgress);
+                if (newProgress == 100) {
+                    progressBar.setProgress(newProgress);
+                    progressBar.setVisibility(View.GONE);
+                }
+                super.onProgressChanged(view, newProgress);
+            }
+
+            @Override
+            public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
+                LogUtil.i("onJsAlert url=" + url);
+                LogUtil.i("onJsAlert message=" + message);
+                LogUtil.i("onJsAlert result=" + result.toString());
+                Intent intent = getIntent();
+                if (intent != null  ) {
+                   String title= intent.getStringExtra(IntentUtils.KEY_TITLE);
+                   if (title!=null&&title.equals("审批知会")){
+                       String caller = intent.getStringExtra("caller");
+                       int keyValue = intent.getIntExtra("keyValue", 0);
+                       LogUtil.i("onJsAlert caller=" + caller);
+                       LogUtil.i("onJsAlert keyValue=" + keyValue);
+                       startActivity(caller, keyValue);
+                   }
+                }
+                result.cancel();
+                return true;
+            }
+        };
+    }
+
+
+    private void startActivity(String caller, int keyValue) {
+        startActivity(new Intent(ct, CommonDocDetailsActivity.class)
+                .putExtra("caller", caller)
+                .putExtra("keyValue", keyValue)
+                .putExtra("device", true)
+                .putExtra("message", true)
+                .putExtra("status", "已审批"));
+    }
+}

+ 19 - 8
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MsgsSecondCommonActivity.java

@@ -39,6 +39,7 @@ import com.core.dao.MessageDao;
 import com.core.model.MessageModel;
 import com.core.net.http.ViewUtil;
 import com.core.utils.CommonUtil;
+import com.core.utils.IntentUtils;
 import com.core.utils.TimeUtils;
 import com.core.widget.EmptyLayout;
 import com.handmark.pulltorefresh.library.PullToRefreshBase;
@@ -381,6 +382,7 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                 mPosition = (int) parent.getItemIdAtPosition(position);
                 msg_id = msgModel.get(mPosition).getId();
+                MessageModel model = msgModel.get(mPosition);
 //                ToastMessage("点击position = " + mPosition + "," + " msg_id = " + msg_id);
                 if (platform) {
                     Log.i("msg_title,msg_context", msg_title + "," + Html.fromHtml(msgModel.get(mPosition).getSubTitle()));
@@ -398,7 +400,7 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
                         MessageDao.getInstance().upStatusByType("kpi", true);// 考勤消息进入第二层后全部标为已读
                         msgAdapter.notifyDataSetChanged();
                     } else {
-                        doClickEvent(mPosition, msg_id);
+                        doClickEvent(mPosition, model);
                     }
                 }
 
@@ -437,14 +439,23 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
     }
 
 
-    private void doClickEvent(int mPosition, int msg_id) {
-        baseUrl = CommonUtil.getSharedPreferences(mContext, "erp_baseurl");
-        String url = baseUrl + "mobile/message/getDetail.action";
-        Intent intent_web = new Intent("com.modular.main.WebViewCommActivity");
-        intent_web.putExtra("url", url + "?id=" + msg_id);
-        intent_web.putExtra("title", msg_title);
-        intent_web.putExtra("cookie", true);
+    private void doClickEvent(int mPosition, MessageModel model ) {
+        baseUrl = CommonUtil.getAppBaseUrl(ct);
+        String url = baseUrl + "mobile/message/getDetail.action?id=" + model.getId();
+        Intent intent_web = new Intent(ct,MsgThirdWebActivity.class);
+        intent_web.putExtra(IntentUtils.KEY_URL, url);
+        intent_web.putExtra(IntentUtils.KEY_TITLE, msg_title);
+        intent_web.putExtra(IntentUtils.KEY_NEER_COOKIE, true);
+        intent_web.putExtra(IntentUtils.KEY_NEER_SHARE, false);
+        intent_web.putExtra(IntentUtils.KEY_SHARE_IMAGE, "");
+        intent_web.putExtra(IntentUtils.KEY_SHARE_CONTENT, "");
+        intent_web.putExtra("caller",model.getCaller());
+        intent_web.putExtra("keyValue",model.getKeyValue());
         startActivityForResult(intent_web, MSG_MARKED_READED);
+//        intent_web.putExtra("url", url + "?id=" + msg_id);
+//        intent_web.putExtra("title", msg_title);
+//        intent_web.putExtra("cookie", true);
+//        startActivityForResult(intent_web, MSG_MARKED_READED);
 
         Log.d("322msg_id", msg_id + ":" + url);
         msgModel.get(mPosition).setReaded(true);

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

@@ -320,8 +320,8 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
     private void gotoReadEnclosure(Approval approval) {
         String url = approval.getIdKey();
         final CustomProgressDialog progressDialog = CustomProgressDialog.createDialog(ct);
-        progressDialog.setTitile("正在下载");
-        progressDialog.setMessage("正在下载,请勿关闭程序");
+        progressDialog.setTitile("正在预览");
+        progressDialog.setMessage("正在生成附件预览,请勿关闭程序");
         LogUtil.i("gotoReadEnclosure");
         if (!StringUtil.isEmpty(approval.getCaption())) {
             if (isImage(approval.getCaption())) {

+ 2 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java

@@ -624,6 +624,8 @@ public class MessagePresenter implements OnHttpResultListener {
                     detailModel.setTime(DateFormatUtil.long2Str(JSONUtil.getTime(detail, "createTime"), "yyyy-MM-dd HH:mm"));
                     detailModel.setType(type);
                     detailModel.setHierarchy(1);
+                    detailModel.setCaller(JSONUtil.getText(detail,"caller"));
+                    detailModel.setKeyValue(JSONUtil.getInt(detail,"keyValue"));
                     detailModels.add(detailModel);
                 }
             }

+ 3 - 2
app_modular/apputils/src/main/java/com/modular/apputils/activity/BaseNetActivity.java

@@ -39,7 +39,7 @@ import java.util.Locale;
 public abstract class BaseNetActivity extends ActionBackActivity {
     protected Activity ct;
     private CustomProgressDialog progressDialog;
-    private HttpClient httpClient;
+    protected HttpClient httpClient;
 
     @Override
     protected void onResume() {
@@ -97,6 +97,7 @@ public abstract class BaseNetActivity extends ActionBackActivity {
 
     private void initHttpConfig() {
         String baseUrl = getBaseUrl();
+        LogUtil.i("baseUrl="+baseUrl);
         if (!StringUtil.isEmpty(baseUrl)) {
             httpClient = new HttpClient.Builder(baseUrl).isDebug(true)
                     .connectTimeout(5000)
@@ -113,7 +114,7 @@ public abstract class BaseNetActivity extends ActionBackActivity {
                     .addHeaders(parameter.getHeaders())
                     .method(parameter.getMode())
                     .url(parameter.getUrl())
-                    .isDebug(false);
+                    .isDebug(true);
             if (parameter.autoProgress()) {
                 showProgress();
             }

+ 4 - 3
app_modular/apputils/src/main/java/com/modular/apputils/utils/SwitchUtil.java

@@ -9,14 +9,15 @@ import com.common.config.BaseConfig;
 
 public class SwitchUtil {
     public static boolean showYiyuanjuan() {
-        return true;
+        return  BaseConfig.isDebug();
     }
 
     public static boolean showShebeiguanli() {
-        return  true;
+        return  BaseConfig.isDebug();
     }
+
     public static boolean newFeePlease() {
-        return  false;
+        return  BaseConfig.isDebug();
     }
 
 

+ 24 - 0
app_modular/apputils/src/main/res/drawable/edit_hint_right_angle.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_focused="true">
+        <shape>
+            <solid android:color="@color/base_bg"/>
+            <stroke android:width="0.6dp" android:color="@color/item_line"/>
+            <padding android:bottom="0.5dp" android:left="0.5dp" android:right="0.5dp" android:top="0.5dp"/>
+        </shape>
+    </item>
+    <item android:state_pressed="true">
+        <shape>
+            <solid android:color="@color/base_bg"/>
+            <stroke android:width="0.6dp" android:color="@color/item_line"/>
+            <padding android:bottom="0.5dp" android:left="0.5dp" android:right="0.5dp" android:top="0.5dp"/>
+        </shape>
+    </item>
+    <item>
+        <shape>
+            <solid android:color="@color/base_bg"/>
+            <stroke android:width="0.6dp" android:color="@color/item_line"/>
+            <padding android:bottom="0.5dp" android:left="0.5dp" android:right="0.5dp" android:top="0.5dp"/>
+        </shape>
+    </item>
+</selector>

+ 10 - 0
app_modular/apputils/src/main/res/drawable/edit_white_right_angle.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape>
+            <solid android:color="@color/white"/>
+            <stroke android:width="0.6dp" android:color="@color/item_line"/>
+            <padding android:bottom="0.5dp" android:left="0.5dp" android:right="0.5dp" android:top="0.5dp"/>
+        </shape>
+    </item>
+</selector>

+ 19 - 4
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/CommonDocDetailsActivity.java

@@ -28,6 +28,7 @@ import com.common.LogUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
+import com.common.data.TextUtil;
 import com.common.system.ActivityUtils;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
@@ -141,11 +142,13 @@ public class CommonDocDetailsActivity extends BaseActivity {
     }
 
     private boolean device;
+    private boolean message;
 
     public void initView() {
         Intent intent = getIntent();
         if (intent != null) {
             device = intent.getBooleanExtra("device", false);
+            message = intent.getBooleanExtra("message", false);
         }
 
         platform = ApiUtils.getApiModel() instanceof ApiPlatform;
@@ -313,7 +316,9 @@ public class CommonDocDetailsActivity extends BaseActivity {
             finish();
         }
         if (item.getItemId() == android.R.id.home) {
-            if (device) {
+            if (message) {
+                endMessage();
+            } else if (device) {
                 endDevice();
             } else {
                 if (ActivityUtils.isExsitMianActivity(mContext, FormListSelectActivity.class)) {
@@ -584,8 +589,12 @@ public class CommonDocDetailsActivity extends BaseActivity {
                 }
             }
         } catch (JSONException e) {
+            if (e != null)
+                LogUtil.i("JSONException =" + e.getMessage());
             e.printStackTrace();
         } catch (Exception e) {
+            if (e != null)
+                LogUtil.i("Exception =" + e.getMessage());
             e.printStackTrace();
         }
 
@@ -645,7 +654,7 @@ public class CommonDocDetailsActivity extends BaseActivity {
         if (device) {
             LogUtil.i("real_status=" + real_status);
             resanddel_ll.setVisibility(View.GONE);
-            if (real_status.equals("已审核")&&!StringUtil.isEmpty(mCaller)&&(mCaller.equals("DeviceChange!Use")||mCaller.equals("DeviceChange!Inspect"))) {
+            if (real_status.equals("已审核") && !StringUtil.isEmpty(mCaller) && (mCaller.equals("DeviceChange!Use") || mCaller.equals("DeviceChange!Inspect"))) {
                 sureTv.setVisibility(View.VISIBLE);
                 sureTv.setOnClickListener(new View.OnClickListener() {
                     @Override
@@ -1037,7 +1046,7 @@ public class CommonDocDetailsActivity extends BaseActivity {
     }
 
     private void getapplypeomsg(String em_number) {
-        if (!em_number.isEmpty()) {
+        if (TextUtils.isEmpty(em_number)) {
             String whichsys = CommonUtil.getSharedPreferences(mContext, "erp_master");
             String[] selectionArgs = {em_number == null ? "" : em_number, whichsys};
             String selection = "em_code=? and whichsys=? ";
@@ -1083,7 +1092,9 @@ public class CommonDocDetailsActivity extends BaseActivity {
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if ((keyCode == KeyEvent.KEYCODE_BACK)) {
-            if (device) {
+            if (message) {
+                endMessage();
+            } else if (device) {
                 endDevice();
             } else {
                 if (ActivityUtils.isExsitMianActivity(mContext, FormListSelectActivity.class)) {
@@ -1115,6 +1126,10 @@ public class CommonDocDetailsActivity extends BaseActivity {
 
     }
 
+    private void endMessage() {
+        onBackPressed();
+    }
+
     private void endDevice() {
         String dc_class = null;
         if (mCaller.equals("DeviceChange!Use")) {

+ 23 - 21
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/adapter/CommonDocMainMsgAdapter.java

@@ -9,6 +9,7 @@ import android.widget.TextView;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONException;
+import com.common.data.ListUtils;
 import com.uas.appworks.R;
 import com.uas.appworks.OA.erp.model.CommonDocAMBean;
 
@@ -62,39 +63,40 @@ public class CommonDocMainMsgAdapter extends BaseAdapter {
     @Override
     public View getView(int position, View convertView, ViewGroup parent) {
         ViewHolder viewHolder = null;
-        if (convertView == null){
+        if (convertView == null) {
             viewHolder = new ViewHolder();
-            convertView =  View.inflate(mContext, R.layout.item_comdoc_am,null);
+            convertView = View.inflate(mContext, R.layout.item_comdoc_am, null);
             viewHolder.docmainmsg_list = (TextView) convertView.findViewById(R.id.item_comdoc_am_list_tv);
             viewHolder.docmainmsg_value = (TextView) convertView.findViewById(R.id.item_comdoc_am_value_tv);
             convertView.setTag(viewHolder);
-        }else {
+        } else {
             viewHolder = (ViewHolder) convertView.getTag();
         }
 
-        if (mFormconfigsBean != null && formdataBeans != null){
-                viewHolder.docmainmsg_list.setText(mFormconfigsBean.get(position).getFD_CAPTION());
-                    try {
-                        if (formdataBeans.getJSONObject(0).getString(mFormconfigsBean.get(position).getFD_FIELD()) != null) {
-                            if (!formdataBeans.getJSONObject(0).getString(mFormconfigsBean.get(position).getFD_FIELD()).equals("null")){
-                                Log.i("VALUE",mFormconfigsBean.get(position).getFD_FIELD().toString());
-                                viewHolder.docmainmsg_value.setText(formdataBeans.getJSONObject(0)
-                                        .getString(mFormconfigsBean.get(position).getFD_FIELD().toString()));
-                            }else {
-                                viewHolder.docmainmsg_value.setText("");
-                            }
-
-                        } else  {
-                            viewHolder.docmainmsg_value.setText("");
-                        }
-                    } catch (JSONException e) {
-                        e.printStackTrace();
+        if (mFormconfigsBean != null && formdataBeans != null) {
+            viewHolder.docmainmsg_list.setText(mFormconfigsBean.get(position).getFD_CAPTION());
+            if (!ListUtils.isEmpty(formdataBeans)) try {
+                if (formdataBeans.getJSONObject(0).getString(mFormconfigsBean.get(position).getFD_FIELD()) != null) {
+                    if (!formdataBeans.getJSONObject(0).getString(mFormconfigsBean.get(position).getFD_FIELD()).equals("null")) {
+                        Log.i("VALUE", mFormconfigsBean.get(position).getFD_FIELD().toString());
+                        viewHolder.docmainmsg_value.setText(formdataBeans.getJSONObject(0)
+                                .getString(mFormconfigsBean.get(position).getFD_FIELD().toString()));
+                    } else {
+                        viewHolder.docmainmsg_value.setText("");
                     }
+
+                } else {
+                    viewHolder.docmainmsg_value.setText("");
+                }
+            } catch (JSONException e) {
+                e.printStackTrace();
+            }
         }
 
         return convertView;
     }
-    class ViewHolder{
+
+    class ViewHolder {
         TextView docmainmsg_list;
         TextView docmainmsg_value;
     }

+ 18 - 29
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/BusinessTravelActivity.java

@@ -51,6 +51,7 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
     private void initView() {
         mRefreshLayout = findViewById(R.id.mRefreshLayout);
         mRecyclerView = findViewById(R.id.mRecyclerView);
+        mRefreshLayout.setEnabledPullUp(false);
         mRefreshLayout.setOnRefreshListener(new BaseRefreshLayout.onRefreshListener() {
             @Override
             public void onRefresh() {
@@ -59,7 +60,7 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
 
             @Override
             public void onLoadMore() {
-                loadData(++page);
+//                loadData(++page);
             }
         });
     }
@@ -78,7 +79,6 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
     }
 
 
-
     @Override
     public void onSuccess(int what, String message, Tags tags) throws Exception {
         handlerData(message);
@@ -96,39 +96,28 @@ public class BusinessTravelActivity extends BaseNetActivity implements OnSmartHt
 
     private void handlerData(String message) throws Exception {
         LogUtil.i("handlerData");
-        try{
-            JSONObject object= JSON.parseObject(message);
-            JSONArray listdata = JSONUtil.getJSONArray(object, "listdata");
-            List<BusinessTravel> models = new ArrayList<>();
-            BusinessTravel model = null;
-            String cttpid=JSONUtil.getText(object, "em_cttpid");
-            for (int i = 0; i < listdata.size(); i++) {
-                JSONObject data = listdata.getJSONObject(i);
-                model = new BusinessTravel();
-                model.setType(BusinessTravel.TITLE);
-                model.setCode(JSONUtil.getText(data, "FP_ID"));
-                models.add(model);
-                JSONArray reimbursements = JSONUtil.getJSONArray(data, "reimbursement");
-                for (int j = 0; j < reimbursements.size(); j++) {
-                    models.add(new BusinessTravel(cttpid,reimbursements.getJSONObject(i)));
-                }
+        JSONObject object = JSON.parseObject(message);
+        JSONArray listdata = JSONUtil.getJSONArray(object, "listdata");
+        List<BusinessTravel> models = new ArrayList<>();
+        BusinessTravel model = null;
+        String cttpid = JSONUtil.getText(object, "em_cttpid");
+        for (int i = 0; i < listdata.size(); i++) {
+            JSONObject data = listdata.getJSONObject(i);
+            model = new BusinessTravel();
+            model.setType(BusinessTravel.TITLE);
+            model.setCode(JSONUtil.getText(data, "FP_ID"));
+            models.add(model);
+            JSONArray reimbursements = JSONUtil.getJSONArray(data, "reimbursement");
+            for (int j = 0; j < reimbursements.size(); j++) {
+                models.add(new BusinessTravel(cttpid, reimbursements.getJSONObject(j)));
             }
-            setAdapter(models);
-        }catch (Exception e){
-            LogUtil.i("Exception="+e.getMessage());
         }
-
+        setAdapter(models);
     }
 
     private void setAdapter(List<BusinessTravel> models) {
-        LogUtil.i("models="+models.size());
         if (mAdapter == null) {
-            mAdapter = new BusinessTravelAdapter(ct, models, new BusinessTravelAdapter.OnItemClickListener() {
-                @Override
-                public void click(int position, BusinessTravel model) {
-
-                }
-            });
+            mAdapter = new BusinessTravelAdapter(ct, models);
             mRecyclerView.addItemDecoration(new SpaceItemDecoration(30));
             mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
             mRecyclerView.setAdapter(mAdapter);

+ 152 - 64
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/PurchaseDetailsActivity.java

@@ -1,19 +1,44 @@
 package com.uas.appworks.OA.platform.activity;
 
+import android.app.Activity;
 import android.content.Intent;
+import android.support.v7.widget.AppCompatButton;
+import android.support.v7.widget.DividerItemDecoration;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baidu.cyberplayer.utils.G;
+import com.baidu.platform.comapi.map.E;
+import com.chad.library.adapter.base.BaseViewHolder;
 import com.common.LogUtil;
+import com.common.data.CalendarUtil;
+import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
+import com.common.data.StringUtil;
 import com.common.thread.ThreadPool;
 import com.core.app.Constants;
+import com.core.app.MyApplication;
 import com.core.net.http.http.OAHttpHelper;
 import com.core.utils.CommonUtil;
+import com.core.utils.ToastUtil;
+import com.core.utils.time.wheel.DateTimePicker;
+import com.core.widget.listener.EditChangeListener;
+import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.modular.apputils.activity.BaseNetActivity;
 import com.modular.apputils.listener.OnSmartHttpListener;
@@ -24,8 +49,11 @@ import com.uas.appworks.OA.platform.adapter.PurchaseDetailsAdapter;
 import com.uas.appworks.OA.platform.model.Purchase;
 import com.uas.appworks.R;
 
+
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -47,7 +75,8 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
 
     @Override
     protected String getBaseUrl() {
-        return CommonUtil.getAppBaseUrl(ct);
+//        return "http://uas.ubtob.com/";
+        return "http://192.168.253.102:8090/platform-b2b/";
     }
 
     @Override
@@ -60,6 +89,7 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
         if (varStatus == null) {
             varStatus = "";
         }
+        getSupportActionBar().setTitle(varStatus);
         initView();
         initData();
     }
@@ -67,73 +97,115 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
     private void initView() {
         mRecyclerView = findViewById(R.id.mRecyclerView);
         mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
+        mRecyclerView.addItemDecoration(new DividerItemDecoration(ct, LinearLayout.VERTICAL));
 
     }
 
     private void initData() {
-        handleMessage(TestStr.PURCHASE_STR);
+        loadData();
     }
 
 
-    private void verifiReply() {
-        reply();
+    private void loadData() {
+        varId = 937370;
+        int enuu = 10041559;
+        String phone = "15671616315";
+        Parameter.Builder builder = new Parameter.Builder();
+        String url = "mobile/sale/orders/" + varId + "/info";//卖方
+        builder.mode(Method.GET)
+                .url(url)
+                .record(0x11)
+                .showLog(true)
+                .autoProgress(true)
+                .addParams("en_uu", enuu)
+                .addParams("user_tel", phone);
+        requestHttp(builder, this);
     }
 
-    private void reply() {
+    private int replyNumber;
+
+    private void verifiReply(List<Purchase> purchases) {
+        replyNumber = 0;
+        for (Purchase purchase : purchases) {
+            if (!TextUtils.isEmpty(purchase.getDate()) &&
+                    !TextUtils.isEmpty(purchase.getNumber()) &&
+                    !TextUtils.isEmpty(purchase.getRemarksInput())) {
+                reply(purchase);
+            }
+        }
+    }
+
+    private void reply(Purchase purchases) {
+        replyNumber++;
+        int enuu = 10041559;
+        String phone = "15671616315";
         Parameter.Builder builder = new Parameter.Builder();
-        String json = null;
+        Map<String, Object> map = new HashMap<>();
+        map.put("qty", purchases.getNumber());
+        map.put("delivery", DateFormatUtil.str2Long(purchases.getDate(), DateFormatUtil.YMD));//
+        map.put("remark", purchases.getRemarksInput());
+        String json = JSONUtil.map2JSON(map);
+        LogUtil.i("json=" + json);
         builder.mode(Method.POST)
-                .url("sale/orders/items/{orderItemId}/reply")
-                .addParams("json", json);
+                .url("mobile/sale/orders/items/" + purchases.getId() + "/reply")
+                .addParams("en_uu", enuu)
+                .addParams("json", json)
+                .record(0x12)
+                .showLog(true)
+                .autoProgress(true)
+                .addParams("user_tel", phone);
         requestHttp(builder, this);
     }
 
-    private Purchase getPurchase(int id, JSONObject object, String caption, String field) {
-        Purchase purchase = new Purchase(id);
-        purchase.setCaption(caption);
-        purchase.setField(field);
-        purchase.setValues(JSONUtil.getText(object, purchase.getField()));
-        return purchase;
+
+    private void setData2Adapter(List<Purchase> dataList) {
+        mAdapter = new PurchaseDetailsAdapter(ct, varStatus, dataList);
+        mAdapter.setOnReplyLisenter(new PurchaseDetailsAdapter.OnReplyLisenter() {
+            @Override
+            public void reply(List<Purchase> purchases) {
+                PurchaseDetailsActivity.this.verifiReply(purchases);
+            }
+        });
+        mRecyclerView.setAdapter(mAdapter);
+
+    }
+
+    @Override
+    public void onSuccess(int what, String message, Tags tag) throws Exception {
+        LogUtil.i("message=" + message);
+        switch (what) {
+            case 0x11:
+                handleMessage(message);
+                break;
+            case 0x12:
+                replyNumber--;
+                if (replyNumber == 0) {
+                    Toast.makeText(MyApplication.getInstance(), "回复成功", Toast.LENGTH_SHORT).show();
+                    if (this != null) {
+                        this.finish();
+                    }
+                }
+                break;
+        }
     }
 
-    private void handleMessage(final String message) {
+    @Override
+    public void onFailure(int what, String message, Tags tag) throws Exception {
+        ToastUtil.showToast(ct, message);
+    }
+
+
+    private void handleMessage(final String message) throws Exception {
         ThreadPool.getThreadPool().addTask(new Runnable() {
             @Override
             public void run() {
                 JSONObject object = JSON.parseObject(message);
                 final List<Purchase> dataList = new ArrayList<>();
-                //添加头部固定功能
-                dataList.add(getPurchase(0, object, "客户", "CLIENT"));
-                dataList.add(getPurchase(0, object, "收货地址", "ADDRESS"));
-                dataList.add(getPurchase(0, object, "订单号", "CODE"));
-                dataList.add(getPurchase(0, object, "单据时间", "TIME"));
-                dataList.add(getPurchase(0, object, "备注", "REMARKS"));
-                dataList.add(getPurchase(0, object, "总额", "ALLS"));
-
-                JSONArray dataJSONs = JSONUtil.getJSONArray(object, "DATA");
-                JSONArray fields = JSONUtil.getJSONArray(object, "fields");
-
-                String idField = null;
-                for (int j = 0; j < fields.size(); j++) {
-                    if ("ID".equals(JSONUtil.getText(fields.getJSONObject(j), "caption"))) {
-                        idField = JSONUtil.getText(fields.getJSONObject(j), "field");
-                        break;
-                    }
-                }
-                if (!ListUtils.isEmpty(dataJSONs) && !ListUtils.isEmpty(fields)) {
-                    for (int i = 0; i < dataJSONs.size(); i++) {
-                        JSONObject dataJSON = dataJSONs.getJSONObject(i);
-                        for (int j = 0; j < fields.size(); j++) {
-                            JSONObject fieldJSON = fields.getJSONObject(j);
-                            Purchase purchaseItem = new Purchase();
-                            purchaseItem.setField(JSONUtil.getText(fieldJSON, "field"));
-                            purchaseItem.setCaption(JSONUtil.getText(fieldJSON, "caption"));
-                            purchaseItem.setType(JSONUtil.getText(fieldJSON, "type"));
-                            purchaseItem.setNeedInput(JSONUtil.getBoolean(fieldJSON, "needInput"));
-                            purchaseItem.setValues(JSONUtil.getText(dataJSON, purchaseItem.getField()));
-                            purchaseItem.setId(JSONUtil.getInt(dataJSON, idField));
-                            dataList.add(purchaseItem);
-                        }
+                dataList.add(getPurchase(true, object));
+                JSONArray orderItems = JSONUtil.getJSONArray(object, "orderItems");
+                if (!ListUtils.isEmpty(orderItems)) {
+                    for (int i = 0; i < orderItems.size(); i++) {
+                        dataList.add(getPurchase(false, orderItems.getJSONObject(i)));
                     }
                 }
                 OAHttpHelper.getInstance().post(new Runnable() {
@@ -146,25 +218,41 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
         });
     }
 
-    private void setData2Adapter(List<Purchase> dataList) {
-        mAdapter = new PurchaseDetailsAdapter(ct, varStatus, dataList);
-        mAdapter.setOnReplyLisenter(new PurchaseDetailsAdapter.OnReplyLisenter() {
-            @Override
-            public void reply(List<Purchase> purchases) {
-                LogUtil.prinlnLongMsg("gongpengming","json="+JSON.toJSONString(purchases));
-            }
-        });
-        mRecyclerView.setAdapter(mAdapter);
-
-    }
-
-    @Override
-    public void onSuccess(int what, String message, Tags tag) throws Exception {
 
-    }
+    private Purchase getPurchase(boolean first, JSONObject object) {
+        Purchase purchase = new Purchase();
+        int id = JSONUtil.getInt(object, "id");
+        String client = JSONUtil.getText(object, "receiveName");//客户
+        String address = JSONUtil.getText(object, "shipAddress");//收货地址
+        String time = DateFormatUtil.long2Str(JSONUtil.getLong(object, "erpDate", "date"), DateFormatUtil.YMD_HMS);//单据时间
+        String number = JSONUtil.getText(object, "qty");//数量
+        String date = DateFormatUtil.long2Str(JSONUtil.getLong(object, "replyDelivery", "delivery"), DateFormatUtil.YMD);//交货日期
+        String replyRemark = JSONUtil.getText(object, "replyRemark");//采购单号
 
-    @Override
-    public void onFailure(int what, String message, Tags tag) throws Exception {
 
+        String code;//采购单号
+        String remarks;//备注|产品
+        String alls ;//总额|产品规格
+        if (first) {
+            code = JSONUtil.getText(object, "code");//采购单号
+            remarks = JSONUtil.getText(object, "remark");//备注
+            alls = JSONUtil.getText(object, "amount");//总额
+        } else {
+            JSONObject product = JSONUtil.getJSONObject(object, "product");
+            code = JSONUtil.getText(product, "cmpCode");
+            remarks = JSONUtil.getText(product, "title");
+            alls = JSONUtil.getText(product, "spec");
+        }
+        purchase.setId(id);
+        purchase.setCode(code);
+        purchase.setCustomer(client);
+        purchase.setAddress(address);
+        purchase.setTime(time);
+        purchase.setRemarks(remarks);
+        purchase.setTotal(alls);
+        purchase.setDate(date);
+        purchase.setNumber(number);
+        purchase.setRemarksInput(replyRemark);
+        return purchase;
     }
 }

+ 61 - 15
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/BusinessTravelAdapter.java

@@ -12,14 +12,21 @@ import android.widget.TextView;
 import com.alibaba.fastjson.JSON;
 import com.common.LogUtil;
 import com.common.data.DateFormatUtil;
+import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
+import com.common.hmac.Md5Util;
 import com.core.utils.CommonUtil;
+import com.core.utils.IntentUtils;
 import com.modular.apputils.widget.TravelDirectionView;
 import com.uas.appworks.OA.platform.model.BusinessTravel;
 import com.uas.appworks.R;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by Bitlike on 2017/12/12.
@@ -28,13 +35,11 @@ import java.util.List;
 public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements View.OnClickListener {
     private Context ct;
     private List<BusinessTravel> models;
-    private OnItemClickListener listener;
     private String currentName;
 
-    public BusinessTravelAdapter(Context ct, List<BusinessTravel> models, OnItemClickListener listener) {
+    public BusinessTravelAdapter(Context ct, List<BusinessTravel> models) {
         this.ct = ct;
         this.models = models;
-        this.listener = listener;
         this.currentName = CommonUtil.getName();
     }
 
@@ -99,7 +104,7 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
     private final String DONE_CANCEL = "取消预约";
 
     private void bindBaseView(BaseViewHlder holder, BusinessTravel model, int position) {
-        holder.codeTv.setText(model.getTitle());
+        holder.codeTv.setText(model.getTitleAndCode() );
         holder.statusTv.setText(model.getStatus());
         holder.nameTv.setText(currentName == null ? "**" : currentName);
         holder.idCardTv.setText(model.getCttpid());
@@ -144,7 +149,7 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         holder.tripTv.setText(fromCity + "-" + toCity);
         holder.mTravelDirectionView.setData(model.getSeat(), longTime2Time(model.getAllTime()));
         //改签
-        if (model.canChange()) {
+        if (StringUtil.getText(holder.dateTv).equals(DONE_CANCEL)) {
             holder.changeTv.setVisibility(View.VISIBLE);
             holder.changeTv.setBackgroundResource(R.drawable.text_frame_radian_hint_bg);
             holder.changeTv.setTextColor(ct.getResources().getColor(R.color.text_hine));
@@ -285,8 +290,6 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
     public void onClick(View v) {
         BusinessTravel model = (BusinessTravel) v.getTag(R.id.tag_key);
         int position = (int) v.getTag(R.id.tag_key2);
-        LogUtil.i("model=" + JSON.toJSONString(model));
-        LogUtil.i("position=" + position);
         int id = v.getId();
         if (id == R.id.expandTv) {
             model.setExpand(!model.isExpand());
@@ -295,21 +298,16 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
             TextView doneTv = (TextView) v;
             String doneMessage = StringUtil.getText(doneTv);
             if (doneMessage.equals(DONE_CANCEL)) {
-                LogUtil.i("点击了取消预约");
+                cancel(model);
             } else {
-                LogUtil.i("点击了预约/订票");
+                reserve(model);
             }
         } else if (R.id.changeTv == id) {
-            LogUtil.i("点击了改签");
+            change(model);
         }
     }
 
 
-    public interface OnItemClickListener {
-        void click(int position, BusinessTravel model);
-    }
-
-
     private String longTime2Time(long time) {
         long second = time / 1000;
         long hh = second / 3600;
@@ -317,4 +315,52 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         return hh + "小时" + mm + "分钟";
     }
 
+
+    private void cancel(BusinessTravel model) {
+        LogUtil.i("点击了取消预约");
+
+    }
+
+    private void reserve(BusinessTravel model) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("traverorderno", model.getCode());
+        map.put("product", model.getTitleCode());
+        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", CommonUtil.getEmcode());
+        String p = JSONUtil.map2JSON(map);
+        turn2Web(p);
+    }
+
+    private void change(BusinessTravel model) {
+        LogUtil.i("点击了改签");
+
+    }
+
+    private void turn2Web(String p) {
+        //TODO 测试数据
+        LogUtil.i("p="+p);
+        String appkey = "y8gd87dsdkencgzk394k7s5c78io35c";
+        String username = "huangx";
+        String appSceret = "e212e142a5c9e0590eefb7d9f1bc91d7";
+        String data = appkey + username.toUpperCase() + appSceret;
+        String key = Md5Util.toMD5(appSceret).toUpperCase();
+        String sign = Md5Util.toMD5(key + data);
+        StringBuilder urlBuilder = new StringBuilder("http://124.254.45.234:8082/oa/caslogin/");
+        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());
+    }
+
+
 }

+ 83 - 48
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/PurchaseDetailsAdapter.java

@@ -2,8 +2,10 @@ package com.uas.appworks.OA.platform.adapter;
 
 import android.app.Activity;
 import android.content.Context;
+import android.support.v7.widget.AppCompatTextView;
 import android.support.v7.widget.RecyclerView;
 import android.text.Editable;
+import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -16,6 +18,7 @@ import com.common.data.CalendarUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
+import com.common.data.TextUtil;
 import com.common.system.DisplayUtil;
 import com.core.utils.time.wheel.DateTimePicker;
 import com.core.widget.listener.EditChangeListener;
@@ -34,13 +37,14 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
     private Context context;
     private List<Purchase> purchases;
     private LayoutInflater mInflater;
-    private String status;
+    private boolean canReply;
 
     public PurchaseDetailsAdapter(Context context, String status, List<Purchase> purchases) {
         this.context = context;
         this.purchases = purchases;
-        this.status = status;
         mInflater = LayoutInflater.from(context);
+        canReply = (status != null && !status.equals("已结案"));
+
     }
 
     @Override
@@ -50,7 +54,12 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
 
     @Override
     public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        return viewType == (getItemCount() - 1) ? new BtnViewHolder(parent) : new ViewHolder(parent);
+        if (viewType == 0) {
+            return new TotalViewHolder(parent);
+        } else if (viewType == (getItemCount() - 1)) {
+            return new BtnViewHolder(parent);
+        }
+        return new ViewHolder(parent);
     }
 
     @Override
@@ -73,9 +82,8 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
     }
 
     class ViewHolder extends RecyclerView.ViewHolder {
-        TextView captionTV, valueTv;
-        EditText valueEt;
-        View line;
+        TextView timeTv, remarksTv, totalTv, dateEd;
+        EditText numberEd, remarksInputEd;
 
         public ViewHolder(ViewGroup viewGroup) {
             this(mInflater.inflate(R.layout.item_purchase, viewGroup, false));
@@ -83,10 +91,37 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
 
         public ViewHolder(View itemView) {
             super(itemView);
-            captionTV = itemView.findViewById(R.id.captionTV);
-            valueTv = itemView.findViewById(R.id.valueTv);
-            valueEt = itemView.findViewById(R.id.valueEt);
-            line = itemView.findViewById(R.id.line);
+            timeTv = itemView.findViewById(R.id.timeTv);
+            remarksTv = itemView.findViewById(R.id.remarksTv);
+            totalTv = itemView.findViewById(R.id.totalTv);
+            dateEd = itemView.findViewById(R.id.dateEd);
+            numberEd = itemView.findViewById(R.id.numberEd);
+            remarksInputEd = itemView.findViewById(R.id.remarksInputEd);
+            if (!canReply) {
+                numberEd.setClickable(false);
+                numberEd.setFocusable(false);
+                remarksInputEd.setClickable(false);
+                remarksInputEd.setFocusable(false);
+            }
+        }
+    }
+
+    class TotalViewHolder extends RecyclerView.ViewHolder {
+        TextView customerTv, addressTv, codeTv, timeTv, remarksTv, totalTv;
+
+        public TotalViewHolder(ViewGroup viewGroup) {
+            this(mInflater.inflate(R.layout.item_ls_purchase, viewGroup, false));
+        }
+
+        public TotalViewHolder(View itemView) {
+            super(itemView);
+            addressTv = itemView.findViewById(R.id.addressTv);
+            codeTv = itemView.findViewById(R.id.codeTv);
+            timeTv = itemView.findViewById(R.id.timeTv);
+            customerTv = itemView.findViewById(R.id.customerTv);
+            remarksTv = itemView.findViewById(R.id.remarksTv);
+            totalTv = itemView.findViewById(R.id.totalTv);
+
         }
     }
 
@@ -95,13 +130,24 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
     public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
         if (holder instanceof ViewHolder && position < ListUtils.getSize(purchases)) {
             onBindViewHolder((ViewHolder) holder, position);
+        } else if (holder instanceof TotalViewHolder) {
+            onBindViewHolder((TotalViewHolder) holder, position);
         } else if (holder instanceof BtnViewHolder) {
             onBindViewHolder((BtnViewHolder) holder);
         }
     }
 
+    private void onBindViewHolder(TotalViewHolder holder, int position) {
+        Purchase purchase = purchases.get(position);
+        holder.totalTv.setText(purchase.getTotal());
+        holder.addressTv.setText(purchase.getAddress());
+        holder.customerTv.setText(purchase.getCustomer());
+        holder.codeTv.setText(purchase.getCode());
+        holder.remarksTv.setText(TextUtils.isEmpty(purchase.getRemarks()) ? "无" : purchase.getRemarks());
+        holder.timeTv.setText(purchase.getTime());
+    }
+
     private void onBindViewHolder(BtnViewHolder holder) {
-        boolean canReply = (status != null && !status.equals("已结案"));
         holder.replyBtn.setFocusable(canReply);
         holder.replyBtn.setClickable(canReply);
         holder.replyBtn.setPressed(!canReply);
@@ -118,39 +164,27 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
 
     private void onBindViewHolder(ViewHolder holder, int position) {
         Purchase purchase = purchases.get(position);
-        holder.captionTV.setText(purchase.getCaption());
-
-        if (purchase.isNeedInput()) {
-            holder.valueEt.setBackgroundResource(R.drawable.edit_hint_right_angle);
-            holder.valueEt.setClickable(true);
-            if (purchase.getType().equals("date")) {
-                holder.valueTv.setText(purchase.getValues());
-                holder.valueTv.setBackgroundResource(R.drawable.edit_hint_right_angle);
-                holder.valueEt.setVisibility(View.GONE);
-                holder.valueTv.setVisibility(View.VISIBLE);
-                holder.valueTv.setTag(position);
-                holder.valueTv.setOnClickListener(onClickListener);
-            } else {
-                holder.valueEt.setText(purchase.getValues());
-                holder.valueTv.setVisibility(View.GONE);
-                holder.valueEt.setVisibility(View.VISIBLE);
-                holder.valueEt.setFocusable(true);
-                holder.valueEt.addTextChangedListener(new TextChangListener(holder, position));
-            }
-        } else {
-            holder.valueTv.setText(StringUtil.isEmpty(purchase.getValues()) ? "无" : purchase.getValues());
-            holder.valueTv.setBackgroundDrawable(null);
-            holder.valueEt.setVisibility(View.GONE);
-            holder.valueTv.setVisibility(View.VISIBLE);
+        holder.totalTv.setText(purchase.getTotal());
+        holder.remarksTv.setText(purchase.getRemarks());
+        holder.timeTv.setText(purchase.getCode());
+        holder.dateEd.setText(purchase.getDate());
+        holder.numberEd.setText(purchase.getNumber());
+        holder.remarksInputEd.setText(purchase.getRemarksInput());
+
+        if (canReply) {
+            holder.dateEd.setTag(position);
+            holder.dateEd.setOnClickListener(onClickListener);
+            holder.numberEd.addTextChangedListener(new TextChangListener(position, 1));
+            holder.remarksInputEd.addTextChangedListener(new TextChangListener(position, 2));
         }
-        holder.line.setVisibility((position > 0 && purchases.get(position - 1).getId() != purchase.getId()) ? View.VISIBLE : View.GONE);
-//        holder.line.setVisibility(View.VISIBLE);
+
+
     }
 
     private View.OnClickListener onClickListener = new View.OnClickListener() {
         @Override
         public void onClick(View v) {
-            if (v.getId() == R.id.valueTv && v.getTag() != null && v.getTag() instanceof Integer) {
+            if (v.getId() == R.id.dateEd && v.getTag() != null && v.getTag() instanceof Integer) {
                 int position = (int) v.getTag();
                 showDateSelect(position);
             } else if (v.getId() == R.id.replyBtn) {
@@ -166,8 +200,8 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
         picker.setRange(2000, 2030);
         int year, month, day;
         Date time = null;
-        if (ListUtils.getSize(purchases) > position && !StringUtil.isEmpty(purchases.get(position).getValues())) {
-            time = DateFormatUtil.str2date(purchases.get(position).getValues(), DateFormatUtil.YMD);
+        if (ListUtils.getSize(purchases) > position && !StringUtil.isEmpty(purchases.get(position).getDate())) {
+            time = DateFormatUtil.str2date(purchases.get(position).getDate(), DateFormatUtil.YMD);
         }
         year = CalendarUtil.getYear(time);
         month = CalendarUtil.getMonth(time);
@@ -177,7 +211,7 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
             @Override
             public void onDateTimePicked(String year, String month, String day, String hour, String minute) {
                 if (ListUtils.getSize(purchases) > position) {
-                    purchases.get(position).setValues(year + "-" + month + "-" + day);
+                    purchases.get(position).setDate(year + "-" + month + "-" + day);
                     notifyItemChanged(position);
                 }
             }
@@ -186,21 +220,22 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
     }
 
     private class TextChangListener extends EditChangeListener {
-        ViewHolder hodler;
         private int position;
+        private int type;
 
-        public TextChangListener(ViewHolder hodler, int position) {
-            this.hodler = hodler;
+        public TextChangListener(int position, int type) {
             this.position = position;
+            this.type = type;
         }
 
         @Override
         public void afterTextChanged(Editable s) {
             if (this.position >= 0 && ListUtils.getSize(purchases) > this.position) {
-                if (this.hodler.valueEt != null && this.hodler.valueEt.getVisibility() == View.VISIBLE) {
-                    LogUtil.i("s=" + s.toString());
-                    LogUtil.i("position=" + this.position);
-                    purchases.get(this.position).setValues(s == null ? "" : s.toString());
+                String message = s == null ? "" : s.toString();
+                if (type == 1) {
+                    purchases.get(this.position).setNumber(message);
+                } else if (type == 2) {
+                    purchases.get(this.position).setRemarksInput(message);
                 }
             }
         }

+ 16 - 0
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/BusinessTravel.java

@@ -265,6 +265,22 @@ public class BusinessTravel {
     }
 
     public String getTitle() {
+        return title;
+    }
+
+    public String getTitleCode() {
+        switch (title) {
+            case "火车票":
+                return "train";
+            case "住宿":
+                return "hotel";
+            case "飞机票":
+                return "air";
+        }
+        return title;
+    }
+
+    public String getTitleAndCode() {
         return title + "   " + (StringUtil.isEmpty(code) ? "未订票" : code);
     }
 

+ 57 - 44
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/Purchase.java

@@ -5,81 +5,94 @@ package com.uas.appworks.OA.platform.model;
  */
 
 public class Purchase {
-    private int position;
     private int id;
-    private String field;
-    private String caption;
-    private String values;
-    private String type;
-    private boolean needInput;
+    private String customer;
+    private String address;
+    private  String code;
+    private  String time;
+    private  String remarks;
+    private  String total;
+    private  String date;
+    private  String number;
+    private  String remarksInput;
 
-    public Purchase(int position) {
-        this.position = position;
-        this.id = 0;
-        this.field = "";
-        this.values = "无";
-        this.caption = "";
-        this.type = "";
-        this.needInput = false;
+    public int getId() {
+        return id;
     }
 
-    public Purchase() {
-        this(0);
+    public void setId(int id) {
+        this.id = id;
     }
 
-    public String getCaption() {
-        return caption;
+    public String getCustomer() {
+        return customer;
     }
 
-    public void setCaption(String caption) {
-        this.caption = caption;
+    public void setCustomer(String customer) {
+        this.customer = customer;
     }
 
-    public int getPosition() {
-        return position;
+    public String getAddress() {
+        return address;
     }
 
-    public void setPosition(int position) {
-        this.position = position;
+    public void setAddress(String address) {
+        this.address = address;
     }
 
-    public int getId() {
-        return id;
+    public String getCode() {
+        return code;
     }
 
-    public void setId(int id) {
-        this.id = id;
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
     }
 
-    public String getField() {
-        return field;
+    public String getTotal() {
+        return total;
     }
 
-    public void setField(String field) {
-        this.field = field;
+    public void setTotal(String total) {
+        this.total = total;
     }
 
-    public String getValues() {
-        return values;
+    public String getDate() {
+        return date;
     }
 
-    public void setValues(String values) {
-        this.values = values;
+    public void setDate(String date) {
+        this.date = date;
     }
 
-    public String getType() {
-        return type;
+    public String getNumber() {
+        return number;
     }
 
-    public void setType(String type) {
-        this.type = type;
+    public void setNumber(String number) {
+        this.number = number;
     }
 
-    public boolean isNeedInput() {
-        return needInput;
+    public String getRemarksInput() {
+        return remarksInput;
     }
 
-    public void setNeedInput(boolean needInput) {
-        this.needInput = needInput;
+    public void setRemarksInput(String remarksInput) {
+        this.remarksInput = remarksInput;
     }
 }

+ 119 - 8
app_modular/appworks/src/main/res/layout/item_ls_purchase.xml

@@ -2,15 +2,126 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:focusableInTouchMode="true"
-    android:paddingBottom="@dimen/padding"
-    android:paddingLeft="@dimen/paddingApp">
+    android:background="#f2f8fc"
+    android:padding="@dimen/padding">
 
-    <com.core.widget.MyListView
-        android:id="@+id/dataListView"
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/customerTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:text="客户:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/customerTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/customerTag"
+        android:layout_toRightOf="@id/customerTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/addressTag"
+        android:layout_width="80dp"
+        android:layout_marginTop="@dimen/padding"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/customerTag"
+        android:text="收货地址:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/addressTv"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:dividerHeight="0dp"
-        android:focusableInTouchMode="false" />
+        android:layout_height="wrap_content"
+        android:lines="1"
+        android:ellipsize="end"
+        android:layout_alignTop="@id/addressTag"
+        android:layout_toRightOf="@id/customerTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/codeTag"
+        android:layout_width="80dp"
+        android:layout_marginTop="@dimen/padding"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/addressTag"
+        android:text="订单号:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/codeTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/codeTag"
+        android:layout_toRightOf="@id/customerTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/timeTag"
+        android:layout_width="80dp"
+        android:layout_marginTop="@dimen/padding"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/codeTag"
+        android:text="单据时间:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
 
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/timeTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/timeTag"
+        android:layout_toRightOf="@id/customerTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/remarksTag"
+        android:layout_width="80dp"
+        android:layout_marginTop="@dimen/padding"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/timeTag"
+        android:text="备注:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/remarksTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/remarksTag"
+        android:layout_toRightOf="@id/customerTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/totalTag"
+        android:layout_marginTop="@dimen/padding"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/remarksTag"
+        android:text="总额:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/totalTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/totalTag"
+        android:layout_toRightOf="@id/customerTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
 </RelativeLayout>

+ 141 - 47
app_modular/appworks/src/main/res/layout/item_purchase.xml

@@ -1,55 +1,149 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical">
-    <View
-        android:id="@+id/line"
+    android:background="@color/white"
+    android:padding="@dimen/padding">
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/timeTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:text="编号:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/timeTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/timeTag"
+        android:layout_toRightOf="@id/timeTag"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/remarksTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/timeTag"
         android:layout_marginTop="@dimen/padding"
-        android:layout_marginBottom="@dimen/padding"
+        android:text="产品:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/remarksTv"
         android:layout_width="match_parent"
-        android:background="@color/item_line"
-        android:layout_height="@dimen/line"/>
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/remarksTag"
+        android:layout_toRightOf="@id/timeTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
 
-    <LinearLayout
-        style="@style/approvalStyle"
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/totalTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/remarksTag"
+        android:layout_marginTop="@dimen/padding"
+        android:text="规格型号:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/totalTv"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:paddingLeft="@dimen/paddingApp">
-
-        <TextView
-            android:id="@+id/captionTV"
-            style="@style/approvalItemStyle"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_marginRight="10dp"
-            android:layout_weight="1" />
-
-        <FrameLayout
-            android:id="@+id/valuesFl"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="3">
-
-            <EditText
-                android:id="@+id/valueEt"
-                style="@style/approvalItemStyle"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:background="@drawable/edit_hint_right_angle"
-                android:hint="@string/common_input2"
-                android:textColor="@color/text_main" />
-
-            <TextView
-                android:id="@+id/valueTv"
-                style="@style/approvalItemStyle"
-                android:layout_width="match_parent"
-                android:background="@drawable/edit_hint_right_angle"
-                android:gravity="center|left"
-                android:hint="@string/common_select1"
-                android:textColor="@color/text_main"
-                android:visibility="gone" />
-        </FrameLayout>
-    </LinearLayout>
-
-</LinearLayout>
+        android:layout_alignTop="@id/totalTag"
+        android:layout_toRightOf="@id/timeTag"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/dateTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/totalTag"
+        android:layout_marginTop="@dimen/padding"
+        android:text="交货日期:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/dateEd"
+        android:layout_width="100dp"
+        android:layout_height="25dp"
+        android:layout_alignTop="@id/dateTag"
+        android:layout_toRightOf="@id/timeTag"
+        android:background="@drawable/edit_white_right_angle"
+        android:gravity="center_vertical"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/numberTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/dateTag"
+        android:layout_marginTop="@dimen/padding"
+        android:text="数量:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatEditText
+        android:id="@+id/numberEd"
+        android:layout_width="100dp"
+        android:layout_height="25dp"
+        android:layout_alignTop="@id/numberTag"
+        android:layout_toRightOf="@id/timeTag"
+        android:background="@drawable/edit_white_right_angle"
+        android:gravity="center_vertical"
+        android:inputType="number"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/numberUnit"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/numberTag"
+        android:layout_toRightOf="@id/numberEd"
+        android:gravity="center_vertical"
+        android:padding="0.5dp"
+        android:layout_marginLeft="@dimen/padding"
+        android:inputType="number"
+        android:text="PCS"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/remarksInputTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/numberTag"
+        android:layout_marginTop="@dimen/padding"
+        android:text="备注:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_main" />
+
+    <android.support.v7.widget.AppCompatEditText
+        android:id="@+id/remarksInputEd"
+        android:layout_width="100dp"
+        android:layout_height="wrap_content"
+        android:minHeight="25dp"
+        android:layout_alignTop="@id/remarksInputTag"
+        android:layout_toRightOf="@id/timeTag"
+        android:background="@drawable/edit_white_right_angle"
+        android:gravity="center_vertical"
+        android:text="客户:"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_main" />
+
+
+</RelativeLayout>