Commit 4b3bafd8 by 陶然

init

parents
################################################################################
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/.vs
/Src/bin/Debug
/Src/obj/Debug
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Contents.Seeyon
{
internal static class Configs
{
internal static string BaseUrl = "http://zyoa.jst-gov.com";
internal static string RouteContentNew = "/seeyon/rest/news";
internal static string RouteNewsType = "/seeyon/rest/news/newsType/unit/670869647114347";
internal static string RouteRestToken = "/seeyon/rest/token";
internal static string accountId = "670869647114347";//单位Id,默认值,OA提供
internal static string restUserName = "rest";
internal static string restPassword = "fba09671-2b1e-4c8c-9aaf-de16821070df";
}
}
<?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>{26EAA5F9-E80A-4B02-82EB-4D720199A4A1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Kivii.Contents.Seeyon</RootNamespace>
<AssemblyName>Kivii.Third.Contents.Seeyon.V4.5</AssemblyName>
<TargetFrameworkVersion>v4.5</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="Kivii.Common.V4.5, Version=5.6.2023.6000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\JST\local.Jst\packages\Kivii.Common.5.6.2023.6000\lib\net45\Kivii.Common.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2023.6000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\JST\local.Jst\packages\Kivii.Core.5.6.2023.6000\lib\net45\Kivii.Core.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2023.4200, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\JST\local.Jst\packages\Kivii.Linq.5.6.2023.4200\lib\net45\Kivii.Linq.V4.5.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configs.cs" />
<Compile Include="Entities\ContentNew.cs" />
<Compile Include="NewExtension.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Transforms\RestfulNewsType.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Kivii.Biz.Contents\Src\Kivii.Biz.Contents.V4.5.csproj">
<Project>{c8694835-a43a-400c-b0fc-98d84298c91e}</Project>
<Name>Kivii.Biz.Contents.V4.5</Name>
</ProjectReference>
<ProjectReference Include="..\..\Kivii.Seeyon.Addons\Src\Kivii.Seeyon.Addons.V4.5.csproj">
<Project>{4304bea2-2f6c-41e6-976b-3b2bc63d3fe3}</Project>
<Name>Kivii.Seeyon.Addons.V4.5</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using Kivii.Auth;
using Kivii.Contents.Entities;
using Kivii.Contents.Seeyon.Entities;
using Kivii.Seeyon.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Contents.Seeyon.Extensions
{
internal static class NewExtension
{
public static ResponseToken RequestRestToken(this JsonServiceClient client, string loginName)
{
if (client == null) throw new ArgumentNullException("client");
if (loginName.IsNullOrEmpty()) throw new ArgumentNullException("loginName");
var request = new RequestRestToken();
request.userName = Configs.restUserName;
request.password = Configs.restPassword;
request.loginName = loginName;
var rtns = client.Post<ResponseToken>($"{Configs.RouteRestToken}", request);
return rtns;
}
public static List<NewsType> GetNewsType(this JsonServiceClient client, IAuthSession session)
{
if (client == null) throw new ArgumentNullException("client");
var token = client.RequestRestToken(session.UserAuthName);
var rtns = client.Get<List<NewsType>>($"{Configs.RouteNewsType}?token={token.id}");
return rtns;
}
public static New_Content ConvertToNew(this ContentNew content, JsonServiceClient client, IAuthSession session)
{
var token = client.RequestRestToken(session.UserAuthName);
var rtns = new New_Content();
rtns.accountId = Configs.accountId;
rtns.typeId = content.typeId.IsNullOrEmpty() ? "" : content.typeId;
rtns.brief = content.Summary.IsNullOrEmpty() ? "" : content.Summary;
rtns.keywords = content.SubTitle.IsNullOrEmpty() ? "" : content.SubTitle;
rtns.publishDepartmentName = KiviiContext.CurrentMember.DepartmentName;
rtns.senderuser = token.bindingUser.loginName;
rtns.content = content.DisplayContent;
rtns.dataFormat = "HTML";
rtns.ext5 = "";
rtns.title = content.Title;
rtns.ext3 = "0";
rtns.state = "30";
rtns.publishDate = content.PublishDate == null ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : content.PublishDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
rtns.publishUserId = "";
rtns.createDate = content.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
rtns.ext1 = "0";
rtns.ext2 = content.ext2.IsNullOrEmpty() ? "0" : content.ext2;
rtns.showPublishUserFlag = content.showPublishUserFlag.IsNullOrEmpty() ? "true" : content.showPublishUserFlag;
rtns.readCount = "0";
rtns.attachmentsFlag = "false";
return rtns;
}
public static string RequestNew_Content(this JsonServiceClient client, New_Content request, IAuthSession session)
{
if (client == null) throw new ArgumentNullException("client");
if (request == null) throw new ArgumentNullException("request");
var json = Kivii.Text.JsonSerializer.SerializeToString(request);
Console.WriteLine(json);
var token = client.RequestRestToken(session.UserAuthName);
var rtns = client.Post<string>($"{Configs.RouteContentNew}?token={token.id}", request);
return rtns;
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Kivii.Third.Contents.Seeyon.V4.5")]
[assembly: AssemblyDescription("内容模块推送致远OA")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kivii.Third.Contents.Seeyon.V4.5")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("26eaa5f9-e80a-4b02-82eb-4d720199a4a1")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2023.9250")]
[assembly: AssemblyFileVersion("5.4.2023.9250")]
using Kivii.Contents.Seeyon.Entities;
using Kivii.Contents.Seeyon.Extensions;
using Kivii.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Contents.Seeyon.Transforms
{
[RequiresAnyRole(SystemRoles.Everyone)]
public class NewsTypeQuery : RestfulExecution<NewsType>
{
public override object OnExecution(IRequest req, IResponse res)
{
var client = new JsonServiceClient(Configs.BaseUrl);
var session = Request.GetSession();
var resp = client.GetNewsType(session);
var rtns = new RestfulQueryResponse<NewsType>();
rtns.Results = new List<NewsType>();
rtns.Results.AddRange(resp);
rtns.Total = rtns.Results.Count;
return rtns;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.6.2023.6000" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2023.6000" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2023.4200" targetFramework="net45" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment