Ver código fonte

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

SpringBoots 8 anos atrás
pai
commit
26a04a820d

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

@@ -76,6 +76,7 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
                 return new TitleViewHolder(parent);
             case Approval.MAIN://列表
             case Approval.DETAIL:
+            case Approval.SETUPTASK:
                 return new BaseRVViewHodler(parent);
             case Approval.ENCLOSURE://单行列表
             case Approval.TAG:

+ 6 - 5
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/model/oa/Approval.java

@@ -23,10 +23,11 @@ public class Approval {
             TITLE = 11//标题
             , MAIN = 12  //主表
             , DETAIL = 13//从表
-            , ENCLOSURE = 14//附件
-            , POINTS = 15//要点
-            , NODES = 16//审批节点
-            , TAG = 17;//标题
+            , SETUPTASK = 14//历史审批要点
+            ,ENCLOSURE = 16//附件
+            , POINTS = 17//要点
+            , NODES = 18//审批节点
+            , TAG = 19;//标题
 
     private boolean neerInput = false;//是否需要输入
     private boolean mustInput = false;//是否是必填字段
@@ -254,7 +255,7 @@ public class Approval {
         }
     }
 
-    @IntDef({TITLE, MAIN, DETAIL, ENCLOSURE, POINTS, NODES, TAG})
+    @IntDef({TITLE, MAIN, DETAIL, ENCLOSURE, POINTS, NODES, TAG,SETUPTASK})
     @Retention(RetentionPolicy.SOURCE)
     public @interface Duration {
     }

+ 9 - 11
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/net/ViewUtil.java

@@ -279,7 +279,7 @@ public class ViewUtil {
                 boolean isNetHas = CommonUtil.isNetWorkConnected(MyApplication.getInstance());
                 if (isNetHas) {
                     String result = getDataFromServer(url, params, request);
-                    LogUtil.d("result:"+result);
+                    LogUtil.d("result:" + result);
                     if (result != null) {
                         if (bundle == null || message == null) {
                             Bundle bundle = new Bundle();
@@ -324,7 +324,7 @@ public class ViewUtil {
                                       final Map<String, String> params, final Handler handler,
                                       final int what, final Message message, final Bundle bundle,
                                       final String request) {
-       ThreadUtil.getInstance().addTask(new Runnable() {
+        ThreadUtil.getInstance().addTask(new Runnable() {
             @Override
             public void run() {
                 boolean isNetHas = CommonUtil.isNetWorkConnected(ct);
@@ -557,7 +557,7 @@ public class ViewUtil {
     }
 
     public static void ChangeStatusB2B(String result) {
-        LogUtil.d("LoginInfo","B2B login:"+result);
+        LogUtil.d("LoginInfo", "B2B login:" + result);
         if (!new JsonValidator().validate(result)) return;
         if (JSON.parseObject(result).getBoolean("success") == null) {
             if (mdProcessDialog == null) return;
@@ -659,7 +659,7 @@ public class ViewUtil {
      */
     public static void LoginSucess(Message msg) {
         String json = msg.getData().getString("result");
-        LogUtil.d("Test","管理平台登录:"+json);
+        LogUtil.d("Test", "管理平台登录:" + json);
         CommonUtil.setSharedPreferences(ct, "loginJson", json);
         String phone = msg.getData().getString("phone");
         String password = msg.getData().getString("password");
@@ -759,9 +759,9 @@ public class ViewUtil {
                         CommonUtil.setSharedPreferences(MyApplication.getInstance().getApplicationContext(), "companyEnUu", String.valueOf(sModel.get(0).getEnuu()));
                         LoginB2BTask(phone, password, sModel.get(0).getId());//登录B2B
                     }
-                }else{
+                } else {
                     CommonUtil.setSharedPreferences(MyApplication.getInstance().getApplicationContext(), "userRole", "1");
-                    if (ct!=null) {
+                    if (ct != null) {
                         ct.startActivity(new Intent(ct, MainActivity.class));
                     }
                 }
@@ -852,9 +852,6 @@ public class ViewUtil {
                     LogUtil.prinlnLongMsg("result", "http 发送请求-----------------------------------------");
                     LogUtil.prinlnLongMsg("result", "url:" + url);
                     LogUtil.prinlnLongMsg("result", "parms:" + params.toString());
-                    if (result != null)
-                        LogUtil.prinlnLongMsg("result", result.getResponseText());
-                    else LogUtil.prinlnLongMsg("result", "result == null");
                     if (result != null) {
                         Log.i("result", "result:" + result.getStatusCode());
                         // Log.i("result", "statusCode:" +result.getResponseText());
@@ -899,6 +896,7 @@ public class ViewUtil {
                             handler.sendMessage(finalMessage);
                         }
                     } else {
+                        LogUtil.prinlnLongMsg("result", "result == null");
                         finalBundle.putString("result", MyApplication.getInstance().getResources().getString(R.string.networks_out));
                         finalBundle.putInt("what", what);
                         finalBundle.putInt("code", 0);
@@ -1063,7 +1061,7 @@ public class ViewUtil {
         CommonUtil.clearSharedPreferences(ct, "Master_ch");
         CommonUtil.clearSharedPreferences(ct, "erp_emname");
         CommonUtil.clearSharedPreferences(ct, "userRole");
-        
-        
+
+
     }
 }

+ 95 - 9
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/presenter/ApprovaPresenter.java

@@ -36,6 +36,7 @@ import java.util.List;
 import java.util.Map;
 
 import static com.alibaba.fastjson.JSON.parseObject;
+import static com.xzjmyk.pm.activity.ui.erp.model.oa.Approval.DETAIL;
 import static com.xzjmyk.pm.activity.ui.erp.util.OACheckUtil.getJson2Text;
 import static com.xzjmyk.pm.activity.ui.erp.util.OACheckUtil.getJsonIntager;
 import static com.xzjmyk.pm.activity.ui.erp.util.OACheckUtil.getString;
@@ -45,6 +46,7 @@ import static com.xzjmyk.pm.activity.ui.erp.util.OACheckUtil.getString;
  */
 
 public class ApprovaPresenter implements OnHttpResultListener {
+    private final int LOAD_ALLHISTORY_NODES = 0x35;    //下拉历史审批要点
     private final int LOAD_TAKE_OVER_OTHER = 0x34;    //下一个处理人
     private final int LOAD_NEXT_STEPOFP_INSTANCE = 0x33;
     private final int LOAD_PROCESS_UPDATE = 0x32;//更新审批必填字段
@@ -99,7 +101,7 @@ public class ApprovaPresenter implements OnHttpResultListener {
             if (approval.getType() == Approval.MAIN) {
                 Data data = new Data(true, approval);
                 fieldsDis.add(data);
-            } else if (approval.getType() == Approval.DETAIL && canAddDetail) {
+            } else if (approval.getType() == DETAIL && canAddDetail) {
                 Data data = new Data(true, approval);
                 fieldsDis.add(data);
                 addDetailed = true;
@@ -390,6 +392,20 @@ public class ApprovaPresenter implements OnHttpResultListener {
         OAHttpHelper.getInstance().requestHttp(bulider.bulid(), this);
     }
 
+    /*下拉历史审批要点*/
+    private void loadAllHistoryNodes() {
+        iApproval.showLoading();
+        String url = "common/getAllHistoryNodes.action";
+        Map<String, Object> param = new HashMap<>();
+        param.put("processInstanceId", record.processInstanceId);
+        param.put("_noc", 1);
+        Request.Bulider bulider = new Request.Bulider()
+                .setUrl(url)
+                .setWhat(LOAD_ALLHISTORY_NODES)
+                .setParam(param);
+        OAHttpHelper.getInstance().requestHttp(bulider.bulid(), this);
+    }
+
     /*下拉审批要点 loading*/
     private void loadCustomSetupOfTask() {
         iApproval.showLoading();
@@ -499,6 +515,9 @@ public class ApprovaPresenter implements OnHttpResultListener {
                     }
                 });
                 break;
+            case LOAD_ALLHISTORY_NODES:
+                handlerHistorySetuptask(object);
+                break;
             case LOAD_JNODES:
                 handlerNode(object);
                 break;
@@ -651,10 +670,12 @@ public class ApprovaPresenter implements OnHttpResultListener {
                 for (int i = 0; i < griddatas.size(); i++) {
                     //获取到单个明细表单
                     final List<Approval> detailedApproval = formandGriddata(griddatas.getJSONObject(i), gridconfigs, record.caller, false);
-                    Approval approval = new Approval(Approval.TAG);
-                    approval.setCaption(getString(R.string.serial_number) + (i + 1));
-                    detailedApproval.add(0, approval);
-                    detailedList.addAll(detailedApproval);
+                    if (!ListUtils.isEmpty(detailedApproval)) {
+                        Approval approval = new Approval(Approval.TAG);
+                        approval.setCaption(getString(R.string.serial_number) + (i + 1));
+                        detailedApproval.add(0, approval);
+                        detailedList.addAll(detailedApproval);
+                    }
                 }
             }
             if (!ListUtils.isEmpty(othergrids)) {
@@ -681,11 +702,11 @@ public class ApprovaPresenter implements OnHttpResultListener {
                     }
                 }
             }
-            setData2ListThread(Approval.DETAIL, detailedList);
+            setData2ListThread(DETAIL, detailedList);
             OAHttpHelper.getInstance().post(new Runnable() {
                 @Override
                 public void run() {
-                    loadCustomSetupOfTask();//获取审批要点
+                    loadAllHistoryNodes();
                 }
             });
         } else {
@@ -701,7 +722,7 @@ public class ApprovaPresenter implements OnHttpResultListener {
         for (int i = 0; i < configs.size(); i++) {
             JSONObject config = configs.getJSONObject(i);
             if (config == null) continue;
-            Approval approval = new Approval(isMain ? Approval.MAIN : Approval.DETAIL);
+            Approval approval = new Approval(isMain ? Approval.MAIN : DETAIL);
             String caption = getJson2Text(config, "FD_CAPTION", "DG_CAPTION");//获取第一个字段字段名称
             String valueKey = getJson2Text(config, "FD_FIELD", "DG_FIELD");
             JSONArray combostore = OACheckUtil.getJsonArray(config, "COMBOSTORE");
@@ -927,6 +948,71 @@ public class ApprovaPresenter implements OnHttpResultListener {
         return approvals;
     }
 
+    private void handlerHistorySetuptask(final JSONObject object) {
+        ThreadUtil.getInstance().addTask(new Runnable() {
+            @Override
+            public void run() {
+                JSONArray nodes = OACheckUtil.getJsonArray(object, "nodes");
+                if (!ListUtils.isEmpty(nodes)) {
+                    List<Approval> setuptasks = new ArrayList<Approval>();
+                    List<Approval> itemSetuptasks;
+                    Approval approval = null;
+                    JSONObject node = null;
+                    String name = null;
+                    for (int i = 0; i < nodes.size(); i++) {
+                        node = nodes.getJSONObject(i);
+                        name = OACheckUtil.getJson2Text(node, "jn_dealManName");
+                        approval = new Approval(Approval.TAG);
+                        approval.setCaption(name + "的审批记录");
+                        itemSetuptasks = getSetuptaskByData(OACheckUtil.getJson2Text(node, "jn_operatedDescription"));
+                        if (!ListUtils.isEmpty(itemSetuptasks)) {
+                            itemSetuptasks.add(0, approval);
+                            setuptasks.addAll(itemSetuptasks);
+                        }
+                    }
+                    setData2ListThread(Approval.DETAIL, setuptasks);
+                }
+                OAHttpHelper.getInstance().post(new Runnable() {
+                    @Override
+                    public void run() {
+                        if (isApprovaling()) {
+                            loadCustomSetupOfTask();
+                        } else {
+                            loadJnodes();
+                        }
+                    }
+                });
+            }
+        });
+    }
+
+    private List<Approval> getSetuptaskByData(String data) {
+        if (!StringUtils.isEmpty(data)) {
+            //需要把该数据填充到对应上面
+            String[] datas = data.split(";");
+            List<Approval> itemSetuptasks = new ArrayList<>();
+            Approval approval = null;
+            if (datas != null && datas.length > 0) {
+                for (int j = 0; j < datas.length; j++) {
+                    String description = datas[j];
+                    if (description.contains("(")) {
+                        String caption = description.substring(0, description.indexOf("("));
+                        String values = OACheckUtil.getFirstBrackets(description);
+                        if (!StringUtils.isEmpty(caption) && !StringUtils.isEmpty(values)) {
+                            approval = new Approval(Approval.SETUPTASK);
+                            approval.setNeerInput(false);
+                            approval.setCaption(caption);
+                            approval.setValues(values);
+                            itemSetuptasks.add(approval);
+                        }
+                    }
+                }
+            }
+            return itemSetuptasks;
+        }
+        return null;
+    }
+
     private void handlerSetupTask(final JSONObject object) throws Exception {
         ThreadUtil.getInstance().addTask(new Runnable() {
             @Override
@@ -1092,7 +1178,7 @@ public class ApprovaPresenter implements OnHttpResultListener {
                 Approval approval = approvals.get(i);
                 if (approval.getType() == Approval.MAIN) {
                     mainList.add(approval);
-                } else if (approval.getType() == Approval.DETAIL) {
+                } else if (approval.getType() == DETAIL) {
                     detail.add(approval);
                     if (approvals.size() > i + 1 && approvals.get(i + 1).getType() != approval.getType()) {
                         detailList.add(detail);