init (kasko)
This commit is contained in:
commit
c958a75ebd
25
.dockerignore
Normal file
25
.dockerignore
Normal file
@ -0,0 +1,25 @@
|
||||
**/.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
|
||||
37
.gitignore
vendored
Normal file
37
.gitignore
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
*.swp
|
||||
*.*~
|
||||
project.lock.json
|
||||
.DS_Store
|
||||
*.pyc
|
||||
nupkg/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode
|
||||
|
||||
# Rider
|
||||
.idea
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
msbuild.log
|
||||
msbuild.err
|
||||
msbuild.wrn
|
||||
|
||||
# Visual Studio 2015
|
||||
.vs/
|
||||
30
ELT.Client/Connected Services/ELTKasko/ConnectedService.json
Normal file
30
ELT.Client/Connected Services/ELTKasko/ConnectedService.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"ProviderId": "Microsoft.VisualStudio.ConnectedService.Wcf",
|
||||
"Version": "15.0.40203.910",
|
||||
"GettingStartedDocument": {
|
||||
"Uri": "https://go.microsoft.com/fwlink/?linkid=858517"
|
||||
},
|
||||
"ExtendedData": {
|
||||
"inputs": [
|
||||
"http://evolucia.elt-poisk.com/soap.php?wsdl"
|
||||
],
|
||||
"collectionTypes": [
|
||||
"System.Array",
|
||||
"System.Collections.Generic.Dictionary`2"
|
||||
],
|
||||
"namespaceMappings": [
|
||||
"*, ELTKasko"
|
||||
],
|
||||
"references": [
|
||||
"System.ServiceModel, {System.ServiceModel.Primitives, 4.4.4}",
|
||||
"System.ServiceModel.Duplex, {System.ServiceModel.Duplex, 4.4.4}",
|
||||
"System.ServiceModel.Http, {System.ServiceModel.Http, 4.4.4}",
|
||||
"System.ServiceModel.NetTcp, {System.ServiceModel.NetTcp, 4.4.4}",
|
||||
"System.ServiceModel.Primitives, {System.ServiceModel.Primitives, 4.4.4}",
|
||||
"System.ServiceModel.Security, {System.ServiceModel.Security, 4.4.4}"
|
||||
],
|
||||
"sync": true,
|
||||
"targetFramework": "netcoreapp3.1",
|
||||
"typeReuseMode": "All"
|
||||
}
|
||||
}
|
||||
20748
ELT.Client/Connected Services/ELTKasko/Reference.cs
Normal file
20748
ELT.Client/Connected Services/ELTKasko/Reference.cs
Normal file
File diff suppressed because it is too large
Load Diff
22
ELT.Client/ELT - Backup.Client.csproj
Normal file
22
ELT.Client/ELT - Backup.Client.csproj
Normal file
@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" />
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="4.4.*" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="4.4.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
18
ELT.Client/ELT.Client.csproj
Normal file
18
ELT.Client/ELT.Client.csproj
Normal file
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" />
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="4.4.*" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="4.4.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
82
ELT.Client/Kasko/KaskoManager.cs
Normal file
82
ELT.Client/Kasko/KaskoManager.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ELT.Models;
|
||||
using ELTKasko;
|
||||
|
||||
namespace ELT.Client.Kasko
|
||||
{
|
||||
public class KaskoManager
|
||||
{
|
||||
private readonly EltSoap _eltKaskoSoap;
|
||||
|
||||
public KaskoManager()
|
||||
{
|
||||
_eltKaskoSoap = new EltSoapClient();
|
||||
}
|
||||
|
||||
public Dictionary<string, object> CalculateKasko(CalculateKaskoRequest calculateKaskoRequest)
|
||||
{
|
||||
var authInfo = new AuthInfo
|
||||
{
|
||||
Login = "dmitrienko",
|
||||
Password = "12345"
|
||||
};
|
||||
var eltParams = calculateKaskoRequest.ELTParams;
|
||||
|
||||
//KLADR
|
||||
var kladr = "0";
|
||||
var eltRegions = _eltKaskoSoap.GetRegionsExt(new GetRegionsExtRequest());
|
||||
var eltRegion = eltRegions.GetRegionsExtResult.FirstOrDefault(x =>
|
||||
x.Name.Contains(calculateKaskoRequest.Preparams.RegionName.Split(" ")[0])
|
||||
);
|
||||
if (eltRegion != null)
|
||||
{
|
||||
if (eltRegion.Kladr != null)
|
||||
{
|
||||
kladr = eltRegion.Kladr;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (eltRegion.Id != null)
|
||||
{
|
||||
var eltCities = _eltKaskoSoap.GetCitiesExt(new GetCitiesExtRequest {RegionId = eltRegion.Id});
|
||||
var eltCity = eltCities.GetCitiesExtResult.FirstOrDefault(x =>
|
||||
x.Name.Contains(calculateKaskoRequest.Preparams.CityName.Split(" ")[0]));
|
||||
if (eltCity != null) kladr = eltCity.Kladr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eltParams.UsageCityKLADR = kladr;
|
||||
//KLADR
|
||||
|
||||
//CAR
|
||||
var mappedCars = _eltKaskoSoap.MappedCars(new MappedCarsRequest
|
||||
{
|
||||
Marka = calculateKaskoRequest.Preparams.BrandId,
|
||||
Model = calculateKaskoRequest.Preparams.ModelId
|
||||
});
|
||||
|
||||
eltParams.Mark = mappedCars.Mark;
|
||||
eltParams.Model = mappedCars.Model;
|
||||
//CAR
|
||||
|
||||
|
||||
var result = new Dictionary<string, object>();
|
||||
foreach (var companyId in calculateKaskoRequest.CompanyIds)
|
||||
try
|
||||
{
|
||||
var res = _eltKaskoSoap.PreliminaryKASKOCalculation(authInfo, null, companyId, null, null, null,
|
||||
"15", null,
|
||||
false, null, null, eltParams);
|
||||
result.Add(companyId, res);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
ELT.Client/Kasko/Models/CalculateKaskoRequest.cs
Normal file
19
ELT.Client/Kasko/Models/CalculateKaskoRequest.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using ELTKasko;
|
||||
|
||||
namespace ELT.Models
|
||||
{
|
||||
public class Preparams
|
||||
{
|
||||
public string RegionName { get; set; }
|
||||
public string CityName { get; set; }
|
||||
public string BrandId { get; set; }
|
||||
public string ModelId { get; set; }
|
||||
}
|
||||
|
||||
public class CalculateKaskoRequest
|
||||
{
|
||||
public string[] CompanyIds { get; set; }
|
||||
public PreliminaryKASKOCalculationParams ELTParams { get; set; }
|
||||
public Preparams Preparams { get; set; }
|
||||
}
|
||||
}
|
||||
31
ELT.sln
Normal file
31
ELT.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31005.135
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ELT", "ELT\ELT.csproj", "{2DB25D88-2DC4-4923-B26D-BE9D4FE03463}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ELT.Client", "ELT.Client\ELT.Client.csproj", "{9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2DB25D88-2DC4-4923-B26D-BE9D4FE03463}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2DB25D88-2DC4-4923-B26D-BE9D4FE03463}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2DB25D88-2DC4-4923-B26D-BE9D4FE03463}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2DB25D88-2DC4-4923-B26D-BE9D4FE03463}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {43516610-06DE-40BF-B3FA-DBC5BF56E6B9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
19
ELT/Controllers/KaskoController.cs
Normal file
19
ELT/Controllers/KaskoController.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using ELT.Client.Kasko;
|
||||
using ELT.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ELT.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class KaskoController : ControllerBase
|
||||
{
|
||||
[HttpPost("[action]")]
|
||||
public ActionResult<object> CalculateKasko([FromBody] CalculateKaskoRequest calculateKaskoRequest)
|
||||
{
|
||||
var kaskoManager = new KaskoManager();
|
||||
var res = kaskoManager.CalculateKasko(calculateKaskoRequest);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
ELT/Dockerfile
Normal file
21
ELT/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
|
||||
WORKDIR /src
|
||||
COPY ["ELT/ELT.csproj", "ELT/"]
|
||||
RUN dotnet restore "ELT/ELT.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/ELT"
|
||||
RUN dotnet build "ELT.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "ELT.csproj" -c Release -o /app/publish
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "ELT.dll"]
|
||||
18
ELT/ELT.csproj
Normal file
18
ELT/ELT.csproj
Normal file
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ELT.Client\ELT.Client.csproj" />
|
||||
<ProjectReference Include="..\ELT.Models\ELT.Models.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
19
ELT/Program.cs
Normal file
19
ELT/Program.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace ELT
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||
{
|
||||
return Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
35
ELT/Properties/launchSettings.json
Normal file
35
ELT/Properties/launchSettings.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:59615",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ELT": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000"
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast",
|
||||
"publishAllPorts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
34
ELT/Startup.cs
Normal file
34
ELT/Startup.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace ELT
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddControllers();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
if (env.IsDevelopment()) app.UseDeveloperExceptionPage();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
9
ELT/appsettings.Development.json
Normal file
9
ELT/appsettings.Development.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
10
ELT/appsettings.json
Normal file
10
ELT/appsettings.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user