Prechádzať zdrojové kódy

1、srm退回及单点

wanghaiwu 2 týždňov pred
rodič
commit
fe9a408130

+ 27 - 29
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/plugin/form/PayApplyBillSRMEditPlugin.java

@@ -29,18 +29,14 @@ public class PayApplyBillSRMEditPlugin extends AbstractBillPlugIn {
         super.afterDoOperation(afterDoOperationEventArgs);
 
         String opKey = afterDoOperationEventArgs.getOperateKey();
+        String srmUrl = (String)this.getModel().getValue("nckd_srmurl");
+
         if(StringUtils.equals("nckd_returnsrm", opKey)){
             OperationResult operationResult = afterDoOperationEventArgs.getOperationResult();
             operationResult.setShowMessage(false);
 
-            String ssoUrl = "";
             String message = operationResult.getMessage();
 
-            if(!StringUtils.isEmpty(message) && message.contains("获取单点地址:")){
-                ssoUrl = message.replace("获取单点地址:", "");
-
-                message = "";
-            }
             List<IOperateInfo> errorInfos = operationResult.getAllErrorOrValidateInfo();
             boolean isSuccess = operationResult.isSuccess();
             if(errorInfos.size()>0){
@@ -54,35 +50,37 @@ public class PayApplyBillSRMEditPlugin extends AbstractBillPlugIn {
 
             if(!StringUtils.isEmpty(message)) {
                 this.getView().showTipNotification(message);
+            } else if(!StringUtils.isEmpty(srmUrl)){
+                openSRMSSOLink();
+            }
+        } else if(StringUtils.equals("nckd_ssosrm", opKey)){
+            if(StringUtils.isEmpty(srmUrl)){
+                this.getView().showTipNotification("不是SRM生成的单据,不能单点到SRM系统");
             } else {
+                openSRMSSOLink();
+            }
+        }
+    }
+
+    /**
+     * 单点登录到srm系统
+     */
+    public void openSRMSSOLink(){
+        String ssourl = (String) this.getModel().getValue("nckd_srmurl");
+        Map<String, String> returnMap = SRMHelperUtils.buildSSOUrl(ssourl);
+
+        if(returnMap != null){
+            if("0".equals(returnMap.get("code"))) {
+                ssourl = returnMap.get("msg");
                 IClientViewProxy proxy = this.getView().getService(IClientViewProxy.class);
                 Map<String, String> mpUrl = new HashMap();
-                mpUrl.put("url", ssoUrl);
+                mpUrl.put("url", ssourl);
                 proxy.addAction("openUrl", mpUrl);
-            }
-        } else if(StringUtils.equals("nckd_ssosrm", opKey)){
-            if(this.getModel().getValue("nckd_srmurl") == null
-                    || "".equals(this.getModel().getValue("nckd_srmurl").toString())){
-                this.getView().showTipNotification("不是SRM生成的单据");
-                return;
             } else {
-                String ssourl = (String) this.getModel().getValue("nckd_srmurl");
-                Map<String, String> returnMap = SRMHelperUtils.buildSSOUrl(ssourl);
-
-                if(returnMap != null){
-                    if("0".equals(returnMap.get("code"))) {
-                        ssourl = returnMap.get("msg");
-                        IClientViewProxy proxy = this.getView().getService(IClientViewProxy.class);
-                        Map<String, String> mpUrl = new HashMap();
-                        mpUrl.put("url", ssourl);
-                        proxy.addAction("openUrl", mpUrl);
-                    } else {
-                        this.getView().showTipNotification(returnMap.get("msg"));
-                    }
-                } else {
-                    this.getView().showTipNotification("获取单点url失败");
-                }
+                this.getView().showTipNotification(returnMap.get("msg"));
             }
+        } else {
+            this.getView().showTipNotification("获取单点url失败");
         }
     }
 

+ 3 - 2
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/plugin/operate/PublicReimBillReturnOpPlugin.java

@@ -71,9 +71,10 @@ public class PublicReimBillReturnOpPlugin extends AbstractOperationServicePlugIn
                             errMessage.append(",");
                         }
                         errMessage.append("单据(" + billno + ")," + returnMap.get("msg"));
-                    } else {
-                        errMessage.append("获取单点地址:" + returnMap.get("msg"));
                     }
+//                    else {
+//                        errMessage.append("获取单点地址:" + returnMap.get("msg"));
+//                    }
                 }
             }
 

+ 5 - 2
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/plugin/operate/SRMHelperUtils.java

@@ -90,6 +90,7 @@ public class SRMHelperUtils {
             } else {//调接口成功后,获取单点登录链接
                 try {
                     billInfo.set("billstatus", "H");
+
                     SaveServiceHelper.update(new DynamicObject[]{billInfo});
                 } catch (Exception e){
                     returnMap.put("code", "1");
@@ -98,9 +99,11 @@ public class SRMHelperUtils {
                     return returnMap;
                 }
 
-                Map<String,String> ssomap = buildSSOUrl(srmurl);
+                return doReturnMap;
 
-                return ssomap;
+//                Map<String,String> ssomap = buildSSOUrl(srmurl);
+//
+//                return ssomap;
             }
         }