初始化
This commit is contained in:
13
SupplierManager/Common/MyMemoryCache.cs
Normal file
13
SupplierManager/Common/MyMemoryCache.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace WebAPIServer.Common
|
||||
{
|
||||
public class MyMemoryCache
|
||||
{
|
||||
public MemoryCache Cache { get; } = new MemoryCache(
|
||||
new MemoryCacheOptions
|
||||
{
|
||||
SizeLimit = 1024
|
||||
});
|
||||
}
|
||||
}
|
||||
30
SupplierManager/Common/StaticData.cs
Normal file
30
SupplierManager/Common/StaticData.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Reflection;
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.Scripting.Hosting;
|
||||
using SupplierManager.Extensions;
|
||||
|
||||
namespace SupplierManager.Common
|
||||
{
|
||||
public class StaticData
|
||||
{
|
||||
public readonly static object obj = new object();
|
||||
public static ScriptEngine eng = Python.CreateEngine();
|
||||
public static ScriptScope scope1 = eng.CreateScope();
|
||||
public static ScriptScope scope2 = eng.CreateScope();
|
||||
public static ScriptScope scope3 = eng.CreateScope();
|
||||
|
||||
public static void GetWebAPIMethod()
|
||||
{
|
||||
eng.Runtime.LoadAssembly(Assembly.GetExecutingAssembly());
|
||||
eng.ExecuteFile("script\\webapi.py", scope1);
|
||||
}
|
||||
public static void GetWebAPIMethod1()
|
||||
{
|
||||
eng.ExecuteFile("script\\a.py", scope1);
|
||||
}
|
||||
public static void GetWebAPIMethod2()
|
||||
{
|
||||
eng.ExecuteFile("script\\b.py", scope1);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
SupplierManager/Controllers/AasCustomerInfoesController.cs
Normal file
120
SupplierManager/Controllers/AasCustomerInfoesController.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class AasCustomerInfoesController : ControllerBase
|
||||
{
|
||||
private readonly AgentApprovalSystemContext _context;
|
||||
|
||||
public AasCustomerInfoesController(AgentApprovalSystemContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/AasCustomerInfoes
|
||||
[HttpGet]
|
||||
public async Task<ReturnInfo> GetAasCustomerInfos([FromBody] QueryAll_Or_Single S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
if (S.IsAll)
|
||||
{
|
||||
returnInfo.response = await _context.AasCustomerInfos.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
var aasCustomerInfo = await _context.AasCustomerInfos.FindAsync(S.ID);
|
||||
|
||||
returnInfo.response = aasCustomerInfo;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
|
||||
// PUT: api/AasCustomerInfoes/5
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPut("{id}")]
|
||||
public async Task<ReturnInfo> PutAasCustomerInfo([FromBody] AasCustomerInfo aasCustomerInfo)
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
_context.Entry(aasCustomerInfo).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// POST: api/AasCustomerInfoes
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPost]
|
||||
public async Task<ReturnInfo> AddAasCustomerInfo([FromBody] AasCustomerInfo aasCustomerInfo)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
_context.AasCustomerInfos.Add(aasCustomerInfo);
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> DeleteAasCustomerInfo([FromBody] Dictionary<string, long> stu)
|
||||
{
|
||||
ReturnInfo re = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
|
||||
long id = stu["id"];
|
||||
re.isok = true;
|
||||
var aasCustomerInfo = await _context.AasCustomerInfos.FindAsync(id);
|
||||
|
||||
if (aasCustomerInfo != null)
|
||||
{
|
||||
_context.AasCustomerInfos.Remove(aasCustomerInfo);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
re.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
re.isok = false;
|
||||
}
|
||||
return re;
|
||||
}
|
||||
}
|
||||
}
|
||||
451
SupplierManager/Controllers/AasProjectInfoesController.cs
Normal file
451
SupplierManager/Controllers/AasProjectInfoesController.cs
Normal file
@@ -0,0 +1,451 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.CodeAnalysis.Elfie.Model.Tree;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SupplierManager.Common;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class AasProjectInfoesController : ControllerBase
|
||||
{
|
||||
|
||||
// GET: api/AasProjectInfoes
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> GetAasProjectInfos([FromBody] QueryAll_Or_Single_ProjectInfo S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
if (S.IsAll)
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
var U = q.AasProjectInfos.Where(A => A.CompanyId == S.ComId).ToList();
|
||||
|
||||
var A = new List<ShengPiDDD>();
|
||||
foreach (AasProjectInfo item in U)
|
||||
{
|
||||
ShengPiDDD s = new ShengPiDDD();
|
||||
s.Id = item.Id;
|
||||
s.Shengfen = item.Shengfen;
|
||||
s.Quyu = item.Quyu;
|
||||
s.AddressDetail = item.AddressDetail;
|
||||
s.HangyeClass = item.HangyeClass;
|
||||
s.ProjectCode = item.ProjectCode;
|
||||
s.ProjectName = item.ProjectName;
|
||||
s.CompanyId = item.CompanyId;
|
||||
s.RoomTotalCount = item.RoomTotalCount;
|
||||
s.RoomTypeCount = item.RoomTypeCount;
|
||||
s.Blueprint = item.Blueprint;
|
||||
s.Createtime = item.Createtime;
|
||||
s.Updatetime = item.Updatetime;
|
||||
s.ShengpiStatus = item.ShengpiStatus;
|
||||
s.Uid = item.Uid;
|
||||
s.Customization = item.Customization;
|
||||
|
||||
var U1 = q.AasProjectShenpis.Where(A => A.ProjectCode == item.ProjectCode).ToList();
|
||||
s.sp = U1;
|
||||
A.Add(s);
|
||||
}
|
||||
|
||||
//var query = from t1 in q.AasProjectInfos
|
||||
// join t2 in q.AasProjectShenpis on t1.ProjectCode equals t2.ProjectCode into tt1
|
||||
// from t3 in tt1.DefaultIfEmpty()
|
||||
// where t1.CompanyId == S.ComId
|
||||
// select new
|
||||
// {
|
||||
// t1.Id,
|
||||
// t1.Shengfen,
|
||||
// t1.Quyu,
|
||||
// t1.AddressDetail,
|
||||
// t1.HangyeClass,
|
||||
// t1.ProjectName,
|
||||
// t1.ProjectCode,
|
||||
// t1.CompanyId,
|
||||
// t1.RoomTotalCount,
|
||||
// t1.RoomTypeCount,
|
||||
// t3.RejectReason,
|
||||
// t3.ShenpiNumber,
|
||||
// sp_Createtime= t3.Createtime
|
||||
// };
|
||||
|
||||
//var result = query.ToList();
|
||||
//var D = Q.ToList<ShengPiDDD>();
|
||||
//var D = Q.ToList();
|
||||
returnInfo.response = A;
|
||||
}
|
||||
else
|
||||
{
|
||||
//returnInfo.isok = true;
|
||||
//var a = q.AasUsers.SingleOrDefault(A => A.Id == S.ID);
|
||||
//if (a != null)
|
||||
//{
|
||||
// returnInfo.response = a;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> GetAasProjectInfos_Page([FromBody] QueryAll_Or_Single_ProjectInfo_Page S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
DateTime dt_s = DateTime.Now;
|
||||
|
||||
DateTime dt_e = DateTime.Now;
|
||||
|
||||
using var q = new AgentApprovalSystemContext();
|
||||
|
||||
|
||||
List<AasProjectInfo> U = new List<AasProjectInfo>();
|
||||
if (!string.IsNullOrEmpty(S.UpdateTime_Start) && !string.IsNullOrEmpty(S.UpdateTime_End) && S.ComId != 0)
|
||||
{
|
||||
DateTime.TryParse(S.UpdateTime_Start, out dt_s);
|
||||
DateTime.TryParse(S.UpdateTime_End, out dt_e);
|
||||
long dt_s_l = Tools.ToUnixTimestampBySeconds(dt_s);
|
||||
long dt_e_l = Tools.ToUnixTimestampBySeconds(dt_e);
|
||||
U = await q.AasProjectInfos.Where(A => A.CompanyId == S.ComId && A.UpdatetimeUnix > dt_s_l && A.UpdatetimeUnix <= dt_e_l).ToListAsync();
|
||||
}
|
||||
else if (string.IsNullOrEmpty(S.UpdateTime_Start) && string.IsNullOrEmpty(S.UpdateTime_End) && S.ComId != 0)
|
||||
{
|
||||
U = await q.AasProjectInfos.Where(A => A.CompanyId == S.ComId).ToListAsync();
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(S.UpdateTime_Start) && !string.IsNullOrEmpty(S.UpdateTime_End) && S.ComId == 0)
|
||||
{
|
||||
DateTime.TryParse(S.UpdateTime_Start, out dt_s);
|
||||
DateTime.TryParse(S.UpdateTime_End, out dt_e);
|
||||
long dt_s_l = Tools.ToUnixTimestampBySeconds(dt_s);
|
||||
long dt_e_l = Tools.ToUnixTimestampBySeconds(dt_e);
|
||||
U = await q.AasProjectInfos.Where(A => A.UpdatetimeUnix > dt_s_l && A.UpdatetimeUnix <= dt_e_l).ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
var A = new List<ShengPiDDD>();
|
||||
foreach (AasProjectInfo item in U)
|
||||
{
|
||||
ShengPiDDD s = new ShengPiDDD();
|
||||
s.Id = item.Id;
|
||||
s.Shengfen = item.Shengfen;
|
||||
s.Quyu = item.Quyu;
|
||||
s.AddressDetail = item.AddressDetail;
|
||||
s.HangyeClass = item.HangyeClass;
|
||||
s.ProjectCode = item.ProjectCode;
|
||||
s.ProjectName = item.ProjectName;
|
||||
s.CompanyId = item.CompanyId;
|
||||
s.RoomTotalCount = item.RoomTotalCount;
|
||||
s.RoomTypeCount = item.RoomTypeCount;
|
||||
s.Blueprint = item.Blueprint;
|
||||
s.Createtime = item.Createtime;
|
||||
s.Updatetime = item.Updatetime;
|
||||
s.ShengpiStatus = item.ShengpiStatus;
|
||||
s.Uid = item.Uid;
|
||||
s.Customization = item.Customization;
|
||||
|
||||
var U1 = await q.AasProjectShenpis.Where(A => A.ProjectCode == item.ProjectCode).ToListAsync();
|
||||
s.sp = U1;
|
||||
A.Add(s);
|
||||
}
|
||||
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = A;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
|
||||
public class ShengPiDDD : AasProjectInfo
|
||||
{
|
||||
public List<AasProjectShenpi> sp { get; set; }
|
||||
}
|
||||
|
||||
public class PInfo
|
||||
{
|
||||
public long id { get; set; }
|
||||
public string projectName { get; set; }
|
||||
public int projectCode { get; set; }
|
||||
public string shengfen { get; set; }
|
||||
public string quyu { get; set; }
|
||||
public string? addressDetail { get; set; }
|
||||
public string? hangyeClass { get; set; }
|
||||
public int roomTypeCount { get; set; }
|
||||
public int roomTotalCount { get; set; }
|
||||
public string? blueprint { get; set; }
|
||||
public string? customization { get; set; }
|
||||
}
|
||||
// PUT: api/AasProjectInfoes/5
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> EditProjectInfo([FromBody] PInfo record)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
using var _context = new AgentApprovalSystemContext();
|
||||
var aasProjectInfo = _context.AasProjectInfos.SingleOrDefault(A => A.Id == record.id);
|
||||
if (aasProjectInfo != null)
|
||||
{
|
||||
|
||||
DateTime dt = DateTime.Now;
|
||||
aasProjectInfo.Updatetime = dt;
|
||||
aasProjectInfo.UpdatetimeUnix = Tools.ToUnixTimestampBySeconds(dt);
|
||||
aasProjectInfo.Shengfen = record.shengfen;
|
||||
aasProjectInfo.ProjectName = record.projectName;
|
||||
aasProjectInfo.Quyu = record.quyu;
|
||||
aasProjectInfo.AddressDetail = record.addressDetail;
|
||||
aasProjectInfo.RoomTotalCount = record.roomTotalCount;
|
||||
aasProjectInfo.RoomTypeCount = record.roomTypeCount;
|
||||
aasProjectInfo.HangyeClass = record.hangyeClass;
|
||||
aasProjectInfo.Blueprint = record.blueprint;
|
||||
aasProjectInfo.Customization = record.customization;
|
||||
|
||||
_context.Entry(aasProjectInfo).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = "你修改了一个不存在的数据,这是不允许的";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
// POST: api/AasProjectInfoes
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPost]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> AddAasProjectInfo(AasProjectInfo aasProjectInfo)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
lock (StaticData.obj)
|
||||
{
|
||||
using (var _context = new AgentApprovalSystemContext())
|
||||
{
|
||||
using var tran = _context.Database.BeginTransaction();
|
||||
var QQQ = _context.Autokeygeneraters.SingleOrDefault();
|
||||
if (QQQ != null)
|
||||
{
|
||||
long? n = QQQ.ProjectInfoCode + 1;
|
||||
QQQ.ProjectInfoCode = n;
|
||||
_context.Autokeygeneraters.Update(QQQ);
|
||||
aasProjectInfo.ProjectCode = n.ToString();
|
||||
}
|
||||
long ll = Tools.ToUnixTimestampBySeconds(DateTime.Now);
|
||||
aasProjectInfo.Createtime = DateTime.Now;
|
||||
aasProjectInfo.Updatetime = DateTime.Now;
|
||||
aasProjectInfo.ShengpiStatus = "1";
|
||||
aasProjectInfo.CreatetimeUnix = ll;
|
||||
aasProjectInfo.UpdatetimeUnix = ll;
|
||||
_context.AasProjectInfos.Add(aasProjectInfo);
|
||||
_context.SaveChanges();
|
||||
|
||||
tran.Commit();
|
||||
}
|
||||
}
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
// DELETE: api/AasProjectInfoes/5
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> DeleteAasProjectInfo(long id)
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
r.isok = true;
|
||||
try
|
||||
{
|
||||
|
||||
using var _context = new AgentApprovalSystemContext();
|
||||
|
||||
var aasProjectInfo = await _context.AasProjectInfos.FindAsync(id);
|
||||
if (aasProjectInfo == null)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = "要删除的数据不存在";
|
||||
}
|
||||
|
||||
_context.AasProjectInfos.Remove(aasProjectInfo);
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> StatusChange_AasProjectInfo([FromBody] A a)
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
r.isok = true;
|
||||
try
|
||||
{
|
||||
|
||||
using var _context = new AgentApprovalSystemContext();
|
||||
|
||||
|
||||
var aasProjectInfo = await _context.AasProjectInfos.FindAsync(a.id);
|
||||
if (aasProjectInfo == null)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = "要修改的数据不存在";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (a.Status.Equals("3"))
|
||||
{
|
||||
var aasProjectInfo0 = await _context.AasProjectInfos.Where(X => X.ShengpiStatus.Equals("3") && X.ProjectName.Equals(aasProjectInfo.ProjectName)).ToListAsync();
|
||||
if (aasProjectInfo0.Count > 0)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = "已有同名项目,请重试";
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
aasProjectInfo.ShengpiStatus = a.Status;
|
||||
aasProjectInfo.Updatetime = DateTime.Now;
|
||||
_context.AasProjectInfos.Update(aasProjectInfo);
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> Get_ProjectCode_Generate()
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
r.isok = true;
|
||||
try
|
||||
{
|
||||
using var _context = new AgentApprovalSystemContext();
|
||||
var a = await _context.Autokeygeneraters.FirstOrDefaultAsync();
|
||||
if (a == null)
|
||||
{
|
||||
Autokeygenerater d1 = new Autokeygenerater();
|
||||
d1.ProjectInfoCode = 1000;
|
||||
_context.Autokeygeneraters.Add(d1);
|
||||
r.isok = true;
|
||||
r.response = a.ProjectInfoCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
a.ProjectInfoCode = a.ProjectInfoCode + 1;
|
||||
_context.Autokeygeneraters.Update(a);
|
||||
r.isok = true;
|
||||
r.response = a.ProjectInfoCode;
|
||||
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> Get_ProjectByStatusCode()
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
r.isok = true;
|
||||
try
|
||||
{
|
||||
using var _context = new AgentApprovalSystemContext();
|
||||
var LLL = await _context.AasProjectInfos.Where(A => A.ShengpiStatus.Equals("3")).ToListAsync();
|
||||
r.response = LLL;
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
public class A
|
||||
{
|
||||
public long id { get; set; }
|
||||
public string? Status { get; set; }
|
||||
//public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
129
SupplierManager/Controllers/AasProjectReportReadiesController.cs
Normal file
129
SupplierManager/Controllers/AasProjectReportReadiesController.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AasProjectReportReadiesController : ControllerBase
|
||||
{
|
||||
private readonly AgentApprovalSystemContext _context;
|
||||
|
||||
public AasProjectReportReadiesController(AgentApprovalSystemContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/AasProjectReportReadies
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> GetAasProjectReportReadies([FromBody] QueryAll_Or_Single_ProjectInfo S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
if (S.IsAll)
|
||||
{
|
||||
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = await _context.AasProjectReportReadies.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
var a = await _context.AasProjectReportReadies.FindAsync(S.ID);
|
||||
if (a != null)
|
||||
{
|
||||
returnInfo.response = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
|
||||
// PUT: api/AasProjectReportReadies/5
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> EditAasProjectReportReady(AasProjectReportReady aasProjectReportReady)
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
_context.Entry(aasProjectReportReady).State = EntityState.Modified;
|
||||
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// POST: api/AasProjectReportReadies
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPost]
|
||||
public async Task<ReturnInfo> AddAasProjectReportReady(AasProjectReportReady aasProjectReportReady)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
|
||||
_context.AasProjectReportReadies.Add(aasProjectReportReady);
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// DELETE: api/AasProjectReportReadies/5
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<ReturnInfo> DeleteAasProjectReportReady(long id)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
var aasProjectReportReady = await _context.AasProjectReportReadies.FindAsync(id);
|
||||
if (aasProjectReportReady == null)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = "找不到要删除的数据";
|
||||
}
|
||||
|
||||
_context.AasProjectReportReadies.Remove(aasProjectReportReady);
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
139
SupplierManager/Controllers/AasProjectShenpisController.cs
Normal file
139
SupplierManager/Controllers/AasProjectShenpisController.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class AasProjectShenpisController : ControllerBase
|
||||
{
|
||||
private readonly AgentApprovalSystemContext _context;
|
||||
|
||||
public AasProjectShenpisController(AgentApprovalSystemContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/AasProjectShenpis
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> GetAasProjectShenpis([FromBody] QueryAll_Or_Single_ProjectInfo S)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
if (S.IsAll)
|
||||
{
|
||||
r.response = await _context.AasProjectShenpis.ToListAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var aasProjectShenpi = await _context.AasProjectShenpis.FindAsync(S.ID);
|
||||
r.isok = true;
|
||||
r.response = aasProjectShenpi;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> EditAasProjectShenpi([FromBody] AasProjectShenpi aasProjectShenpi)
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
aasProjectShenpi.Updatetime = DateTime.Now;
|
||||
_context.Entry(aasProjectShenpi).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> AddAasProjectShenpi(AasProjectShenpi aasProjectShenpi)
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
r.isok = false;
|
||||
try
|
||||
{
|
||||
var Q = _context.AasProjectShenpis.Where(x => x.ProjectCode.Equals(aasProjectShenpi.ProjectCode));
|
||||
if (Q.Count() > 0)
|
||||
{
|
||||
var Q1 = Q.OrderByDescending(A => A.ShenpiNumber).FirstOrDefault();
|
||||
aasProjectShenpi.ShenpiNumber = Q1?.ShenpiNumber + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
aasProjectShenpi.ShenpiNumber = 0;
|
||||
}
|
||||
aasProjectShenpi.Updatetime = DateTime.Now;
|
||||
_context.AasProjectShenpis.Add(aasProjectShenpi);
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// DELETE: api/AasProjectShenpis/5
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> DeleteAasProjectShenpi(long id)
|
||||
{
|
||||
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
|
||||
var aasProjectShenpi = await _context.AasProjectShenpis.FindAsync(id);
|
||||
if (aasProjectShenpi == null)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = "找不到相应的数据";
|
||||
}
|
||||
_context.AasProjectShenpis.Remove(aasProjectShenpi);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
private bool AasProjectShenpiExists(long id)
|
||||
{
|
||||
return _context.AasProjectShenpis.Any(e => e.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
235
SupplierManager/Controllers/CompanyController.cs
Normal file
235
SupplierManager/Controllers/CompanyController.cs
Normal file
@@ -0,0 +1,235 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class CompanyController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo DelCom([FromBody] Dictionary<string, int> LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
int idd = LLL["Id"];
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var FFF = q.AasCompanyInfos.FirstOrDefault(A => A.Id == idd);
|
||||
if (FFF != null)
|
||||
{
|
||||
q.AasCompanyInfos.Remove(FFF);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo EditCom([FromBody] Com LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var lll = q.AasCompanyInfos.SingleOrDefault(A => A.Id == LLL.Id);
|
||||
if (lll != null)
|
||||
{
|
||||
|
||||
lll.NameCn = LLL.NameCn;
|
||||
lll.NameEn = LLL.NameEn;
|
||||
lll.Identity = LLL.Identity;
|
||||
lll.Industry = LLL.Industry;
|
||||
lll.Code = LLL.Code;
|
||||
lll.LicenseCode = LLL.LicenseCode;
|
||||
lll.Region = LLL.Region;
|
||||
lll.Logoaddress= LLL.Logoaddress;
|
||||
lll.Updatetime = DateTime.Now;
|
||||
|
||||
q.AasCompanyInfos.Update(lll);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <param name="S"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo GetComInfo([FromBody] QueryAll_Or_Single S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
if (S.IsAll)
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = q.AasCompanyInfos.Select(F => new AasCompanyInfo
|
||||
{
|
||||
Id = F.Id,
|
||||
Code = F.Code,
|
||||
NameCn = F.NameCn,
|
||||
NameEn = F.NameEn,
|
||||
Identity = F.Identity,
|
||||
LicenseCode = F.LicenseCode,
|
||||
Industry = F.Industry,
|
||||
Region = F.Region,
|
||||
Logoaddress = F.Logoaddress
|
||||
}).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
var a = q.AasCompanyInfos.SingleOrDefault(A => A.Id == S.ID);
|
||||
if (a != null)
|
||||
{
|
||||
AasCompanyInfo u = new AasCompanyInfo();
|
||||
u.Id = a.Id;
|
||||
u.Code = a.Code;
|
||||
u.NameCn = a.NameCn;
|
||||
u.NameEn = a.NameEn;
|
||||
u.Updatetime = a.Updatetime;
|
||||
u.Createtime = a.Createtime;
|
||||
u.Industry = a.Industry;
|
||||
u.LicenseCode = a.LicenseCode;
|
||||
u.Region = a.Region;
|
||||
returnInfo.response = u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo AddCom([FromBody] Com LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
AasCompanyInfo a = new AasCompanyInfo();
|
||||
a.NameCn = LLL.NameCn;
|
||||
a.NameEn = LLL.NameEn;
|
||||
a.Identity = LLL.Identity;
|
||||
a.Industry = LLL.Industry;
|
||||
a.Region = LLL.Region;
|
||||
a.Logoaddress = LLL.Logoaddress;
|
||||
a.Createtime = DateTime.Now;
|
||||
a.Updatetime = DateTime.Now;
|
||||
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var Q = q.AasCompanyInfos.Where(A => A.NameCn.Equals(LLL.NameCn));
|
||||
if (Q.Count() > 0)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = "此公司已经存在";
|
||||
}
|
||||
else
|
||||
{
|
||||
using var T = q.Database.BeginTransaction();
|
||||
Autokeygenerater? QQQ = q.Autokeygeneraters.SingleOrDefault();
|
||||
QQQ.CompanyCode = QQQ.CompanyCode + 1;
|
||||
|
||||
a.Code = QQQ.CompanyCode.ToString();
|
||||
q.Autokeygeneraters.Update(QQQ);
|
||||
q.AasCompanyInfos.Add(a);
|
||||
returnInfo.isok = true;
|
||||
q.SaveChanges();
|
||||
T.Commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
}
|
||||
public class Com
|
||||
{
|
||||
|
||||
public int Id { get; set; } = -1;
|
||||
public string? Code { get; set; }
|
||||
|
||||
public string? NameCn { get; set; }
|
||||
|
||||
public string? NameEn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属行业
|
||||
/// </summary>
|
||||
public string? Industry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份
|
||||
/// </summary>
|
||||
public string? Identity { get; set; }
|
||||
|
||||
public string? Region { get; set; }
|
||||
public string? Logoaddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业执照
|
||||
/// </summary>
|
||||
public string? LicenseCode { get; set; }
|
||||
}
|
||||
}
|
||||
134
SupplierManager/Controllers/ConfigPYController.cs
Normal file
134
SupplierManager/Controllers/ConfigPYController.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Scripting.Utils;
|
||||
using SupplierManager.Common;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ConfigPYController : ControllerBase
|
||||
{
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> GetConfigString()
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
string[] str = await System.IO.File.ReadAllLinesAsync("script\\webapi.py");
|
||||
|
||||
List<VK> ll = new List<VK>();
|
||||
foreach (var item in str)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(item))
|
||||
{
|
||||
string[] a = item.Split('=');
|
||||
VK v = new VK();
|
||||
v.VarName = a[0];
|
||||
v.VarValue = a[1];
|
||||
ll.Add(v);
|
||||
}
|
||||
}
|
||||
|
||||
r.isok = true;
|
||||
r.response = ll;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo RefreshConfig()
|
||||
{
|
||||
ReturnInfo info = new ReturnInfo();
|
||||
info.isok = true;
|
||||
try
|
||||
{
|
||||
StaticData.GetWebAPIMethod();
|
||||
info.message = "Sucess";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
info.isok = false;
|
||||
info.message = ex.Message;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
public class VK
|
||||
{
|
||||
public string VarName { get; set; }
|
||||
public string VarValue { get; set; }
|
||||
}
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> SaveOrAddConfigString([FromBody] VK data)
|
||||
{
|
||||
ReturnInfo info = new ReturnInfo();
|
||||
info.isok = true;
|
||||
try
|
||||
{
|
||||
var sss = System.IO.File.ReadAllLines("script\\webapi.py", Encoding.UTF8).ToList<string>();
|
||||
for (int i = 0; i < sss.Count; i++)
|
||||
{
|
||||
string item = sss[i];
|
||||
string[] txtdata = item.Split('=');
|
||||
if (txtdata[0].Equals(data.VarName))
|
||||
{
|
||||
txtdata[1] = data.VarValue;
|
||||
sss[i] = txtdata[0] + "=" + txtdata[1];
|
||||
}
|
||||
}
|
||||
bool exists = sss.Any(A => A.StartsWith(data.VarName));
|
||||
|
||||
if (exists == false)
|
||||
{
|
||||
sss.AddRange<string>(new string[] { data.VarName + "=" + data.VarValue });
|
||||
}
|
||||
|
||||
await System.IO.File.WriteAllLinesAsync("script\\webapi.py", sss, Encoding.UTF8);
|
||||
StaticData.GetWebAPIMethod();
|
||||
info.message = "Sucess";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
info.isok = false;
|
||||
info.message = ex.Message;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo GetSingleValue([FromBody] Dictionary<string, string> dic)
|
||||
{
|
||||
ReturnInfo info = new ReturnInfo();
|
||||
info.isok = true;
|
||||
try
|
||||
{
|
||||
string VarValue = dic["VarName"];
|
||||
if (!string.IsNullOrEmpty(VarValue))
|
||||
{
|
||||
var QQQ = StaticData.scope1.GetVariable(VarValue);
|
||||
string str = System.Text.Json.JsonSerializer.Serialize(QQQ);
|
||||
info.response = str;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
info.isok = false;
|
||||
info.message = ex.Message;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
134
SupplierManager/Controllers/FileUploadController.cs
Normal file
134
SupplierManager/Controllers/FileUploadController.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class FileUploadController : ControllerBase
|
||||
{
|
||||
|
||||
public static string[] FolderG = new string[] {"face" };
|
||||
|
||||
[Authorize()]
|
||||
[HttpPost()]
|
||||
public async Task<IActionResult> UploadFile([FromForm] UploadFileModel model)
|
||||
{
|
||||
if (model.File == null || model.File.Length == 0)
|
||||
{
|
||||
return BadRequest("没有上传任何文件");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 获取文件名和扩展名
|
||||
string originalFileName = Path.GetFileNameWithoutExtension(model.File.FileName);
|
||||
string fileExtension = Path.GetExtension(model.File.FileName); // 包含扩展名前的点(如.jpg)
|
||||
|
||||
// 生成8位GUID(取完整GUID的前8位字符)
|
||||
string guidPart = Guid.NewGuid().ToString("N")[..16];
|
||||
|
||||
// 组合新文件名:原文件名_8位GUID.扩展名
|
||||
string newFileName = $"{originalFileName}_{guidPart}{fileExtension}";
|
||||
|
||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(),
|
||||
$"wwwroot/Uploads/{model.Folder}",
|
||||
newFileName);
|
||||
|
||||
using (var stream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
await model.File.CopyToAsync(stream);
|
||||
}
|
||||
return Ok(new { FileName = newFileName });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return BadRequest(new { Message = ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
public record DF
|
||||
{
|
||||
public string? FileName { get; set; }
|
||||
}
|
||||
// 示例:通过文件名获取图片
|
||||
[Authorize()]
|
||||
[HttpPost()]
|
||||
public IActionResult DownloadFile([FromBody]DF imageName)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 拼接图片物理路径(假设图片存放在项目的 wwwroot/images 目录下)
|
||||
var imagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/", imageName.FileName);
|
||||
|
||||
// 检查文件是否存在
|
||||
if (!System.IO.File.Exists(imagePath))
|
||||
{
|
||||
return NotFound("Image not found");
|
||||
}
|
||||
if (imageName.FileName.Contains(".."))
|
||||
{
|
||||
return BadRequest("Invalid file name");
|
||||
}
|
||||
|
||||
|
||||
// 读取文件流并返回
|
||||
var imageStream = System.IO.File.OpenRead(imagePath);
|
||||
|
||||
// 根据扩展名自动设置 Content-Type(MIME类型)
|
||||
var mimeType = GetMimeType(imageName.FileName);
|
||||
|
||||
return File(imageStream, mimeType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Internal server error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[Authorize()]
|
||||
[HttpPost()]
|
||||
public IActionResult GetFileNameList()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 拼接图片物理路径(假设图片存放在项目的 wwwroot/images 目录下)
|
||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(),
|
||||
$"wwwroot/Download/customization","");
|
||||
|
||||
string[] files= System.IO.Directory.GetFiles(filePath);
|
||||
var myfiles= files.Select(A=>Path.GetFileName(A));
|
||||
return Ok(new { FileNameList = myfiles });
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"Internal server error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// 获取 MIME 类型映射
|
||||
private string GetMimeType(string fileName)
|
||||
{
|
||||
var extension = Path.GetExtension(fileName).ToLowerInvariant();
|
||||
return
|
||||
extension switch
|
||||
{
|
||||
".jpg" => "image/jpeg",
|
||||
".jpeg" => "image/jpeg",
|
||||
".png" => "image/png",
|
||||
".gif" => "image/gif",
|
||||
".xls" =>"application/vnd.ms-excel",
|
||||
".xlsx"=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
_ => "application/octet-stream" // 默认类型
|
||||
};
|
||||
}
|
||||
}
|
||||
public class UploadFileModel
|
||||
{
|
||||
public IFormFile File { get; set; }
|
||||
public string Folder { get; set; }
|
||||
}
|
||||
}
|
||||
247
SupplierManager/Controllers/LoginController.cs
Normal file
247
SupplierManager/Controllers/LoginController.cs
Normal file
@@ -0,0 +1,247 @@
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Text;
|
||||
using ViewModels;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ViewModels.RequestData;
|
||||
using ViewModels.ResponseData;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using NLog;
|
||||
using SupplierManager.Extensions;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels.Common;
|
||||
using static IronPython.Modules._ast;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class LoginController : ControllerBase
|
||||
{
|
||||
|
||||
|
||||
|
||||
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
public IConfiguration? configuration { get; set; }
|
||||
public LoginController(IConfiguration _configuration)
|
||||
{
|
||||
configuration = _configuration;
|
||||
}
|
||||
[Authorize()]
|
||||
[HttpPost()]
|
||||
public ReturnInfo TokenXuQi()
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
r.isok = false;
|
||||
try
|
||||
{
|
||||
var claims = HttpContext.AuthenticateAsync().Result?.Principal?.Claims;
|
||||
if (claims != null && claims.Any())
|
||||
{
|
||||
var Name = claims.SingleOrDefault(A => A.Type == ClaimTypes.Name)?.Value;
|
||||
var UUU = claims.SingleOrDefault(A => A.Type == ClaimTypes.Role)?.Value;
|
||||
var TTT = claims.SingleOrDefault(A => A.Type == ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
AasUser? HH = new AasUser();
|
||||
int a = 0;
|
||||
int.TryParse(TTT, out a);
|
||||
HH.Id = a;
|
||||
bool bl = false;
|
||||
bool.TryParse(UUU, out bl);
|
||||
HH.Username = Name;
|
||||
string TokenStr = GetToken(HH);
|
||||
r.isok = true;
|
||||
r.response = TokenStr;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="username">用户名</param>
|
||||
/// <param name="password">密码</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ReturnInfo Login([FromBody] LoginData data)
|
||||
{
|
||||
|
||||
ReturnInfo res = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
string password = data.password;
|
||||
string username = data.username;
|
||||
AasUser? entity = null;
|
||||
string TokenString = "";
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
entity = q.AasUsers.SingleOrDefault(A => A.Username.Equals(username)&&A.Isdelete==false);
|
||||
if (entity != null)
|
||||
{
|
||||
bool vvv = Tools.VerifyHashedPassword(entity.Password, password);
|
||||
if (vvv == false)
|
||||
{
|
||||
res.isok = false;
|
||||
res.message = "密码错误";
|
||||
}
|
||||
else
|
||||
{
|
||||
TokenString = GetToken(entity);
|
||||
res.isok = true;
|
||||
|
||||
|
||||
ResLoginData r = new ResLoginData();
|
||||
r.AccessToken = TokenString;
|
||||
r.Id = entity.Id;
|
||||
r.Username = entity.Username;
|
||||
r.Realname = entity.Realname;
|
||||
r.Position = entity.Position;
|
||||
r.ComId = entity.ComId;
|
||||
r.RoleId = entity.RoleId;
|
||||
r.Avatar = entity.Avatar;
|
||||
|
||||
res.response = r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.isok = false;
|
||||
res.message = "用户不存在";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res.message = ex.Message;
|
||||
res.isok = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// wy登录验证
|
||||
/// </summary>
|
||||
/// <param name="username">用户名</param>
|
||||
/// <param name="password">密码</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ReturnInfo WeLogin([FromBody] LoginData data)
|
||||
{
|
||||
|
||||
ReturnInfo res = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
string password = data.password;
|
||||
string username = data.username;
|
||||
AasUser? entity = null;
|
||||
string TokenString = "";
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
entity = q.AasUsers.SingleOrDefault(A => A.Username.Equals(username)&&A.Isdelete==false);
|
||||
if (entity != null)
|
||||
{
|
||||
bool vvv = Tools.VerifyHashedPassword(entity.Password, password);
|
||||
if (vvv == false)
|
||||
{
|
||||
res.isok = false;
|
||||
res.message = "密码错误";
|
||||
}
|
||||
else
|
||||
{
|
||||
TokenString = GetToken(entity);
|
||||
res.isok = true;
|
||||
|
||||
JWTData r = new()
|
||||
{
|
||||
AccessToken = TokenString,
|
||||
iss = "BLW-" + Guid.NewGuid().ToString(),
|
||||
exp = Tools.ToUnixTimestampBySeconds(DateTime.Now.AddHours(12)),
|
||||
iat = Tools.ToUnixTimestampBySeconds(DateTime.Now).ToString(),
|
||||
jti = "AAS-" + Guid.NewGuid().ToString(),
|
||||
};
|
||||
|
||||
res.response = r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res.isok = false;
|
||||
res.message = "用户不存在";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res.message = ex.Message;
|
||||
res.isok = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private string GetToken(AasUser? entity)
|
||||
{
|
||||
string TokenString;
|
||||
var claims = new Claim[]
|
||||
{
|
||||
new Claim(ClaimTypes.NameIdentifier, entity.Id.ToString()),
|
||||
new Claim(ClaimTypes.MobilePhone, entity.Mobile.ToString()),
|
||||
new Claim(ClaimTypes.Name, entity.Username)
|
||||
};
|
||||
|
||||
var secretByte = Encoding.UTF8.GetBytes(configuration["JwT:SecretKey"]);
|
||||
var signingKey = new SymmetricSecurityKey(secretByte);
|
||||
var a = SecurityAlgorithms.HmacSha256;
|
||||
|
||||
var signingCredentials = new SigningCredentials(signingKey, a);
|
||||
|
||||
var token = new JwtSecurityToken(
|
||||
issuer: configuration["JwT:Issuer"],
|
||||
audience: configuration["JwT:Audience"],//接收
|
||||
claims: claims,//存放的用户信息
|
||||
notBefore: DateTime.UtcNow,//发布时间
|
||||
expires: DateTime.UtcNow.AddHours(12),
|
||||
signingCredentials: signingCredentials
|
||||
//有效期设置为1天signingCredentials //数字名
|
||||
);
|
||||
TokenString = new JwtSecurityTokenHandler().WriteToken(token);
|
||||
return TokenString;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public string Helloooo()
|
||||
{
|
||||
return "hello";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal class TblUtsManageUser
|
||||
{
|
||||
public object Id { get; internal set; }
|
||||
public bool IsAdmin { get; internal set; }
|
||||
public string? UserName { get; internal set; }
|
||||
}
|
||||
}
|
||||
20
SupplierManager/Controllers/PanelSelectionController.cs
Normal file
20
SupplierManager/Controllers/PanelSelectionController.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class PanelSelectionController : ControllerBase
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
381
SupplierManager/Controllers/UsersController.cs
Normal file
381
SupplierManager/Controllers/UsersController.cs
Normal file
@@ -0,0 +1,381 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels;
|
||||
using ViewModels.Common;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class UsersController : ControllerBase
|
||||
{
|
||||
public class duser
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo DelUser([FromBody] duser LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new();
|
||||
if(LLL.Id == 2 || LLL.Id == 1)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = "超级管理员不可删除!";
|
||||
return returnInfo;
|
||||
}
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var FFF = q.AasUsers.FirstOrDefault(A => A.Id == LLL.Id);
|
||||
if (FFF != null)
|
||||
{
|
||||
FFF.Isdelete = true;
|
||||
q.AasUsers.Update(FFF);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo EditUser([FromBody] ReturnUser LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var lll = q.AasUsers.SingleOrDefault(A => A.Id == LLL.Id);
|
||||
if (lll != null)
|
||||
{
|
||||
|
||||
string username = LLL.Username;
|
||||
int? companyId = LLL.ComId;
|
||||
string mobile = LLL.Mobile;
|
||||
string weiXin = LLL.Weixin;
|
||||
string email = LLL.Email;
|
||||
|
||||
lll.Realname = LLL.Realname;
|
||||
lll.RoleId = LLL.RoleId;
|
||||
lll.Position = LLL.Position;
|
||||
if (!string.IsNullOrWhiteSpace(LLL.Avatar))
|
||||
{
|
||||
lll.Avatar = "Uploads/face/" + LLL.Avatar;
|
||||
}
|
||||
lll.Username = username;
|
||||
lll.ComId = companyId;
|
||||
lll.Mobile = mobile;
|
||||
lll.Weixin = weiXin;
|
||||
lll.Email = email;
|
||||
lll.UpdateTime = DateTime.Now;
|
||||
|
||||
string PPP = LLL.Password.Trim();
|
||||
if (!string.IsNullOrWhiteSpace(PPP))
|
||||
{
|
||||
lll.Password = Tools.HashPassword(PPP);
|
||||
lll.PswEncryption = Tools.EncryptString(PPP);
|
||||
}
|
||||
|
||||
q.AasUsers.Update(lll);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo ModifyPassWord([FromBody] PWD_Reset LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var QQQ = q.AasUsers.SingleOrDefault(A => A.Id == LLL.Id);
|
||||
if (QQQ != null)
|
||||
{
|
||||
QQQ.Password = Tools.HashPassword(LLL.PlaintextPwd);
|
||||
QQQ.PswEncryption = Tools.EncryptString(LLL.PlaintextPwd);
|
||||
q.AasUsers.Update(QQQ);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增密码为123456
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo ResetPassWord([FromBody] PWD_Reset LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var Q = q.AasUsers.SingleOrDefault(A => A.Id == LLL.Id);
|
||||
if (Q != null)
|
||||
{
|
||||
Q.Password = Tools.HashPassword("123456");
|
||||
Q.PswEncryption = Tools.EncryptString("123456");
|
||||
q.AasUsers.Update(Q);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <param name="S"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo GetUserInfo([FromBody] QueryAll_Or_Single S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
if (S.IsAll)
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = q.AasUsers.Where(A=>!A.Isdelete).Select(F => new ReturnUser
|
||||
{
|
||||
Id = F.Id,
|
||||
Username = F.Username,
|
||||
Realname = F.Realname,
|
||||
RoleId = F.RoleId,
|
||||
Email = F.Email,
|
||||
Weixin = F.Weixin,
|
||||
Position = F.Position,
|
||||
Avatar = F.Avatar,
|
||||
ComId = F.ComId,
|
||||
Mobile = F.Mobile,
|
||||
}).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
var a = q.AasUsers.SingleOrDefault(A => A.Id == S.ID);
|
||||
if (a != null)
|
||||
{
|
||||
ReturnUser u = new ReturnUser();
|
||||
u.Id = a.Id;
|
||||
u.Username = a.Username;
|
||||
u.Realname = a.Realname;
|
||||
u.RoleId = a.RoleId;
|
||||
u.ComId = a.ComId;
|
||||
u.Mobile = a.Mobile;
|
||||
u.Weixin = a.Weixin;
|
||||
u.Position = a.Position;
|
||||
u.Avatar = a.Avatar;
|
||||
u.Email = a.Email;
|
||||
returnInfo.response = u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
//[Authorize()]
|
||||
public ReturnInfo AddUser([FromBody] ReturnUser LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string username = LLL.Username;
|
||||
int? companyId = LLL.ComId;
|
||||
string mobile = LLL.Mobile;
|
||||
string weiXin = LLL.Weixin;
|
||||
string email = LLL.Email;
|
||||
|
||||
AasUser lll = new AasUser();
|
||||
lll.Username = username;
|
||||
lll.Realname = LLL.Realname;
|
||||
lll.ComId = LLL.ComId;
|
||||
lll.RoleId = LLL.RoleId;
|
||||
lll.Position = LLL.Position;
|
||||
lll.Weixin = LLL.Weixin;
|
||||
lll.Email = email;
|
||||
lll.Mobile = mobile;
|
||||
if (!string.IsNullOrWhiteSpace(LLL.Avatar))
|
||||
{
|
||||
lll.Avatar = "Uploads/face/" + LLL.Avatar;
|
||||
}
|
||||
lll.Isdelete = false;
|
||||
|
||||
lll.CreationTime = DateTime.Now;
|
||||
lll.UpdateTime = DateTime.Now;
|
||||
|
||||
using (var q = new AgentApprovalSystemContext())
|
||||
{
|
||||
var Q = q.AasUsers.Where(A => A.Username.Equals(username));
|
||||
if (Q.Count() > 0)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = "此用户名已经存在";
|
||||
}
|
||||
else
|
||||
{
|
||||
//lll.Password = Tools.HashPassword("123456");
|
||||
//lll.PswEncryption = Tools.EncryptString("123456");
|
||||
|
||||
lll.Password = Tools.HashPassword(LLL.Password.Trim());
|
||||
lll.PswEncryption = Tools.EncryptString(LLL.Password.Trim());
|
||||
q.AasUsers.Add(lll);
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
q.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回用户信息
|
||||
/// </summary>
|
||||
public class ReturnUser
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public int Id { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 用户名(登录名)
|
||||
/// </summary>
|
||||
public string? Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 真实姓名
|
||||
/// </summary>
|
||||
public string? Realname { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属公司ID
|
||||
/// </summary>
|
||||
public int? ComId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色ID
|
||||
/// </summary>
|
||||
public int? RoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职位
|
||||
/// </summary>
|
||||
public string? Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 密码加密处理
|
||||
/// </summary>
|
||||
public string PswEncryption { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 微信号
|
||||
/// </summary>
|
||||
public string? Weixin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话号码
|
||||
/// </summary>
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账户头像
|
||||
/// </summary>
|
||||
public string? Avatar { get; set; }
|
||||
}
|
||||
public class PWD_Reset
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string PlaintextPwd { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
41
SupplierManager/Controllers/WeatherForecastController.cs
Normal file
41
SupplierManager/Controllers/WeatherForecastController.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SupplierManager.Models;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public string AAA()
|
||||
{
|
||||
//using var q = new AgentApprovalSystemContext();
|
||||
//q.AasCompanyInfos.ToLinqToDB().LeftJoin(A=>A.Id==A.Id);
|
||||
return "hello";
|
||||
}
|
||||
}
|
||||
}
|
||||
143
SupplierManager/Controllers/WyUsersController.cs
Normal file
143
SupplierManager/Controllers/WyUsersController.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SupplierManager.Models;
|
||||
using ViewModels;
|
||||
|
||||
namespace SupplierManager.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class WyUsersController : ControllerBase
|
||||
{
|
||||
private readonly AgentApprovalSystemContext _context;
|
||||
|
||||
public WyUsersController(AgentApprovalSystemContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/WyUsers
|
||||
[HttpPost()]
|
||||
public async Task<ReturnInfo> GetUserInfo([FromBody] QueryAll_Or_Single S)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
r.isok = true;
|
||||
r.response= await _context.WyUsers.ToListAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message=ex.Message;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> EditWyUser(WyUser wyUser)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
if (!WyUserExists(wyUser.Id))
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = "此用户不存在";
|
||||
}
|
||||
else
|
||||
{
|
||||
_context.Entry(wyUser).State = EntityState.Modified;
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
string Introduced = JsonSerializer.Serialize(wyUser);
|
||||
string ReturnValue = JsonSerializer.Serialize(r);
|
||||
await LogRecord(Introduced, ReturnValue);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
private string GetIP()
|
||||
{
|
||||
string? ip = string.Empty;
|
||||
string? NNN = HttpContext?.Request?.HttpContext?.Connection?.RemoteIpAddress?.ToString();
|
||||
if (string.IsNullOrEmpty(NNN))
|
||||
{
|
||||
ip = HttpContext?.Request.Headers["HTTP_X_FORWARDED_FOR"];
|
||||
}
|
||||
else
|
||||
{
|
||||
ip = NNN;
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize()]
|
||||
public async Task<ReturnInfo> AddWyUser(List<WyUser> wyUser)
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
_context.WyUsers.AddRange(wyUser);
|
||||
await _context.SaveChangesAsync();
|
||||
r.isok = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
|
||||
string Introduced = JsonSerializer.Serialize(wyUser);
|
||||
string ReturnValue = JsonSerializer.Serialize(r);
|
||||
await LogRecord(Introduced, ReturnValue);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
private async Task LogRecord(string Introduced, string ReturnValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
WyLog wx = new WyLog();
|
||||
wx.Ip = GetIP();
|
||||
wx.Operation = "Edit";
|
||||
wx.Introduced = Introduced;
|
||||
wx.ReturnValue = ReturnValue;
|
||||
wx.CreationTime = Tools.ToUnixTimestampBySeconds(DateTime.Now);
|
||||
_context.WyLogs.Add(wx);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private bool WyUserExists(long id)
|
||||
{
|
||||
return _context.WyUsers.Any(e => e.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
346
SupplierManager/Extensions/StringExtensions.cs
Normal file
346
SupplierManager/Extensions/StringExtensions.cs
Normal file
@@ -0,0 +1,346 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SupplierManager.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 字符串扩展函数工具类
|
||||
/// </summary>
|
||||
public static class StringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 将\r\n替换成BR
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToSafeBR(this string str)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(str))
|
||||
{
|
||||
return str.Replace("\r\n", "<br>").Replace("\r", "<br>").Replace("\n", "<br>");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到父部门的ID
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetDepartmentFatherID(this string str)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(str) && str.Length > 2)
|
||||
{
|
||||
str = str.Substring(0, str.Length - 3);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 截取字符串,超过部分用...代替
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="len"></param>
|
||||
/// <returns></returns>
|
||||
public static string Substr(this string source, int len)
|
||||
{
|
||||
return source.Substr(len, "...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 截取字符串,超过部分用自定义代替
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="len"></param>
|
||||
/// <param name="att"></param>
|
||||
/// <returns></returns>
|
||||
public static string Substr(this string source, int len, string att)
|
||||
{
|
||||
if (string.IsNullOrEmpty(source))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
att = (att ?? string.Empty);
|
||||
Regex regex = new Regex("[\\u4e00-\\u9fa5]");
|
||||
Regex regex2 = new Regex("^[A-Za-z0-9]+$");
|
||||
if (regex.IsMatch(source))
|
||||
{
|
||||
if (source.Length <= len)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return source.Substring(0, len) + att;
|
||||
}
|
||||
else if (regex2.IsMatch(source))
|
||||
{
|
||||
if (source.Length <= len * 2)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return source.Substring(0, len * 2) + att;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (source.Length <= len)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return source.Substring(0, len) + att;
|
||||
}
|
||||
}
|
||||
|
||||
public static string InputStr(this string source)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
{
|
||||
Regex regex = new Regex("[\\u4e00-\\u9fa5]");
|
||||
Regex regex2 = new Regex("^[A-Za-z0-9]+$");
|
||||
if (regex.IsMatch(source))
|
||||
{
|
||||
if (source.Length < 3)
|
||||
{
|
||||
return string.Format("{0}**", source[0]);
|
||||
}
|
||||
if (source.Length == 3)
|
||||
{
|
||||
return string.Format("{0}*{1}", source[0], source[source.Length - 1]);
|
||||
}
|
||||
if (source.Length > 3)
|
||||
{
|
||||
return string.Format("{0}**{1}", source[0], source[source.Length - 1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!regex2.IsMatch(source))
|
||||
{
|
||||
return string.Format("{0}**", source.Substring(0, 2));
|
||||
}
|
||||
if (source.Length < 6)
|
||||
{
|
||||
return string.Format("{0}**", source.Substring(0, 2));
|
||||
}
|
||||
return string.Format("{0}****{1}", source.Substring(0, 2), source.Substring(source.Length - 3, 2));
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除掉所有的Html代码
|
||||
/// </summary>
|
||||
/// <param name="strHtml"></param>
|
||||
/// <returns></returns>
|
||||
public static string RemoveHtml(this string strHtml)
|
||||
{
|
||||
Regex regex = new Regex("<.+?>", RegexOptions.IgnoreCase);
|
||||
strHtml = regex.Replace(strHtml, "");
|
||||
strHtml = strHtml.Replace(" ", "");
|
||||
return strHtml;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成0-9随机数
|
||||
/// </summary>
|
||||
/// <param name="VcodeNum">生成长度</param>
|
||||
/// <returns></returns>
|
||||
public static string RndNum(int VcodeNum)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(VcodeNum);
|
||||
Random random = new Random();
|
||||
for (int i = 1; i < VcodeNum + 1; i++)
|
||||
{
|
||||
int num = random.Next(9);
|
||||
stringBuilder.AppendFormat("{0}", num);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回星号的加密
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="mask"></param>
|
||||
/// <returns></returns>
|
||||
public static string MaskStar(Dictionary<string, string> items, bool mask)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (mask)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> keyValuePair in items)
|
||||
{
|
||||
stringBuilder.Append(string.Concat(new string[]
|
||||
{
|
||||
"$('#",
|
||||
keyValuePair.Key,
|
||||
"').attr('name', '",
|
||||
keyValuePair.Key,
|
||||
"mask');"
|
||||
}));
|
||||
}
|
||||
stringBuilder.Append("$('.maskstar').attr('disabled', true);");
|
||||
stringBuilder.Append("$('.maskstar').val('***');");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<string, string> keyValuePair2 in items)
|
||||
{
|
||||
stringBuilder.Append(string.Concat(new string[]
|
||||
{
|
||||
"$('#",
|
||||
keyValuePair2.Key,
|
||||
"').attr('name', '",
|
||||
keyValuePair2.Key,
|
||||
"');"
|
||||
}));
|
||||
stringBuilder.Append(string.Concat(new string[]
|
||||
{
|
||||
"$('#",
|
||||
keyValuePair2.Key,
|
||||
"').val('",
|
||||
keyValuePair2.Value,
|
||||
"');"
|
||||
}));
|
||||
}
|
||||
stringBuilder.Append("$('.maskstar').attr('disabled', false);");
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给自动填充使用
|
||||
/// </summary>
|
||||
/// <param name="str1"></param>
|
||||
/// <param name="str2"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToAutoComplate(this string str1, string str2)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(str1) && !string.IsNullOrEmpty(str2))
|
||||
{
|
||||
return str1 + "," + str2;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回红色字体
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToRedColor(this int value)
|
||||
{
|
||||
if (value != 0)
|
||||
{
|
||||
return "<font color='red'>" + value.ToString() + "</font>";
|
||||
}
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回安全的字符串类型如果为NULL则返回空
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToSafeString(this object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将中文转换成Unicode编码,主要用在URL传递中文
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string GB2Unicode(this string str)
|
||||
{
|
||||
string text = "";
|
||||
Encoding encoding = Encoding.GetEncoding("GB2312");
|
||||
Encoding unicode = Encoding.Unicode;
|
||||
byte[] bytes = encoding.GetBytes(str);
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
string str2 = "%" + bytes[i].ToString("x");
|
||||
text += str2;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将字符串转换成为大写的MD5
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToMD5(this string str)
|
||||
{
|
||||
MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider();
|
||||
byte[] array = md5CryptoServiceProvider.ComputeHash(Encoding.Default.GetBytes(str));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (byte b in array)
|
||||
{
|
||||
stringBuilder.Append(b.ToString("x2"));
|
||||
}
|
||||
return stringBuilder.ToString().ToUpper();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字节码长度转可读字符串 00000000 bytes 0.0GB
|
||||
/// </summary>
|
||||
/// <param name="KSize"></param>
|
||||
/// <returns></returns>
|
||||
public static string ByteSizeToString(this long KSize)
|
||||
{
|
||||
if (KSize > 0L)
|
||||
{
|
||||
string[] array = new string[]
|
||||
{
|
||||
"B",
|
||||
"KB",
|
||||
"MB",
|
||||
"GB",
|
||||
"TB"
|
||||
};
|
||||
double num = 0.0;
|
||||
int num2 = array.Length - 1;
|
||||
while (num2 >= 0 && (num = Math.Round((double)KSize / Math.Pow(1024.0, (double)num2), 2)) < 1.0)
|
||||
{
|
||||
num2--;
|
||||
}
|
||||
return string.Format("{0}{1}", num, array[num2]);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将字符串转换成为大写的MD5
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetMD5Code(this string str)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
using (MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider())
|
||||
{
|
||||
byte[] array = md5CryptoServiceProvider.ComputeHash(Encoding.Default.GetBytes(str));
|
||||
foreach (byte b in array)
|
||||
{
|
||||
stringBuilder.Append(b.ToString("x2"));
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
33
SupplierManager/Extensions/TimeExtensions.cs
Normal file
33
SupplierManager/Extensions/TimeExtensions.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SupplierManager.Extensions
|
||||
{
|
||||
public static class TimeExtensions
|
||||
{
|
||||
public static DateTime? ToDateTime(this string timeStamp)
|
||||
{
|
||||
long ticks = 0L;
|
||||
if (long.TryParse(timeStamp, out ticks))
|
||||
{
|
||||
DateTime dateTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
TimeSpan value = new TimeSpan(ticks);
|
||||
return new DateTime?(dateTime.Add(value));
|
||||
}
|
||||
DateTime now = DateTime.Now;
|
||||
if (DateTime.TryParse(timeStamp, out now))
|
||||
{
|
||||
return new DateTime?(now);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static string fff()
|
||||
{
|
||||
return "hello";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
50
SupplierManager/Models/AasCompanyInfo.cs
Normal file
50
SupplierManager/Models/AasCompanyInfo.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasCompanyInfo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公司代码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 中文名
|
||||
/// </summary>
|
||||
public string? NameCn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 英文名
|
||||
/// </summary>
|
||||
public string? NameEn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属行业
|
||||
/// </summary>
|
||||
public string? Industry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 身份
|
||||
/// </summary>
|
||||
public string? Identity { get; set; }
|
||||
|
||||
public string? Region { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业执照
|
||||
/// </summary>
|
||||
public string? LicenseCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// logo地址
|
||||
/// </summary>
|
||||
public string? Logoaddress { get; set; }
|
||||
|
||||
public DateTime? Createtime { get; set; }
|
||||
|
||||
public DateTime? Updatetime { get; set; }
|
||||
}
|
||||
21
SupplierManager/Models/AasCustomerInfo.cs
Normal file
21
SupplierManager/Models/AasCustomerInfo.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasCustomerInfo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public string? Realname { get; set; }
|
||||
|
||||
public string? ComName { get; set; }
|
||||
|
||||
public string? Job { get; set; }
|
||||
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
public string? Weixin { get; set; }
|
||||
|
||||
public string? Mark { get; set; }
|
||||
}
|
||||
85
SupplierManager/Models/AasProjectInfo.cs
Normal file
85
SupplierManager/Models/AasProjectInfo.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasProjectInfo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属省份
|
||||
/// </summary>
|
||||
public string? Shengfen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属区域
|
||||
/// </summary>
|
||||
public string? Quyu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 详细地址
|
||||
/// </summary>
|
||||
public string? AddressDetail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 行业类型
|
||||
/// </summary>
|
||||
public string? HangyeClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
public string? ProjectName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目编码
|
||||
/// </summary>
|
||||
public string? ProjectCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公司ID
|
||||
/// </summary>
|
||||
public int? CompanyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房型数量
|
||||
/// </summary>
|
||||
public int? RoomTypeCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 房间总数
|
||||
/// </summary>
|
||||
public int? RoomTotalCount { get; set; }
|
||||
|
||||
public DateTime? Createtime { get; set; }
|
||||
|
||||
public DateTime? Updatetime { get; set; }
|
||||
|
||||
public long? UpdatetimeUnix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unix时间
|
||||
/// </summary>
|
||||
public long? CreatetimeUnix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审批状态
|
||||
/// </summary>
|
||||
public string? ShengpiStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请人
|
||||
/// </summary>
|
||||
public int? Uid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设计图
|
||||
/// </summary>
|
||||
public string? Blueprint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 套餐名称
|
||||
/// </summary>
|
||||
public string? Customization { get; set; }
|
||||
}
|
||||
19
SupplierManager/Models/AasProjectReportReady.cs
Normal file
19
SupplierManager/Models/AasProjectReportReady.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasProjectReportReady
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public string? ProjectCode { get; set; }
|
||||
|
||||
public string? CustomerContactsH { get; set; }
|
||||
|
||||
public DateTime? Createtime { get; set; }
|
||||
|
||||
public DateTime? Updatetime { get; set; }
|
||||
|
||||
public long? Unixtime { get; set; }
|
||||
}
|
||||
33
SupplierManager/Models/AasProjectShenpi.cs
Normal file
33
SupplierManager/Models/AasProjectShenpi.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasProjectShenpi
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目代码
|
||||
/// </summary>
|
||||
public string? ProjectCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审批建议
|
||||
/// </summary>
|
||||
public string? ShenpiSuggest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 驳回理由
|
||||
/// </summary>
|
||||
public string? RejectReason { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审批序号
|
||||
/// </summary>
|
||||
public int? ShenpiNumber { get; set; }
|
||||
|
||||
public DateTime? Createtime { get; set; }
|
||||
|
||||
public DateTime? Updatetime { get; set; }
|
||||
}
|
||||
82
SupplierManager/Models/AasUser.cs
Normal file
82
SupplierManager/Models/AasUser.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasUser
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名(登录名)
|
||||
/// </summary>
|
||||
public string? Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 真实姓名
|
||||
/// </summary>
|
||||
public string? Realname { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属公司ID
|
||||
/// </summary>
|
||||
public int? ComId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色ID
|
||||
/// </summary>
|
||||
public int? RoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职位
|
||||
/// </summary>
|
||||
public string? Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 密码加密处理
|
||||
/// </summary>
|
||||
public string PswEncryption { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 微信号
|
||||
/// </summary>
|
||||
public string? Weixin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话号码
|
||||
/// </summary>
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账户头像
|
||||
/// </summary>
|
||||
public string? Avatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
public bool Isdelete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
}
|
||||
13
SupplierManager/Models/AasUserPermission.cs
Normal file
13
SupplierManager/Models/AasUserPermission.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasUserPermission
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? ProxyClass { get; set; }
|
||||
|
||||
public string? ProxyRegion { get; set; }
|
||||
}
|
||||
47
SupplierManager/Models/AasUsersLoginLog.cs
Normal file
47
SupplierManager/Models/AasUsersLoginLog.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasUsersLoginLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名字
|
||||
/// </summary>
|
||||
public string? Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ip地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 浏览器版本
|
||||
/// </summary>
|
||||
public string? Browser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型
|
||||
/// </summary>
|
||||
public string? Operation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备型号
|
||||
/// </summary>
|
||||
public string? Device { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地理位置
|
||||
/// </summary>
|
||||
public string? Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreationTime { get; set; }
|
||||
}
|
||||
57
SupplierManager/Models/AasUsersOperateLog.cs
Normal file
57
SupplierManager/Models/AasUsersOperateLog.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AasUsersOperateLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名字
|
||||
/// </summary>
|
||||
public string? Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志类型ID
|
||||
/// </summary>
|
||||
public int? TypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行操作
|
||||
/// </summary>
|
||||
public string? Operate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ip地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 浏览器版本
|
||||
/// </summary>
|
||||
public string? Browser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型
|
||||
/// </summary>
|
||||
public string? Operation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备型号
|
||||
/// </summary>
|
||||
public string? Device { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地理位置
|
||||
/// </summary>
|
||||
public string? Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreationTime { get; set; }
|
||||
}
|
||||
550
SupplierManager/Models/AgentApprovalSystemContext.cs
Normal file
550
SupplierManager/Models/AgentApprovalSystemContext.cs
Normal file
@@ -0,0 +1,550 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class AgentApprovalSystemContext : DbContext
|
||||
{
|
||||
public AgentApprovalSystemContext()
|
||||
{
|
||||
}
|
||||
|
||||
public AgentApprovalSystemContext(DbContextOptions<AgentApprovalSystemContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<AasCompanyInfo> AasCompanyInfos { get; set; }
|
||||
|
||||
public virtual DbSet<AasCustomerInfo> AasCustomerInfos { get; set; }
|
||||
|
||||
public virtual DbSet<AasProjectInfo> AasProjectInfos { get; set; }
|
||||
|
||||
public virtual DbSet<AasProjectReportReady> AasProjectReportReadies { get; set; }
|
||||
|
||||
public virtual DbSet<AasProjectShenpi> AasProjectShenpis { get; set; }
|
||||
|
||||
public virtual DbSet<AasUser> AasUsers { get; set; }
|
||||
|
||||
public virtual DbSet<AasUserPermission> AasUserPermissions { get; set; }
|
||||
|
||||
public virtual DbSet<AasUsersOperateLog> AasUsersOperateLogs { get; set; }
|
||||
|
||||
public virtual DbSet<Autokeygenerater> Autokeygeneraters { get; set; }
|
||||
|
||||
public virtual DbSet<WyLog> WyLogs { get; set; }
|
||||
|
||||
public virtual DbSet<WyUser> WyUsers { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
=> optionsBuilder.UseMySql("server=blv-cloud-db.mysql.rds.aliyuncs.com;database=agent_approval_system;uid=blv_rcu;pwd=fnadiaJDIJ7546;charset=utf8;port=3307", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.28-mysql"));
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.UseCollation("utf8mb4_bin")
|
||||
.HasCharSet("utf8mb4");
|
||||
|
||||
modelBuilder.Entity<AasCompanyInfo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_company_info");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Code)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("公司代码")
|
||||
.HasColumnName("code");
|
||||
entity.Property(e => e.Createtime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("createtime");
|
||||
entity.Property(e => e.Identity)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("身份")
|
||||
.HasColumnName("identity");
|
||||
entity.Property(e => e.Industry)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("所属行业")
|
||||
.HasColumnName("industry");
|
||||
entity.Property(e => e.LicenseCode)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("营业执照")
|
||||
.HasColumnName("licenseCode");
|
||||
entity.Property(e => e.Logoaddress)
|
||||
.HasComment("logo地址")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("logoaddress");
|
||||
entity.Property(e => e.NameCn)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("中文名")
|
||||
.HasColumnName("nameCn");
|
||||
entity.Property(e => e.NameEn)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("英文名")
|
||||
.HasColumnName("nameEn");
|
||||
entity.Property(e => e.Region)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("region");
|
||||
entity.Property(e => e.Updatetime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("updatetime");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AasCustomerInfo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_customer_info");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.ComName)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("com_name");
|
||||
entity.Property(e => e.Job)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("job");
|
||||
entity.Property(e => e.Mark)
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("mark");
|
||||
entity.Property(e => e.Mobile)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("mobile");
|
||||
entity.Property(e => e.Realname)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("realname");
|
||||
entity.Property(e => e.Weixin)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("weixin");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AasProjectInfo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_project_info");
|
||||
|
||||
entity.HasIndex(e => e.UpdatetimeUnix, "Unixupdatetime");
|
||||
|
||||
entity.HasIndex(e => e.CompanyId, "comid");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.AddressDetail)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("详细地址")
|
||||
.HasColumnName("address_detail");
|
||||
entity.Property(e => e.Blueprint)
|
||||
.HasComment("设计图")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("blueprint");
|
||||
entity.Property(e => e.CompanyId)
|
||||
.HasComment("公司ID")
|
||||
.HasColumnName("company_id");
|
||||
entity.Property(e => e.Createtime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("createtime");
|
||||
entity.Property(e => e.CreatetimeUnix)
|
||||
.HasComment("Unix时间")
|
||||
.HasColumnName("createtime_unix");
|
||||
entity.Property(e => e.Customization)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("套餐名称")
|
||||
.HasColumnName("customization");
|
||||
entity.Property(e => e.HangyeClass)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("行业类型")
|
||||
.HasColumnName("hangye_class");
|
||||
entity.Property(e => e.ProjectCode)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("项目编码")
|
||||
.HasColumnName("project_code");
|
||||
entity.Property(e => e.ProjectName)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("项目名称")
|
||||
.HasColumnName("project_name");
|
||||
entity.Property(e => e.Quyu)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("所属区域")
|
||||
.HasColumnName("quyu");
|
||||
entity.Property(e => e.RoomTotalCount)
|
||||
.HasComment("房间总数")
|
||||
.HasColumnName("room_total_count");
|
||||
entity.Property(e => e.RoomTypeCount)
|
||||
.HasComment("房型数量")
|
||||
.HasColumnName("room_type_count");
|
||||
entity.Property(e => e.Shengfen)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("所属省份")
|
||||
.HasColumnName("shengfen");
|
||||
entity.Property(e => e.ShengpiStatus)
|
||||
.HasMaxLength(64)
|
||||
.HasComment("审批状态")
|
||||
.HasColumnName("shengpi_status");
|
||||
entity.Property(e => e.Uid)
|
||||
.HasComment("申请人")
|
||||
.HasColumnName("uid");
|
||||
entity.Property(e => e.Updatetime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("updatetime");
|
||||
entity.Property(e => e.UpdatetimeUnix).HasColumnName("updatetime_unix");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AasProjectReportReady>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_project_report_ready");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Createtime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("createtime");
|
||||
entity.Property(e => e.CustomerContactsH)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("customer_contacts_h");
|
||||
entity.Property(e => e.ProjectCode)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("project_code");
|
||||
entity.Property(e => e.Unixtime).HasColumnName("unixtime");
|
||||
entity.Property(e => e.Updatetime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("updatetime");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AasProjectShenpi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_project_shenpi");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Createtime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("createtime");
|
||||
entity.Property(e => e.ProjectCode)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("项目代码")
|
||||
.HasColumnName("project_code");
|
||||
entity.Property(e => e.RejectReason)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("驳回理由")
|
||||
.HasColumnName("reject_reason");
|
||||
entity.Property(e => e.ShenpiNumber)
|
||||
.HasComment("审批序号")
|
||||
.HasColumnName("shenpi_number");
|
||||
entity.Property(e => e.ShenpiSuggest)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("审批建议")
|
||||
.HasColumnName("shenpi_suggest");
|
||||
entity.Property(e => e.Updatetime)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("updatetime");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AasUser>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_users");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasComment("主键")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Avatar)
|
||||
.HasComment("账户头像")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("avatar");
|
||||
entity.Property(e => e.ComId)
|
||||
.HasComment("所属公司ID")
|
||||
.HasColumnName("com_id");
|
||||
entity.Property(e => e.CreationTime)
|
||||
.HasComment("创建时间")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("creation_time");
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("邮箱")
|
||||
.HasColumnName("email");
|
||||
entity.Property(e => e.Isdelete)
|
||||
.HasComment("是否删除")
|
||||
.HasColumnName("isdelete");
|
||||
entity.Property(e => e.Mobile)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("电话号码")
|
||||
.HasColumnName("mobile");
|
||||
entity.Property(e => e.Password)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("密码")
|
||||
.HasColumnName("password");
|
||||
entity.Property(e => e.Position)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("职位")
|
||||
.HasColumnName("position");
|
||||
entity.Property(e => e.PswEncryption)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("密码加密处理")
|
||||
.HasColumnName("psw_encryption");
|
||||
entity.Property(e => e.Realname)
|
||||
.HasMaxLength(64)
|
||||
.HasComment("真实姓名")
|
||||
.HasColumnName("realname");
|
||||
entity.Property(e => e.RoleId)
|
||||
.HasComment("角色ID")
|
||||
.HasColumnName("role_id");
|
||||
entity.Property(e => e.UpdateTime)
|
||||
.HasComment("更新时间")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("update_time");
|
||||
entity.Property(e => e.Username)
|
||||
.HasMaxLength(64)
|
||||
.HasComment("用户名(登录名)")
|
||||
.HasColumnName("username");
|
||||
entity.Property(e => e.Weixin)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("微信号")
|
||||
.HasColumnName("weixin");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AasUserPermission>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_user_permission");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.ProxyClass)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("proxy_class");
|
||||
entity.Property(e => e.ProxyRegion)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("proxy_region");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AasUsersOperateLog>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("aas_users_operate_log");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasComment("主键")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Browser)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("浏览器版本")
|
||||
.HasColumnName("browser")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
entity.Property(e => e.CreationTime)
|
||||
.HasComment("创建时间")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("creation_time");
|
||||
entity.Property(e => e.Device)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("设备型号")
|
||||
.HasColumnName("device")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
entity.Property(e => e.Ip)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("ip地址")
|
||||
.HasColumnName("ip")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
entity.Property(e => e.Location)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("地理位置")
|
||||
.HasColumnName("location")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
entity.Property(e => e.Operate)
|
||||
.HasComment("执行操作")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("operate");
|
||||
entity.Property(e => e.Operation)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("操作类型")
|
||||
.HasColumnName("operation")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
entity.Property(e => e.TypeId)
|
||||
.HasComment("日志类型ID")
|
||||
.HasColumnName("type_id");
|
||||
entity.Property(e => e.Username)
|
||||
.HasMaxLength(100)
|
||||
.HasComment("用户名字")
|
||||
.HasColumnName("username")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Autokeygenerater>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("autokeygenerater");
|
||||
|
||||
entity.Property(e => e.CompanyCode).HasColumnName("Company_code");
|
||||
entity.Property(e => e.ProjectInfoCode).HasColumnName("ProjectInfo_code");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WyLog>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("wy_logs");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasComment("主键")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.CreationTime)
|
||||
.HasComment("创建时间")
|
||||
.HasColumnName("creation_time");
|
||||
entity.Property(e => e.Introduced)
|
||||
.HasComment("传入参数")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("introduced");
|
||||
entity.Property(e => e.Ip)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("ip地址")
|
||||
.HasColumnName("ip")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
entity.Property(e => e.Operation)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("操作类型")
|
||||
.HasColumnName("operation")
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
entity.Property(e => e.ReturnValue)
|
||||
.HasComment("返回值")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("return_value");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<WyUser>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity
|
||||
.ToTable("wy_users", tb => tb.HasComment("用户信息表"))
|
||||
.UseCollation("utf8mb4_general_ci");
|
||||
|
||||
entity.HasIndex(e => e.Username, "idx_account");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasComment("主键")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Avatar)
|
||||
.HasMaxLength(500)
|
||||
.HasComment("头像")
|
||||
.HasColumnName("avatar");
|
||||
entity.Property(e => e.Birthday)
|
||||
.HasComment("生日")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("birthday");
|
||||
entity.Property(e => e.Code)
|
||||
.HasMaxLength(12)
|
||||
.HasComment("用户编号")
|
||||
.HasColumnName("code");
|
||||
entity.Property(e => e.ComId)
|
||||
.HasComment("所属公司ID")
|
||||
.HasColumnName("com_id");
|
||||
entity.Property(e => e.CreateDept)
|
||||
.HasComment("创建部门")
|
||||
.HasColumnName("create_dept");
|
||||
entity.Property(e => e.CreateUser)
|
||||
.HasComment("创建人")
|
||||
.HasColumnName("create_user");
|
||||
entity.Property(e => e.CreationTime)
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP")
|
||||
.HasComment("创建时间")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("creation_time");
|
||||
entity.Property(e => e.DeptId)
|
||||
.HasMaxLength(1000)
|
||||
.HasComment("部门id")
|
||||
.HasColumnName("dept_id");
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(45)
|
||||
.HasComment("邮箱")
|
||||
.HasColumnName("email");
|
||||
entity.Property(e => e.Isdelete)
|
||||
.HasDefaultValueSql("'0'")
|
||||
.HasComment("是否已删除")
|
||||
.HasColumnName("isdelete");
|
||||
entity.Property(e => e.Mobile)
|
||||
.HasMaxLength(45)
|
||||
.HasComment("手机")
|
||||
.HasColumnName("mobile");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(20)
|
||||
.HasComment("昵称")
|
||||
.HasColumnName("name");
|
||||
entity.Property(e => e.Password)
|
||||
.HasMaxLength(45)
|
||||
.HasComment("密码")
|
||||
.HasColumnName("password");
|
||||
entity.Property(e => e.Position)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("职位")
|
||||
.HasColumnName("position")
|
||||
.UseCollation("utf8mb4_bin");
|
||||
entity.Property(e => e.PostId)
|
||||
.HasMaxLength(1000)
|
||||
.HasComment("岗位id")
|
||||
.HasColumnName("post_id");
|
||||
entity.Property(e => e.Realname)
|
||||
.HasMaxLength(10)
|
||||
.HasComment("真名")
|
||||
.HasColumnName("realname");
|
||||
entity.Property(e => e.RoleId)
|
||||
.HasMaxLength(1000)
|
||||
.HasComment("角色id")
|
||||
.HasColumnName("role_id");
|
||||
entity.Property(e => e.RoleIdAas)
|
||||
.HasComment("角色ID")
|
||||
.HasColumnName("role_id_aas");
|
||||
entity.Property(e => e.Sex)
|
||||
.HasComment("性别")
|
||||
.HasColumnName("sex");
|
||||
entity.Property(e => e.Status)
|
||||
.HasComment("状态")
|
||||
.HasColumnName("status");
|
||||
entity.Property(e => e.TenantId)
|
||||
.HasMaxLength(12)
|
||||
.HasDefaultValueSql("'000000'")
|
||||
.HasComment("租户ID")
|
||||
.HasColumnName("tenant_id");
|
||||
entity.Property(e => e.UpdateTime)
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP")
|
||||
.HasComment("修改时间")
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("update_time");
|
||||
entity.Property(e => e.UpdateUser)
|
||||
.HasComment("修改人")
|
||||
.HasColumnName("update_user");
|
||||
entity.Property(e => e.UserType)
|
||||
.HasComment("用户平台")
|
||||
.HasColumnName("user_type");
|
||||
entity.Property(e => e.Username)
|
||||
.HasMaxLength(45)
|
||||
.HasComment("账号")
|
||||
.HasColumnName("username");
|
||||
entity.Property(e => e.Weixin)
|
||||
.HasMaxLength(255)
|
||||
.HasComment("微信")
|
||||
.HasColumnName("weixin");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
13
SupplierManager/Models/Autokeygenerater.cs
Normal file
13
SupplierManager/Models/Autokeygenerater.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class Autokeygenerater
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public long? ProjectInfoCode { get; set; }
|
||||
|
||||
public int? CompanyCode { get; set; }
|
||||
}
|
||||
37
SupplierManager/Models/WyLog.cs
Normal file
37
SupplierManager/Models/WyLog.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
public partial class WyLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 传入参数
|
||||
/// </summary>
|
||||
public string? Introduced { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回值
|
||||
/// </summary>
|
||||
public string? ReturnValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ip地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型
|
||||
/// </summary>
|
||||
public string? Operation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public long? CreationTime { get; set; }
|
||||
}
|
||||
145
SupplierManager/Models/WyUser.cs
Normal file
145
SupplierManager/Models/WyUser.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SupplierManager.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 用户信息表
|
||||
/// </summary>
|
||||
public partial class WyUser
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户ID
|
||||
/// </summary>
|
||||
public string? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户编号
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户平台
|
||||
/// </summary>
|
||||
public int? UserType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public string? Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string? Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 真名
|
||||
/// </summary>
|
||||
public string? Realname { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
public string? Avatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机
|
||||
/// </summary>
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
/// </summary>
|
||||
public DateTime? Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public int? Sex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色id
|
||||
/// </summary>
|
||||
public string? RoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门id
|
||||
/// </summary>
|
||||
public string? DeptId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位id
|
||||
/// </summary>
|
||||
public string? PostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
public long? CreateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建部门
|
||||
/// </summary>
|
||||
public long? CreateDept { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改人
|
||||
/// </summary>
|
||||
public long? UpdateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已删除
|
||||
/// </summary>
|
||||
public int? Isdelete { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属公司ID
|
||||
/// </summary>
|
||||
public int? ComId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色ID
|
||||
/// </summary>
|
||||
public int? RoleIdAas { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职位
|
||||
/// </summary>
|
||||
public string? Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信
|
||||
/// </summary>
|
||||
public string? Weixin { get; set; }
|
||||
}
|
||||
108
SupplierManager/Program.cs
Normal file
108
SupplierManager/Program.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System.Text;
|
||||
using System.Threading.RateLimiting;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using SupplierManager.Common;
|
||||
using SupplierManager.Models;
|
||||
|
||||
namespace SupplierManager
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddScoped<AgentApprovalSystemContext>();
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(name: "Vue3",
|
||||
policy =>
|
||||
{
|
||||
//policy.WithOrigins("http://localhost:5180",
|
||||
// "http://localhost:8809/",
|
||||
// "http://www.contoso.com",
|
||||
// "http://new.uts-data.com:6688/", "http://new.uts-data.com")
|
||||
policy
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//builder.Services.AddRateLimiter(options =>
|
||||
//{
|
||||
// options.AddTokenBucketLimiter(policyName: "token_bucket", tokenBucketOptions =>
|
||||
// {
|
||||
// tokenBucketOptions.TokenLimit = 100;//Ͱ<><CDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĶ<C5B5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻᱻ<C6BB><E1B1BB><EFBFBD><EFBFBD>
|
||||
// tokenBucketOptions.ReplenishmentPeriod = TimeSpan.FromSeconds(10);//<2F><><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// tokenBucketOptions.TokensPerPeriod = 100;//ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// tokenBucketOptions.QueueLimit = 90;//<2F><>Ͱ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꣨token=0<><30>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD>
|
||||
// tokenBucketOptions.QueueProcessingOrder = QueueProcessingOrder.OldestFirst;
|
||||
// tokenBucketOptions.AutoReplenishment = true;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3>Ƿ<EFBFBD><C7B7>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊfalse<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD> TokenBucketRateLimiter.TryReplenish<73><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// });
|
||||
//});
|
||||
builder.Services.AddAuthorization();
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddJwtBearer(option =>
|
||||
{
|
||||
string DefaultKey = "B,EZipeApY3cNj3~4RP0UMR=H>9x8.1!E85wmZ]]py2d$Y?5";
|
||||
var sec = Encoding.UTF8.GetBytes(builder.Configuration["JWT:SecretKey"] ?? DefaultKey);
|
||||
|
||||
option.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
|
||||
{
|
||||
ValidateIssuer = true,
|
||||
ValidateAudience = true,
|
||||
ValidateLifetime = true,
|
||||
|
||||
ValidateIssuerSigningKey = true,
|
||||
ValidIssuer = builder.Configuration["JwT:Issuer"],
|
||||
ValidAudience = builder.Configuration["JwT:Audience"],
|
||||
IssuerSigningKey = new SymmetricSecurityKey(sec)
|
||||
};
|
||||
|
||||
option.Events = new JwtBearerEvents
|
||||
{
|
||||
OnMessageReceived = context =>
|
||||
{
|
||||
var token = context.Request.Headers["token"].FirstOrDefault();
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD> token ͷ<><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Authorization ͷ<><CDB7>
|
||||
token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD> token<65><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> HttpContext <20><>
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
context.Token = token;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
};
|
||||
});
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
app.UseCors("Vue3");
|
||||
app.UseAuthentication(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
|
||||
app.UseAuthorization(); // ʹ<><CAB9><EFBFBD><EFBFBD>Ȩ<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
//app.UseRateLimiter(new Microsoft.AspNetCore.RateLimiting.RateLimiterOptions()
|
||||
//{
|
||||
// RejectionStatusCode = 500
|
||||
//});
|
||||
|
||||
StaticData.GetWebAPIMethod();
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
SupplierManager/Properties/launchSettings.json
Normal file
31
SupplierManager/Properties/launchSettings.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:46256",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"applicationUrl": "http://localhost:5077",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
56
SupplierManager/SupplierManager.csproj
Normal file
56
SupplierManager/SupplierManager.csproj
Normal file
@@ -0,0 +1,56 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Uploads\**" />
|
||||
<Content Remove="Uploads\**" />
|
||||
<EmbeddedResource Remove="Uploads\**" />
|
||||
<None Remove="Uploads\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IronPython" Version="3.4.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.15" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.15" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.15">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.15">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
|
||||
<PackageReference Include="NLog" Version="5.4.0" />
|
||||
<PackageReference Include="NLog.Schema" Version="5.4.0" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.4.0" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ViewModels\ViewModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="script\a.py">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="script\b.py">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="script\webapi.py">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
SupplierManager/SupplierManager.http
Normal file
6
SupplierManager/SupplierManager.http
Normal file
@@ -0,0 +1,6 @@
|
||||
@SupplierManager_HostAddress = http://localhost:5076
|
||||
|
||||
GET {{SupplierManager_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
13
SupplierManager/WeatherForecast.cs
Normal file
13
SupplierManager/WeatherForecast.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace SupplierManager
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
8
SupplierManager/appsettings.Development.json
Normal file
8
SupplierManager/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
14
SupplierManager/appsettings.json
Normal file
14
SupplierManager/appsettings.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"JwT": {
|
||||
"SecretKey": "1%猜U36eraIYI?3s9dI}46an不Nn>P]3)$9:dCnS5=ajAu%8B5]15hF到20T20QBD]Mt9}2z76jO#Glg&0yDy7k-2zVdt&Z5ur>=l)QF2^1&Dq04m76U2P9wvlWf",
|
||||
"Issuer": "宝来威供应商系统",
|
||||
"Audience": "W*u93xxp*08DnW@%6}5Tjh6bE?;hW"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
35
SupplierManager/nlog.config
Normal file
35
SupplierManager/nlog.config
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<!-- enable asp.net core layout renderers -->
|
||||
<targets>
|
||||
<!--项目日志保存文件路径说明fileName="${basedir}/保存目录,以年月日的格式创建/${shortdate}/${记录器名称}-${单级记录}-${shortdate}.txt"-->
|
||||
<target name="info_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/info_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/info_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
<target name="error_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/error_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/error_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
</targets>
|
||||
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--定义使用哪个target输出-->
|
||||
<rules>
|
||||
<!-- 优先级从高到低依次为:OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL -->
|
||||
<!-- 将所有日志输出到文件 -->
|
||||
<logger name="*" minlevel="FATAL" maxlevel="FATAL" writeTo="info_file" />
|
||||
<logger name="*" minlevel="ERROR" maxlevel="ERROR" writeTo="error_file" />
|
||||
</rules>
|
||||
</nlog>
|
||||
3
SupplierManager/script/a.py
Normal file
3
SupplierManager/script/a.py
Normal file
@@ -0,0 +1,3 @@
|
||||
a="ffff"
|
||||
b="ddddd"
|
||||
c="fffff"
|
||||
1
SupplierManager/script/b.py
Normal file
1
SupplierManager/script/b.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
9
SupplierManager/script/webapi.py
Normal file
9
SupplierManager/script/webapi.py
Normal file
@@ -0,0 +1,9 @@
|
||||
区域={"其他":["其他地区"],"华南大区":["广东省","福建省","台湾省","湖南省"],"东北大区":["黑龙江省","吉林省","辽宁省"]}
|
||||
省份地区=["其他地区","北京市","天津市","河北省","山西省","内蒙古自治区","辽宁省","吉林省","黑龙江省","上海市","江苏省","浙江省","安徽省","福建省","江西省","山东省","河南省","湖北省","湖南省","广东省","广西壮族自治区","海南省","重庆市","四川省","贵州省","云南省","西藏自治区","陕西省","甘肃省","青海省","宁夏回族自治区","新疆维吾尔自治区","台湾省","香港特别行政区","澳门特别行政区","海外"]
|
||||
用户类型=["其他","公司业务员","省级代理负责人","区域代理负责人","酒店业主"]
|
||||
公司身份=["其他","公司业务","代理","酒店方"]
|
||||
行业分类=["其他行业","连锁酒店","独立品牌酒店","短租公寓","民宿","养老机构","电竞酒店","棋牌室"]
|
||||
驳回理由=["其他原因","信息填写不完整"]
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
SupplierManager/wwwroot/Download/customization/弱电-无界开关方案.xlsx
Normal file
BIN
SupplierManager/wwwroot/Download/customization/弱电-无界开关方案.xlsx
Normal file
Binary file not shown.
BIN
SupplierManager/wwwroot/Download/customization/弱电-智多方7寸屏.xlsx
Normal file
BIN
SupplierManager/wwwroot/Download/customization/弱电-智多方7寸屏.xlsx
Normal file
Binary file not shown.
BIN
SupplierManager/wwwroot/Download/customization/弱电-水悦派可视方案.xlsx
Normal file
BIN
SupplierManager/wwwroot/Download/customization/弱电-水悦派可视方案.xlsx
Normal file
Binary file not shown.
BIN
SupplierManager/wwwroot/Download/customization/弱电-轻触大板开关.xlsx
Normal file
BIN
SupplierManager/wwwroot/Download/customization/弱电-轻触大板开关.xlsx
Normal file
Binary file not shown.
BIN
SupplierManager/wwwroot/Download/customization/强电-D8T大板直连.xlsx
Normal file
BIN
SupplierManager/wwwroot/Download/customization/强电-D8T大板直连.xlsx
Normal file
Binary file not shown.
BIN
SupplierManager/wwwroot/Download/customization/强电-T1水立方.xlsx
Normal file
BIN
SupplierManager/wwwroot/Download/customization/强电-T1水立方.xlsx
Normal file
Binary file not shown.
BIN
SupplierManager/wwwroot/Download/customization/强电-T3水星阁直连.xlsx
Normal file
BIN
SupplierManager/wwwroot/Download/customization/强电-T3水星阁直连.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user