Commit d54cb379 authored by zhanglongtao's avatar zhanglongtao

add registry service

parents
Pipeline #138 canceled with stages
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
\ No newline at end of file
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F10AA149-2626-486E-85BB-9CD5365F3016}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.Registry.Core", "src\HYH.Registry.Core\HYH.Registry.Core.csproj", "{0FA75A5B-AB83-4FD0-B545-279774C01E87}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.Registry.Application", "src\HYH.Registry.Application\HYH.Registry.Application.csproj", "{3870C648-4AEA-4B85-BA3F-F2F63B96136A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.Registry.EntityFrameworkCore", "src\HYH.Registry.EntityFrameworkCore\HYH.Registry.EntityFrameworkCore.csproj", "{DC780BC4-4EAC-4C63-9052-6F3169A59FA4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HYH.Framework", "HYH.Framework", "{CD887CE6-12D6-4AED-9EA4-7517C68D352E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.AspNetCore", "..\HYH.Framework\HYH.AspNetCore\HYH.AspNetCore.csproj", "{0823BD7E-64FE-4D7C-BB71-E097D0D0D9D8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.Core", "..\HYH.Framework\HYH.Core\HYH.Core.csproj", "{0920877D-4735-451A-982E-9EC5D96555D4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.EntityFramework", "..\HYH.Framework\HYH.EntityFramework\HYH.EntityFramework.csproj", "{84D240BC-C55E-4830-982C-482457C2E5D6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.RegistryHost.ConsulRegistry", "..\HYH.Framework\HYH.RegistryHost.ConsulRegistry\HYH.RegistryHost.ConsulRegistry.csproj", "{4A8378EE-5982-4DD2-B777-818A11F4776A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.Registry.Web.Host", "src\HYH.Registry.Web.Host\HYH.Registry.Web.Host.csproj", "{B1285F03-30C9-4464-8D3A-D0F33D9B4354}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.RegistryTests", "test\HYH.Registry.Tests\HYH.RegistryTests.csproj", "{CD60CF8F-FA1B-4EF4-93DB-0D3EAFAA5FB0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.MongonDb", "..\HYH.Framework\HYH.MongonDb\HYH.MongonDb.csproj", "{5FD0CD75-C059-4107-8D3A-F6B8674AC4BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HYH.SqlSugar", "..\HYH.Framework\HYH.SqlSugar\HYH.SqlSugar.csproj", "{A34CADFB-5939-4E6C-A488-ABC8727ADF7E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FA75A5B-AB83-4FD0-B545-279774C01E87}.Release|Any CPU.Build.0 = Release|Any CPU
{3870C648-4AEA-4B85-BA3F-F2F63B96136A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3870C648-4AEA-4B85-BA3F-F2F63B96136A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3870C648-4AEA-4B85-BA3F-F2F63B96136A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3870C648-4AEA-4B85-BA3F-F2F63B96136A}.Release|Any CPU.Build.0 = Release|Any CPU
{DC780BC4-4EAC-4C63-9052-6F3169A59FA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC780BC4-4EAC-4C63-9052-6F3169A59FA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC780BC4-4EAC-4C63-9052-6F3169A59FA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC780BC4-4EAC-4C63-9052-6F3169A59FA4}.Release|Any CPU.Build.0 = Release|Any CPU
{0823BD7E-64FE-4D7C-BB71-E097D0D0D9D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0823BD7E-64FE-4D7C-BB71-E097D0D0D9D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0823BD7E-64FE-4D7C-BB71-E097D0D0D9D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0823BD7E-64FE-4D7C-BB71-E097D0D0D9D8}.Release|Any CPU.Build.0 = Release|Any CPU
{0920877D-4735-451A-982E-9EC5D96555D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0920877D-4735-451A-982E-9EC5D96555D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0920877D-4735-451A-982E-9EC5D96555D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0920877D-4735-451A-982E-9EC5D96555D4}.Release|Any CPU.Build.0 = Release|Any CPU
{84D240BC-C55E-4830-982C-482457C2E5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{84D240BC-C55E-4830-982C-482457C2E5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84D240BC-C55E-4830-982C-482457C2E5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84D240BC-C55E-4830-982C-482457C2E5D6}.Release|Any CPU.Build.0 = Release|Any CPU
{4A8378EE-5982-4DD2-B777-818A11F4776A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A8378EE-5982-4DD2-B777-818A11F4776A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A8378EE-5982-4DD2-B777-818A11F4776A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A8378EE-5982-4DD2-B777-818A11F4776A}.Release|Any CPU.Build.0 = Release|Any CPU
{B1285F03-30C9-4464-8D3A-D0F33D9B4354}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1285F03-30C9-4464-8D3A-D0F33D9B4354}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1285F03-30C9-4464-8D3A-D0F33D9B4354}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1285F03-30C9-4464-8D3A-D0F33D9B4354}.Release|Any CPU.Build.0 = Release|Any CPU
{CD60CF8F-FA1B-4EF4-93DB-0D3EAFAA5FB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD60CF8F-FA1B-4EF4-93DB-0D3EAFAA5FB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD60CF8F-FA1B-4EF4-93DB-0D3EAFAA5FB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD60CF8F-FA1B-4EF4-93DB-0D3EAFAA5FB0}.Release|Any CPU.Build.0 = Release|Any CPU
{5FD0CD75-C059-4107-8D3A-F6B8674AC4BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FD0CD75-C059-4107-8D3A-F6B8674AC4BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FD0CD75-C059-4107-8D3A-F6B8674AC4BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FD0CD75-C059-4107-8D3A-F6B8674AC4BC}.Release|Any CPU.Build.0 = Release|Any CPU
{A34CADFB-5939-4E6C-A488-ABC8727ADF7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A34CADFB-5939-4E6C-A488-ABC8727ADF7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A34CADFB-5939-4E6C-A488-ABC8727ADF7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A34CADFB-5939-4E6C-A488-ABC8727ADF7E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0FA75A5B-AB83-4FD0-B545-279774C01E87} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{3870C648-4AEA-4B85-BA3F-F2F63B96136A} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{DC780BC4-4EAC-4C63-9052-6F3169A59FA4} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{CD887CE6-12D6-4AED-9EA4-7517C68D352E} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{0823BD7E-64FE-4D7C-BB71-E097D0D0D9D8} = {CD887CE6-12D6-4AED-9EA4-7517C68D352E}
{0920877D-4735-451A-982E-9EC5D96555D4} = {CD887CE6-12D6-4AED-9EA4-7517C68D352E}
{84D240BC-C55E-4830-982C-482457C2E5D6} = {CD887CE6-12D6-4AED-9EA4-7517C68D352E}
{4A8378EE-5982-4DD2-B777-818A11F4776A} = {CD887CE6-12D6-4AED-9EA4-7517C68D352E}
{B1285F03-30C9-4464-8D3A-D0F33D9B4354} = {AFAA0841-BD93-466F-B8F4-FB4EEC86F1FC}
{CD60CF8F-FA1B-4EF4-93DB-0D3EAFAA5FB0} = {F10AA149-2626-486E-85BB-9CD5365F3016}
{5FD0CD75-C059-4107-8D3A-F6B8674AC4BC} = {CD887CE6-12D6-4AED-9EA4-7517C68D352E}
{A34CADFB-5939-4E6C-A488-ABC8727ADF7E} = {CD887CE6-12D6-4AED-9EA4-7517C68D352E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B516B1E8-1CEC-4BCC-BA92-93CB32845E37}
EndGlobalSection
EndGlobal
using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.Text;
namespace HYH.Registry.Core
{
/// <summary>
/// 基础类库字段,隐藏删除相关属性
/// </summary>
public class BaseEntity: AuditedEntity
{
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace HYH.Registry.Core
{
/// <summary>
/// 基础Service
/// </summary>
public class BaseService:RegistryAppServiceBase
{
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0.0</Version>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>HYH.Registry.Application</AssemblyName>
<PackageId>HYH.Registry.Application</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace>HYH.Registry</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>..\HYH.Registry.Web.Host\HYH.Registry.Application.xml</DocumentationFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Dtos\**" />
<Compile Remove="Services\MaterialPlacode\**" />
<Compile Remove="Services\MaterialPowder\**" />
<EmbeddedResource Remove="Dtos\**" />
<EmbeddedResource Remove="Services\MaterialPlacode\**" />
<EmbeddedResource Remove="Services\MaterialPowder\**" />
<None Remove="Dtos\**" />
<None Remove="Services\MaterialPlacode\**" />
<None Remove="Services\MaterialPowder\**" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\HYH.Framework\HYH.AspNetCore\HYH.AspNetCore.csproj" />
<ProjectReference Include="..\..\..\HYH.Framework\HYH.SqlSugar\HYH.SqlSugar.csproj" />
<ProjectReference Include="..\HYH.Registry.Core\HYH.Registry.Core.csproj" />
<ProjectReference Include="..\HYH.Registry.EntityFrameworkCore\HYH.Registry.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Abp.AutoMapper" Version="5.0.0" />
<PackageReference Include="System.Management" Version="5.0.0" />
</ItemGroup>
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HYH.Registry.Application")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3870c648-4aea-4b85-ba3f-f2f63b96136a")]
using Abp.Application.Services;
namespace HYH.Registry
{
/// <summary>
/// Derive your application services from this class.
/// </summary>
public abstract class RegistryAppServiceBase : ApplicationService
{
protected RegistryAppServiceBase()
{
LocalizationSourceName = RegistryConsts.LocalizationSourceName;
}
}
}
\ No newline at end of file
using Abp.AutoMapper;
using Abp.Modules;
using Abp.Reflection.Extensions;
using AutoMapper;
using HYH.Core;
using HYH.Core.Utilities;
using HYH.Registry.Nodes;
using System.Linq;
using System.Reflection;
namespace HYH.Registry
{
[DependsOn(
typeof(RegistryCoreModule),
typeof(AbpAutoMapperModule))]
public class RegistryApplicationModule : AbpModule
{
private Assembly thisAssembly;
public override void Initialize()
{
thisAssembly = typeof(RegistryApplicationModule).GetAssembly();
IocManager.RegisterAssemblyByConvention(thisAssembly);
var profiles = thisAssembly.GetTypes().Where(x => typeof(Profile).IsAssignableFrom(x));
Configuration.Modules.AbpAutoMapper().Configurators.Add(
cfg =>
{
foreach (var profile in profiles)
{
var resolvedProfile = IocManager.Resolve(profile) as Profile;
cfg.AddProfile(resolvedProfile);
}
}
);
}
public override void PreInitialize()
{
Configuration.Modules.AbpAutoMapper().Configurators.Add(config =>
{
});
}
public override void PostInitialize()
{
base.PostInitialize();
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace HYH.Registry.Services.Encryption
{
public class AESHelper
{
/// <summary>
/// AES加密
/// </summary>
/// <param name="Data">被加密的明文</param>
/// <param name="Key">密钥</param>
/// <param name="Vector">向量</param>
/// <returns>密文</returns>
public static String AESEncrypt(String Data, String Key, String Vector)
{
Byte[] plainBytes = Encoding.UTF8.GetBytes(Data);
Byte[] bKey = new Byte[32];
Array.Copy(Encoding.UTF8.GetBytes(Key.PadRight(bKey.Length)), bKey, bKey.Length);
Byte[] bVector = new Byte[16];
Array.Copy(Encoding.UTF8.GetBytes(Vector.PadRight(bVector.Length)), bVector, bVector.Length);
Byte[] Cryptograph = null; // 加密后的密文
Rijndael Aes = Rijndael.Create();
try
{
// 开辟一块内存流
using (MemoryStream Memory = new MemoryStream())
{
// 把内存流对象包装成加密流对象
using (CryptoStream Encryptor = new CryptoStream(Memory, Aes.CreateEncryptor(bKey, bVector), CryptoStreamMode.Write))
{
// 明文数据写入加密流
Encryptor.Write(plainBytes, 0, plainBytes.Length);
Encryptor.FlushFinalBlock();
Cryptograph = Memory.ToArray();
//Cryptograph = new Byte[64];
//Array.Copy(b, Cryptograph, Cryptograph.Length);
}
}
}
catch (Exception ex)
{
string e = ex.Message;
Cryptograph = null;
}
return Convert.ToBase64String(Cryptograph);
}
/// <summary>
/// AES解密
/// </summary>
/// <param name="Data">被解密的密文</param>
/// <param name="Key">密钥</param>
/// <param name="Vector">向量</param>
/// <returns>明文</returns>
public static String AESDecrypt(String Data, String Key, String Vector)
{
Byte[] encryptedBytes = Convert.FromBase64String(Data);
Byte[] bKey = new Byte[32];
Array.Copy(Encoding.UTF8.GetBytes(Key.PadRight(bKey.Length)), bKey, bKey.Length);
Byte[] bVector = new Byte[16];
Array.Copy(Encoding.UTF8.GetBytes(Vector.PadRight(bVector.Length)), bVector, bVector.Length);
Byte[] original = null; // 解密后的明文
Rijndael Aes = Rijndael.Create();
try
{
// 开辟一块内存流,存储密文
using (MemoryStream Memory = new MemoryStream(encryptedBytes))
{
// 把内存流对象包装成加密流对象
using (CryptoStream Decryptor = new CryptoStream(Memory,
Aes.CreateDecryptor(bKey, bVector),
CryptoStreamMode.Read))
{
// 明文存储区
using (MemoryStream originalMemory = new MemoryStream())
{
Byte[] Buffer = new Byte[1024];
Int32 readBytes = 0;
while ((readBytes = Decryptor.Read(Buffer, 0, Buffer.Length)) > 0)
{
originalMemory.Write(Buffer, 0, readBytes);
}
original = originalMemory.ToArray();
}
}
}
}
catch (Exception ex)
{
string e = ex.Message;
original = null;
}
return Encoding.UTF8.GetString(original);
}
}
}
using System;
using System.Collections.Generic;
using System.Management;
using System.Net.NetworkInformation;
using System.Text;
namespace HYH.Registry.Services.Encryption
{
public static class ComputerInfoHelper
{
//获取硬盘序列号
public static string GetHardDiskSerialNumber()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");
string sHardDiskSerialNumber = "";
foreach (ManagementObject mo in searcher.Get())
{
sHardDiskSerialNumber = mo["SerialNumber"].ToString().Trim();
break;
}
return sHardDiskSerialNumber;
}
catch
{
return "";
}
}
//获取网卡地址
public static string GetNetCardMACAddress()
{
try
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapter WHERE ((MACAddress Is Not NULL) AND (Manufacturer <> 'Microsoft'))");
string NetCardMACAddress = "";
foreach (ManagementObject mo in searcher.Get())
{
NetCardMACAddress = mo["MACAddress"].ToString().Trim();
break;
}
return NetCardMACAddress;
}
catch
{
return "";
}
}
/// <summary>
/// 获取电脑 MAC(物理) 地址
/// </summary>
/// <returns></returns>
public static string GetMACIp()
{
//本地计算机网络连接信息
IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
//获取本机所有网络连接
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
//获取本机电脑名
var HostName = computerProperties.HostName;
//获取域名
var DomainName = computerProperties.DomainName;
if (nics == null || nics.Length < 1)
{
return "";
}
var MACIp = "";
foreach (NetworkInterface adapter in nics)
{
string macip = "";
var adapterName = adapter.Name;
var adapterDescription = adapter.Description;
var NetworkInterfaceType = adapter.NetworkInterfaceType;
//if (adapterName.Contains("本地连接"))
//{
PhysicalAddress address = adapter.GetPhysicalAddress();
byte[] bytes = address.GetAddressBytes();
for (int i = 0; i < bytes.Length; i++)
{
macip += bytes[i].ToString("X2");
if (i != bytes.Length - 1)
{
macip += "-";
}
}
//}
MACIp += "[" + adapterName + ":" + macip + ";] ";
}
return MACIp;
}
}
}
using Abp.Application.Services;
using Abp.Domain.Repositories;
using HYH.AspNetCore;
using HYH.Core.DbModels;
using HYH.Registry.EntityFrameworkCore;
using HYH.SqlSugarCore;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
namespace HYH.Registry.Services.Encryption
{
/// <summary>
///
/// </summary>
public class EncryptionService : ApplicationService
{
private readonly ICurrentUser _currentUser;
private readonly RegistryDbContext _dbContext;
private readonly DbContext<Tenant> _dbTenant;
private readonly IRepository<Tenant, int> _repTenant;
/// <summary>
/// 构造函数
///</summary>
public EncryptionService(
ICurrentUser currentUser,
RegistryDbContext dbContext,
DbContext<Tenant> dbTenant,
IRepository<Tenant, int> repTenant)
{
_currentUser = currentUser;
_dbContext = dbContext;
_dbTenant = dbTenant;
_repTenant = repTenant;
}
/// <summary>
/// 获取Mac地址
/// </summary>
/// <returns></returns>
[HttpGet]
public string GetNetCardMACAddress()
{
string netCardMACAddress = ComputerInfoHelper.GetNetCardMACAddress();
return netCardMACAddress;
}
/// <summary>
/// 获取Mac地址
/// </summary>
/// <returns></returns>
[HttpGet]
public string GetMACIp()
{
string netCardMACAddress = ComputerInfoHelper.GetMACIp();
return netCardMACAddress;
}
/// <summary>
/// 获取硬盘序列号
/// </summary>
/// <returns></returns>
[HttpGet]
public string GetHardDiskSerialNumber()
{
string hardDiskSerialNumber = ComputerInfoHelper.GetHardDiskSerialNumber();
return hardDiskSerialNumber;
}
/// <summary>
/// 合成码
/// </summary>
/// <returns></returns>
[HttpGet]
public string GetGeneratedCode()
{
string netCardMACAddress = ComputerInfoHelper.GetNetCardMACAddress();
string hardDiskSerialNumber = ComputerInfoHelper.GetHardDiskSerialNumber();
string data = netCardMACAddress + hardDiskSerialNumber;
var dataLen = data.Length;
var result = AESHelper.AESEncrypt(data, "jianzhukeji", "jzkj");
var length = result.Length;
return result;
}
/// <summary>
/// 生成密文
/// </summary>
/// <returns></returns>
[HttpGet]
public string GetGeneratingCiphertext(string input)
{
string data = AESHelper.AESDecrypt(input, "jianzhukeji", "jzkj");
string code = _currentUser.TenantCode;
var tenant = _repTenant.FirstOrDefault(q => q.Code == code);
string day = (tenant.EndTime - tenant.StartTime).ToString();
string companyName = tenant.Name;
data += "365" + "北京见著科技";
var datalen = data.Length;
var result = AESHelper.AESEncrypt(data, "jianzhukeji", "jzkj");
var length = result.Length;
return result;
}
}
}
using HYH.Registry.Core;
using System;
using System.ComponentModel.DataAnnotations;
namespace HYH.Registry.Dtos
{
/// <summary>
/// author: henq
/// time: 2019/12/4 18:27:14
///
///</summary>
/*
//在 DbContent 中注册
public DbSet<MaterialPlacode> MaterialPlacodes { get; set; }
//在 ApplicationModule.cs 关联映射
config.CreateMap<MaterialPlacode, MaterialPlacodeDto>();
config.CreateMap<MaterialPlacodeCreateDto, MaterialPlacode>();
config.CreateMap<MaterialPlacodeEditDto, MaterialPlacode>();
config.CreateMap<MaterialPlacode,MaterialPlacodeListDto>();
*/
#region Dto
public class MaterialPlacodeDto : BaseEntity
{
/// <summary>
/// 基板编码
/// </summary>
[StringLength(200)]
public string SubstrateCoding { get; set; }
/// <summary>
/// 基板材质
/// </summary>
[StringLength(200)]
public string BaseMaterial { get; set; }
/// <summary>
/// 材料编号
/// </summary>
[StringLength(200)]
public string MaterialNumber { get; set; }
/// <summary>
/// 适用设备
/// </summary>
[StringLength(200)]
public string ApplyToEquipment { get; set; }
/// <summary>
/// 厚度
/// </summary>
public double Thickness { get; set; }
/// <summary>
/// 状态
/// </summary>
public Int16 State { get; set; }
/// <summary>
/// 所处位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 库存
/// </summary>
public double Inventory { get; set; }
/// <summary>
/// 最低库存
/// </summary>
public double MinimumInventory { get; set; }
/// <summary>
/// 可用库存
/// </summary>
public double AvailableInStock { get; set; }
}
#endregion
#region CreateDto
public class MaterialPlacodeCreateDto : BaseEntity
{
/// <summary>
/// 基板编码
/// </summary>
[StringLength(200)]
public string SubstrateCoding { get; set; }
/// <summary>
/// 基板材质
/// </summary>
[StringLength(200)]
public string BaseMaterial { get; set; }
/// <summary>
/// 材料编号
/// </summary>
[StringLength(200)]
public string MaterialNumber { get; set; }
/// <summary>
/// 适用设备
/// </summary>
[StringLength(200)]
public string ApplyToEquipment { get; set; }
/// <summary>
/// 厚度
/// </summary>
public double Thickness { get; set; }
/// <summary>
/// 状态
/// </summary>
public Int16 State { get; set; }
/// <summary>
/// 所处位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 库存
/// </summary>
public double Inventory { get; set; }
/// <summary>
/// 最低库存
/// </summary>
public double MinimumInventory { get; set; }
/// <summary>
/// 可用库存
/// </summary>
public double AvailableInStock { get; set; }
}
#endregion
#region EditDto
public class MaterialPlacodeEditDto : MaterialPlacodeCreateDto
{
}
#endregion
#region ListDto
public class MaterialPlacodeListDto : BaseEntity
{
/// <summary>
/// 基板编码
/// </summary>
[StringLength(200)]
public string SubstrateCoding { get; set; }
/// <summary>
/// 基板材质
/// </summary>
[StringLength(200)]
public string BaseMaterial { get; set; }
/// <summary>
/// 材料编号
/// </summary>
[StringLength(200)]
public string MaterialNumber { get; set; }
/// <summary>
/// 适用设备
/// </summary>
[StringLength(200)]
public string ApplyToEquipment { get; set; }
/// <summary>
/// 厚度
/// </summary>
public double Thickness { get; set; }
/// <summary>
/// 状态
/// </summary>
public Int16 State { get; set; }
/// <summary>
/// 所处位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 库存
/// </summary>
public double Inventory { get; set; }
/// <summary>
/// 最低库存
/// </summary>
public double MinimumInventory { get; set; }
/// <summary>
/// 可用库存
/// </summary>
public double AvailableInStock { get; set; }
}
#endregion
}
using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using HYH.Registry.Core;
using HYH.Registry.DbModels;
using HYH.Registry.Dtos;
using HYH.Registry.Core;
namespace HYH.Registry.Service
{
/// <summary>
/// MaterialPlacode
///
///应用层服务的接口实现方法
///</summary>
public class MaterialPlacodeAppService : BaseService
{
private readonly IRepository<MaterialPlacode, int> _rep;
/// <summary>
/// 构造函数
///</summary>
public MaterialPlacodeAppService (IRepository<MaterialPlacode, int> entityRepository )
{
_rep = entityRepository;
}
#region 自动生成服务代码
/// <summary>
/// 获取分页列表信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<PagedResultDto<MaterialPlacodeListDto>> Paged(PageRequestDto<MaterialPlacodeDto> input)
{
var query = _rep.GetAll();
// TODO:根据传入的参数添加过滤条件
int pageSize = input.PageSize > 0 ? input.PageSize : Int32.MaxValue;
int current = input.PageIndex > 0 ? input.PageIndex : 1;
var count = await query.CountAsync();
var entityList = await query
.OrderByDescending(u=>u.Id).AsNoTracking()
.PageBy((current-1)*pageSize,pageSize)
.ToListAsync();
var entityListDtos =entityList.MapTo<List<MaterialPlacodeListDto>>();
return new PagedResultDto<MaterialPlacodeListDto> (count,entityListDtos);
}
/// <summary>
/// 获取编辑的MaterialPlacode
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<MaterialPlacodeDto> Get(NullableIdDto<int> input)
{
MaterialPlacodeDto editDto;
var entity = await _rep.GetAsync(input.Id.Value);
editDto = entity.MapTo<MaterialPlacodeDto>();
return editDto;
}
/// <summary>
/// 添加MaterialPlacode
///</summary>
public virtual async Task<IActionResult> Create(MaterialPlacodeCreateDto input)
{
//TODO:新增前的逻辑判断,是否允许新增
var entity=input.MapTo<MaterialPlacode>();
int id = await _rep.InsertAndGetIdAsync(entity);
return new JsonResult(id>0?true:false);
}
/// <summary>
/// 编辑
/// </summary>
public virtual async Task<IActionResult> Update(MaterialPlacodeEditDto input)
{
//TODO:更新前的逻辑判断,是否允许更新
var entity = await _rep.GetAsync(input.Id);
input.MapTo(entity);
await _rep.UpdateAsync(entity);
return new JsonResult(true);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<IActionResult> Delete(EntityDto<int> input)
{
//TODO:删除前的逻辑判断,是否允许删除
await _rep.DeleteAsync(input.Id);
return new JsonResult(true);
}
/// <summary>
/// 批量删除的方法
///</summary>
public async Task<IActionResult> BatchDelete(List<int> input)
{
// TODO:批量删除前的逻辑判断,是否允许删除
await _rep.DeleteAsync(s => input.Contains(s.Id));
return new JsonResult(true);
}
#endregion
}
}
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HYH.Registry.Core;
namespace HYH.Registry.Dtos
{
/// <summary>
/// author: henq
/// time: 2019/12/4 14:13:34
///
///</summary>
#region Dto
public class MaterialPowderDto: BaseEntity
{
/// <summary>
/// 编码
/// </summary>
[StringLength(200)]
public string Coding { get; set; }
/// <summary>
/// 名称
/// </summary>
[StringLength(200)]
public string Name { get; set; }
/// <summary>
/// 牌号
/// </summary>
[StringLength(200)]
public string Brand { get; set; }
/// <summary>
/// 规格
/// </summary>
[StringLength(200)]
public string Specifications { get; set; }
/// <summary>
/// 原厂家
/// </summary>
[StringLength(200)]
public string OriginalManufacturer { get; set; }
/// <summary>
/// 批次号
/// </summary>
[StringLength(200)]
public string BatchNo { get; set; }
/// <summary>
/// 剩余量(kg)
/// </summary>
public double RemainingAmount { get; set; }
/// <summary>
/// 入库总量(kg)
/// </summary>
public double TotalInventory { get; set; }
/// <summary>
/// 单价(元/kg)
/// </summary>
[StringLength(200)]
public string UnitPrice { get; set; }
/// <summary>
/// 合格证
/// </summary>
[StringLength(200)]
public string CertificateOfApproval { get; set; }
/// <summary>
/// 库房库位
/// </summary>
public int StoreId { get; set; }
/// <summary>
/// 位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 类别
/// </summary>
public Int16 Category { get; set; }
/// <summary>
/// 复验日期
/// </summary>
public DateTime ReinspectionDate { get; set; }
/// <summary>
/// 复验状态
/// </summary>
[StringLength(200)]
public string ReinspectionStatus { get; set; }
}
#endregion
#region CreateDto
public class MaterialPowderCreateDto: BaseEntity
{
/// <summary>
/// 编码
/// </summary>
[StringLength(200)]
public string Coding { get; set; }
/// <summary>
/// 名称
/// </summary>
[StringLength(200)]
public string Name { get; set; }
/// <summary>
/// 牌号
/// </summary>
[StringLength(200)]
public string Brand { get; set; }
/// <summary>
/// 规格
/// </summary>
[StringLength(200)]
public string Specifications { get; set; }
/// <summary>
/// 原厂家
/// </summary>
[StringLength(200)]
public string OriginalManufacturer { get; set; }
/// <summary>
/// 批次号
/// </summary>
[StringLength(200)]
public string BatchNo { get; set; }
/// <summary>
/// 剩余量(kg)
/// </summary>
public double RemainingAmount { get; set; }
/// <summary>
/// 入库总量(kg)
/// </summary>
public double TotalInventory { get; set; }
/// <summary>
/// 单价(元/kg)
/// </summary>
[StringLength(200)]
public string UnitPrice { get; set; }
/// <summary>
/// 合格证
/// </summary>
[StringLength(200)]
public string CertificateOfApproval { get; set; }
/// <summary>
/// 库房库位
/// </summary>
public int StoreId { get; set; }
/// <summary>
/// 位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 类别
/// </summary>
public Int16 Category { get; set; }
/// <summary>
/// 复验日期
/// </summary>
public DateTime ReinspectionDate { get; set; }
/// <summary>
/// 复验状态
/// </summary>
[StringLength(200)]
public string ReinspectionStatus { get; set; }
}
#endregion
#region EditDto
public class MaterialPowderEditDto: MaterialPowderCreateDto
{
}
#endregion
#region ListDto
public class MaterialPowderListDto: BaseEntity
{
/// <summary>
/// 编码
/// </summary>
[StringLength(200)]
public string Coding { get; set; }
/// <summary>
/// 名称
/// </summary>
[StringLength(200)]
public string Name { get; set; }
/// <summary>
/// 牌号
/// </summary>
[StringLength(200)]
public string Brand { get; set; }
/// <summary>
/// 规格
/// </summary>
[StringLength(200)]
public string Specifications { get; set; }
/// <summary>
/// 原厂家
/// </summary>
[StringLength(200)]
public string OriginalManufacturer { get; set; }
/// <summary>
/// 批次号
/// </summary>
[StringLength(200)]
public string BatchNo { get; set; }
/// <summary>
/// 剩余量(kg)
/// </summary>
public double RemainingAmount { get; set; }
/// <summary>
/// 入库总量(kg)
/// </summary>
public double TotalInventory { get; set; }
/// <summary>
/// 单价(元/kg)
/// </summary>
[StringLength(200)]
public string UnitPrice { get; set; }
/// <summary>
/// 合格证
/// </summary>
[StringLength(200)]
public string CertificateOfApproval { get; set; }
/// <summary>
/// 库房库位
/// </summary>
public int StoreId { get; set; }
/// <summary>
/// 位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 类别
/// </summary>
public Int16 Category { get; set; }
/// <summary>
/// 复验日期
/// </summary>
public DateTime ReinspectionDate { get; set; }
/// <summary>
/// 复验状态
/// </summary>
[StringLength(200)]
public string ReinspectionStatus { get; set; }
}
#endregion
}
using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using HYH.Registry.Core;
using HYH.Registry.DbModels;
using HYH.Registry.Dtos;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace HYH.Registry.Service
{
/// <summary>
/// MaterialPowder
///
///应用层服务的接口实现方法
///</summary>
public class MaterialPowderAppService : BaseService
{
private readonly IRepository<MaterialPowder, int> _rep;
/// <summary>
/// 构造函数
///</summary>
public MaterialPowderAppService(IRepository<MaterialPowder, int> entityRepository)
{
_rep = entityRepository;
}
#region 自动生成服务代码
/// <summary>
/// 获取分页列表信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<PagedResultDto<MaterialPowderListDto>> Paged(PageRequestDto<MaterialPowderDto> input)
{
var query = _rep.GetAll();
// TODO:根据传入的参数添加过滤条件
int pageSize = input.PageSize > 0 ? input.PageSize : Int32.MaxValue;
int current = input.PageIndex > 0 ? input.PageIndex : 1;
var count = await query.CountAsync();
var entityList = await query
.OrderByDescending(u => u.Id).AsNoTracking()
.PageBy((current - 1) * pageSize, pageSize)
.ToListAsync();
var entityListDtos = entityList.MapTo<List<MaterialPowderListDto>>();
return new PagedResultDto<MaterialPowderListDto>(count, entityListDtos);
}
/// <summary>
/// 获取编辑的MaterialPowder
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<MaterialPowderDto> Get(NullableIdDto<int> input)
{
MaterialPowderDto editDto;
var entity = await _rep.GetAsync(input.Id.Value);
editDto = entity.MapTo<MaterialPowderDto>();
return editDto;
}
/// <summary>
/// 添加MaterialPowder
///</summary>
public virtual async Task<IActionResult> Create(MaterialPowderCreateDto input)
{
//TODO:新增前的逻辑判断,是否允许新增
var entity = input.MapTo<MaterialPowder>();
int id = await _rep.InsertAndGetIdAsync(entity);
return new JsonResult(id > 0 ? true : false);
}
/// <summary>
/// 编辑
/// </summary>
public virtual async Task<IActionResult>
Update(MaterialPowderEditDto input)
{
//TODO:更新前的逻辑判断,是否允许更新
var entity = await _rep.GetAsync(input.Id);
input.MapTo(entity);
await _rep.UpdateAsync(entity);
return new JsonResult(true);
}
/// <summary>
/// 删除
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<IActionResult> Delete(EntityDto<int> input)
{
//TODO:删除前的逻辑判断,是否允许删除
await _rep.DeleteAsync(input.Id);
return new JsonResult(true);
}
/// <summary>
/// 批量删除的方法
///</summary>
public async Task<IActionResult> BatchDelete(List<int> input)
{
// TODO:批量删除前的逻辑判断,是否允许删除
await _rep.DeleteAsync(s => input.Contains(s.Id));
return new JsonResult(true);
}
#endregion
}
}
using System.Collections.Concurrent;
using Abp.Extensions;
using Microsoft.Extensions.Configuration;
namespace HYH.Registry.Configuration
{
public static class AppConfigurations
{
private static readonly ConcurrentDictionary<string, IConfigurationRoot> ConfigurationCache;
static AppConfigurations()
{
ConfigurationCache = new ConcurrentDictionary<string, IConfigurationRoot>();
}
public static IConfigurationRoot Get(string path, string environmentName = null)
{
var cacheKey = path + "#" + environmentName;
return ConfigurationCache.GetOrAdd(
cacheKey,
_ => BuildConfiguration(path, environmentName)
);
}
private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null)
{
var builder = new ConfigurationBuilder()
.SetBasePath(path)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
if (!environmentName.IsNullOrWhiteSpace())
{
builder = builder.AddJsonFile($"appsettings.{environmentName}.json", optional: true);
}
builder = builder.AddEnvironmentVariables();
return builder.Build();
}
}
}
using System;
using Abp.Domain.Entities.Auditing;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HYH.Registry.DbModels
{
/// <summary>
/// author: henq
/// time: 2019/12/4 18:27:14
///
///</summary>
[Table("MaterialPlacode")]
public class MaterialPlacode: FullAuditedEntity
{
/// <summary>
/// 基板编码
/// </summary>
[StringLength(200)]
[Column("substrate_coding")]
public string SubstrateCoding { get; set; }
/// <summary>
/// 基板材质
/// </summary>
[StringLength(200)]
[Column("base_material")]
public string BaseMaterial { get; set; }
/// <summary>
/// 材料编号
/// </summary>
[StringLength(200)]
[Column("material_number")]
public string MaterialNumber { get; set; }
/// <summary>
/// 适用设备
/// </summary>
[StringLength(200)]
[Column("apply_to_equipment")]
public string ApplyToEquipment { get; set; }
/// <summary>
/// 厚度
/// </summary>
public double Thickness { get; set; }
/// <summary>
/// 状态
/// </summary>
public Int16 State { get; set; }
/// <summary>
/// 所处位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 库存
/// </summary>
public double Inventory { get; set; }
/// <summary>
/// 最低库存
/// </summary>
[Column("minimum_inventory")]
public double MinimumInventory { get; set; }
/// <summary>
/// 可用库存
/// </summary>
[Column("available_in_stock")]
public double AvailableInStock { get; set; }
}
}
\ No newline at end of file
using System;
using Abp.Domain.Entities.Auditing;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HYH.Registry.DbModels
{
/// <summary>
/// author: henq
/// time: 2019/12/4 14:13:34
///
///</summary>
[Table("MaterialPowder")]
public class MaterialPowder: FullAuditedEntity
{
/// <summary>
/// 编码
/// </summary>
[StringLength(200)]
public string Coding { get; set; }
/// <summary>
/// 名称
/// </summary>
[StringLength(200)]
public string Name { get; set; }
/// <summary>
/// 牌号
/// </summary>
[StringLength(200)]
public string Brand { get; set; }
/// <summary>
/// 规格
/// </summary>
[StringLength(200)]
public string Specifications { get; set; }
/// <summary>
/// 原厂家
/// </summary>
[StringLength(200)]
[Column("original_manufacturer")]
public string OriginalManufacturer { get; set; }
/// <summary>
/// 批次号
/// </summary>
[StringLength(200)]
[Column("batch_no")]
public string BatchNo { get; set; }
/// <summary>
/// 剩余量(kg)
/// </summary>
[Column("remaining_amount")]
public double RemainingAmount { get; set; }
/// <summary>
/// 入库总量(kg)
/// </summary>
[Column("total_inventory")]
public double TotalInventory { get; set; }
/// <summary>
/// 单价(元/kg)
/// </summary>
[StringLength(200)]
[Column("unit_price")]
public string UnitPrice { get; set; }
/// <summary>
/// 合格证
/// </summary>
[StringLength(200)]
[Column("certificate_of_approval")]
public string CertificateOfApproval { get; set; }
/// <summary>
/// 库房库位
/// </summary>
[Column("store_id")]
public int StoreId { get; set; }
/// <summary>
/// 位置
/// </summary>
[StringLength(200)]
public string Location { get; set; }
/// <summary>
/// 类别
/// </summary>
public Int16 Category { get; set; }
/// <summary>
/// 复验日期
/// </summary>
[Column("reinspection_date")]
public DateTime ReinspectionDate { get; set; }
/// <summary>
/// 复验状态
/// </summary>
[StringLength(200)]
[Column("reinspection_status")]
public string ReinspectionStatus { get; set; }
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0.0</Version>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>HYH.Registry.Core</AssemblyName>
<PackageId>HYH.Registry.Core</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace>HYH.Registry</RootNamespace>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Localization\SourceFiles\*.json" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Abp" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="DbModels\" />
</ItemGroup>
</Project>
\ No newline at end of file
using System.Reflection;
using Abp.Configuration.Startup;
using Abp.Localization;
using Abp.Localization.Dictionaries;
using Abp.Localization.Dictionaries.Json;
using Abp.Reflection.Extensions;
namespace HYH.Registry.Localization
{
public static class RegistryLocalizationConfigurer
{
public static void Configure(ILocalizationConfiguration localizationConfiguration)
{
localizationConfiguration.Languages.Add(new LanguageInfo("en", "English", "famfamfam-flags england", isDefault: true));
localizationConfiguration.Languages.Add(new LanguageInfo("tr", "Türkçe", "famfamfam-flags tr"));
localizationConfiguration.Sources.Add(
new DictionaryBasedLocalizationSource(RegistryConsts.LocalizationSourceName,
new JsonEmbeddedFileLocalizationDictionaryProvider(
typeof(RegistryLocalizationConfigurer).GetAssembly(),
"HYH.Registry.Localization.SourceFiles"
)
)
);
}
}
}
\ No newline at end of file
using Abp.Domain.Entities.Auditing;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace HYH.Registry.Nodes
{
[Table("node")]
public class Node: FullAuditedEntity
{
/// <summary>
///
/// </summary>
public int SchemaId { get; set; }
[StringLength(100)]
public string Name { get; set; }
public int FormId { get; set; }
[StringLength(500)]
public string AgreeOperation { get; set; }
public int RejectOption { get; set; }
[StringLength(500)]
public string RejectOperation { get; set; }
public int Category { get; set; }
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HYH.Registry.Core")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0fa75a5b-ab83-4fd0-b545-279774c01e87")]
namespace HYH.Registry
{
public class RegistryConsts
{
public const string LocalizationSourceName = "Registry";
public const string ConnectionStringName = "Default";
/// <summary>
/// 审核状态
/// </summary>
public enum AuditStatus
{
/// <summary>
/// 初始创建
/// </summary>
Initial = 0,
/// <summary>
/// 审核中
/// </summary>
Auditing = 1,
/// <summary>
/// 审核通过
/// </summary>
Passed = 2,
/// <summary>
/// 驳回
/// </summary>
Rejected = 3
}
/// <summary>
/// 驳回类型
/// </summary>
public enum RejectType
{
/// <summary>
/// 返回第一个节点
/// </summary>
ReturnToFirstNode = 0,
/// <summary>
/// 返回上一节点
/// </summary>
ReturnToPreviousNode = 1,
/// <summary>
/// 手动指定返回的节点
/// </summary>
ReturnByManual =2,
/// <summary>
/// 流程终止
/// </summary>
Terminated =3
}
/// <summary>
/// 节点分类
/// </summary>
public enum NodeCategory
{
/// <summary>
/// 启动节点
/// </summary>
Start = 0,
/// <summary>
/// 条件节点
/// </summary>
Condition = 1,
/// <summary>
/// 处理节点
/// </summary>
Process = 2,
/// <summary>
/// 结束节点
/// </summary>
End = 3
}
}
}
\ No newline at end of file
using Abp.Modules;
using Abp.Reflection.Extensions;
using HYH.Registry.Localization;
namespace HYH.Registry
{
public class RegistryCoreModule : AbpModule
{
public override void PreInitialize()
{
Configuration.Auditing.IsEnabledForAnonymousUsers = true;
RegistryLocalizationConfigurer.Configure(Configuration.Localization);
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(RegistryCoreModule).GetAssembly());
}
}
}
\ No newline at end of file
using System;
using System.IO;
using System.Linq;
namespace HYH.Registry.Web
{
/// <summary>
/// This class is used to find root path of the web project in;
/// unit tests (to find views) and entity framework core command line commands (to find conn string).
/// </summary>
public static class WebContentDirectoryFinder
{
public static string CalculateContentRootFolder()
{
var coreAssemblyDirectoryPath = Path.GetDirectoryName(AppContext.BaseDirectory);
if (coreAssemblyDirectoryPath == null)
{
throw new Exception("Could not find location of HYH.Registry.Core assembly!");
}
var directoryInfo = new DirectoryInfo(coreAssemblyDirectoryPath);
while (!DirectoryContains(directoryInfo.FullName, "HYH.Registry.sln"))
{
if (directoryInfo.Parent == null)
{
throw new Exception("Could not find content root folder!");
}
directoryInfo = directoryInfo.Parent;
}
return Path.Combine(directoryInfo.FullName, $"src{Path.DirectorySeparatorChar}HYH.Registry.Web.Host");
}
private static bool DirectoryContains(string directory, string fileName)
{
return Directory.GetFiles(directory).Any(filePath => string.Equals(Path.GetFileName(filePath), fileName));
}
}
}
using Microsoft.EntityFrameworkCore;
using System.Data.Common;
namespace HYH.Registry.EntityFrameworkCore
{
public static class DbContextOptionsConfigurer
{
public static void Configure(DbContextOptionsBuilder<RegistryDbContext> builder, string connectionString)
{
builder.UseMySql(connectionString);
}
public static void Configure(DbContextOptionsBuilder<RegistryDbContext> builder, DbConnection connection)
{
builder.UseMySql(connection);
}
}
}
using Abp.EntityFrameworkCore;
using HYH.Registry.DbModels;
//using HYH.Registry.DbModels;
using HYH.Registry.Nodes;
using Microsoft.EntityFrameworkCore;
namespace HYH.Registry.EntityFrameworkCore
{
public class RegistryDbContext : AbpDbContext
{
public DbSet<Node> Nodes { get; set; }
public DbSet<MaterialPowder> MaterialPowders { get; set; }
public RegistryDbContext(DbContextOptions<RegistryDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/*
foreach (var entity in builder.Model.GetEntityTypes())
{
if (!entity.Relational().TableName.StartsWith("Abp"))
{
// Replace table names
entity.Relational().TableName = entity.Relational().TableName.ToSnakeCase();
// Replace column names
foreach (var property in entity.GetProperties())
{
property.Relational().ColumnName = property.Relational().ColumnName.ToSnakeCase();
}
foreach (var key in entity.GetKeys())
{
key.Relational().Name = key.Relational().Name.ToSnakeCase();
}
foreach (var key in entity.GetForeignKeys())
{
key.Relational().Name = key.Relational().Name.ToSnakeCase();
}
foreach (var index in entity.GetIndexes())
{
index.Relational().Name = index.Relational().Name.ToSnakeCase();
}
}
}
*/
}
}
}
using HYH.Registry.Configuration;
using HYH.Registry.Web;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace HYH.Registry.EntityFrameworkCore
{
/* This class is needed to run EF Core PMC commands. Not used anywhere else */
public class RegistryDbContextFactory : IDesignTimeDbContextFactory<RegistryDbContext>
{
public RegistryDbContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<RegistryDbContext>();
var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());
DbContextOptionsConfigurer.Configure(
builder,
configuration.GetConnectionString(RegistryConsts.ConnectionStringName)
);
return new RegistryDbContext(builder.Options);
}
}
}
\ No newline at end of file
using Abp.Configuration.Startup;
using Abp.Domain.Uow;
using Abp.EntityFrameworkCore;
using Abp.EntityFrameworkCore.Configuration;
using Abp.Modules;
using Abp.Reflection.Extensions;
using HYH.EntityFramework;
using HYH.EntityFrameworkCore;
namespace HYH.Registry.EntityFrameworkCore
{
[DependsOn(
typeof(RegistryCoreModule),
typeof(AbpEntityFrameworkCoreModule))]
public class RegistryEntityFrameworkCoreModule : AbpModule
{
public override void PreInitialize()
{
Configuration.ReplaceService<IConnectionStringResolver, ConnectionStringResolver>();
// Configure first DbContext
Configuration.Modules.AbpEfCore().AddDbContext<RegistryDbContext>(options =>
{
if (options.ExistingConnection != null)
{
DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
}
else
{
DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
}
});
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(RegistryEntityFrameworkCoreModule).GetAssembly());
}
}
}
\ No newline at end of file
using System.Text.RegularExpressions;
namespace HYH.Registry.EntityFrameworkCore
{
public static class StringExtensions
{
public static string ToSnakeCase(this string input)
{
if (string.IsNullOrEmpty(input)) { return input; }
var startUnderscores = Regex.Match(input, @"^_+");
return startUnderscores + Regex.Replace(input, @"([a-z0-9])([A-Z])", "$1_$2").ToLower();
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0.0</Version>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>HYH.Registry.EntityFrameworkCore</AssemblyName>
<OutputType>Library</OutputType>
<PackageId>HYH.Registry.EntityFrameworkCore</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<RootNamespace>HYH.Registry</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20180726084415_Upgrade_ABP_3.8.0.cs" />
<Compile Remove="Migrations\20180726084415_Upgrade_ABP_3.8.0.Designer.cs" />
<Compile Remove="Migrations\20181015085310_Upgraded_To_ABP_v3_9_0.cs" />
<Compile Remove="Migrations\20181015085310_Upgraded_To_ABP_v3_9_0.Designer.cs" />
<Compile Remove="Migrations\20190719145525_Upgraded_To_Abp_4_8_0.cs" />
<Compile Remove="Migrations\20190719145525_Upgraded_To_Abp_4_8_0.Designer.cs" />
<Compile Remove="Migrations\20191128095833_aa.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\HYH.Framework\HYH.EntityFramework\HYH.EntityFramework.csproj" />
<ProjectReference Include="..\HYH.Registry.Core\HYH.Registry.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HYH.Registry.EntityFrameworkCore")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("dc780bc4-4eac-4c63-9052-6f3169a59fa4")]
This diff is collapsed.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Abp.AspNetCore.Mvc.Controllers;
using Abp.Runtime.Validation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.AspNetCore.Mvc;
namespace HYH.Registry.Web.Host.Controllers.Code
{
[AllowAnonymous]
[Route("/code/[action]")]
[ApiController]
[DisableValidation]
[ApiExplorerSettings(IgnoreApi = true)]
public class CodeController : AbpController
{
public string host = "http://localhost:5008/";
[HttpGet]
public IActionResult Index()
{
ViewBag.host = host;
return View();
}
[HttpPost]
public IActionResult Down([FromBody]DBTable table)
{
var web = Directory.GetCurrentDirectory();
var dirs = new DirectoryInfo(web).Parent.GetDirectories();
var modelPath = "";
var appPath = "";
foreach (var item in dirs)
{
if (item.Name.EndsWith(".Core"))
{
modelPath = item.FullName;
}
else if (item.Name.EndsWith(".Application"))
{
appPath = item.FullName;
}
}
if (string.IsNullOrEmpty(modelPath + appPath))
{
return new JsonResult(false);
}
makeCode(table, modelPath, appPath);
return new JsonResult(true);
}
private void makeCode(DBTable dto,string modelPath,string appPath)
{
var name = underToPascal(dto.Name.Trim());
var url = host+"c/{0}?id={1}";
//1 model 生成
getHtml(string.Format(url, "index", dto.Id), modelPath + "/DbModels/",name + ".cs");
//2 dto 生成
getHtml(string.Format(url, "dto", dto.Id), appPath + "/Services/"+name, name + "Dto.cs");
//3 service 生成
getHtml(string.Format(url, "service", dto.Id), appPath + "/Services/" + name, name + "Service.cs");
}
private void getHtml(string url, string path, string name)
{
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receive = response.GetResponseStream();
StreamReader readStream = new StreamReader(receive, Encoding.Default);
var txt = readStream.ReadToEnd();
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
System.IO.File.WriteAllText(Path.Combine(path,name), txt);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
public string underToPascal(string s)
{
var arrs = s.Split('_');
var reslut = "";
arrs.ToList().ForEach(u =>
{
var w = u[0].ToString().ToUpper() + u.Substring(1);
reslut += w;
});
return reslut;
}
}
public class DBTable
{
public int Id { get; set; }
/// <summary>
/// 数据库名称
/// </summary>
public string DatabaseName { get; set; }
/// <summary>
/// 表名称
/// </summary>
public string Name { get; set; }
}
}
\ No newline at end of file
using Abp.AspNetCore.Mvc.Controllers;
using Abp.Auditing;
using Abp.Runtime.Validation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace HYH.Registry.Controllers
{
[AllowAnonymous]
[Route("/api/[controller]")]
[ApiController]
[Produces("application/json")]
[DisableValidation]
[DisableAuditing]
[ApiExplorerSettings(IgnoreApi = true)]
public class HealthController : AbpController
{
[HttpGet]
public IActionResult Get() => Ok("ok");
}
}
\ No newline at end of file
FROM microsoft/dotnet:2.2-aspnetcore-runtime
WORKDIR /app/Registry
COPY . /app/Registry
EXPOSE 10100
ENV ASPNETCORE_ENVIRONMENT FAT
ENV APPOLO:ENV FAT
ENV ASPNETCORE_URLS http://*:10100
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT ["dotnet", "HYH.Registry.Web.Host.dll"]
<?xml version="1.0"?>
<doc>
<assembly>
<name>HYH.Registry.Application</name>
</assembly>
<members>
<member name="T:HYH.Registry.Core.BaseEntity">
<summary>
基础类库字段,隐藏删除相关属性
</summary>
</member>
<member name="T:HYH.Registry.Core.BaseService">
<summary>
基础Service
</summary>
</member>
<member name="T:HYH.Registry.RegistryAppServiceBase">
<summary>
Derive your application services from this class.
</summary>
</member>
<member name="M:HYH.Registry.Services.Encryption.AESHelper.AESEncrypt(System.String,System.String,System.String)">
<summary>
AES加密
</summary>
<param name="Data">被加密的明文</param>
<param name="Key">密钥</param>
<param name="Vector">向量</param>
<returns>密文</returns>
</member>
<member name="M:HYH.Registry.Services.Encryption.AESHelper.AESDecrypt(System.String,System.String,System.String)">
<summary>
AES解密
</summary>
<param name="Data">被解密的密文</param>
<param name="Key">密钥</param>
<param name="Vector">向量</param>
<returns>明文</returns>
</member>
<member name="M:HYH.Registry.Services.Encryption.ComputerInfoHelper.GetMACIp">
<summary>
获取电脑 MAC(物理) 地址
</summary>
<returns></returns>
</member>
<member name="T:HYH.Registry.Services.Encryption.EncryptionService">
<summary>
</summary>
</member>
<member name="M:HYH.Registry.Services.Encryption.EncryptionService.#ctor(HYH.AspNetCore.ICurrentUser,HYH.Registry.EntityFrameworkCore.RegistryDbContext,HYH.SqlSugarCore.DbContext{HYH.Core.DbModels.Tenant},Abp.Domain.Repositories.IRepository{HYH.Core.DbModels.Tenant,System.Int32})">
<summary>
构造函数
</summary>
</member>
<member name="M:HYH.Registry.Services.Encryption.EncryptionService.GetNetCardMACAddress">
<summary>
获取Mac地址
</summary>
<returns></returns>
</member>
<member name="M:HYH.Registry.Services.Encryption.EncryptionService.GetMACIp">
<summary>
获取Mac地址
</summary>
<returns></returns>
</member>
<member name="M:HYH.Registry.Services.Encryption.EncryptionService.GetHardDiskSerialNumber">
<summary>
获取硬盘序列号
</summary>
<returns></returns>
</member>
<member name="M:HYH.Registry.Services.Encryption.EncryptionService.GetGeneratedCode">
<summary>
合成码
</summary>
<returns></returns>
</member>
<member name="M:HYH.Registry.Services.Encryption.EncryptionService.GetGeneratingCiphertext(System.String)">
<summary>
生成密文
</summary>
<returns></returns>
</member>
</members>
</doc>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>HYH.Registry.Web.Host</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>HYH.System.Web.Host</PackageId>
<UserSecretsId>HYH-System-56C2EF2F-ABD6-4EFC-AAF2-2E81C34E8FB1</UserSecretsId>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile></DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Content Remove="appsettings.Common.json" />
<Content Remove="appsettings.Development.Common.json" />
<Content Remove="appsettings.Production.Common.json" />
<Content Remove="appsettings.Staging250.Common.json" />
<Content Remove="appsettings.Staging88.Common.json" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Update="Dockerfile">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="HYH.System.Application.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="HYH.Registry.Application.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
<None Update="wwwroot\**\*">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="3.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.MongoDB" Version="4.0.0" />
<PackageReference Include="Castle.Core-Serilog" Version="4.4.1" />
<PackageReference Include="Castle.LoggingFacility.MsLogging" Version="3.1.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\swagger\ui\index.html">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\Logs\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\HYH.Framework\HYH.AspNetCore\HYH.AspNetCore.csproj" />
<ProjectReference Include="..\..\..\HYH.Framework\HYH.Core\HYH.Core.csproj" />
<ProjectReference Include="..\HYH.Registry.Application\HYH.Registry.Application.csproj" />
<ProjectReference Include="..\HYH.Registry.EntityFrameworkCore\HYH.Registry.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="role.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JSONSchema="http://json.schemastore.org/band-manifest" /></VisualStudio></ProjectExtensions>
</Project>
\ No newline at end of file
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iis": {
"applicationUrl": "http://localhost:10160",
"sslPort": 0
},
"iisExpress": {
"applicationUrl": "http://localhost:21021/",
"sslPort": 0
}
},
"profiles": {
"HYH.Registry.Web.Host": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger/index.html",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:10160"
}
}
}
\ No newline at end of file
using Microsoft.Extensions.DependencyInjection;
namespace HYH.Registry
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddRegistry(this IServiceCollection services)
{
return services;
}
}
}
using Abp.Timing;
using HYH.AspNetCore;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace HYH.Registry.Web.Host.Startup
{
public class Program
{
private const string serviceAddressKey = "App:ServerAddress";
public static void Main(string[] args)
{
Clock.Provider = ClockProviders.Local;
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args)
{
var configurationBuilder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).Build();
string url = configurationBuilder[serviceAddressKey];
var hostBuilder = WebHost.CreateDefaultBuilder(args)
.ConfigureApollo();
hostBuilder = hostBuilder.ConfigureAppConfiguration((hostContext, builder) =>
{
if (args != null)
{
builder.AddCommandLine(args);
}
});
return hostBuilder.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseUrls(url)
.UseStartup<Startup>()
.Build();
}
}
}
using Abp.AspNetCore;
using Abp.AspNetCore.Configuration;
using Abp.Modules;
using Abp.Reflection.Extensions;
using HYH.AspNetCore;
using HYH.Registry.EntityFrameworkCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace HYH.Registry.Web.Host.Startup
{
[DependsOn(
typeof(RegistryApplicationModule),
typeof(RegistryEntityFrameworkCoreModule),
typeof(AbpAspNetCoreModule),
typeof(WebHostModule))
]
public class RegistryWebHostModule : AbpModule
{
private readonly IHostingEnvironment _env;
private readonly IConfiguration _appConfiguration;
public RegistryWebHostModule(IHostingEnvironment env, IConfiguration configuration)
{
_env = env;
_appConfiguration = configuration;
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(RegistryWebHostModule).GetAssembly());
}
public override void PreInitialize()
{
Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString(
RegistryConsts.ConnectionStringName
);
Configuration.Modules.AbpAspNetCore()
.CreateControllersForAppServices(
typeof(RegistryApplicationModule).GetAssembly()
);
}
}
}
using Abp.AspNetCore;
using Castle.Facilities.Logging;
using Castle.Services.Logging.SerilogIntegration;
using HYH.AspNetCore;
using HYH.Core;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NanoFabric.Swagger;
using Serilog;
using System;
using Volo.Abp.Security.Claims;
namespace HYH.Registry.Web.Host.Startup
{
public class Startup
{
private readonly IConfiguration _configuration;
public Startup(IHostingEnvironment env, IConfiguration configuration)
{
_configuration = configuration;
}
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services
.AddRequired(_configuration)
.AddRegistry()
.AddMicroServices();
var sp = services.BuildServiceProvider();
var httpContextAccessor = sp.GetService<IHttpContextAccessor>();
var currentPrincipalAccessor = sp.GetService<ICurrentPrincipalAccessor>();
LogEnricher logEnricher = new LogEnricher();
logEnricher.HttpContextAccessor = httpContextAccessor;
logEnricher.CurrentPrincipalAccessor = currentPrincipalAccessor;
return services.AddAbp<RegistryWebHostModule>(
options =>
{
var config = new LoggerConfiguration()
.ReadFrom.Configuration(_configuration)
.Enrich.With(logEnricher)
.CreateLogger();
options.IocManager.IocContainer
.AddFacility<LoggingFacility>(f => f.LogUsing(new SerilogFactory(config)));
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApiInfo apiInfo)
{
app.UseAbp(options => {
options.UseAbpRequestLocalization = false;
options.UseCastleLoggerFactory = true;
});
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
app.UseDeveloperExceptionPage();
app.UsePermissiveCors();
app.UseStaticFiles();
app.UseConsulRegisterService(_configuration);
app.UseAbpRequestLocalization();
app.UseAuthentication();
app.UseMvc();
app.UseCustomSwagger(apiInfo);
}
}
}
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>代码生成</title>
<script src="//vuejs.org/js/vue.min.js"></script>
<!-- import stylesheet -->
<link rel="stylesheet" href="//unpkg.com/view-design/dist/styles/iview.css">
<!-- import iView -->
<script src="//unpkg.com/view-design/dist/iview.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<h1>
</h1>
<div id="app">
<div>
<i-select style="width:200px;" v-model="database" @@on-change="setDb" placeholder="请选择数据库">
<i-option v-for="(li,i) in dbs" :key="i" :value="li">{{li}}</i-option>
</i-select>
<i-input v-model="keys" placeholder="请输入关键字" clearable>
<a slot="append" @@click="setDb"><Icon type="md-sync" /></a>
</i-input>
</div>
<i-table :data="curs" :columns="cols" border>
<registry slot="action" slot-scope="{row,index}">
<a @@click="down(row)">生成</a>
</registry>
</i-table>
</div>
<script>
const url = '@ViewBag.host'
new Vue({
el: '#app',
data: {
visible: false,
dbs: [],
keys:"",
database: "",
cols: [
{ key: "id", title: "id" ,width:80},
{ key: "name", title: "表" },
{ key: "note", title: "备注" },
{ key: "createTime", title: "创建时间" },
{ key: "editTime", title: "修改时间" },
{ key: "count", title: "记录数" ,width:80},
{ key: "id", title: "操作", slot: "action", width: 80},
],
tables: [],
},
created() {
this.loadDatabase();
},
methods: {
show: function () {
this.visible = true;
},
loadDatabase() {
axios.get(url + "api/db/getDatabase")
.then(r => {
this.dbs = r.data;
});
},
setDb() {
axios
.get(url + "api/db/getTables/" + this.database)
.then(r => {
this.tables = r.data;
//.filter(u => u.id > 0);
});
},
down(row) {
alert(row.id)
axios.post("/code/Down", row).then(r => {
if (r.data) {
this.$Message.success("成功!")
} else {
this.$Message.error("失败!")
}
})
}
},
computed: {
curs() {
var ul = [];
ul = this.tables.filter(u => {
return u.name.indexOf(this.keys) > -1;
})
return ul;
}
}
})
</script>
</body>
</html>
<configuration>
<appSettings>
<add key="owin:AutomaticAppStartup" value="false"/>
</appSettings>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>
{
"ServiceDiscovery": {
"Endpoints": [ "http://localhost:10160" ]
}
}
\ No newline at end of file
{
//"Logging": {
// "IncludeScopes": true,
// "LogLevel": {
// "Default": "DEBUG",
// "System": "DEBUG",
// "Microsoft": "DEBUG"
// }
//},
"App": {
"ServerAddress": "http://*:10160"
},
"apollo": {
"AppId": "saas_mes_registry",
"Env": "Pro",
"Meta": {
//"MetaServer": "http://39.100.148.168:8080",
"FAT": "http://39.100.148.168:8082",
"DEV": "http://39.100.148.168:8080",
"UAT": "http://39.100.148.168:8082",
"PRO": "http://39.100.148.168:8081"
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >
<file value="App_Data/Logs/Logs.txt" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd.'txt'" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level %date [%-5.5thread] %-40.40logger - %message%newline" />
</layout>
</appender>
<root>
<appender-ref ref="RollingFileAppender" />
<level value="ERROR" />
</root>
</log4net>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="WebDAV" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<add name="WebDAV" path="*" verb="*" modules="WebDAVModule" resourceType="Either" requireAccess="None" />
</handlers>
<aspNetCore processPath="bin\IISSupport\VSIISExeLauncher.exe" arguments="-argFile IISExeLauncherArgs.txt" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
<environmentVariables />
</aspNetCore>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
\ No newline at end of file
var abp = abp || {};
(function () {
/* Application paths *****************************************/
// Current application root path (including virtual directory if exists).
abp.appPath = abp.appPath || '/';
/* AUTHORIZATION **********************************************/
// Implements Authorization API that simplifies usage of authorization scripts generated by Abp.
abp.auth = abp.auth || {};
abp.auth.tokenCookieName = 'Abp.AuthToken';
abp.auth.tokenHeaderName = 'Authorization';
abp.auth.setToken = function (authToken, expireDate) {
abp.utils.setCookieValue(abp.auth.tokenCookieName, authToken, expireDate, abp.appPath);
};
abp.auth.getToken = function () {
return abp.utils.getCookieValue(abp.auth.tokenCookieName);
}
abp.auth.clearToken = function () {
abp.auth.setToken();
}
/* UTILS ***************************************************/
abp.utils = abp.utils || {};
/**
* Sets a cookie value for given key.
* This is a simple implementation created to be used by ABP.
* Please use a complete cookie library if you need.
* @param {string} key
* @param {string} value
* @param {Date} expireDate (optional). If not specified the cookie will expire at the end of session.
* @param {string} path (optional)
*/
abp.utils.setCookieValue = function (key, value, expireDate, path) {
var cookieValue = encodeURIComponent(key) + '=';
if (value) {
cookieValue = cookieValue + encodeURIComponent(value);
}
if (expireDate) {
cookieValue = cookieValue + "; expires=" + expireDate.toUTCString();
}
if (path) {
cookieValue = cookieValue + "; path=" + path;
}
document.cookie = cookieValue;
};
/**
* Gets a cookie with given key.
* This is a simple implementation created to be used by ABP.
* Please use a complete cookie library if you need.
* @param {string} key
* @returns {string} Cookie value or null
*/
abp.utils.getCookieValue = function (key) {
var equalities = document.cookie.split('; ');
for (var i = 0; i < equalities.length; i++) {
if (!equalities[i]) {
continue;
}
var splitted = equalities[i].split('=');
if (splitted.length != 2) {
continue;
}
if (decodeURIComponent(splitted[0]) === key) {
return decodeURIComponent(splitted[1] || '');
}
}
return null;
};
/**
* Deletes cookie for given key.
* This is a simple implementation created to be used by ABP.
* Please use a complete cookie library if you need.
* @param {string} key
* @param {string} path (optional)
*/
abp.utils.deleteCookie = function (key, path) {
var cookieValue = encodeURIComponent(key) + '=';
cookieValue = cookieValue + "; expires=" + (new Date(new Date().getTime() - 86400000)).toUTCString();
if (path) {
cookieValue = cookieValue + "; path=" + path;
}
document.cookie = cookieValue;
}
/* SECURITY ***************************************/
abp.security = abp.security || {};
abp.security.antiForgery = abp.security.antiForgery || {};
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN';
abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN';
abp.security.antiForgery.getToken = function () {
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
};
})();
var abp = abp || {};
(function () {
/* Swagger */
abp.swagger = abp.swagger || {};
abp.swagger.addAuthToken = function () {
var authToken = abp.auth.getToken();
if (!authToken) {
return false;
}
var cookieAuth = new SwaggerClient.ApiKeyAuthorization(abp.auth.tokenHeaderName, 'Bearer ' + authToken, 'header');
swaggerUi.api.clientAuthorizations.add('bearerAuth', cookieAuth);
return true;
}
abp.swagger.addCsrfToken = function () {
var csrfToken = abp.security.antiForgery.getToken();
if (!csrfToken) {
return false;
}
var csrfCookieAuth = new SwaggerClient.ApiKeyAuthorization(abp.security.antiForgery.tokenHeaderName, csrfToken, 'header');
swaggerUi.api.clientAuthorizations.add(abp.security.antiForgery.tokenHeaderName, csrfCookieAuth);
return true;
}
function loginUserInternal(tenantId, callback) {
var usernameOrEmailAddress = document.getElementById('userName').value;
if (!usernameOrEmailAddress) {
alert('Username or Email Address is required, please try with a valid value !');
return false;
}
var password = document.getElementById('password').value;
if (!password) {
alert('Password is required, please try with a valid value !');
return false;
}
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
var responseJSON = JSON.parse(xhr.responseText);
var result = responseJSON.result;
var expireDate = new Date(Date.now() + (result.expireInSeconds * 1000));
abp.auth.setToken(result.accessToken, expireDate);
callback();
} else {
alert('Login failed !');
}
}
};
xhr.open('POST', '/api/TokenAuth/Authenticate', true);
xhr.setRequestHeader('Abp.TenantId', tenantId);
xhr.setRequestHeader('Content-type', 'application/json');
xhr.send("{" + "usernameOrEmailAddress:'" + usernameOrEmailAddress + "'," + "password:'" + password + "'}");
};
abp.swagger.login = function (callback) {
//Get TenantId first
var tenancyName = document.getElementById('tenancyName').value;
if (tenancyName) {
var xhrTenancyName = new XMLHttpRequest();
xhrTenancyName.onreadystatechange = function () {
if (xhrTenancyName.readyState === XMLHttpRequest.DONE && xhrTenancyName.status === 200) {
var responseJSON = JSON.parse(xhrTenancyName.responseText);
var result = responseJSON.result;
if (result.state === 1) { // Tenant exists and active.
loginUserInternal(result.tenantId, callback); // Login for tenant
} else {
alert('There is no such tenant or tenant is not active !');
}
}
};
xhrTenancyName.open('POST', '/api/services/app/Account/IsTenantAvailable', true);
xhrTenancyName.setRequestHeader('Content-type', 'application/json');
xhrTenancyName.send("{" + "tenancyName:'" + tenancyName + "'}");
} else {
loginUserInternal(null, callback); // Login for host
}
};
abp.swagger.logout = function () {
abp.auth.clearToken();
}
abp.swagger.closeAuthDialog = function () {
if (document.getElementById('abp-auth-dialog')) {
document.getElementsByClassName("swagger-ui")[1].removeChild(document.getElementById('abp-auth-dialog'));
}
}
abp.swagger.openAuthDialog = function (loginCallback) {
abp.swagger.closeAuthDialog();
var abpAuthDialog = document.createElement('div');
abpAuthDialog.className = 'dialog-ux';
abpAuthDialog.id = 'abp-auth-dialog';
document.getElementsByClassName("swagger-ui")[1].appendChild(abpAuthDialog);
// -- backdrop-ux
var backdropUx = document.createElement('div');
backdropUx.className = 'backdrop-ux';
abpAuthDialog.appendChild(backdropUx);
// -- modal-ux
var modalUx = document.createElement('div');
modalUx.className = 'modal-ux';
abpAuthDialog.appendChild(modalUx);
// -- -- modal-dialog-ux
var modalDialogUx = document.createElement('div');
modalDialogUx.className = 'modal-dialog-ux';
modalUx.appendChild(modalDialogUx);
// -- -- -- modal-ux-inner
var modalUxInner = document.createElement('div');
modalUxInner.className = 'modal-ux-inner';
modalDialogUx.appendChild(modalUxInner);
// -- -- -- -- modal-ux-header
var modalUxHeader = document.createElement('div');
modalUxHeader.className = 'modal-ux-header';
modalUxInner.appendChild(modalUxHeader);
var modalHeader = document.createElement('h3');
modalHeader.innerText = 'Authorize';
modalUxHeader.appendChild(modalHeader);
// -- -- -- -- modal-ux-content
var modalUxContent = document.createElement('div');
modalUxContent.className = 'modal-ux-content';
modalUxInner.appendChild(modalUxContent);
modalUxContent.onkeydown = function (e) {
if (e.keyCode === 13) {
//try to login when user presses enter on authorize modal
abp.swagger.login(loginCallback);
}
};
//Inputs
createInput(modalUxContent, 'tenancyName', 'Tenancy Name (Leave empty for Host)');
createInput(modalUxContent, 'userName', 'Username or email address');
createInput(modalUxContent, 'password', 'Password', 'password');
//Buttons
var authBtnWrapper = document.createElement('div');
authBtnWrapper.className = 'auth-btn-wrapper';
modalUxContent.appendChild(authBtnWrapper);
//Close button
var closeButton = document.createElement('button');
closeButton.className = 'btn modal-btn auth btn-done button';
closeButton.innerText = 'Close';
closeButton.style.marginRight = '5px';
closeButton.onclick = abp.swagger.closeAuthDialog;
authBtnWrapper.appendChild(closeButton);
//Authorize button
var authorizeButton = document.createElement('button');
authorizeButton.className = 'btn modal-btn auth authorize button';
authorizeButton.innerText = 'Login';
authorizeButton.onclick = function() {
abp.swagger.login(loginCallback);
};
authBtnWrapper.appendChild(authorizeButton);
}
function createInput(container, id, title, type) {
var wrapper = document.createElement('div');
wrapper.className = 'wrapper';
container.appendChild(wrapper);
var label = document.createElement('label');
label.innerText = title;
wrapper.appendChild(label);
var section = document.createElement('section');
section.className = 'block-tablet col-10-tablet block-desktop col-10-desktop';
wrapper.appendChild(section);
var input = document.createElement('input');
input.id = id;
input.type = type ? type : 'text';
input.style.width = '100%';
section.appendChild(input);
}
})();
\ No newline at end of file
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>%(DocumentTitle)</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css">
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}
</style>
%(HeadContent)
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z" />
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z" />
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z" />
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z" />
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z" />
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z" />
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="swagger-ui-bundle.js"></script>
<script src="swagger-ui-standalone-preset.js"></script>
<script src="ui/abp.js"></script>
<script src="ui/abp.swagger.js"></script>
<script>
window.onload = function () {
var configObject = JSON.parse('%(ConfigObject)');
// Apply mandatory parameters
configObject.dom_id = "#swagger-ui";
configObject.presets = [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset];
configObject.layout = "StandaloneLayout";
configObject.requestInterceptor = function (request) {
var token = abp.auth.getToken();
request.headers.Authorization = token ? "Bearer " + token : null;
return request;
};
if (!configObject.hasOwnProperty("oauth2RedirectUrl")) {
configObject.oauth2RedirectUrl = window.location + "oauth2-redirect.html"; // use the built-in default
}
function getAuthorizeButtonText() {
return abp.auth.getToken() ? 'Logout' : 'Authorize';
}
function getAuthorizeButtonCssClass() {
return abp.auth.getToken() ? 'cancel' : 'authorize';
}
configObject.plugins = [
function (system) {
return {
components: {
authorizeBtn: function () {
return system.React.createElement("button",
{
id: "authorize",
className: "btn " + getAuthorizeButtonCssClass(),
style: {
lineHeight: "normal"
},
onClick: function () {
var authorizeButton = document.getElementById('authorize');
if (abp.auth.getToken()) {
abp.swagger.logout();
authorizeButton.innerText = getAuthorizeButtonText();
authorizeButton.className = 'btn ' + getAuthorizeButtonCssClass();
} else {
abp.swagger.openAuthDialog(function () {
authorizeButton.innerText = getAuthorizeButtonText();
authorizeButton.className = 'btn ' + getAuthorizeButtonCssClass();
abp.swagger.closeAuthDialog();
});
}
}
}, getAuthorizeButtonText());
}
}
}
}
];
// Build a system
SwaggerUIBundle(configObject);
}
</script>
</body>
</html>
using System;
using System.Threading.Tasks;
using Abp.TestBase;
using HYH.Aps.EntityFrameworkCore;
using HYH.Aps.Tests.TestDatas;
namespace HYH.Aps.Tests
{
public class WorkflowTestBase : AbpIntegratedTestBase<WorkflowTestModule>
{
public WorkflowTestBase()
{
UsingDbContext(context => new TestDataBuilder(context).Build());
}
protected virtual void UsingDbContext(Action<WorkflowDbContext> action)
{
using (var context = LocalIocManager.Resolve<WorkflowDbContext>())
{
action(context);
context.SaveChanges();
}
}
protected virtual T UsingDbContext<T>(Func<WorkflowDbContext, T> func)
{
T result;
using (var context = LocalIocManager.Resolve<WorkflowDbContext>())
{
result = func(context);
context.SaveChanges();
}
return result;
}
protected virtual async Task UsingDbContextAsync(Func<WorkflowDbContext, Task> action)
{
using (var context = LocalIocManager.Resolve<WorkflowDbContext>())
{
await action(context);
await context.SaveChangesAsync(true);
}
}
protected virtual async Task<T> UsingDbContextAsync<T>(Func<WorkflowDbContext, Task<T>> func)
{
T result;
using (var context = LocalIocManager.Resolve<WorkflowDbContext>())
{
result = await func(context);
context.SaveChanges();
}
return result;
}
}
}
using System.Reflection;
using Abp.Modules;
using Abp.Reflection.Extensions;
using Abp.TestBase;
using HYH.Aps.EntityFrameworkCore;
using Castle.MicroKernel.Registration;
using Castle.Windsor.MsDependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace HYH.Aps.Tests
{
[DependsOn(
typeof(WorkflowApplicationModule),
typeof(WorkflowEntityFrameworkCoreModule),
typeof(AbpTestBaseModule)
)]
public class WorkflowTestModule : AbpModule
{
public override void PreInitialize()
{
Configuration.UnitOfWork.IsTransactional = false; //EF Core InMemory DB does not support transactions.
SetupInMemoryDb();
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(WorkflowTestModule).GetAssembly());
}
private void SetupInMemoryDb()
{
var services = new ServiceCollection()
.AddEntityFrameworkInMemoryDatabase();
var serviceProvider = WindsorRegistrationHelper.CreateServiceProvider(
IocManager.IocContainer,
services
);
var builder = new DbContextOptionsBuilder<WorkflowDbContext>();
builder.UseInMemoryDatabase().UseInternalServiceProvider(serviceProvider);
IocManager.IocContainer.Register(
Component
.For<DbContextOptions<WorkflowDbContext>>()
.Instance(builder.Options)
.LifestyleSingleton()
);
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0.0</Version>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>HYH.Aps.Tests</AssemblyName>
<PackageId>HYH.Aps.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\HYH.Aps.Application\HYH.Aps.Application.csproj" />
<ProjectReference Include="..\..\src\HYH.Aps.EntityFrameworkCore\HYH.Aps.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="Abp.TestBase" Version="4.9.0" />
<PackageReference Include="NSubstitute" Version="4.2.0" />
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="3.3.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.4" />
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
</ItemGroup>
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HYH.Aps.Tests")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0d4c5d00-c144-4213-a007-4b8944113ab1")]
using HYH.Aps.EntityFrameworkCore;
namespace HYH.Aps.Tests.TestDatas
{
public class TestDataBuilder
{
private readonly WorkflowDbContext _context;
public TestDataBuilder(WorkflowDbContext context)
{
_context = context;
}
public void Build()
{
//create test data here...
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0.0</Version>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<AssemblyName>HYH.Registry.Tests</AssemblyName>
<PackageId>HYH.Registry.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\HYH.Registry.Application\HYH.Registry.Application.csproj" />
<ProjectReference Include="..\..\src\HYH.Registry.EntityFrameworkCore\HYH.Registry.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="Abp.TestBase" Version="4.9.0" />
<PackageReference Include="NSubstitute" Version="4.2.0" />
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="3.3.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.4" />
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
</ItemGroup>
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HYH.Registry.Tests")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0d4c5d00-c144-4213-a007-4b8944113ab1")]
using System;
using System.Threading.Tasks;
using Abp.TestBase;
using HYH.Registry.EntityFrameworkCore;
using HYH.Registry.Tests.TestDatas;
namespace HYH.Registry.Tests
{
public class RegistryTestBase : AbpIntegratedTestBase<RegistryTestModule>
{
public RegistryTestBase()
{
UsingDbContext(context => new TestDataBuilder(context).Build());
}
protected virtual void UsingDbContext(Action<RegistryDbContext> action)
{
using (var context = LocalIocManager.Resolve<RegistryDbContext>())
{
action(context);
context.SaveChanges();
}
}
protected virtual T UsingDbContext<T>(Func<RegistryDbContext, T> func)
{
T result;
using (var context = LocalIocManager.Resolve<RegistryDbContext>())
{
result = func(context);
context.SaveChanges();
}
return result;
}
protected virtual async Task UsingDbContextAsync(Func<RegistryDbContext, Task> action)
{
using (var context = LocalIocManager.Resolve<RegistryDbContext>())
{
await action(context);
await context.SaveChangesAsync(true);
}
}
protected virtual async Task<T> UsingDbContextAsync<T>(Func<RegistryDbContext, Task<T>> func)
{
T result;
using (var context = LocalIocManager.Resolve<RegistryDbContext>())
{
result = await func(context);
context.SaveChanges();
}
return result;
}
}
}
using System.Reflection;
using Abp.Modules;
using Abp.Reflection.Extensions;
using Abp.TestBase;
using HYH.Registry.EntityFrameworkCore;
using Castle.MicroKernel.Registration;
using Castle.Windsor.MsDependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace HYH.Registry.Tests
{
[DependsOn(
typeof(RegistryApplicationModule),
typeof(RegistryEntityFrameworkCoreModule),
typeof(AbpTestBaseModule)
)]
public class RegistryTestModule : AbpModule
{
public override void PreInitialize()
{
Configuration.UnitOfWork.IsTransactional = false; //EF Core InMemory DB does not support transactions.
SetupInMemoryDb();
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(RegistryTestModule).GetAssembly());
}
private void SetupInMemoryDb()
{
var services = new ServiceCollection()
.AddEntityFrameworkInMemoryDatabase();
var serviceProvider = WindsorRegistrationHelper.CreateServiceProvider(
IocManager.IocContainer,
services
);
var builder = new DbContextOptionsBuilder<RegistryDbContext>();
builder.UseInMemoryDatabase().UseInternalServiceProvider(serviceProvider);
IocManager.IocContainer.Register(
Component
.For<DbContextOptions<RegistryDbContext>>()
.Instance(builder.Options)
.LifestyleSingleton()
);
}
}
}
\ No newline at end of file
using HYH.Registry.EntityFrameworkCore;
namespace HYH.Registry.Tests.TestDatas
{
public class TestDataBuilder
{
private readonly RegistryDbContext _context;
public TestDataBuilder(RegistryDbContext context)
{
_context = context;
}
public void Build()
{
//create test data here...
}
}
}
\ 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