Przeglądaj źródła

数据查询,报表统计交付测试备份

raomeng 8 lat temu
rodzic
commit
3d8f2b0ca8

+ 7 - 4
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java

@@ -243,7 +243,8 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
 //                Manifest.permission.CAMERA,
 //                Manifest.permission.CALL_PHONE
                 , Manifest.permission.RECORD_AUDIO
-
+                , Manifest.permission.WRITE_EXTERNAL_STORAGE
+//                , Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS
         };
         for (String permission : permissions)
             if (PermissionUtil.lacksPermissions(this, permission)) {
@@ -588,6 +589,7 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
     private Handler handler = new Handler();
     private Runnable runnable = new MyRunnable();
     private Boolean firstRed = true;
+
     private void doHiTask() {
         int isUUStep = PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.UU_STEP);
         if (isUUStep != 0 && StepCountCheckUtil.isSupportStepCountSensor(this)) { // 开启UU运动
@@ -610,14 +612,14 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
     }
 
     private void hiQuickSearch() {
-        int qs =  PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.Q_SEARCH);
+        int qs = PreferenceUtils.getInt(MyApplication.getInstance(), MainActivity.Q_SEARCH);
         if (CommonUtil.isReleaseVersion() || MainActivity.class == null || qs == 1) return;
         handler.postDelayed(new Runnable() {
             @Override
             public void run() {
-                 QSearchPpwindowUtils.qSearchWindows(MainActivity.this);
+                QSearchPpwindowUtils.qSearchWindows(MainActivity.this);
             }
-        },4000);
+        }, 4000);
     }
 
     public class MyRunnable implements Runnable {
@@ -628,6 +630,7 @@ public class MainActivity extends BaseActivity implements NetWorkObservable.NetW
             BadgeUtil.setBadgeCount(getApplicationContext(), mMsgUnReadNum, R.drawable.hongdian);//启动红点显示逻辑
         }
     }
+
     private PopupWindow popupWindow;
 
     private void initScoringWindows() {

+ 19 - 6
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/datainquiry/PDFUtils.java

@@ -5,8 +5,6 @@ import android.os.Message;
 import android.text.TextUtils;
 import android.util.Base64;
 
-import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
-
 import org.json.JSONObject;
 
 import java.io.ByteArrayInputStream;
@@ -43,7 +41,10 @@ public class PDFUtils {
      */
     public static void downloadPDF(String pdfUrl, final Handler mHandler) {
         if (pdfUrl == null) {
-            mHandler.sendEmptyMessage(Constants.CONSTANT.DOWNLOAD_FAILED);
+            Message message = Message.obtain();
+            message.what = Constants.CONSTANT.DOWNLOAD_FAILED;
+            message.obj = "下载地址为空";
+            mHandler.sendMessage(message);
             return;
         }
 //        try {
@@ -72,15 +73,27 @@ public class PDFUtils {
                 try {
                     if (response.body() != null) {
                         String responseStr = response.body().string();
-                        LogUtil.prinlnLongMsg("pdfresponse", responseStr);
+//                        LogUtil.prinlnLongMsg("pdfresponse", responseStr);
                         JSONObject responseObject = new JSONObject(responseStr);
                         if (!responseObject.isNull("success") && !responseObject.optBoolean("success")) {
-                            mHandler.sendEmptyMessage(Constants.CONSTANT.DOWNLOAD_FAILED);
+                            Message message = Message.obtain();
+                            message.what = Constants.CONSTANT.DOWNLOAD_FAILED;
+                            message.obj = responseObject.optString("message");
+                            mHandler.sendMessage(message);
                             return;
                         }
                         boolean overload = responseObject.optBoolean("overload");
+                        int pageSize = -1;
+                        if (!responseObject.isNull("pageSize")) {
+                            pageSize = responseObject.optInt("pageSize");
+                        }
                         if (overload) {
                             mHandler.sendEmptyMessage(Constants.CONSTANT.PDF_OVERLOAD);
+                        } else if (pageSize == 0) {
+                            Message message = Message.obtain();
+                            message.what = Constants.CONSTANT.DOWNLOAD_FAILED;
+                            message.obj = "报表文件内容为空";
+                            mHandler.sendMessage(message);
                         } else {
                             File directory = new File(Constants.CONSTANT.PDF_FILE_PATH);
                             if (!directory.exists() && !directory.isDirectory()) {
@@ -106,7 +119,7 @@ public class PDFUtils {
                                     while ((length = inputStream.read(buffer)) != -1) {
                                         fileOutputStream.write(buffer, 0, length);
                                         count += length;
-                                        int progress = (count / available) * 100;
+                                        int progress = (count * 100) / available;
                                         Message message = Message.obtain();
                                         message.what = Constants.CONSTANT.DOWNLOAD_PROGRESS;
                                         message.obj = progress;

+ 15 - 13
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/datainquiry/activity/DataInquiryListActivity.java

@@ -147,10 +147,7 @@ public class DataInquiryListActivity extends BaseActivity implements View.OnClic
                                             }
                                         } else {
                                             ArrayList<SchemeConditionBean.Property> properties = new ArrayList<>();
-                                            if ("S".equals(type)) {
-                                                SchemeConditionBean.Property property = new SchemeConditionBean.Property();
-                                                properties.add(property);
-                                            } else if ("N".equals(type)) {
+                                            if ("N".equals(type)) {
                                                 for (int m = 0; m < 2; m++) {
                                                     SchemeConditionBean.Property property = new SchemeConditionBean.Property();
                                                     properties.add(property);
@@ -162,6 +159,9 @@ public class DataInquiryListActivity extends BaseActivity implements View.OnClic
                                                 }
                                             } else if ("CBG".equals(type) || "EC".equals(type) || "C".equals(type) || "R".equals(type)) {
 
+                                            } else {
+                                                SchemeConditionBean.Property property = new SchemeConditionBean.Property();
+                                                properties.add(property);
                                             }
                                             schemeConditionBean.setProperties(properties);
                                         }
@@ -605,13 +605,7 @@ public class DataInquiryListActivity extends BaseActivity implements View.OnClic
                 mCondition = "";
                 for (int i = 0; i < mAppSchemeConditions.size(); i++) {
                     SchemeConditionBean schemeConditionBean = mAppSchemeConditions.get(i);
-                    if ("S".equals(schemeConditionBean.getType()) && schemeConditionBean.getProperties().size() == 1) {
-                        if (!TextUtils.isEmpty(schemeConditionBean.getProperties().get(0).getDisplay())) {
-                            mCondition = mCondition + "(" + schemeConditionBean.getField()
-                                    + " = \'" + schemeConditionBean.getProperties().get(0).getDisplay() + "\')"
-                                    + " and ";
-                        }
-                    } else if ("N".equals(schemeConditionBean.getType()) && schemeConditionBean.getProperties().size() == 2) {
+                    if ("N".equals(schemeConditionBean.getType()) && schemeConditionBean.getProperties().size() == 2) {
                         if (!TextUtils.isEmpty(schemeConditionBean.getProperties().get(0).getDisplay())
                                 && !TextUtils.isEmpty(schemeConditionBean.getProperties().get(1).getDisplay())) {
                             mCondition = mCondition + "(" + schemeConditionBean.getField()
@@ -649,6 +643,14 @@ public class DataInquiryListActivity extends BaseActivity implements View.OnClic
 
                             mCondition = mCondition + "(" + gridCondition + ") and ";
                         }
+                    } else {
+                        if (schemeConditionBean.getProperties().size() == 1) {
+                            if (!TextUtils.isEmpty(schemeConditionBean.getProperties().get(0).getDisplay())) {
+                                mCondition = mCondition + "(" + schemeConditionBean.getField()
+                                        + " = \'" + schemeConditionBean.getProperties().get(0).getDisplay() + "\')"
+                                        + " and ";
+                            }
+                        }
                     }
                 }
 
@@ -698,10 +700,10 @@ public class DataInquiryListActivity extends BaseActivity implements View.OnClic
                 mCondition = "";
                 for (int i = 0; i < mfuzzySchemeConditionBeans.size(); i++) {
                     mCondition = mCondition + "(" + mfuzzySchemeConditionBeans.get(i).getField()
-                            + " like \'%" + searchField + "%\') and ";
+                            + " like \'%" + searchField + "%\') or ";
                 }
                 if (mCondition.length() >= 5) {
-                    mCondition = mCondition.substring(0, mCondition.length() - 5);
+                    mCondition = mCondition.substring(0, mCondition.length() - 4);
                 }
 
                 Log.d("fuzzyCondition", mCondition);

+ 9 - 2
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/datainquiry/activity/PDFDownloadActivity.java

@@ -47,6 +47,7 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
                 case Constants.CONSTANT.DOWNLOAD_PROGRESS:
                     try {
                         int progress = (int) msg.obj;
+                        Log.d("progress", progress + "");
                         mStateTextView.setText(R.string.str_loading);
                         mDownloadProgressBar.setProgress(progress);
                         mRemainTextView.setText((100 - progress) + "");
@@ -74,7 +75,11 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
                     break;
                 case Constants.CONSTANT.DOWNLOAD_FAILED:
                     mErrorLinearLayout.setVisibility(View.VISIBLE);
-                    mStateTextView.setText("报表文件下载失败");
+                    String info = "";
+                    if (msg.obj != null) {
+                        info = "\n" + (String) msg.obj;
+                    }
+                    mStateTextView.setText("报表文件下载失败" + info);
                     mDownloadProgressBar.setProgress(0);
                     mRemainTextView.setText(100 + "");
                     break;
@@ -139,6 +144,8 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
         Log.d("downloadUrl", downloadUrl);
 
         mPDFView = (PDFView) findViewById(R.id.pdf_download_pdfview);
+        mPDFView.useBestQuality(true);
+
         mStateTextView = (TextView) findViewById(R.id.pdf_download_state_tv);
         mRemainTextView = (TextView) findViewById(R.id.pdf_download_remain_tv);
         mDownloadProgressBar = (ProgressBar) findViewById(R.id.pdf_download_progress_pb);
@@ -195,6 +202,6 @@ public class PDFDownloadActivity extends BaseActivity implements View.OnClickLis
 
     @Override
     public void onInitiallyRendered(int nbPages, float pageWidth, float pageHeight) {
-
+        mPDFView.fitToWidth();
     }
 }

+ 131 - 69
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/datainquiry/activity/ReportQueryCriteriaActivity.java

@@ -1,6 +1,11 @@
 package com.xzjmyk.pm.activity.ui.erp.activity.datainquiry.activity;
 
+import android.Manifest;
+import android.content.Context;
 import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
@@ -18,6 +23,7 @@ import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.Constants;
 import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
+import com.xzjmyk.pm.activity.util.PermissionUtil;
 import com.xzjmyk.pm.activity.view.MyListView;
 
 import org.json.JSONArray;
@@ -39,6 +45,7 @@ import java.util.Map;
  * Created by RaoMeng on 2017/8/16.
  */
 public class ReportQueryCriteriaActivity extends BaseActivity implements View.OnClickListener {
+    private final int REQUEST_WRITE_EXTERNAL_STORAGE = 0X22;
     private final int GET_OPTION_DATA = 0X11;
     private MyListView mOptionListView;
     private TextView mCancelTextView, mResetTextView, mConfirmTextView;
@@ -90,10 +97,7 @@ public class ReportQueryCriteriaActivity extends BaseActivity implements View.On
                                             }
                                         } else {
                                             ArrayList<ReportConditionBean.Property> properties = new ArrayList<>();
-                                            if ("S".equals(type)) {
-                                                ReportConditionBean.Property property = new ReportConditionBean.Property();
-                                                properties.add(property);
-                                            } else if ("N".equals(type)) {
+                                            if ("N".equals(type)) {
                                                 for (int m = 0; m < 2; m++) {
                                                     ReportConditionBean.Property property = new ReportConditionBean.Property();
                                                     properties.add(property);
@@ -105,6 +109,9 @@ public class ReportQueryCriteriaActivity extends BaseActivity implements View.On
                                                 }
                                             } else if ("CBG".equals(type) || "C".equals(type) || "R".equals(type)) {
 
+                                            } else {
+                                                ReportConditionBean.Property property = new ReportConditionBean.Property();
+                                                properties.add(property);
                                             }
                                             reportConditionBean.setProperties(properties);
                                         }
@@ -197,73 +204,12 @@ public class ReportQueryCriteriaActivity extends BaseActivity implements View.On
     public void onClick(View v) {
         switch (v.getId()) {
             case R.id.report_query_criteria_confirm_btn:
-                mCondition = "";
-                for (int i = 0; i < mReportConditionBeans.size(); i++) {
-                    ReportConditionBean reportConditionBean = mReportConditionBeans.get(i);
-                    if ("S".equals(reportConditionBean.getType()) && reportConditionBean.getProperties().size() == 1) {
-                        if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(0).getDisplay())) {
-                            mCondition = mCondition + "(" + reportConditionBean.getField()
-                                    + " = \'" + reportConditionBean.getProperties().get(0).getDisplay() + "\')"
-                                    + " and ";
-                        }
-                    } else if ("N".equals(reportConditionBean.getType()) && reportConditionBean.getProperties().size() == 2) {
-                        if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(0).getDisplay())
-                                && !TextUtils.isEmpty(reportConditionBean.getProperties().get(1).getDisplay())) {
-                            mCondition = mCondition + "(" + reportConditionBean.getField()
-                                    + " >= " + reportConditionBean.getProperties().get(0).getDisplay()
-                                    + " and " + reportConditionBean.getField()
-                                    + " <= " + reportConditionBean.getProperties().get(1).getDisplay() + ") and ";
-
-                        } else if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(0).getDisplay())) {
-                            mCondition = mCondition + "(" + reportConditionBean.getField()
-                                    + " >= " + reportConditionBean.getProperties().get(0).getDisplay() + ") and ";
-                        } else if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(1).getDisplay())) {
-                            mCondition = mCondition + "(" + reportConditionBean.getField()
-                                    + " <= " + reportConditionBean.getProperties().get(1).getDisplay() + ") and ";
-                        }
-
-                    } else if (("D".equals(reportConditionBean.getType()) || "CD".equals(reportConditionBean.getType())) && reportConditionBean.getProperties().size() == 2) {
-                        mCondition = mCondition + "(" + reportConditionBean.getField()
-                                + " >= to_date(\'" + reportConditionBean.getProperties().get(0).getDisplay()
-                                + "\',\'yyyy-MM-dd\') and " + reportConditionBean.getField()
-                                + " <= to_date(\'" + reportConditionBean.getProperties().get(1).getDisplay()
-                                + "\',\'yyyy-MM-dd\')) and ";
-                    } else if ("CBG".equals(reportConditionBean.getType()) || "C".equals(reportConditionBean.getType())
-                            || "R".equals(reportConditionBean.getType()) || "EC".equals(reportConditionBean.getType())) {
-                        String gridCondition = "";
-                        int selectedCount = 0;
-                        for (int j = 0; j < reportConditionBean.getProperties().size(); j++) {
-                            if (reportConditionBean.getProperties().get(j).isState()) {
-                                selectedCount++;
-                                gridCondition = gridCondition + reportConditionBean.getField() + " = \'"
-                                        + reportConditionBean.getProperties().get(j).getValue() + "\' or ";
-                            }
-                        }
-                        if (selectedCount > 0) {
-                            gridCondition = gridCondition.substring(0, gridCondition.length() - 4);
-
-                            mCondition = mCondition + "(" + gridCondition + ") and ";
-                        }
-                    }
-                }
-
-                if (mCondition.length() >= 5) {
-                    mCondition = mCondition.substring(0, mCondition.length() - 5);
-                }
-
-                Log.d("exactCondition", mCondition);
-
-                if (mCondition.length() == 0) {
-                    ToastMessage("请确认报表查询条件");
+                if (PermissionUtil.lacksPermissions(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
+                    PermissionUtil.requestPermission(this, REQUEST_WRITE_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE);
                 } else {
-                    Intent intent = new Intent();
-                    intent.setClass(this, PDFDownloadActivity.class);
-                    intent.putExtra("condition", mCondition);
-                    if (mReportInfo != null)
-                        intent.putExtra("reportName", mReportInfo.getReportName());
-
-                    startActivity(intent);
+                    gotoPDFLoadActivity();
                 }
+
                 break;
             case R.id.report_query_criteria_reset_btn:
                 mReportConditionBeans.clear();
@@ -283,6 +229,103 @@ public class ReportQueryCriteriaActivity extends BaseActivity implements View.On
         }
     }
 
+    @Override
+    public void onRequestPermissionsResult(int requestCode, String[] permissions,
+                                           int[] grantResults) {
+        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+        if (requestCode == REQUEST_WRITE_EXTERNAL_STORAGE) {
+            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+                gotoPDFLoadActivity();
+            } else {
+//                new AlertDialog.Builder(this).setTitle(R.string.prompt_title)
+//                        .setMessage("查看报表文件需要开启读写手机权限")
+//                        .setPositiveButton("去设置", new DialogInterface.OnClickListener() {
+//                            @Override
+//                            public void onClick(DialogInterface dialog, int which) {
+//                                Intent intent = getAppDetailSettingIntent(ReportQueryCriteriaActivity.this);
+//                                startActivity(intent);
+//                            }
+//                        })
+//                        .setNegativeButton(R.string.cancel, null)
+//                        .create().show();
+                ToastMessage("查看报表文件需要开启读写手机权限,请在设置中手动开启");
+            }
+        }
+    }
+
+
+    private void gotoPDFLoadActivity() {
+        mCondition = "";
+        for (int i = 0; i < mReportConditionBeans.size(); i++) {
+            ReportConditionBean reportConditionBean = mReportConditionBeans.get(i);
+            if ("N".equals(reportConditionBean.getType()) && reportConditionBean.getProperties().size() == 2) {
+                if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(0).getDisplay())
+                        && !TextUtils.isEmpty(reportConditionBean.getProperties().get(1).getDisplay())) {
+                    mCondition = mCondition + "(" + reportConditionBean.getField()
+                            + " >= " + reportConditionBean.getProperties().get(0).getDisplay()
+                            + " and " + reportConditionBean.getField()
+                            + " <= " + reportConditionBean.getProperties().get(1).getDisplay() + ") and ";
+
+                } else if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(0).getDisplay())) {
+                    mCondition = mCondition + "(" + reportConditionBean.getField()
+                            + " >= " + reportConditionBean.getProperties().get(0).getDisplay() + ") and ";
+                } else if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(1).getDisplay())) {
+                    mCondition = mCondition + "(" + reportConditionBean.getField()
+                            + " <= " + reportConditionBean.getProperties().get(1).getDisplay() + ") and ";
+                }
+
+            } else if (("D".equals(reportConditionBean.getType()) || "CD".equals(reportConditionBean.getType())) && reportConditionBean.getProperties().size() == 2) {
+                mCondition = mCondition + "(" + reportConditionBean.getField()
+                        + " >= to_date(\'" + reportConditionBean.getProperties().get(0).getDisplay()
+                        + "\',\'yyyy-MM-dd\') and " + reportConditionBean.getField()
+                        + " <= to_date(\'" + reportConditionBean.getProperties().get(1).getDisplay()
+                        + "\',\'yyyy-MM-dd\')) and ";
+            } else if ("CBG".equals(reportConditionBean.getType()) || "C".equals(reportConditionBean.getType())
+                    || "R".equals(reportConditionBean.getType()) || "EC".equals(reportConditionBean.getType())) {
+                String gridCondition = "";
+                int selectedCount = 0;
+                for (int j = 0; j < reportConditionBean.getProperties().size(); j++) {
+                    if (reportConditionBean.getProperties().get(j).isState()) {
+                        selectedCount++;
+                        gridCondition = gridCondition + reportConditionBean.getField() + " = \'"
+                                + reportConditionBean.getProperties().get(j).getValue() + "\' or ";
+                    }
+                }
+                if (selectedCount > 0) {
+                    gridCondition = gridCondition.substring(0, gridCondition.length() - 4);
+
+                    mCondition = mCondition + "(" + gridCondition + ") and ";
+                }
+            } else {
+                if (reportConditionBean.getProperties().size() == 1) {
+                    if (!TextUtils.isEmpty(reportConditionBean.getProperties().get(0).getDisplay())) {
+                        mCondition = mCondition + "(" + reportConditionBean.getField()
+                                + " = \'" + reportConditionBean.getProperties().get(0).getDisplay() + "\')"
+                                + " and ";
+                    }
+                }
+            }
+        }
+
+        if (mCondition.length() >= 5) {
+            mCondition = mCondition.substring(0, mCondition.length() - 5);
+        }
+
+        Log.d("exactCondition", mCondition);
+
+        if (mCondition.length() == 0) {
+            ToastMessage("请确认报表查询条件");
+        } else {
+            Intent intent = new Intent();
+            intent.setClass(this, PDFDownloadActivity.class);
+            intent.putExtra("condition", mCondition);
+            if (mReportInfo != null)
+                intent.putExtra("reportName", mReportInfo.getReportName());
+
+            startActivity(intent);
+        }
+    }
+
     public String optStringNotNull(JSONObject json, String key) {
         if (json.isNull(key)) {
             return "";
@@ -302,4 +345,23 @@ public class ReportQueryCriteriaActivity extends BaseActivity implements View.On
         List<T> dest = (List<T>) in.readObject();
         return dest;
     }
+
+    /**
+     * 获取应用详情页面intent
+     *
+     * @return
+     */
+    public static Intent getAppDetailSettingIntent(Context context) {
+        Intent localIntent = new Intent();
+        localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        if (Build.VERSION.SDK_INT >= 9) {
+            localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
+            localIntent.setData(Uri.fromParts("package", context.getPackageName(), null));
+        } else if (Build.VERSION.SDK_INT <= 8) {
+            localIntent.setAction(Intent.ACTION_VIEW);
+            localIntent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
+            localIntent.putExtra("com.android.settings.ApplicationPkgName", context.getPackageName());
+        }
+        return localIntent;
+    }
 }

+ 102 - 47
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/datainquiry/adapter/DataInquirySchemeConditionAdapter.java

@@ -66,45 +66,13 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
         holder.captionTv.setText(object.getCaption());
 
         switch (object.getType()) {
-            case "S":
-                holder.stringEdittext.setVisibility(View.VISIBLE);
-                holder.numEdittextLl.setVisibility(View.GONE);
-                holder.textviewLl.setVisibility(View.GONE);
-                holder.gridview.setVisibility(View.GONE);
-                List<SchemeConditionBean.Property> mProperties = object.getProperties();
-
-                holder.stringEdittext.addTextChangedListener(new TextWatcher() {
-                    @Override
-                    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-                    }
-
-                    @Override
-                    public void onTextChanged(CharSequence s, int start, int before, int count) {
-
-                    }
-
-                    @Override
-                    public void afterTextChanged(Editable s) {
-                        if (!strChanged && object.getProperties().size() == 1) {
-                            object.getProperties().get(0).setDisplay(s.toString());
-                            object.getProperties().get(0).setValue(s.toString());
-                        }
-                    }
-                });
 
-                strChanged = true;
-                if (mProperties != null && object.getProperties().size() == 1) {
-                    holder.stringEdittext.setText(mProperties.get(0).getDisplay());
-                    strChanged = false;
-                }
-                break;
             case "N":
                 holder.stringEdittext.setVisibility(View.GONE);
                 holder.numEdittextLl.setVisibility(View.VISIBLE);
                 holder.textviewLl.setVisibility(View.GONE);
                 holder.gridview.setVisibility(View.GONE);
-                mProperties = object.getProperties();
+                List<SchemeConditionBean.Property> mProperties = object.getProperties();
 
                 holder.numEdittext1.addTextChangedListener(new TextWatcher() {
                     @Override
@@ -173,6 +141,20 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
 
                 mProperties = object.getProperties();
 
+                holder.textview1.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                    }
+                });
+
+                holder.textview2.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                    }
+                });
+
                 holder.calendar1.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
@@ -199,32 +181,105 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
             case "C":
             case "EC":
             case "R":
-                holder.stringEdittext.setVisibility(View.GONE);
-                holder.numEdittextLl.setVisibility(View.GONE);
-                holder.textviewLl.setVisibility(View.GONE);
-                holder.gridview.setVisibility(View.VISIBLE);
                 mProperties = object.getProperties();
 
                 if (mProperties != null) {
+                    holder.stringEdittext.setVisibility(View.GONE);
+                    holder.numEdittextLl.setVisibility(View.GONE);
+                    holder.textviewLl.setVisibility(View.GONE);
+                    holder.gridview.setVisibility(View.VISIBLE);
+
                     ItemGridDataInquiryExactAdapter itemGridDataInquiryExactAdapter
                             = new ItemGridDataInquiryExactAdapter(context, mProperties);
                     holder.gridview.setAdapter(itemGridDataInquiryExactAdapter);
-                }
 
-                holder.gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-                    @Override
-                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                        List<SchemeConditionBean.Property> properties = object.getProperties();
-                        for (int i = 0; i < properties.size(); i++) {
-                            if (i == position) {
-                                properties.get(i).setState(!properties.get(i).isState());
+                    holder.gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+                        @Override
+                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                            List<SchemeConditionBean.Property> properties = object.getProperties();
+                            for (int i = 0; i < properties.size(); i++) {
+                                if (i == position) {
+                                    properties.get(i).setState(!properties.get(i).isState());
+                                }
+                            }
+                            if (holder.gridview.getAdapter() != null) {
+                                ((ItemGridDataInquiryExactAdapter) holder.gridview.getAdapter()).notifyDataSetChanged();
                             }
                         }
-                        if (holder.gridview.getAdapter() != null) {
-                            ((ItemGridDataInquiryExactAdapter) holder.gridview.getAdapter()).notifyDataSetChanged();
+                    });
+                } else {
+                    holder.stringEdittext.setVisibility(View.VISIBLE);
+                    holder.numEdittextLl.setVisibility(View.GONE);
+                    holder.textviewLl.setVisibility(View.GONE);
+                    holder.gridview.setVisibility(View.GONE);
+
+                    object.setType("S");
+                    ArrayList<SchemeConditionBean.Property> propertyList = new ArrayList<>();
+                    SchemeConditionBean.Property property = new SchemeConditionBean.Property();
+                    propertyList.add(property);
+                    object.setProperties(propertyList);
+
+                    holder.stringEdittext.addTextChangedListener(new TextWatcher() {
+                        @Override
+                        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+                        }
+
+                        @Override
+                        public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+                        }
+
+                        @Override
+                        public void afterTextChanged(Editable s) {
+                            if (!strChanged && object.getProperties().size() == 1) {
+                                object.getProperties().get(0).setDisplay(s.toString());
+                                object.getProperties().get(0).setValue(s.toString());
+                            }
+                        }
+                    });
+
+                    strChanged = true;
+                    if (propertyList != null && propertyList.size() == 1) {
+                        holder.stringEdittext.setText(propertyList.get(0).getDisplay());
+                        strChanged = false;
+                    }
+                }
+
+                break;
+            case "S":
+            default:
+                holder.stringEdittext.setVisibility(View.VISIBLE);
+                holder.numEdittextLl.setVisibility(View.GONE);
+                holder.textviewLl.setVisibility(View.GONE);
+                holder.gridview.setVisibility(View.GONE);
+                mProperties = object.getProperties();
+
+                holder.stringEdittext.addTextChangedListener(new TextWatcher() {
+                    @Override
+                    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+                    }
+
+                    @Override
+                    public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+                    }
+
+                    @Override
+                    public void afterTextChanged(Editable s) {
+                        if (!strChanged && object.getProperties().size() == 1) {
+                            object.getProperties().get(0).setDisplay(s.toString());
+                            object.getProperties().get(0).setValue(s.toString());
                         }
                     }
                 });
+
+                strChanged = true;
+                if (mProperties != null && object.getProperties().size() == 1) {
+                    holder.stringEdittext.setText(mProperties.get(0).getDisplay());
+                    strChanged = false;
+                }
                 break;
         }
     }

+ 103 - 48
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/datainquiry/adapter/ReportQueryConditionAdapter.java

@@ -66,45 +66,13 @@ public class ReportQueryConditionAdapter extends BaseAdapter {
         holder.captionTv.setText(object.getTitle());
 
         switch (object.getType()) {
-            case "S":
-                holder.stringEdittext.setVisibility(View.VISIBLE);
-                holder.numEdittextLl.setVisibility(View.GONE);
-                holder.textviewLl.setVisibility(View.GONE);
-                holder.gridview.setVisibility(View.GONE);
-                List<ReportConditionBean.Property> mProperties = object.getProperties();
-
-                holder.stringEdittext.addTextChangedListener(new TextWatcher() {
-                    @Override
-                    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-                    }
-
-                    @Override
-                    public void onTextChanged(CharSequence s, int start, int before, int count) {
-
-                    }
-
-                    @Override
-                    public void afterTextChanged(Editable s) {
-                        if (!strChanged && object.getProperties().size() == 1) {
-                            object.getProperties().get(0).setDisplay(s.toString());
-                            object.getProperties().get(0).setValue(s.toString());
-                        }
-                    }
-                });
 
-                strChanged = true;
-                if (mProperties != null && object.getProperties().size() == 1) {
-                    holder.stringEdittext.setText(mProperties.get(0).getDisplay());
-                    strChanged = false;
-                }
-                break;
             case "N":
                 holder.stringEdittext.setVisibility(View.GONE);
                 holder.numEdittextLl.setVisibility(View.VISIBLE);
                 holder.textviewLl.setVisibility(View.GONE);
                 holder.gridview.setVisibility(View.GONE);
-                mProperties = object.getProperties();
+                List<ReportConditionBean.Property> mProperties = object.getProperties();
 
                 holder.numEdittext1.addTextChangedListener(new TextWatcher() {
                     @Override
@@ -173,6 +141,20 @@ public class ReportQueryConditionAdapter extends BaseAdapter {
 
                 mProperties = object.getProperties();
 
+                holder.textview1.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                    }
+                });
+
+                holder.textview2.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                    }
+                });
+
                 holder.calendar1.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
@@ -199,32 +181,105 @@ public class ReportQueryConditionAdapter extends BaseAdapter {
             case "C":
             case "EC":
             case "R":
-                holder.stringEdittext.setVisibility(View.GONE);
-                holder.numEdittextLl.setVisibility(View.GONE);
-                holder.textviewLl.setVisibility(View.GONE);
-                holder.gridview.setVisibility(View.VISIBLE);
                 mProperties = object.getProperties();
 
-                if (mProperties != null) {
+                if (mProperties != null && mProperties.size() > 0) {
+                    holder.stringEdittext.setVisibility(View.GONE);
+                    holder.numEdittextLl.setVisibility(View.GONE);
+                    holder.textviewLl.setVisibility(View.GONE);
+                    holder.gridview.setVisibility(View.VISIBLE);
+
                     ItemGridReportQueryExactAdapter itemGridDataInquiryExactAdapter
                             = new ItemGridReportQueryExactAdapter(context, mProperties);
                     holder.gridview.setAdapter(itemGridDataInquiryExactAdapter);
-                }
 
-                holder.gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-                    @Override
-                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                        List<ReportConditionBean.Property> properties = object.getProperties();
-                        for (int i = 0; i < properties.size(); i++) {
-                            if (i == position) {
-                                properties.get(i).setState(!properties.get(i).isState());
+                    holder.gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+                        @Override
+                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                            List<ReportConditionBean.Property> properties = object.getProperties();
+                            for (int i = 0; i < properties.size(); i++) {
+                                if (i == position) {
+                                    properties.get(i).setState(!properties.get(i).isState());
+                                }
+                            }
+                            if (holder.gridview.getAdapter() != null) {
+                                ((ItemGridReportQueryExactAdapter) holder.gridview.getAdapter()).notifyDataSetChanged();
                             }
                         }
-                        if (holder.gridview.getAdapter() != null) {
-                            ((ItemGridDataInquiryExactAdapter) holder.gridview.getAdapter()).notifyDataSetChanged();
+                    });
+                } else {
+                    holder.stringEdittext.setVisibility(View.VISIBLE);
+                    holder.numEdittextLl.setVisibility(View.GONE);
+                    holder.textviewLl.setVisibility(View.GONE);
+                    holder.gridview.setVisibility(View.GONE);
+
+                    object.setType("S");
+                    ArrayList<ReportConditionBean.Property> properties = new ArrayList<>();
+                    ReportConditionBean.Property property = new ReportConditionBean.Property();
+                    properties.add(property);
+                    object.setProperties(properties);
+
+                    holder.stringEdittext.addTextChangedListener(new TextWatcher() {
+                        @Override
+                        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+                        }
+
+                        @Override
+                        public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+                        }
+
+                        @Override
+                        public void afterTextChanged(Editable s) {
+                            if (!strChanged && object.getProperties().size() == 1) {
+                                object.getProperties().get(0).setDisplay(s.toString());
+                                object.getProperties().get(0).setValue(s.toString());
+                            }
+                        }
+                    });
+
+                    strChanged = true;
+                    if (properties != null && properties.size() == 1) {
+                        holder.stringEdittext.setText(properties.get(0).getDisplay());
+                        strChanged = false;
+                    }
+                }
+
+                break;
+            case "S":
+            default:
+                holder.stringEdittext.setVisibility(View.VISIBLE);
+                holder.numEdittextLl.setVisibility(View.GONE);
+                holder.textviewLl.setVisibility(View.GONE);
+                holder.gridview.setVisibility(View.GONE);
+                mProperties = object.getProperties();
+
+                holder.stringEdittext.addTextChangedListener(new TextWatcher() {
+                    @Override
+                    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+                    }
+
+                    @Override
+                    public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+                    }
+
+                    @Override
+                    public void afterTextChanged(Editable s) {
+                        if (!strChanged && object.getProperties().size() == 1) {
+                            object.getProperties().get(0).setDisplay(s.toString());
+                            object.getProperties().get(0).setValue(s.toString());
                         }
                     }
                 });
+
+                strChanged = true;
+                if (mProperties != null && object.getProperties().size() == 1) {
+                    holder.stringEdittext.setText(mProperties.get(0).getDisplay());
+                    strChanged = false;
+                }
                 break;
         }
     }

+ 13 - 7
WeiChat/src/main/res/layout/item_grid_data_inquiry_exact.xml

@@ -1,10 +1,16 @@
 <?xml version="1.0" encoding="utf-8"?>
-<TextView
-    android:id="@+id/item_data_inquiry_exact_grid_tv"
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@drawable/selector_me_menu_item_bg"
-    android:gravity="center"
-    android:padding="6dp"
-    android:textAppearance="?android:attr/textAppearanceListItemSmall"/>
+    android:layout_height="46dp">
+
+    <TextView
+        android:id="@+id/item_data_inquiry_exact_grid_tv"
+        android:layout_width="match_parent"
+        android:layout_height="46dp"
+        android:background="@drawable/selector_me_menu_item_bg"
+        android:gravity="center"
+        android:maxLines="2"
+        android:padding="6dp"
+        android:textSize="14sp"/>
+</LinearLayout>

+ 8 - 3
WeiChat/src/main/res/layout/item_list_data_inquiry_exact_query.xml

@@ -14,6 +14,7 @@
         android:layout_height="wrap_content"
         android:gravity="center"
         android:textSize="16sp"
+        android:layout_marginRight="10dp"
         tools:text="caption"/>
 
     <EditText
@@ -22,6 +23,7 @@
         android:layout_height="36dp"
         android:background="@drawable/shape_corner_white_bg"
         android:gravity="center"
+        android:textSize="14sp"
         android:visibility="gone"/>
 
     <LinearLayout
@@ -39,6 +41,7 @@
             android:layout_weight="1"
             android:background="@drawable/shape_corner_white_bg"
             android:gravity="center"
+            android:textSize="14sp"
             android:inputType="number"/>
 
         <TextView
@@ -55,6 +58,7 @@
             android:layout_width="0dp"
             android:layout_height="36dp"
             android:layout_weight="1"
+            android:textSize="14sp"
             android:background="@drawable/shape_corner_white_bg"
             android:gravity="center"
             android:inputType="number"/>
@@ -80,6 +84,7 @@
                 android:layout_width="0dp"
                 android:layout_height="match_parent"
                 android:layout_weight="1"
+                android:textSize="14sp"
                 android:gravity="center"
                 tools:text="2017-08-15"/>
 
@@ -87,7 +92,7 @@
                 android:id="@+id/item_data_inquiry_exact_calendar1"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
-                android:layout_marginRight="6dp"
+                android:paddingRight="6dp"
                 android:src="@drawable/ic_blue_calendar"/>
         </LinearLayout>
 
@@ -111,14 +116,14 @@
                 android:layout_height="match_parent"
                 android:layout_weight="1"
                 android:gravity="center"
+                android:textSize="14sp"
                 tools:text="2017-08-20"/>
 
             <ImageView
                 android:id="@+id/item_data_inquiry_exact_calendar2"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent"
-                android:layout_marginLeft="6dp"
-                android:layout_marginRight="6dp"
+                android:paddingRight="6dp"
                 android:src="@drawable/ic_blue_calendar"/>
         </LinearLayout>
 

+ 2 - 2
android-pdf-viewer/build.gradle

@@ -41,5 +41,5 @@ dependencies {
     compile 'com.github.barteksc:pdfium-android:1.7.0'
 }
 
-apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
-apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
+//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
+//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'