a
This commit is contained in:
113
00.未分类/VerifyTest/Ext_HomePagePlugin.cs
Normal file
113
00.未分类/VerifyTest/Ext_HomePagePlugin.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using Kingdee.BOS.Core;
|
||||
using Kingdee.BOS.Core.Bill;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.List;
|
||||
using Kingdee.BOS.Core.Metadata;
|
||||
using Kingdee.BOS.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Kingdee.BOS.Authentication;
|
||||
using Kingdee.BOS.App.Data;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.DataEntity;
|
||||
|
||||
|
||||
namespace Kingdee.BOS.Test.PlugIn.Basic
|
||||
{
|
||||
[HotUpdate, Description("主控台test")]
|
||||
public class Ext_HomePagePlugin : AbstractDynamicFormPlugIn
|
||||
{
|
||||
|
||||
public override void BarItemClick(Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
|
||||
{
|
||||
base.BarItemClick(e);
|
||||
DBUtils.Execute(this.Context,"");
|
||||
}
|
||||
|
||||
|
||||
public override void DataChanged(DataChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void AfterBindData(EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
base.AfterBindData(e);
|
||||
//隔离参数键值
|
||||
var isoKey = this.Context.SessionId + "_AutoLoginArgs";
|
||||
//获取客制化参数
|
||||
var cargs = HttpContext.Current.Application.Get(isoKey) as string;
|
||||
//清理Session
|
||||
var args = this.View.OpenParameter.GetCustomParameter(FormConst.StartAppArgs) as StartAppHomePageArgs;
|
||||
var args2= this.View.OpenSpecFormsByStartArgs();
|
||||
var args3 = this.View.GetStartAppHomePageArgs(); // 返回对象 StartAppHomePageArgs ,其中CustomArgs为自定义数据。
|
||||
|
||||
HttpContext.Current.Application.Remove(isoKey);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(cargs) && cargs.IndexOf('|') > 0)
|
||||
{
|
||||
var tmp = cargs.Split('|');
|
||||
string pageId = Guid.NewGuid().ToString();
|
||||
|
||||
// 显示单据, 使用 BillShowParameter
|
||||
|
||||
var showParam = new BillShowParameter()
|
||||
{
|
||||
FormId = tmp[0],
|
||||
PageId = pageId,
|
||||
Status = OperationStatus.EDIT
|
||||
};
|
||||
|
||||
showParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
|
||||
showParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
|
||||
showParam.OpenStyle.TagetKey = "FMAINTAB";
|
||||
|
||||
// 传入需要单据内码
|
||||
showParam.PKey = tmp[1];
|
||||
this.View.ShowForm(showParam);
|
||||
|
||||
//// 显示单据列表, 使用 ListShowParameter
|
||||
|
||||
//var showListParam = new ListShowParameter()
|
||||
//{
|
||||
// FormId = tmp[0],
|
||||
// PageId = Guid.NewGuid().ToString()
|
||||
//};
|
||||
|
||||
//showListParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
|
||||
//showListParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
|
||||
//showListParam.OpenStyle.TagetKey = "FMAINTAB";
|
||||
|
||||
//this.View.ShowForm(showListParam);
|
||||
}
|
||||
|
||||
//// 显示动态表单, 使用 DynamicFormShowParameter
|
||||
|
||||
//var showDyParam = new DynamicFormShowParameter()
|
||||
//{
|
||||
// FormId = "PUR_USERORDERPARAM",
|
||||
// PageId = Guid.NewGuid().ToString()
|
||||
//};
|
||||
|
||||
//showDyParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
|
||||
//showDyParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
|
||||
//showDyParam.OpenStyle.TagetKey = "FMAINTAB";
|
||||
|
||||
//this.View.ShowForm(showDyParam);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void AfterCreateNewData(EventArgs e)
|
||||
{
|
||||
base.AfterCreateNewData(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
163
00.未分类/VerifyTest/MacVerify.cs
Normal file
163
00.未分类/VerifyTest/MacVerify.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
using Kingdee.BOS.Authentication;
|
||||
using Kingdee.BOS.JSON;
|
||||
using Kingdee.BOS.ServiceFacade.KDServiceFx;
|
||||
using Kingdee.BOS.ServiceFacade.ServicesStub;
|
||||
using Kingdee.BOS.Resource;
|
||||
using System.Web;
|
||||
namespace Kingdee.BOS.ServiceFacade.StartApp
|
||||
{
|
||||
public class MacVerify : StartAppVerifyServiceBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 客制化参数映射到用户信息,或域签名串映射到用户信息存储池,也可以是数据库
|
||||
/// </summary>
|
||||
static ConcurrentDictionary<string, string> customArgsMapUser = new ConcurrentDictionary<string, string>();
|
||||
static MacVerify()
|
||||
{
|
||||
customArgsMapUser["testautologinwithdemo"] = "demo|123qwe!@#|金蝶蓝海实业集团";
|
||||
}
|
||||
/// <summary>
|
||||
/// 随机测试标识,仅用于模拟各种启动校验结果的返回判定
|
||||
/// </summary>
|
||||
static int randomFlag = 0;
|
||||
/// <summary>
|
||||
/// 实现登录服务处理接口,在程序启动界面加入参数 "ud=TestAutoLoginWithDemo" 即可实现自动用Demo用户登录CPDEMOV5数据中心
|
||||
/// 例如:
|
||||
/// WEB的Silverlight: http://xxxx/k3cloud/silverlight/index.aspx?ud=TestAutoLoginWithDemo
|
||||
/// WEB的HTML5:http://xxxx/k3cloud/html5/index.aspx?ud=TestAutoLoginWithDemo
|
||||
/// </summary>
|
||||
public override StartAppResult Verify(KDServiceContext context, string ipmac)
|
||||
{
|
||||
var ret = this.Verify(ipmac);
|
||||
if (ret.ResultType == StartAppResultType.Success)
|
||||
{
|
||||
var data = JSONObject.Parse(ipmac);
|
||||
VerifyLogin(context, ret, data);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
/// 实现登录校验的例子的私有函数
|
||||
/// </summary>
|
||||
private void VerifyLogin(KDServiceContext context, StartAppResult ret, JSONObject data)
|
||||
{
|
||||
//实现自动登录功能
|
||||
var customArgs = data.GetValue<string>("customArgs", "");//ud用户定义参数将会传递到服务端插件的customArgs中
|
||||
var isAutoLogin = !string.IsNullOrWhiteSpace(customArgs);
|
||||
if (isAutoLogin && context != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
//不一定非得从data中传进来这些信息,
|
||||
//也可以通过Mac映射到数据库中的某个记录,从中读取登录信息,
|
||||
//包括用户名、密码和数据库id,已经对应的语种id
|
||||
//这里只是Demo而已
|
||||
var userInfoStr = "";
|
||||
var key = customArgs.ToLowerInvariant();
|
||||
customArgsMapUser.TryGetValue(key, out userInfoStr);
|
||||
if (string.IsNullOrWhiteSpace(userInfoStr))
|
||||
userInfoStr = "";
|
||||
var userInfo = userInfoStr.Split('|');
|
||||
var un = userInfo.Length > 2 ? userInfo[0] : "";
|
||||
var pw = userInfo.Length > 2 ? userInfo[1] : "";
|
||||
var dbname = userInfo.Length > 2 ? userInfo[2] : "";
|
||||
var pluginLoginInfo = new PluginLoginInfo()
|
||||
{
|
||||
//AcctID = "xxxxxx", //AcctID如果传递,将不再通过AcctName查找AcctID了。
|
||||
//LoginType = PluginLoginType.Common, //默认为用户名密码的通用登录方式。 //PluginLoginInfo.AuthenticateType = Kingdee.BOS.Authentication.AuthenticationType.DynamicPwdAuthentication, // 动态密码验证方式
|
||||
AcctName = dbname,
|
||||
Username = un,
|
||||
Password = pw,
|
||||
ClientInfo = GetClientInfo(context, data) //基类静态工具方法
|
||||
};
|
||||
//调用基类静态工具方法实现登录验证,并返回ret.UserToken,给客户端实现自动登录
|
||||
DoLoginCore(context, ret, pluginLoginInfo);
|
||||
//登录后的参数传入,具体使用参考【自动打开单据】
|
||||
if (!string.IsNullOrWhiteSpace(ret.SessionId))
|
||||
{
|
||||
var isoKey = ret.SessionId + "_AutoLoginArgs";
|
||||
//登陆成功后,加入自定义参数
|
||||
HttpContext.Current.Application.Set(isoKey, "PUR_PurchaseOrder|100001");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ret.ResultType = StartAppResultType.Failure;
|
||||
ret.FailureCallBackType = StartAppResultCallBackType.Message;
|
||||
ret.Message = ex.Message + "\r\n" + ex.StackTrace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实现基类访问校验接口,如果没有该业务需求,可以不实现,使用基类的接口即可。
|
||||
/// </summary>
|
||||
public override StartAppResult Verify(string ipmac)
|
||||
{
|
||||
randomFlag++;
|
||||
StartAppResult ret = null;
|
||||
var data = JSONObject.Parse(ipmac);
|
||||
var flag = randomFlag % 5;
|
||||
flag = 5;
|
||||
switch (flag)
|
||||
{
|
||||
case 4:
|
||||
// 提示后退出并重定向到指定页面
|
||||
ret = GetResult(StartAppResultCallBackType.ExitMsg_Redirect, ipmac);
|
||||
break;
|
||||
case 3:
|
||||
// 退出并重定向到指定页面(不做任何提示)
|
||||
ret = GetResult(StartAppResultCallBackType.Exit_Redirect, ipmac);
|
||||
break;
|
||||
case 2:
|
||||
// 退出并提示
|
||||
ret = GetResult(StartAppResultCallBackType.ExitMsg, ipmac);
|
||||
break;
|
||||
case 1:
|
||||
// 提示信息(不退出程序)
|
||||
ret = GetResult(StartAppResultCallBackType.Message, ipmac);
|
||||
break;
|
||||
default:
|
||||
ret = new StartAppResult()
|
||||
{
|
||||
ResultType = StartAppResultType.Success
|
||||
};
|
||||
randomFlag = 0;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
/// 构造返回结果
|
||||
/// </summary>
|
||||
/// <param name="fcbType">返回回调类型</param>
|
||||
/// <returns></returns>
|
||||
private static StartAppResult GetResult(StartAppResultCallBackType fcbType, string attMsg)
|
||||
{
|
||||
var ret = new StartAppResult()
|
||||
{
|
||||
FailureCallBackType = fcbType,
|
||||
// 成功Sucess:正常登录
|
||||
ResultType = StartAppResultType.Failure,
|
||||
|
||||
// 外部网址:RedirectUrl = "http://www.kingdee.com"
|
||||
// 空白页:RedirectUrl = "about:blank"
|
||||
// 失败后重定向URL,可以是相对路径也可以是绝对路径,相对路径已K3Cloud为基地址,例如:http://xxxx/k3cloud/
|
||||
RedirectUrl = "help/clienthelp.htm",
|
||||
ExitType = StartAppResultExitType.Shutdown,
|
||||
|
||||
Title = "温馨提示" + "0022883030028663",
|
||||
Message = "网站正在维护中 ... ..." + "0022883030028642" +
|
||||
"\r\n" + attMsg
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
00.未分类/VerifyTest/Properties/AssemblyInfo.cs
Normal file
36
00.未分类/VerifyTest/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("VerifyTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("VerifyTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("89c1a54b-6fb2-4dbe-a36e-f21650623538")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
69
00.未分类/VerifyTest/VerifyTest.csproj
Normal file
69
00.未分类/VerifyTest/VerifyTest.csproj
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{89C1A54B-6FB2-4DBE-A36E-F21650623538}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>VerifyTest</RootNamespace>
|
||||
<AssemblyName>VerifyTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Kingdee.BOS">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.App, Version=8.2.830.9, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.App.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.Business.PlugIn">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.Business.PlugIn.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.Core, Version=8.2.830.9, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.ServiceFacade.KDServiceFx">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.ServiceFacade.KDServiceFx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.ServiceFacade.ServicesStub">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.ServiceFacade.ServicesStub.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Ext_HomePagePlugin.cs" />
|
||||
<Compile Include="MacVerify.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user