Browse Source

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

RaoMeng 7 years ago
parent
commit
9bc1ba9f9f

+ 5 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java

@@ -923,8 +923,12 @@ public class MainActivity extends BaseActivity implements ImStatusListener, NetW
                 cal.set(Calendar.MILLISECOND, 0);
                 long startcal = cal.getTimeInMillis();
                 long endcal = cal.getTimeInMillis() + 24 * 60 * 60 * 1000;
-                List<Schedule> systemSchedule = ScheduleUtils.getSystemCalendar(MyApplication.getInstance(), startcal, endcal);
+                List<Schedule> systemSchedule =null;
+                try{
+                    ScheduleUtils.getSystemCalendar(MyApplication.getInstance(), startcal, endcal);
+                }catch (Exception e){
 
+                }
                 for (int i = 0; i < dataArray.size(); i++) {
                     JSONObject dataObject = dataArray.getJSONObject(i);
                     if (dataObject != null) {

+ 5 - 5
app_modular/apputils/src/main/java/com/modular/apputils/adapter/BillAdapter.java

@@ -310,7 +310,7 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
     private void bindEnclosureView(EnclosureViewHolder holder, BillGroupModel.BillModel model, int position) {
         if (model != null) {
             holder.captionTv.setText(model.getCaption());
-            holder.muchInputTv.setVisibility(model.getAllowBlank().equals("T") ? View.GONE : View.VISIBLE);
+            holder.muchInputTv.setVisibility(model.getAllowBlank().equals("F") ? View.VISIBLE  :View.GONE);
             EnclosureAdapter mEnclosureAdapter = null;
             if (holder.ffGv.getTag(R.id.tag_key) != null && holder.ffGv.getTag(R.id.tag_key) instanceof EnclosureAdapter) {
                 mEnclosureAdapter = (EnclosureAdapter) holder.ffGv.getTag(R.id.tag_key);
@@ -377,13 +377,13 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
 
     public void bindTitleView(TitleViewHolder mTitleViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
         if (model != null) {
-            if (model.getAllowBlank().equals("T")) {
+            if (model.getAllowBlank().equals("F")) {
+                mTitleViewHolder.deleteTv.setVisibility(View.GONE);
+                mTitleViewHolder.deleteTv.setOnClickListener(null);
+            } else {
                 mTitleViewHolder.deleteTv.setVisibility(View.VISIBLE);
                 mTitleViewHolder.deleteTv.setTag(model.getGroupIndex());
                 mTitleViewHolder.deleteTv.setOnClickListener(this);
-            } else {
-                mTitleViewHolder.deleteTv.setVisibility(View.GONE);
-                mTitleViewHolder.deleteTv.setOnClickListener(null);
             }
             mTitleViewHolder.tvTitle.setText(model.getCaption());
         }

+ 1 - 0
app_modular/apputils/src/main/java/com/modular/apputils/presenter/imp/IBill.java

@@ -17,4 +17,5 @@ public interface IBill extends HttpImp{
     void startActivityForResult(Intent intent, int requestCode);
 
     void updateFileOk();
+
 }

+ 1 - 1
app_modular/apputils/src/main/res/layout/item_bill_enclosure.xml

@@ -27,7 +27,7 @@
         android:text="*"
         android:textColor="@color/red"
         android:textSize="15sp"
-        android:visibility="visible"
+        android:visibility="gone"
         app:layout_constraintLeft_toRightOf="@id/captionTv"
         app:layout_constraintTop_toTopOf="@id/captionTv" />
 

+ 6 - 1
app_modular/appworks/src/main/java/com/uas/appworks/activity/ScheduleActivity.java

@@ -222,7 +222,12 @@ public class ScheduleActivity extends BaseNetActivity {
         cal.set(Calendar.MILLISECOND, 0);
         long startTime = cal.getTimeInMillis();
         long endTime = cal.getTimeInMillis() + 24 * 60 * 60 * 1000;
-        List<Schedule> systemSchedule = ScheduleUtils.getSystemCalendar(MyApplication.getInstance(), startTime, endTime);
+        List<Schedule> systemSchedule =null;
+        try{
+          systemSchedule = ScheduleUtils.getSystemCalendar(MyApplication.getInstance(), startTime, endTime);
+        }catch (Exception e){
+
+        }
         if (!ListUtils.isEmpty(jsonArray)) {
             schedules = new ArrayList<>();
             Schedule chche = null;

+ 23 - 1
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/activity/CustomerContactActivity.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.common.LogUtil;
 import com.common.data.JSONUtil;
+import com.common.data.ListUtils;
 import com.core.app.Constants;
 import com.core.utils.ToastUtil;
 import com.modular.apputils.activity.BillInputActivity;
@@ -29,18 +30,39 @@ import java.util.List;
 public class CustomerContactActivity extends BillInputActivity {
     private boolean isMe;
 
+
+    @Override
+    public void setAdapter(List<BillGroupModel> groupModels) {
+        super.setAdapter(groupModels);
+    }
+
     @Override
     public BillPresenter newBillPresenter() {
         return new CustomerContactBillPresenter(this, this, new IContact() {
             @Override
             public void updateStatus(String status) {
-
             }
 
             @Override
             public void deleteDetailOk(int deleteIndex) {
                 ((CustomerContactAdapter) mBillAdapter).superDeleteGroup(deleteIndex);
             }
+
+            @Override
+            public void setFilePaths(int mGroupIndex, List<BillGroupModel.LocalData> mLocalDatas) {
+                if (mBillAdapter != null) {
+                    BillGroupModel mBillModel = mBillAdapter.getBillGroupModel(mGroupIndex);
+                    if (mBillModel != null && !ListUtils.isEmpty(mBillModel.getShowBillFields())) {
+                        for (BillGroupModel.BillModel billModel : mBillModel.getShowBillFields()) {
+                            if (billModel.getType().equals("FF")) {
+                                billModel.setLocalDatas(mLocalDatas);
+                                mBillAdapter.notifyDataSetChanged();
+                            }
+                        }
+
+                    }
+                }
+            }
         });
     }
 

+ 2 - 2
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/activity/CustomerVisitDetailsActivity.java

@@ -150,9 +150,9 @@ public class CustomerVisitDetailsActivity extends OABaseActivity {
                     } else {
                         int vrId = JSONUtil.getInt(data, "vrId");
                         showToast("转单成功!!");
-                        startActivity(new Intent(ct, BillDetailsActivity.class)
+                        startActivity(new Intent(ct, VisitRecordBillInputActivity.class)
                                 .putExtra(Constants.Intents.CALLER, "VisitRecord")
-                                .putExtra(Constants.Intents.TITLE, getToolBarTitle())
+                                .putExtra(Constants.Intents.TITLE, "拜访记录")
                                 .putExtra(Constants.Intents.ID, vrId));
                         finish();
                     }

+ 63 - 0
app_modular/appworks/src/main/java/com/uas/appworks/presenter/CustomerContactBillPresenter.java

@@ -9,7 +9,10 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
+import com.common.data.StringUtil;
 import com.core.app.Constants;
+import com.core.app.MyApplication;
+import com.core.utils.CommonUtil;
 import com.me.network.app.http.Method;
 import com.modular.apputils.model.BillGroupModel;
 import com.modular.apputils.network.Parameter;
@@ -30,6 +33,8 @@ public class CustomerContactBillPresenter extends BillPresenter {
     private final int LOAD_FORM_DETAILS = 0x32;
     private final int DELETE_DETAIL = 0x33;
     private final int TAG_DELETE_INDEX = 0x41;
+    private final int LOAD_FILE_PATHS = 0x42;
+    private final int TAG_GROUP_INDEX = 0x43;
 
 
     public CustomerContactBillPresenter(Context ct, IBill iBill, IContact iContact) {
@@ -143,6 +148,21 @@ public class CustomerContactBillPresenter extends BillPresenter {
                 , this);
     }
 
+    /*获取附件  */
+    private void loadFilePaths(int mGroupIndex, String attachs) {
+        if (StringUtil.isEmpty(attachs) || "null".equals(attachs)) {
+            return;
+        }
+        iBill.showLoading();
+        requestCompanyHttp(new Parameter.Builder()
+                        .url("common/getFilePaths.action")
+                        .addParams("field", "fb_attach")
+                        .addParams("id", attachs)
+                        .addTag(TAG_GROUP_INDEX, mGroupIndex)
+                        .record(LOAD_FILE_PATHS)
+                , this);
+    }
+
     public void deleteDetail(int groupIndex, int ctId) {
         iBill.showLoading();
         requestCompanyHttp(new Parameter.Builder()
@@ -171,16 +191,53 @@ public class CustomerContactBillPresenter extends BillPresenter {
                     iContact.deleteDetailOk(deleteIndex);
                 }
                 break;
+            case LOAD_FILE_PATHS:
+                int mGroupIndex = 0;
+                if (tag != null && tag.get(TAG_GROUP_INDEX) != null && tag.get(TAG_GROUP_INDEX) instanceof Integer) {
+                    mGroupIndex = (int) tag.get(TAG_GROUP_INDEX);
+                }
+                handlerEnclosure(mGroupIndex, JSONUtil.getJSONArray(JSON.parseObject(message), "files"));
+                break;
             default:
                 super.onSuccess(what, message, tag);
 
         }
         iBill.dimssLoading();
+    }
 
+    @Override
+    public void onFailure(int what, String message, Tags tag) throws Exception {
+        if (LOAD_FILE_PATHS != what) {
+            super.onFailure(what, message, tag);
+        }
+    }
 
+    private void handlerEnclosure(final int mGroupIndex, final JSONArray array) throws Exception {
+        List<BillGroupModel.LocalData> mLocalDatas = new ArrayList<>();
+        if (!ListUtils.isEmpty(array)) {
+            for (int i = 0; i < array.size(); i++) {
+                JSONObject o = array.getJSONObject(i);
+                if (o == null) continue;
+                BillGroupModel.LocalData mLocalData = new BillGroupModel.LocalData();
+                int id = JSONUtil.getInt(o, "fp_id");
+                mLocalData.value = JSONUtil.getText(o, "fp_name");
+                mLocalData.display = getImageUrl(id);
+                mLocalDatas.add(mLocalData);
+            }
+        }
+        if (!ListUtils.isEmpty(mLocalDatas)) {
+            iContact.setFilePaths(mGroupIndex, mLocalDatas);
+        }
     }
 
 
+    private String getImageUrl(int id) {
+        return CommonUtil.getAppBaseUrl(MyApplication.getInstance()) + "common/downloadbyId.action?id=" + id + "&sessionId=" +
+                CommonUtil.getSharedPreferences(MyApplication.getInstance(), "sessionId") +
+                "&sessionUser=" + CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_username") +
+                "&master=" + CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master");
+    }
+
     private void handlerFormData(JSONObject datas) throws Exception {
         String status = null;
         List<BillGroupModel> mBillGroupModels = new ArrayList<>();
@@ -246,6 +303,9 @@ public class CustomerContactBillPresenter extends BillPresenter {
             mBillModel.setField(field);
             mBillModel.setAllowBlank(allowBlank);
             mBillModel.setValue(JSONUtil.getText(object, field));
+            if ("ct_attach".equals(mBillModel.getField())) {
+                mBillModel.setType("FF");
+            }
             if (!ListUtils.isEmpty(combostore)) {
                 List<BillGroupModel.LocalData> localDatas = new ArrayList<>();
                 for (int j = 0; j < combostore.size(); j++) {
@@ -258,6 +318,9 @@ public class CustomerContactBillPresenter extends BillPresenter {
                 mBillModel.setLocalDatas(localDatas);
             }
             if (mBillModel.getIsdefault() == -1 && !mBillModel.getType().equals("H")) {
+                if ("FF".equals(mBillModel.getType()) && !StringUtil.isEmpty(mBillModel.getValue())) {
+                    loadFilePaths(mBillModel.getGroupIndex(), mBillModel.getValue());
+                }
                 mGroupModel.addShow(mBillModel);
             } else {
                 mGroupModel.addHide(mBillModel);

+ 5 - 0
app_modular/appworks/src/main/java/com/uas/appworks/presenter/imp/IContact.java

@@ -1,7 +1,12 @@
 package com.uas.appworks.presenter.imp;
 
+import com.modular.apputils.model.BillGroupModel;
+
+import java.util.List;
+
 public interface IContact {
     void updateStatus(String status);
 
     void deleteDetailOk(int deleteIndex);
+    void setFilePaths(int mGroupIndex,List<BillGroupModel.LocalData> mLocalDatas);
 }