Commit d15c1d00 authored by 黄奎's avatar 黄奎

11

parent 863a3c6a
......@@ -1085,7 +1085,27 @@ namespace Mall.Module.TradePavilion
List<object> secondResultList = new List<object>();
foreach (var secondItem in subList)
{
string secondUrl = "/pages/kotra/CarrierBuildingIndex?cat_id="+ firstItem .Id+ "&CategoryIds=" + secondItem.ID;
string secondUrl ="";
//载体
if (firstItem.Id == 1)
{
secondUrl = "/pages/kotra/carrier/list?id=" + secondItem.ID;
}
//楼宇
else if (firstItem.Id == 2)
{
secondUrl = "/pages/kotra/carrier/list?id=" + secondItem.ID;
}
//消费品牌
else if (firstItem.Id == 3)
{
secondUrl = "/pages/kotra/brand/list?id=" + secondItem.ID;
}
//企业服务
else
{
secondUrl = "/pages/kotra/brand/list?id=" + secondItem.ID;
}
secondResultList.Add(new
{
PageId = secondItem.ID + 300000,
......@@ -1100,7 +1120,27 @@ namespace Mall.Module.TradePavilion
});
}
string rootUrl = @"/pages/kotra/CarrierBuildingIndex?cat_id=" + firstItem.Id;
string rootUrl = "";
//载体
if (firstItem.Id == 1)
{
rootUrl = "/pages/kotra/carrier/list";
}
//楼宇
else if (firstItem.Id == 2)
{
rootUrl = "/pages/kotra/carrier/list";
}
//消费品牌
else if (firstItem.Id == 3)
{
rootUrl = "/pages/kotra/brand/list";
}
//企业服务
else
{
rootUrl = "/pages/kotra/brand/list";
}
resultList.Add(new
{
PageId = firstItem.Id + 200000,
......
using Mall.Model.Entity.TradePavilion;
using Mall.Common.Enum;
using Mall.Model.Entity.TradePavilion;
using Mall.Model.Extend.TradePavilion;
using System;
using System.Collections.Generic;
......@@ -27,8 +28,9 @@ namespace Mall.Repository.TradePavilion
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.ClassName,'') AS CategoryName
FROM rb_brand_Enterprise AS A LEFT JOIN rb_brandclass AS B ON A.CategoryId=B.ID WHERE 1=1 ");
FROM rb_brand_Enterprise AS A LEFT JOIN rb_brandclass AS B ON A.CategoryId=B.ID
WHERE 1=1 ");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Brand_Enterprise_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.TenantId > 0)
......@@ -119,7 +121,7 @@ SELECT A.*,IFNULL(B.ClassName,'') AS CategoryName
FROM rb_brand_Enterprise AS A LEFT JOIN rb_brandclass AS B ON A.CategoryId=B.ID
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Brand_Enterprise_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.TenantId > 0)
......
......@@ -52,7 +52,7 @@ namespace Mall.ThirdCore.Oss
/// <summary>
/// 上传文件
/// </summary>
/// <param name="fileName">文件名</param>
/// <param name="filePath">文件名</param>
/// <param name="stream">文件流</param>
/// <returns></returns>
public OssResult UploadFile(string filePath, System.IO.Stream stream)
......@@ -76,7 +76,7 @@ namespace Mall.ThirdCore.Oss
{
string fileExtention = System.IO.Path.GetExtension(filePath);
string bucket = this.bucketName; //存储桶,格式:BucketName-APPID
string key = @"/SaleBefore/Goods/"+DateTime.Now.Ticks.ToString()+fileExtention; //对象在存储桶中的位置,即称对象键
string key = @"/YB2024/Goods/"+DateTime.Now.Ticks.ToString()+fileExtention; //对象在存储桶中的位置,即称对象键
PutObjectRequest request = new PutObjectRequest(bucket, key, filePath);
//设置签名有效时长
request.SetSign(TimeUtils.GetCurrentTime(TimeUnit.SECONDS), 600);
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<connectionStrings>
<add name="DefaultConnection" providerName="MySql.Data.MySqlClient" connectionString="server=192.168.10.214;user id=reborn;password=Reborn@2018;database=reborn_mall;CharSet=utf8; Convert Zero Datetime=true; " />
<add name="DefaultConnection" providerName="MySql.Data.MySqlClient" connectionString="server=192.168.10.214;user id=reborn;password=Reborn@2018;database=reborn_mall;CharSet=utf8; Convert Zero Datetime=true; "/>
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data></configuration>
using System;
using Mall.Common.Models;
using Mall.Common.Plugin;
using Newtonsoft.Json;
using Mall.DataHelper.Import;
using Mall.Repository.TradePavilion;
using Mall.ThirdCore.Oss;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace TestCore
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("开始..");
static string rootPath = Path.Combine(Directory.GetCurrentDirectory(), "upfile");
static string tempPath = rootPath + @"\TempImport\TempFile";
static string ViewFileSiteUrl = "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com";
//new Word2ImageConverter().ConvertToImage("C:/Users/Administrator/Desktop/testImage/网课需求(1).docx", "C:/Users/Administrator/Desktop/testImage/Image/");
//new Pdf2ImageConverter().ConvertToImage("C:/Users/Administrator/Desktop/testImage/MA10048W_zh.pdf", "C:/Users/Administrator/Desktop/testImage/PdfImage/");
//new Ppt2ImageConverter().ConvertToImage("C:/Users/Administrator/Desktop/testImage/kjljlkjk.ppt", "C:/Users/Administrator/Desktop/testImage/PptImage/");
/// <summary>
/// 分类仓储层
/// </summary>
private static RB_BrandClassRepository brandClassRepository = new RB_BrandClassRepository();
RabbiMQManager.SendMessage(new RabbitConfig()
/// <summary>
/// 品牌仓储层
/// </summary>
private static RB_Brand_EnterpriseRepository brand_EnterpriseRepository = new RB_Brand_EnterpriseRepository();
static void Main(string[] args)
{
Console.WriteLine("开始.." );
int Type = 2;
if (Type == 1)
{
HostName = "47.96.25.130",
Port = 5672,
UserName = "guest",
Password = "viitto2019",
QueenName = RabbitKey.QUEEN_GENERATE_EDUCARION
}, JsonConvert.SerializeObject(new
BrandImport();
}
else if (Type == 2)
{
Name = "科长级",
Age = 33
}));
CarrierImport();
}
else if (Type == 3)
{
BuildingImport();
}
else
{
EnterpriseImport();
}
Console.WriteLine("结束..");
Console.ReadKey();
}
/// <summary>
/// 品牌导入
/// </summary>
static void BrandImport()
{
string brandFile = rootPath + @"\消费品牌导入.xlsx";
Console.WriteLine("Start解析品牌文件...");
var brandList = BrandHelper.ImportYBBrandData(brandFile, tempPath);
Console.WriteLine("End解析品牌文件...");
var categoryList = brandClassRepository.GetBrandClassListRepository(new Mall.Model.Extend.TradePavilion.RB_BrandClass_Extend() { });
foreach (var item in brandList)
{
item.BrandEnterpriseType = 1;
item.FullBrandName = item.BrandName;
if (!string.IsNullOrEmpty(item.Logo))
{
OssResult logoObj = SaveImg(item.Logo);
if (logoObj != null && logoObj.resultCode == 1)
{
item.Logo = ViewFileSiteUrl + logoObj.data;
}
}
if (!string.IsNullOrEmpty(item.Banner))
{
List<string> bannerList = new List<string>();
var tempArray = item.Banner.Split(',');
if (tempArray != null && tempArray.Length > 0)
{
foreach (var tItem in tempArray)
{
if (!string.IsNullOrEmpty(tItem))
{
OssResult bObj = SaveImg(tItem);
if (bObj.resultCode == 1)
{
bannerList.Add(ViewFileSiteUrl + bObj.data);
}
}
}
}
item.Banner = Mall.Common.Plugin.JsonHelper.Serialize(bannerList);
}
if (!string.IsNullOrEmpty(item.CategoryName))
{
var tempCategory = categoryList.FirstOrDefault(qitem => qitem.ClassName.Trim() == item.CategoryName.Trim());
item.CategoryId = tempCategory?.ID ?? 0;
}
item.TenantId = 30;
item.MallBaseId = 20;
item.CreateBy = 30;
item.CreateDate = DateTime.Now;
item.UpdateBy = 30;
item.UpdateDate = DateTime.Now;
}
bool flag = false;
if (brandList != null && brandList.Count > 0)
{
flag= brand_EnterpriseRepository.InsertBatch(brandList);
}
Console.WriteLine("BrandImport::Flag_{0} Params:{1} ", flag, Mall.Common.Plugin.JsonHelper.Serialize(brandList));
}
/// <summary>
/// 商业载体导入
/// </summary>
static void CarrierImport()
{
string carrierFile = rootPath + @"\商业载体导入.xlsx";
var carrierList = CarrierHelper.ImportYBCarrierData(carrierFile, tempPath);
Console.WriteLine("CarrierImport::{0}", Mall.Common.Plugin.JsonHelper.Serialize(carrierList));
}
/// <summary>
/// 楼宇导入
/// </summary>
static void BuildingImport()
{
string buildingFile = rootPath + @"\活力楼宇导入.xlsx";
var buildingList = BuildingHelper.ImportYBuildingData(buildingFile, tempPath);
Console.WriteLine("BuildingImport::{0}", Mall.Common.Plugin.JsonHelper.Serialize(buildingList));
}
/// <summary>
/// 企业服务导入
/// </summary>
static void EnterpriseImport()
{
string enterpriseFile = rootPath + @"\企业服务导入.xlsx";
var enterpriseList = EnterpriseServiceHelper.ImportYBEnterpriseData(enterpriseFile, tempPath);
Console.WriteLine("EnterpriseImport::{0}", Mall.Common.Plugin.JsonHelper.Serialize(enterpriseList));
}
/// <summary>
/// 上传图片
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
static OssResult SaveImg(string path)
{
OssResult result = new OssResult();
if (!string.IsNullOrEmpty(path))
{
result = UploadHelper.UploadFileToTencent(path);
}
return result;
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
......@@ -6,7 +6,39 @@
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mall.AOP\Mall.AOP.csproj" />
<ProjectReference Include="..\Mall.CacheManager\Mall.CacheManager.csproj" />
<ProjectReference Include="..\Mall.Common\Mall.Common.csproj" />
<ProjectReference Include="..\Mall.DataHelper\Mall.DataHelper.csproj" />
<ProjectReference Include="..\Mall.IM\Mall.IM.csproj" />
<ProjectReference Include="..\Mall.Model\Mall.Model.csproj" />
<ProjectReference Include="..\Mall.Module.BaseSetUp\Mall.Module.BaseSetUp.csproj" />
<ProjectReference Include="..\Mall.Module.Education\Mall.Module.Education.csproj" />
<ProjectReference Include="..\Mall.Module.MarketingCenter\Mall.Module.MarketingCenter.csproj" />
<ProjectReference Include="..\Mall.Module.Miai\Mall.Module.Miai.csproj" />
<ProjectReference Include="..\Mall.Module.Product\Mall.Module.Product.csproj" />
<ProjectReference Include="..\Mall.Module.Property\Mall.Module.Property.csproj" />
<ProjectReference Include="..\Mall.Module.Reserve\Mall.Module.Reserve.csproj" />
<ProjectReference Include="..\Mall.Module.TradePavilion\Mall.Module.TradePavilion.csproj" />
<ProjectReference Include="..\Mall.Module.User\Mall.Module.User.csproj" />
<ProjectReference Include="..\Mall.Repository\Mall.Repository.csproj" />
<ProjectReference Include="..\Mall.ThirdCore\Mall.ThirdCore.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="upfile\" />
</ItemGroup>
</Project>
using Mall.ThirdCore.Oss;
using Microsoft.AspNetCore.Server.IISIntegration;
using System;
using System.Collections.Generic;
using System.Text;
namespace TestCore
{
public class UploadHelper
{
/// <summary>
/// 文件上传搭配腾讯
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static OssResult UploadFileToTencent(string filePath)
{
string Region = "ap-chengdu";
string SecretId = "AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd";
string SecretKey = "PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob";
string Bucket = "viitto-1301420277";
IOssService ossService = OssService.GetTencent(Region, SecretId, SecretKey, Bucket);
OssResult result = ossService.UploadFile(filePath, null);
return result;
}
}
}
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