128 changed files with 7259 additions and 699 deletions
@ -0,0 +1,7 @@ |
|||
{ |
|||
"ExpandedNodes": [ |
|||
"" |
|||
], |
|||
"SelectedNode": "\\Znyc.Dispatching.sln", |
|||
"PreviewInSolutionExplorer": false |
|||
} |
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class CakeJson |
|||
{ |
|||
public string name { get; set; } |
|||
|
|||
public string CarNo { get; set; } |
|||
|
|||
public decimal value { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class CarTotalOutPut |
|||
{ |
|||
public List<CarTotalOutPutInfo> CarTotalOutPutInfo { get; set; } |
|||
[Column(TypeName = "decimal(10, 2)")] |
|||
public decimal Total { get; set; } |
|||
|
|||
} |
|||
|
|||
public class CarTotalOutPutInfo |
|||
{ |
|||
public long CarNo { get; set; } |
|||
|
|||
public String CarName { get; set; } |
|||
|
|||
[Column(TypeName = "decimal(10, 2)")] |
|||
public decimal Money { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class ColumnJson |
|||
{ |
|||
|
|||
public List<string> categories { get; set; } = new List<string>(); |
|||
|
|||
|
|||
public List<decimal> data { get; set; } = new List<decimal>(); |
|||
|
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class ConsumptionMeterOutput |
|||
{ |
|||
/// <summary>
|
|||
/// 累计花费
|
|||
/// </summary>
|
|||
public string Cumulative { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平均日花费
|
|||
/// </summary>
|
|||
public string Average { get; set; } |
|||
|
|||
///// <summary>
|
|||
///// 饼状图json
|
|||
///// </summary>
|
|||
//public string CakeJson { get; set; }
|
|||
|
|||
|
|||
///// <summary>
|
|||
///// 柱状图json
|
|||
///// </summary>
|
|||
//public string ColumnJson { get; set; }
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 饼状图
|
|||
/// </summary>
|
|||
public List<Expenditure> Expenditures { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 柱状图
|
|||
/// </summary>
|
|||
public ColumnJson ColumnJson { get; set; } |
|||
|
|||
} |
|||
|
|||
public class Expenditure |
|||
{ |
|||
/// <summary>
|
|||
/// 类型名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 车辆编号
|
|||
/// </summary>
|
|||
public string CarNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 花费金额
|
|||
/// </summary>
|
|||
[Column(TypeName = "decimal(10, 2)")] |
|||
public decimal Value { get; set; } |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,65 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class ConsumptionOutput |
|||
{ |
|||
/// <summary>
|
|||
/// ID
|
|||
/// </summary>
|
|||
public long ID { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 时间
|
|||
/// </summary>
|
|||
public DateTime CreatedTime { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 车辆编号
|
|||
/// </summary>
|
|||
public string CarNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 开支类别ID
|
|||
/// </summary>
|
|||
public long PayTyepID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 开支类别
|
|||
/// </summary>
|
|||
public string PayTyepName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车ID
|
|||
/// </summary>
|
|||
public long CarID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车名称
|
|||
/// </summary>
|
|||
public string CarName { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 支付途径
|
|||
/// </summary>
|
|||
public string PayChannel { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 金额
|
|||
/// </summary>
|
|||
public decimal Money { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 备注
|
|||
/// </summary>
|
|||
public string Remarks { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class ConsumptionInput |
|||
{ |
|||
|
|||
public long? ID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 开支类别ID
|
|||
/// </summary>
|
|||
public long PayTyepID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
public DateTime CreatedTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 开支类别
|
|||
/// </summary>
|
|||
public string PayTyepName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车ID
|
|||
/// </summary>
|
|||
public List<long> CarIDs { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车牌号
|
|||
/// </summary>
|
|||
public string CarName { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 支付途径
|
|||
/// </summary>
|
|||
public string PayChannel { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 金额
|
|||
/// </summary>
|
|||
public decimal Money { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 备注
|
|||
/// </summary>
|
|||
public string Remarks { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,434 @@ |
|||
using Furion.DatabaseAccessor; |
|||
using Furion.DependencyInjection; |
|||
using Furion.DynamicApiController; |
|||
using Furion.FriendlyException; |
|||
using Mapster; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text.Json; |
|||
using System.Threading.Tasks; |
|||
using Yitter.IdGenerator; |
|||
using Znyc.Dispatching.Common.Extensions; |
|||
using Znyc.Dispatching.Core; |
|||
using Znyc.Dispatching.Core.Entitys; |
|||
using Znyc.Dispatching.Core.Extension; |
|||
using Znyc.Dispatching.Core.Helpers; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
/// <summary>
|
|||
/// 开支记录
|
|||
/// </summary>
|
|||
[ApiDescriptionSettings(Name = "consumption", Order = 33)] |
|||
public class ConsumptionService : IConsumptionService, IDynamicApiController, ITransient |
|||
{ |
|||
private readonly IUserManager userManager; |
|||
private readonly ICacheService cacheService; |
|||
private readonly IRepository<Consumption> repository; |
|||
private readonly IRepository<Vehicle> vehicleRepository; |
|||
|
|||
public ConsumptionService(IRepository<Consumption> repository, |
|||
IUserManager userManager, |
|||
ICacheService cacheService, IRepository<Vehicle> vehicleRepository) |
|||
{ |
|||
this.repository = repository; |
|||
this.userManager = userManager; |
|||
this.cacheService = cacheService; |
|||
this.vehicleRepository = vehicleRepository; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 开支记录分页查询
|
|||
/// </summary>
|
|||
/// <param name="currentPage"></param>
|
|||
/// <param name="pageSize"></param>
|
|||
/// <param name="type"></param>
|
|||
/// <param name="CarNo" ></param>
|
|||
/// <param name="startTime"></param>
|
|||
/// <param name="endTime"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
[Route("api/v1/consumption/search")] |
|||
public async Task<PagedList<ConsumptionOutput>> PageAsync(DateTime startTime, DateTime endTime, int? type, long? CarNo, int currentPage = 1, int pageSize = 10) |
|||
{ |
|||
var res = from x in this.repository.AsQueryable() |
|||
.WhereIf(type.IsNotNull(), x => x.PayTyepID == type) |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CreatedTime >= startTime && x.CreatedTime < endTime) |
|||
.Where(x => x.CompayID == this.userManager.CompanyId) |
|||
.OrderByDescending(x => x.CreatedTime) |
|||
join d in this.vehicleRepository.AsQueryable() on x.CarID equals d.Id into results |
|||
from d in results.DefaultIfEmpty() |
|||
select new |
|||
{ |
|||
x.ProductID, |
|||
x.Id, |
|||
x.PayTyepID, |
|||
x.CarID, |
|||
x.CarName, |
|||
CarNo = x.CarNo == "全部" ? x.CarNo : d.VehicleCode, |
|||
x.CompayID, |
|||
x.CreatedTime, |
|||
x.CreatedUserId, |
|||
x.IsDeleted, |
|||
x.PayChannel, |
|||
x.PayTyepName, |
|||
x.Remarks, |
|||
x.ModifiedTime, |
|||
x.ModifiedUserId, |
|||
Money = x.Money |
|||
}; |
|||
var page = res.ToPagedList(currentPage, pageSize); |
|||
|
|||
var respage = page.Adapt<PagedList<ConsumptionOutput>>(); |
|||
return respage; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 开支记录分页查询
|
|||
/// </summary>
|
|||
/// <param name="currentPage"></param>
|
|||
/// <param name="pageSize"></param>
|
|||
/// <param name="type"></param>
|
|||
/// <param name="CarNo" ></param>
|
|||
/// <param name="startTime"></param>
|
|||
/// <param name="endTime"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
[Route("api/v1/consumption/Info")] |
|||
public async Task<PagedList<ConsumptionOutput>> PageInfoAsync(DateTime startTime, DateTime endTime, int? type, long? CarNo, int currentPage = 1, int pageSize = 10) |
|||
{ |
|||
//统计所有车辆数
|
|||
var conut = await this.vehicleRepository.DetachedEntities |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CompanyId == this.userManager.CompanyId).ToListAsync(); |
|||
//获取当前车牌号
|
|||
var cars = await this.vehicleRepository.DetachedEntities |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.Id == CarNo) |
|||
.Where(x => x.CompanyId == this.userManager.CompanyId).FirstOrDefaultAsync(); |
|||
|
|||
var res = from x in this.repository.AsQueryable() |
|||
.WhereIf(type.IsNotNull(), x => x.PayTyepID == type) |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CarID == CarNo || x.CarNo == "全部") |
|||
.Where(x => x.CreatedTime >= startTime && x.CreatedTime < endTime) |
|||
.Where(x => x.CompayID == this.userManager.CompanyId) |
|||
.OrderByDescending(x => x.CreatedTime) |
|||
join d in this.vehicleRepository.AsQueryable() on x.CarID equals d.Id into results |
|||
from d in results.DefaultIfEmpty() |
|||
select new |
|||
{ |
|||
x.ProductID, |
|||
x.Id, |
|||
x.PayTyepID, |
|||
x.CarID, |
|||
x.CarName, |
|||
CarNo = x.CarNo == "全部" ? cars.VehicleCode: d.VehicleCode, |
|||
x.CompayID, |
|||
x.CreatedTime, |
|||
x.CreatedUserId, |
|||
x.IsDeleted, |
|||
x.PayChannel, |
|||
x.PayTyepName, |
|||
x.Remarks, |
|||
x.ModifiedTime, |
|||
x.ModifiedUserId, |
|||
Money = x.CarNo =="全部" ? (x.Money /conut.Count) :x.Money |
|||
}; |
|||
|
|||
var page = res.ToPagedList(currentPage, pageSize); |
|||
var respage = page.Adapt<PagedList<ConsumptionOutput>>(); |
|||
return respage; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 开支统计
|
|||
/// </summary>
|
|||
/// <param name="startTime"></param>
|
|||
/// <param name="endTime"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
[Route("api/v1/consumption/Statistics")] |
|||
public async Task<ConsumptionMeterOutput> Statistics(DateTime startTime, DateTime endTime) |
|||
{ |
|||
List<Expenditure> expenditures = new List<Expenditure>(); |
|||
ColumnJson columnJson = new ColumnJson(); |
|||
List<CakeJson> cakeJsons = new List<CakeJson>(); |
|||
var allCar = await this.vehicleRepository |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CompanyId == this.userManager.CompanyId).ToListAsync(); |
|||
|
|||
var Day = TimeHelper.ExecDateDay(startTime,endTime); |
|||
|
|||
var reslq = from x in this.repository.AsQueryable() |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CompayID == this.userManager.CompanyId) |
|||
.Where(x => x.CreatedTime >= startTime && x.CreatedTime < endTime) |
|||
.OrderByDescending(x => x.CreatedTime) |
|||
join d in this.vehicleRepository.AsQueryable() on x.CarID equals d.Id into results |
|||
from d in results.DefaultIfEmpty() |
|||
select new |
|||
{ |
|||
x.ProductID, |
|||
x.Id, |
|||
x.PayTyepID, |
|||
x.CarID, |
|||
x.CarName, |
|||
CarNo = x.CarNo == "全部" ? x.CarNo : d.VehicleCode, |
|||
x.CompayID, |
|||
x.CreatedTime, |
|||
x.CreatedUserId, |
|||
x.IsDeleted, |
|||
x.PayChannel, |
|||
x.PayTyepName, |
|||
x.Remarks, |
|||
x.ModifiedTime, |
|||
x.ModifiedUserId, |
|||
Money = x.Money |
|||
}; |
|||
var res = reslq.ToList(); |
|||
|
|||
var sum = res.Sum(x => x.Money); |
|||
var Avg = Math.Round(sum / Day, 2); |
|||
|
|||
var PayTyeps = res.GroupBy(x => x.PayTyepID).ToList(); |
|||
|
|||
foreach (var item in PayTyeps) |
|||
{ |
|||
expenditures.Add(new Expenditure() |
|||
{ |
|||
Name = res.Where(x =>x.PayTyepID == item.Key).FirstOrDefault().PayTyepName, |
|||
Value = res.Where(x => x.PayTyepID == item.Key).Sum((x) => x.Money) |
|||
}); |
|||
} |
|||
|
|||
|
|||
foreach (var item in allCar) |
|||
{ |
|||
//设置平摊
|
|||
columnJson.categories.Add(item.VehicleCode); |
|||
var CarSum = res.Where(x => x.CarNo == item.VehicleCode).Sum(x =>x.Money); |
|||
|
|||
|
|||
var CarAvg = res.Where(x =>x.PayChannel.Contains("平摊")).Sum(x => x.Money)/allCar.Count; |
|||
columnJson.data.Add(Math.Round(CarSum + CarAvg,2)); |
|||
} |
|||
|
|||
return new ConsumptionMeterOutput() |
|||
{ |
|||
Cumulative = sum.ToString(), |
|||
Average = Avg.ToString(), |
|||
ColumnJson = columnJson, |
|||
Expenditures = expenditures |
|||
}; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 车辆分组开支统计
|
|||
/// </summary>
|
|||
/// <param name="startTime"></param>
|
|||
/// <param name="endTime"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
[Route("api/v1/consumption/CarTotal")] |
|||
public async Task<CarTotalOutPut> CarTotal(DateTime startTime, DateTime endTime) |
|||
{ |
|||
CarTotalOutPut carTotalOutPut = new CarTotalOutPut(); |
|||
var reslq = from x in this.repository.AsQueryable() |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CompayID == this.userManager.CompanyId) |
|||
.Where(x => x.CreatedTime >= startTime && x.CreatedTime < endTime) |
|||
.OrderByDescending(x => x.CreatedTime) |
|||
join d in this.vehicleRepository.AsQueryable() on x.CarID equals d.Id into results |
|||
from d in results.DefaultIfEmpty() |
|||
select new |
|||
{ |
|||
x.ProductID, |
|||
x.Id, |
|||
x.PayTyepID, |
|||
x.CarID, |
|||
x.CarName, |
|||
CarNo = d.VehicleCode, |
|||
x.CompayID, |
|||
x.CreatedTime, |
|||
x.CreatedUserId, |
|||
x.IsDeleted, |
|||
x.PayChannel, |
|||
x.PayTyepName, |
|||
x.Remarks, |
|||
x.ModifiedTime, |
|||
x.ModifiedUserId, |
|||
Money = x.Money |
|||
}; |
|||
//var carmoney = reslq.GroupBy(x => x.CarID, x => x.Money);
|
|||
|
|||
var allCar = await this.vehicleRepository |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CompanyId == this.userManager.CompanyId).ToListAsync(); |
|||
List<CarTotalOutPutInfo> grres = new List<CarTotalOutPutInfo>(); |
|||
|
|||
var JunMoney = reslq.Where(x =>x.PayChannel == "平摊").Sum(x=>x.Money)/allCar.Count; |
|||
|
|||
foreach (var item in allCar) |
|||
{ |
|||
var money = reslq.Where(x => x.CarID == item.Id).Where(x=>x.PayChannel != "平摊").Sum(x => x.Money); |
|||
grres.Add(new CarTotalOutPutInfo() |
|||
{ |
|||
CarNo = item.Id, |
|||
CarName = item.VehicleCode, |
|||
Money = Math.Round(JunMoney + money, 2) |
|||
}); |
|||
} |
|||
|
|||
return new CarTotalOutPut() |
|||
{ |
|||
Total = (int)grres.Sum(x => x.Money), |
|||
CarTotalOutPutInfo = grres |
|||
}; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 新增开支
|
|||
/// </summary>
|
|||
/// <param name="consumptionInput"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
[Route("api/v1/consumption/InsertAsync")] |
|||
public async Task<bool> InsertAsync(ConsumptionInput consumptionInput) |
|||
{ |
|||
var result = false; |
|||
long ProductID = YitIdHelper.NextId(); |
|||
//平摊
|
|||
if (consumptionInput.PayChannel == "平摊") |
|||
{ |
|||
var res = await this.vehicleRepository |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CompanyId == this.userManager.CompanyId).ToListAsync(); |
|||
if (res.Count == 0) |
|||
return result; |
|||
consumptionInput.CarIDs.Add(1); |
|||
} |
|||
|
|||
var avg = consumptionInput.Money / consumptionInput.CarIDs.Count; |
|||
|
|||
foreach (var item in consumptionInput.CarIDs) |
|||
{ |
|||
var map = consumptionInput.Adapt<Consumption>(); |
|||
Console.WriteLine("车辆ID" + item); |
|||
var carRes = await this.cacheService.GetVehicleAsync(item); |
|||
if (carRes.IsNull()) |
|||
{ |
|||
map.CarID = item; |
|||
map.CarName = "平摊"; |
|||
map.CarNo = "全部"; |
|||
} |
|||
else |
|||
{ |
|||
map.CarName = carRes.VehiclePlate; |
|||
map.CarNo = carRes.VehicleCode; |
|||
map.CarID = item; |
|||
} |
|||
|
|||
|
|||
map.Money = avg; |
|||
map.ProductID = ProductID; |
|||
|
|||
map.CreatedTime = consumptionInput.CreatedTime; |
|||
map.CreatedUserId = this.userManager.CompanyId; |
|||
map.CompayID = this.userManager.CompanyId; |
|||
var res = await this.repository.InsertNowAsync(map); |
|||
if (res.IsNotNull()) |
|||
result = true; |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 更新开支
|
|||
/// </summary>
|
|||
/// <param name="payTypeInput"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPut] |
|||
[Route("api/v1/consumption/UpdateAsync")] |
|||
public async Task<bool> UpdateAsync(ConsumptionInput payTypeInput) |
|||
{ |
|||
bool result = false; |
|||
if (payTypeInput.ID.IsNull()) |
|||
throw Oops.Oh($"编辑缺少ID!"); |
|||
|
|||
var carres = await this.vehicleRepository |
|||
.Where(x => x.IsDeleted == false) |
|||
.Where(x => x.CompanyId == this.userManager.CompanyId).ToListAsync(); |
|||
//平摊
|
|||
if (payTypeInput.PayChannel == "平摊") |
|||
{ |
|||
if (carres.Count == 0) |
|||
return result; |
|||
|
|||
var map = payTypeInput.Adapt<Consumption>(); |
|||
map.CarID = 1; |
|||
map.CarName = "平摊"; |
|||
map.CompayID = this.userManager.CompanyId; |
|||
map.ModifiedUserId = this.userManager.UserId; |
|||
map.ModifiedTime = System.DateTime.Now; |
|||
var resUp = await this.repository.UpdateNowAsync(map); |
|||
if (resUp.IsNotNull()) |
|||
result = true; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
for (int i = 0; i < payTypeInput.CarIDs.Count; i++) |
|||
{ |
|||
var carRes = carres.Where(x => x.Id == payTypeInput.CarIDs[i]).FirstOrDefault(); |
|||
if (carRes.IsNull()) |
|||
throw Oops.Oh("车辆信息不存在!"); |
|||
var map = payTypeInput.Adapt<Consumption>(); |
|||
map.CarID = payTypeInput.CarIDs[i]; |
|||
map.CarName = carRes.VehiclePlate; |
|||
map.CarNo = carRes.VehicleCode; |
|||
map.CompayID = this.userManager.CompanyId; |
|||
map.ModifiedUserId = this.userManager.UserId; |
|||
map.ModifiedTime = System.DateTime.Now; |
|||
var resUp = await this.repository.UpdateNowAsync(map); |
|||
if (resUp.IsNotNull()) |
|||
result = true; |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 删除油耗信息
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpDelete] |
|||
[Route("api/v1/consumption/{id}")] |
|||
public async Task DeleteAsync(long id) |
|||
{ |
|||
var oil = await this.repository.FirstOrDefaultAsync(x => x.Id == id); |
|||
if (oil.IsNull()) |
|||
throw Oops.Oh("暂无该信息"); |
|||
oil.IsDeleted = true; |
|||
var result = await this.repository.UpdateNowAsync(oil); |
|||
if (result.IsNull()) |
|||
{ |
|||
throw Oops.Oh("删除油耗信息失败"); |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public interface IConsumptionService |
|||
{ |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class WorkDeclarationOutput |
|||
{ |
|||
/// <summary>
|
|||
/// 公司名称
|
|||
/// </summary>
|
|||
public long CompanyName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车型
|
|||
/// </summary>
|
|||
public int CarType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 到场时间
|
|||
/// </summary>
|
|||
public DateTime ArriveDate { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 报单信息
|
|||
/// </summary>
|
|||
public string Info { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 报单员
|
|||
/// </summary>
|
|||
public string ReportSheetName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 联系电话
|
|||
/// </summary>
|
|||
public string Phone { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,52 @@ |
|||
using Furion.DatabaseAccessor; |
|||
using Furion.DependencyInjection; |
|||
using Furion.DynamicApiController; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Znyc.Dispatching.Core; |
|||
using Znyc.Dispatching.Core.Entitys; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class DeclarationService : IDeclarationService, IDynamicApiController, ITransient |
|||
{ |
|||
private readonly IUserManager userManager; |
|||
|
|||
private readonly IRepository<Declaration> repository; |
|||
|
|||
public DeclarationService(IRepository<Declaration> repository, |
|||
IUserManager userManager) |
|||
{ |
|||
this.repository = repository; |
|||
this.userManager = userManager; |
|||
} |
|||
|
|||
|
|||
#region 工地方
|
|||
|
|||
///// <summary>
|
|||
///// 工地端报单列表
|
|||
///// </summary>
|
|||
///// <param name="status"></param>
|
|||
///// <param name="currentPage"></param>
|
|||
///// <param name="pageSize"></param>
|
|||
///// <param name="key"></param>
|
|||
///// <returns></returns>
|
|||
//[HttpGet]
|
|||
//[Route("api/v1/admin/declaration/search")]
|
|||
//public async Task<WorkDeclarationOutput> PageAsync(int status = 0, int currentPage = 1, int pageSize = 10, string key = "")
|
|||
//{
|
|||
// //var compay = this,
|
|||
|
|||
// //var res = this.repository.Where(x =>x.State == status).Where(x =>x.CompanyId == user)
|
|||
//}
|
|||
|
|||
#endregion
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public interface IDeclarationService |
|||
{ |
|||
|
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application.Login |
|||
{ |
|||
public class TicketOut |
|||
{ |
|||
public int Id { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Ticket值
|
|||
/// </summary>
|
|||
public string TicketStr { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class NewCensusOilOutput |
|||
{ |
|||
/// <summary>
|
|||
/// 累计花费
|
|||
/// </summary>
|
|||
public string Cumulative { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平均日花费
|
|||
/// </summary>
|
|||
public string Average { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 柱状图
|
|||
/// </summary>
|
|||
public ColumnJson ColumnJson { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 饼图
|
|||
/// </summary>
|
|||
public List<Expenditure> Expenditures { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 四大标签
|
|||
/// </summary>
|
|||
public List<Expenditure> FourExpenditures { get; set; } |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,45 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class OilCatTotalOutput |
|||
{ |
|||
public List<OilCatOutputInfo> OilCatOutputInfos { get; set; } |
|||
|
|||
public int Total { get; set; } |
|||
|
|||
} |
|||
|
|||
public class OilCatOutputInfo |
|||
{ |
|||
public long ID { get; set; } |
|||
/// <summary>
|
|||
/// 车牌号
|
|||
/// </summary>
|
|||
public string CarName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工作时长
|
|||
/// </summary>
|
|||
public string WoekAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 时长
|
|||
/// </summary>
|
|||
public int TimeAmount { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 油耗
|
|||
/// </summary>
|
|||
public int OilPtion { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 油耗比
|
|||
/// </summary>
|
|||
public string OilThan { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class DistinguishOut |
|||
{ |
|||
public long vehicleTypeID { get; set; } |
|||
|
|||
public string vehicleName { get; set; } |
|||
|
|||
public DateTime dateTime { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,27 @@ |
|||
using Microsoft.AspNetCore.Http; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class CheckInput |
|||
{ |
|||
/// <summary>
|
|||
/// OrderId
|
|||
/// </summary>
|
|||
public long OrderId { get; set; } |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 图片路径
|
|||
/// </summary>
|
|||
public string location { get; set; } |
|||
|
|||
|
|||
public IFormFile FormFiles { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class CheckOutPut |
|||
{ |
|||
/// <summary>
|
|||
/// 图片路径
|
|||
/// </summary>
|
|||
public string Picture { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
public enum PayTypeOutEnum |
|||
{ |
|||
启用 = 0, |
|||
停用 = 1, |
|||
} |
|||
} |
@ -0,0 +1,32 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class PayTypeInput |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 类别ID
|
|||
/// </summary>
|
|||
public long? ID { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 开支类别
|
|||
/// </summary>
|
|||
public string TypeName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public PayTypeOutEnum Enable { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class PayTypeOutPut |
|||
{ |
|||
/// <summary>
|
|||
/// 类比ID 修改删除用
|
|||
/// </summary>
|
|||
public long ID { get; set; } |
|||
/// <summary>
|
|||
/// 开支类别
|
|||
/// </summary>
|
|||
public string TypeName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public PayTypeOutEnum Enable { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否能编辑 0 可以 1 否
|
|||
/// </summary>
|
|||
public PayTypeOutEnum IsEdit { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
/// <summary>
|
|||
/// 支付类型管理接口
|
|||
/// </summary>
|
|||
public interface IPayTypeService |
|||
{ |
|||
|
|||
} |
|||
} |
@ -0,0 +1,110 @@ |
|||
using Furion.DatabaseAccessor; |
|||
using Furion.DependencyInjection; |
|||
using Furion.DynamicApiController; |
|||
using Furion.FriendlyException; |
|||
using Mapster; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Znyc.Dispatching.Core; |
|||
using Znyc.Dispatching.Core.Entitys; |
|||
using Znyc.Dispatching.Core.Extension; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
/// <summary>
|
|||
/// 支付类型管理
|
|||
/// </summary>
|
|||
[ApiDescriptionSettings(Name = "paytype", Order = 32)] |
|||
public class PayTypeService : IPayTypeService, IDynamicApiController, ITransient |
|||
{ |
|||
private readonly IUserManager userManager; |
|||
private readonly ICacheService cacheService; |
|||
private readonly IRepository<PayType> repository; |
|||
|
|||
|
|||
public PayTypeService(IRepository<PayType> repository, |
|||
IUserManager userManager, |
|||
ICacheService cacheService) |
|||
{ |
|||
this.repository = repository; |
|||
this.userManager = userManager; |
|||
this.cacheService = cacheService; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 获取开支类别
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet] |
|||
[Route("api/v1/PayType")] |
|||
public async Task<List<PayTypeOutPut>> GetAll(bool Enable) |
|||
{ |
|||
var compayId = this.userManager.CompanyId; |
|||
if (compayId.IsNull()) |
|||
throw Oops.Oh($"用户公司为空!"); |
|||
if(this.userManager.RoleId == 1005 || this.userManager.RoleId == 1004) |
|||
return await this.cacheService.GetPayTypeAll(compayId, Enable); |
|||
return await this.cacheService.GetPayTypeAll(compayId, Enable); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 添加支付类型
|
|||
/// </summary>
|
|||
/// <param name="payTypeInput"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
[Route("api/v1/paytype/InsertAsync")] |
|||
public async Task<bool> InsertAsync(PayTypeInput payTypeInput) |
|||
{ |
|||
var result = false; |
|||
if (payTypeInput.IsNull()) |
|||
return result; |
|||
var res = await this.repository.InsertNowAsync(new PayType() |
|||
{ |
|||
TypeName = payTypeInput.TypeName, |
|||
Enable = 0, |
|||
CreatedTime = System.DateTime.Now, |
|||
CreatedUserId = this.userManager.UserId, |
|||
IsDeleted = false, |
|||
CompayId = this.userManager.CompanyId, |
|||
IsEdit = 0, |
|||
}); |
|||
await this.cacheService.RemovePayTypeAllAsync(userManager.CompanyId); |
|||
if (res.Entity.Id > 0) |
|||
result = true; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 编辑支付类型
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPut] |
|||
[UnitOfWork] |
|||
[Route("api/v1/paytype/UpdateAsync")] |
|||
public async Task<bool> UpdateAsync(PayTypeInput payTypeInput) |
|||
{ |
|||
bool result = false; |
|||
if (payTypeInput.IsNull()) |
|||
return result; |
|||
if (payTypeInput.ID.IsNull()) |
|||
throw Oops.Oh($"编辑缺少ID!"); |
|||
var res = await this.repository.FindOrDefaultAsync(payTypeInput.ID); |
|||
if (res.IsNull()) |
|||
throw Oops.Oh("ID查询为空"); |
|||
res.TypeName = payTypeInput.TypeName; |
|||
res.Enable = (int)payTypeInput.Enable; |
|||
res.ModifiedUserId = this.userManager.UserId; |
|||
res.ModifiedTime = System.DateTime.Now; |
|||
var resUp = await this.repository.UpdateNowAsync(res); |
|||
if(resUp.IsNotNull()) |
|||
result = true; |
|||
return result; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application.SpareTimeWorker.Server |
|||
{ |
|||
public interface ISpareTimeWorkerService |
|||
{ |
|||
Task TimeWorker(); |
|||
} |
|||
} |
@ -0,0 +1,35 @@ |
|||
using Furion.RemoteRequest.Extensions; |
|||
using Furion.TaskScheduler; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application.SpareTimeWorker.Server |
|||
{ |
|||
public class SpareTimeWorkerService: ISpareTimeWorker |
|||
{ |
|||
[SpareTime(600000, "jobName", StartNow = true)] |
|||
public async Task TimeWorker(SpareTimer timer, long count) |
|||
{ |
|||
|
|||
await "http://localhost/api/job/sync-vehicle-off".GetAsync(); |
|||
// await "http://localhost/api/job/sync-vehicle-off".GetAsync();
|
|||
|
|||
} |
|||
|
|||
[SpareTime(60000, "vehicleName", StartNow = true)] |
|||
public async Task VehicleWorker(SpareTimer timer, long count) |
|||
{ |
|||
|
|||
Console.WriteLine("车辆异常提醒"); |
|||
////停留
|
|||
await "http://localhost/api/job/syncstoping".GetAsync(); |
|||
////超速
|
|||
//await "http://localhost/api/job/syncspeeding".GetAsync();
|
|||
|
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class VehiclesOutPut |
|||
{ |
|||
/// <summary>
|
|||
/// 车辆ID
|
|||
/// </summary>
|
|||
public long Id { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 车牌号
|
|||
/// </summary>
|
|||
public string VehiclePlate { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class WorkPlaceListPage |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class WorkPlaceAddInput |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class WorkPlaceOutput |
|||
{ |
|||
|
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public class WorkPlaceUpdateInput |
|||
{ |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
public interface IWorkPlaceService |
|||
{ |
|||
|
|||
Task<WorkPlaceListPage> PageAsync(int currentPage, int pageSize, int status, int roleId, string key, string orderby); |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 根据id获取员工资料
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
Task<WorkPlaceOutput> GetByIdAsync(long id); |
|||
|
|||
/// <summary>
|
|||
/// 添加员工信息
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
Task<long> AddAsync(WorkPlaceAddInput input); |
|||
|
|||
/// <summary>
|
|||
/// 编辑员工信息
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
Task UpdateAsync(WorkPlaceUpdateInput input); |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 软删除员工信息
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
Task DeleteByIdAsync(long id); |
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
using Furion.DatabaseAccessor; |
|||
using Furion.DependencyInjection; |
|||
using Furion.DynamicApiController; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Znyc.Dispatching.Core.Entitys; |
|||
|
|||
namespace Znyc.Dispatching.Application |
|||
{ |
|||
|
|||
public class WorkPlaceService : IWorkPlaceService, IDynamicApiController, ITransient |
|||
{ |
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
private readonly IRepository<WorkPlace> workPlaceRepository; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="workPlaceRepository"></param>
|
|||
public WorkPlaceService(IRepository<WorkPlace> workPlaceRepository) |
|||
{ |
|||
this.workPlaceRepository = workPlaceRepository; |
|||
} |
|||
|
|||
public Task<long> AddAsync(WorkPlaceAddInput input) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Task DeleteByIdAsync(long id) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Task<WorkPlaceOutput> GetByIdAsync(long id) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Task<WorkPlaceListPage> PageAsync(int currentPage, int pageSize, int status, int roleId, string key, string orderby) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Task UpdateAsync(WorkPlaceUpdateInput input) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,28 @@ |
|||
using Furion.ConfigurableOptions; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core |
|||
{ |
|||
[OptionsSettings("WxOpenSetting")] |
|||
public class WxOpenSetting : IConfigurableOptions |
|||
{ |
|||
/// <summary>
|
|||
/// 小程序
|
|||
/// </summary>
|
|||
public string AppID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// </summary>
|
|||
public string WxOpenAppSecret { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 请求CODEURL
|
|||
/// </summary>
|
|||
public string OpenUrl { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,70 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Entitys |
|||
{ |
|||
[Table("dc_consumption")] |
|||
[Comment("消费详情表")] |
|||
public class Consumption : DEntityBase |
|||
{ |
|||
/// <summary>
|
|||
/// 开支类别ID
|
|||
/// </summary>
|
|||
public long PayTyepID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平摊ID
|
|||
/// </summary>
|
|||
|
|||
public long ProductID { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 公司ID
|
|||
/// </summary>
|
|||
public long CompayID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 开支类别
|
|||
/// </summary>
|
|||
public string PayTyepName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车ID
|
|||
/// </summary>
|
|||
public long CarID { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 车牌号
|
|||
/// </summary>
|
|||
public string CarName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车辆编号
|
|||
/// </summary>
|
|||
public string CarNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 支付途径
|
|||
/// </summary>
|
|||
public string PayChannel { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 金额
|
|||
/// </summary>
|
|||
public decimal Money { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 备注
|
|||
/// </summary>
|
|||
public string Remarks { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,131 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Entitys |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 派单订单表
|
|||
/// </summary>
|
|||
[Table("dc_declaration")] |
|||
[Comment("派单订单表")] |
|||
public class Declaration: DEntityBase |
|||
{ |
|||
/// <summary>
|
|||
/// 公司Id
|
|||
/// </summary>
|
|||
public long CompanyId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 车型
|
|||
/// </summary>
|
|||
public int CarType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 到场时间
|
|||
/// </summary>
|
|||
public DateTime ArriveDate { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 结束时间
|
|||
/// </summary>
|
|||
public DateTime EndTime { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 地址
|
|||
/// </summary>
|
|||
public string Address { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 报单信息
|
|||
/// </summary>
|
|||
public string Info { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 报单员
|
|||
/// </summary>
|
|||
public string ReportSheetID { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 报单员
|
|||
/// </summary>
|
|||
public string ReportSheetName { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 经度
|
|||
/// </summary>
|
|||
public decimal Longitude { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 纬度
|
|||
/// </summary>
|
|||
public decimal Latitude { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 工程名称
|
|||
/// </summary>
|
|||
public string ProjectName { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 施工位置
|
|||
/// </summary>
|
|||
public string Position { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 施工量
|
|||
/// </summary>
|
|||
public string Amount { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 公里数
|
|||
/// </summary>
|
|||
public long Kilometre { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 联系电话
|
|||
/// </summary>
|
|||
public string Phone { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 报单状态
|
|||
/// </summary>
|
|||
public int State { get; set; } |
|||
|
|||
#region 审核
|
|||
|
|||
/// <summary>
|
|||
/// 审核人
|
|||
/// </summary>
|
|||
public string ReviewName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 审核人ID
|
|||
/// </summary>
|
|||
public string ReviewID { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
#endregion
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Entitys |
|||
{ |
|||
[Table("dc_order_check")] |
|||
[Comment("订单安检表")] |
|||
public class OrderCheck : DEntityBase |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 订单Id
|
|||
/// </summary>
|
|||
public long OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 图片路径
|
|||
/// </summary>
|
|||
public string Picture { get; set; } |
|||
|
|||
|
|||
public string Tag { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Entitys |
|||
{ |
|||
[Table("dc_paytype")] |
|||
[Comment("支付类型表")] |
|||
public class PayType : DEntityBase |
|||
{ |
|||
/// <summary>
|
|||
/// 开支类别
|
|||
/// </summary>
|
|||
public string TypeName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用 0 启用 1禁用
|
|||
/// </summary>
|
|||
public int Enable { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否可以编辑 0 可以编辑 1,不可以编辑
|
|||
/// </summary>
|
|||
public int IsEdit { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 公司ID
|
|||
/// </summary>
|
|||
public long CompayId { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,51 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Entitys |
|||
{ |
|||
[Table("dc_recordplusoil")] |
|||
[Comment("加油记录表")] |
|||
public class RecordPlusOil : DEntityBase |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 车辆编号
|
|||
/// </summary>
|
|||
public string CarNo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 加油单号
|
|||
/// </summary>
|
|||
public string PlusOilNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 升
|
|||
/// </summary>
|
|||
public string Rise { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 单价
|
|||
/// </summary>
|
|||
public decimal Price { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 总价
|
|||
/// </summary>
|
|||
public decimal Total { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 备注
|
|||
/// </summary>
|
|||
public string Remarks { get; set; } |
|||
|
|||
} |
|||
} |
@ -0,0 +1,79 @@ |
|||
using Furion.DatabaseAccessor; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Entitys |
|||
{ |
|||
[SuppressChangedListener] |
|||
[Table("dc_workplace")] |
|||
[Comment("工地表")] |
|||
public class WorkPlace : DEntityBase |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 公司名称
|
|||
/// </summary>
|
|||
[Comment("公司名称")] |
|||
[Required] |
|||
[MaxLength(8)] |
|||
public string CompanyName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 公司Logo
|
|||
/// </summary>
|
|||
[Comment("公司Logo")] |
|||
public string CompanyLogo { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 精度
|
|||
/// </summary>
|
|||
[Comment("精度")] |
|||
public decimal Longitude { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 纬度
|
|||
/// </summary>
|
|||
[Comment("纬度")] |
|||
public decimal Latitude { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 地址
|
|||
/// </summary>
|
|||
[Comment("地址")] |
|||
[MaxLength(35)] |
|||
public string Address { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 审核时间
|
|||
/// </summary>
|
|||
[Comment("审核时间")] |
|||
public DateTime AuditTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 状态(字典 0正常 1停用 2删除)
|
|||
/// </summary>
|
|||
[Comment("状态")] |
|||
public int Status { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 停留标示Id
|
|||
/// </summary>
|
|||
[Comment("停留标示Id")] |
|||
public long StopTag { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 是否启用任务车型选项,默认为关
|
|||
/// </summary>
|
|||
[Comment("是否启用任务车型选项")] |
|||
|
|||
public bool IsOpenVehicleType { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Entitys |
|||
{ |
|||
[Table("dc_workplaceemployee")] |
|||
[Comment("工地中间表")] |
|||
public class WorkPlaceEmployee: DEntityBase |
|||
{ |
|||
/// <summary>
|
|||
/// UnionId
|
|||
/// </summary>
|
|||
[Comment("UnionId")] |
|||
[Required] |
|||
[MaxLength(32)] |
|||
public string UnionId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工地ID
|
|||
/// </summary>
|
|||
[Comment("工地ID")] |
|||
|
|||
public string? WordPlaceID { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 用户Id
|
|||
/// </summary>
|
|||
[Comment("用户Id")] |
|||
[Required] |
|||
public long UserId { get; set; } |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,55 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Enums |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 报单状态
|
|||
/// </summary>
|
|||
public enum DeclarationEnum |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 未接单
|
|||
/// </summary>
|
|||
[Description("未接单")] |
|||
MissedOrder = 0, |
|||
|
|||
/// <summary>
|
|||
/// 待审核
|
|||
/// </summary>
|
|||
[Description("待审核")] |
|||
StayCheck = 1, |
|||
|
|||
/// <summary>
|
|||
/// 已审核
|
|||
/// </summary>
|
|||
[Description("已审核")] |
|||
EndCheck = 2, |
|||
|
|||
/// <summary>
|
|||
/// 待指派
|
|||
/// </summary>
|
|||
[Description("待指派")] |
|||
Assign = 3, |
|||
|
|||
/// <summary>
|
|||
/// 工作中
|
|||
/// </summary>
|
|||
[Description("工作中")] |
|||
WordHit = 4, |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 已完工
|
|||
/// </summary>
|
|||
[Description("已完工")] |
|||
OverWord = 10 |
|||
|
|||
} |
|||
} |
@ -0,0 +1,214 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Helpers |
|||
{ |
|||
public class GeocoderLoaction |
|||
{ |
|||
|
|||
public int status { get; set; } |
|||
public string message { get; set; } |
|||
public string request_id { get; set; } |
|||
public Result result { get; set; } |
|||
|
|||
|
|||
public class Result |
|||
{ |
|||
public Location location { get; set; } |
|||
public string address { get; set; } |
|||
public Formatted_Addresses formatted_addresses { get; set; } |
|||
public Address_Component address_component { get; set; } |
|||
public Ad_Info ad_info { get; set; } |
|||
public Address_Reference address_reference { get; set; } |
|||
public int poi_count { get; set; } |
|||
public Pois[] pois { get; set; } |
|||
} |
|||
|
|||
public class Location |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Formatted_Addresses |
|||
{ |
|||
public string recommend { get; set; } |
|||
public string rough { get; set; } |
|||
} |
|||
|
|||
public class Address_Component |
|||
{ |
|||
public string nation { get; set; } |
|||
public string province { get; set; } |
|||
public string city { get; set; } |
|||
public string district { get; set; } |
|||
public string street { get; set; } |
|||
public string street_number { get; set; } |
|||
} |
|||
|
|||
public class Ad_Info |
|||
{ |
|||
public string nation_code { get; set; } |
|||
public string adcode { get; set; } |
|||
public string city_code { get; set; } |
|||
public string name { get; set; } |
|||
public Location1 location { get; set; } |
|||
public string nation { get; set; } |
|||
public string province { get; set; } |
|||
public string city { get; set; } |
|||
public string district { get; set; } |
|||
} |
|||
|
|||
public class Location1 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Address_Reference |
|||
{ |
|||
public Business_Area business_area { get; set; } |
|||
public Famous_Area famous_area { get; set; } |
|||
public Crossroad crossroad { get; set; } |
|||
public Town town { get; set; } |
|||
public Street_Number street_number { get; set; } |
|||
public Street street { get; set; } |
|||
public Landmark_L2 landmark_l2 { get; set; } |
|||
} |
|||
|
|||
public class Business_Area |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public Location2 location { get; set; } |
|||
public int _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location2 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Famous_Area |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public Location3 location { get; set; } |
|||
public int _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location3 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Crossroad |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public Location4 location { get; set; } |
|||
public float _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location4 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Town |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public Location5 location { get; set; } |
|||
public int _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location5 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Street_Number |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public Location6 location { get; set; } |
|||
public float _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location6 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Street |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public Location7 location { get; set; } |
|||
public float _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location7 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Landmark_L2 |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public Location8 location { get; set; } |
|||
public int _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location8 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Pois |
|||
{ |
|||
public string id { get; set; } |
|||
public string title { get; set; } |
|||
public string address { get; set; } |
|||
public string category { get; set; } |
|||
public Location9 location { get; set; } |
|||
public Ad_Info1 ad_info { get; set; } |
|||
public float _distance { get; set; } |
|||
public string _dir_desc { get; set; } |
|||
} |
|||
|
|||
public class Location9 |
|||
{ |
|||
public float lat { get; set; } |
|||
public float lng { get; set; } |
|||
} |
|||
|
|||
public class Ad_Info1 |
|||
{ |
|||
public string adcode { get; set; } |
|||
public string province { get; set; } |
|||
public string city { get; set; } |
|||
public string district { get; set; } |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,324 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Drawing; |
|||
using System.Drawing.Drawing2D; |
|||
using System.Drawing.Imaging; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Helpers |
|||
{ |
|||
public static class WaterMarkHelper |
|||
{ |
|||
#region 添加水印
|
|||
|
|||
/// <summary>
|
|||
/// 文字水印
|
|||
/// </summary>
|
|||
/// <param name="imgPath">服务器图片相对路径</param>
|
|||
/// <param name="filename">保存文件名</param>
|
|||
/// <param name="watermarkText">水印文字</param>
|
|||
/// <param name="watermarkStatus">图片水印位置 0=不使用 1=左上 2=中上 3=右上 4=左中 9=右下</param>
|
|||
/// <param name="quality">附加水印图片质量,0-100</param>
|
|||
/// <param name="fontsize">字体大小</param>
|
|||
/// <param name="fontname">字体</param>
|
|||
public static void AddImageSignText(Image img, string filename, string watermarkText, int watermarkStatus, int quality, int fontsize, string fontname = "微软雅黑") |
|||
{ |
|||
//byte[] _ImageBytes = File.ReadAllBytes(imgPath);
|
|||
//Image img = Image.FromStream(new MemoryStream(_ImageBytes));
|
|||
//filename = GetMapPath(filename);
|
|||
|
|||
Graphics g = Graphics.FromImage(img); |
|||
|
|||
//watermarkText = get_uft8(watermarkText);
|
|||
Font drawFont = new Font(fontname, fontsize, FontStyle.Regular, GraphicsUnit.Pixel); |
|||
SizeF crSize; |
|||
crSize = g.MeasureString(watermarkText, drawFont); |
|||
|
|||
float xpos = 0; |
|||
float ypos = 0; |
|||
|
|||
switch (watermarkStatus) |
|||
{ |
|||
case 1: |
|||
xpos = (float)img.Width * (float).01; |
|||
ypos = (float)img.Height * (float).01; |
|||
break; |
|||
case 2: |
|||
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2); |
|||
ypos = (float)img.Height * (float).01; |
|||
break; |
|||
case 3: |
|||
xpos = ((float)img.Width * (float).99) - crSize.Width; |
|||
ypos = (float)img.Height * (float).01; |
|||
break; |
|||
case 4: |
|||
xpos = (float)img.Width * (float).01; |
|||
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2); |
|||
break; |
|||
case 5: |
|||
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2); |
|||
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2); |
|||
break; |
|||
case 6: |
|||
xpos = ((float)img.Width * (float).99) - crSize.Width; |
|||
ypos = ((float)img.Height * (float).50) - (crSize.Height / 2); |
|||
break; |
|||
case 7: |
|||
xpos = (float)img.Width * (float).01; |
|||
ypos = ((float)img.Height * (float).99) - crSize.Height; |
|||
break; |
|||
case 8: |
|||
xpos = ((float)img.Width * (float).50) - (crSize.Width / 2); |
|||
ypos = ((float)img.Height * (float).99) - crSize.Height; |
|||
break; |
|||
case 9: |
|||
xpos = ((float)img.Width * (float).99) - crSize.Width; |
|||
ypos = ((float)img.Height * (float).99) - crSize.Height; |
|||
break; |
|||
} |
|||
|
|||
g.DrawString(watermarkText, drawFont, new SolidBrush(Color.White), xpos + 1, ypos + 1); |
|||
g.DrawString(watermarkText, drawFont, new SolidBrush(Color.Black), xpos, ypos); |
|||
|
|||
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders(); |
|||
ImageCodecInfo ici = null; |
|||
foreach (ImageCodecInfo codec in codecs) |
|||
{ |
|||
if (codec.MimeType.IndexOf("jpeg") > -1) |
|||
ici = codec; |
|||
} |
|||
EncoderParameters encoderParams = new EncoderParameters(); |
|||
long[] qualityParam = new long[1]; |
|||
if (quality < 0 || quality > 100) |
|||
quality = 80; |
|||
|
|||
qualityParam[0] = quality; |
|||
|
|||
EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, qualityParam); |
|||
encoderParams.Param[0] = encoderParam; |
|||
|
|||
if (ici != null) |
|||
img.Save(filename, ici, encoderParams); |
|||
else |
|||
img.Save(filename); |
|||
|
|||
g.Dispose(); |
|||
img.Dispose(); |
|||
} |
|||
|
|||
|
|||
public static string get_uft8(string unicodeString) |
|||
{ |
|||
string keyword; |
|||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); |
|||
byte[] buffer = Encoding.GetEncoding("GB2312").GetBytes(unicodeString); |
|||
return Encoding.GetEncoding("GB2312").GetString(buffer); |
|||
//keyword = Encoding.UTF8.GetString(buffer);
|
|||
//Console.WriteLine("编码后"+keyword);
|
|||
//return keyword;
|
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 添加文字水印
|
|||
/// </summary>
|
|||
/// <param name="image"></param>
|
|||
/// <param name="text"></param>
|
|||
/// <param name="fontSize">字体大小</param>
|
|||
/// <param name="rectX">水印开始X坐标(自动扣除文字宽度)</param>
|
|||
/// <param name="rectY">水印开始Y坐标(自动扣除文字高度</param>
|
|||
/// <param name="opacity">0-255 值越大透明度越低</param>
|
|||
/// <param name="externName">文件后缀名</param>
|
|||
/// <returns></returns>
|
|||
public static Image AddTextToImg(Image image, string text, float fontSize, float rectX, float rectY, int opacity, string externName) |
|||
{ |
|||
|
|||
Bitmap bitmap = new Bitmap(image, image.Width, image.Height); |
|||
|
|||
Graphics g = Graphics.FromImage(bitmap); |
|||
|
|||
//下面定义一个矩形区域
|
|||
float rectWidth = text.Length * (fontSize + 10); |
|||
float rectHeight = fontSize + 20; |
|||
|
|||
//声明矩形域
|
|||
|
|||
RectangleF textArea = new RectangleF(rectX - rectWidth, rectY - rectHeight, rectWidth, rectHeight); |
|||
|
|||
Font font = new Font("Verdana", fontSize, FontStyle.Bold); //定义字体
|
|||
|
|||
Brush whiteBrush = new SolidBrush(Color.FromArgb(opacity,255, 255, 255)); //画文字用
|
|||
|
|||
g.DrawString(text, font, whiteBrush, textArea); |
|||
|
|||
MemoryStream ms = new MemoryStream(); |
|||
|
|||
//保存图片
|
|||
switch (externName) |
|||
{ |
|||
case ".jpg": |
|||
bitmap.Save(ms, ImageFormat.Jpeg); |
|||
break; |
|||
case ".gif": |
|||
bitmap.Save(ms, ImageFormat.Gif); |
|||
break; |
|||
case ".png": |
|||
bitmap.Save(ms, ImageFormat.Png); |
|||
break; |
|||
default: |
|||
bitmap.Save(ms, ImageFormat.Jpeg); |
|||
break; |
|||
} |
|||
|
|||
|
|||
Image h_hovercImg = Image.FromStream(ms); |
|||
|
|||
g.Dispose(); |
|||
|
|||
bitmap.Dispose(); |
|||
|
|||
return h_hovercImg; |
|||
|
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 添加图片水印
|
|||
/// </summary>
|
|||
/// <param name="image"></param>
|
|||
/// <param name="text"></param>
|
|||
/// <param name="rectX">水印开始X坐标(自动扣除图片宽度)</param>
|
|||
/// <param name="rectY">水印开始Y坐标(自动扣除图片高度</param>
|
|||
/// <param name="opacity">透明度 0-1</param>
|
|||
/// <param name="externName">文件后缀名</param>
|
|||
/// <returns></returns>
|
|||
public static Image AddImgToImg(Image image, Image watermark, float rectX, float rectY, float opacity, string externName) |
|||
{ |
|||
|
|||
Bitmap bitmap = new Bitmap(image, image.Width, image.Height); |
|||
|
|||
Graphics g = Graphics.FromImage(bitmap); |
|||
|
|||
|
|||
//下面定义一个矩形区域
|
|||
float rectWidth = watermark.Width + 10; |
|||
float rectHeight = watermark.Height + 10; |
|||
|
|||
//声明矩形域
|
|||
RectangleF textArea = new RectangleF(rectX - rectWidth, rectY - rectHeight, rectWidth, rectHeight); |
|||
|
|||
Bitmap w_bitmap = ChangeOpacity(watermark, opacity); |
|||
|
|||
g.DrawImage(w_bitmap, textArea); |
|||
|
|||
MemoryStream ms = new MemoryStream(); |
|||
|
|||
//保存图片
|
|||
switch (externName) |
|||
{ |
|||
case ".jpg": |
|||
bitmap.Save(ms, ImageFormat.Jpeg); |
|||
break; |
|||
case ".gif": |
|||
bitmap.Save(ms, ImageFormat.Gif); |
|||
break; |
|||
case ".png": |
|||
bitmap.Save(ms, ImageFormat.Png); |
|||
break; |
|||
default: |
|||
bitmap.Save(ms, ImageFormat.Jpeg); |
|||
break; |
|||
} |
|||
|
|||
Image h_hovercImg = Image.FromStream(ms); |
|||
|
|||
g.Dispose(); |
|||
|
|||
bitmap.Dispose(); |
|||
return h_hovercImg; |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 改变图片的透明度
|
|||
/// </summary>
|
|||
/// <param name="img">图片</param>
|
|||
/// <param name="opacityvalue">透明度</param>
|
|||
/// <returns></returns>
|
|||
public static Bitmap ChangeOpacity(Image img, float opacityvalue) |
|||
{ |
|||
|
|||
float[][] nArray ={ new float[] {1, 0, 0, 0, 0}, |
|||
|
|||
new float[] {0, 1, 0, 0, 0}, |
|||
|
|||
new float[] {0, 0, 1, 0, 0}, |
|||
|
|||
new float[] {0, 0, 0, opacityvalue, 0}, |
|||
|
|||
new float[] {0, 0, 0, 0, 1}}; |
|||
|
|||
ColorMatrix matrix = new ColorMatrix(nArray); |
|||
|
|||
ImageAttributes attributes = new ImageAttributes(); |
|||
|
|||
attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); |
|||
|
|||
Image srcImage = img; |
|||
|
|||
Bitmap resultImage = new Bitmap(srcImage.Width, srcImage.Height); |
|||
|
|||
Graphics g = Graphics.FromImage(resultImage); |
|||
|
|||
g.DrawImage(srcImage, new Rectangle(0, 0, srcImage.Width, srcImage.Height), 0, 0, srcImage.Width, srcImage.Height, GraphicsUnit.Pixel, attributes); |
|||
|
|||
return resultImage; |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
|
|||
|
|||
#region 图片大小
|
|||
|
|||
public static Image resizeImage(Image imgToResize, Size size) |
|||
{ |
|||
//获取图片宽度
|
|||
int sourceWidth = imgToResize.Width; |
|||
//获取图片高度
|
|||
int sourceHeight = imgToResize.Height; |
|||
|
|||
float nPercent = 0; |
|||
float nPercentW = 0; |
|||
float nPercentH = 0; |
|||
//计算宽度的缩放比例
|
|||
nPercentW = ((float)size.Width / (float)sourceWidth); |
|||
//计算高度的缩放比例
|
|||
nPercentH = ((float)size.Height / (float)sourceHeight); |
|||
|
|||
if (nPercentH < nPercentW) |
|||
nPercent = nPercentH; |
|||
else |
|||
nPercent = nPercentW; |
|||
//期望的宽度
|
|||
int destWidth = (int)(sourceWidth * nPercent); |
|||
//期望的高度
|
|||
int destHeight = (int)(sourceHeight * nPercent); |
|||
|
|||
Bitmap b = new Bitmap(destWidth, destHeight); |
|||
Graphics g = Graphics.FromImage((System.Drawing.Image)b); |
|||
g.InterpolationMode = InterpolationMode.HighQualityBicubic; |
|||
//绘制图像
|
|||
g.DrawImage(imgToResize, 0, 0, destWidth, destHeight); |
|||
g.Dispose(); |
|||
return (System.Drawing.Image)b; |
|||
} |
|||
|
|||
|
|||
#endregion
|
|||
} |
|||
} |
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Options |
|||
{ |
|||
public class Rootobject |
|||
{ |
|||
public int status { get; set; } |
|||
public string message { get; set; } |
|||
public string request_id { get; set; } |
|||
public Result result { get; set; } |
|||
} |
|||
|
|||
public class Result |
|||
{ |
|||
public Route[] routes { get; set; } |
|||
} |
|||
|
|||
public class Route |
|||
{ |
|||
public string mode { get; set; } |
|||
public int distance { get; set; } |
|||
public int duration { get; set; } |
|||
public int traffic_light_count { get; set; } |
|||
public int toll { get; set; } |
|||
public Restriction restriction { get; set; } |
|||
public decimal[] polyline { get; set; } |
|||
public Step[] steps { get; set; } |
|||
public object[] tags { get; set; } |
|||
public Taxi_Fare taxi_fare { get; set; } |
|||
} |
|||
|
|||
public class Restriction |
|||
{ |
|||
public int status { get; set; } |
|||
} |
|||
|
|||
public class Taxi_Fare |
|||
{ |
|||
public int fare { get; set; } |
|||
} |
|||
|
|||
public class Step |
|||
{ |
|||
public string instruction { get; set; } |
|||
public int[] polyline_idx { get; set; } |
|||
public string road_name { get; set; } |
|||
public string dir_desc { get; set; } |
|||
public int distance { get; set; } |
|||
public string act_desc { get; set; } |
|||
public string accessorial_desc { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,254 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Net; |
|||
using System.Security.Cryptography; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Znyc.Dispatching.Core.Util |
|||
{ |
|||
public class COSClientUtil |
|||
{ |
|||
|
|||
string Bucket = ""; |
|||
string Region = ""; //根据区域需要变更
|
|||
string protocol = ""; |
|||
string prefix = "https://znyc-imagers-1306377152.cos.ap-guangzhou.myqcloud.com"; |
|||
// 上传文件
|
|||
//NewUpload(prefix, "/dir/demo/web.rar", "C:\\web.rar");
|
|||
//删除文件
|
|||
// NEWDeleteFile(prefix, "/dir/demo/web.rar");
|
|||
//下载文件
|
|||
//FileDownload(prefix, "/dir/demo/0379aeb8-4a31-ec76-e79c-9cde8b021c98.jpg", "C:\\temp\\0379aeb8-4a31-ec76-e79c-9cde8b021c98.jpg"); //ok
|
|||
public string SecretId = "AKID61h8KHyQcaJmBMHxNXS7XhcHgqmSt42k";//写自己的id
|
|||
public string SecretKey = "VkkV0FEyTihSxDDyUkkV0GG0VllV0Ril";//写自己的密钥
|
|||
|
|||
#region 获取签名处理
|
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="strModel"></param>
|
|||
/// <param name="pathname"></param>
|
|||
/// <param name="qheaderlist"></param>
|
|||
/// <param name="qurlparamlist"></param>
|
|||
/// <returns></returns>
|
|||
public string gettxkey(string strModel, string pathname, string qheaderlist, string qurlparamlist) |
|||
{ |
|||
|
|||
strModel = strModel.ToLower(); |
|||
if (pathname.IndexOf("/") != 0) |
|||
{ |
|||
pathname = "/" + pathname; |
|||
} |
|||
var singtime = ""; |
|||
|
|||
|
|||
var now = new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds(); |
|||
var exp = new DateTimeOffset(DateTime.Now.AddMinutes(15)).ToUnixTimeSeconds(); |
|||
singtime = now + ";" + exp; |
|||
|
|||
|
|||
string s1 = HmacSha1Sign(singtime, SecretKey); |
|||
|
|||
string s2 = strModel + "\n" + pathname + "\n" + qurlparamlist + "\n" + qheaderlist + "\n"; |
|||
|
|||
string t1 = ""; |
|||
t1 = EncryptToSHA1(s2); |
|||
|
|||
string s3 = "sha1\n" + singtime + "\n" + t1 + "\n"; |
|||
|
|||
string s4 = HmacSha1Sign(s3, s1); |
|||
|
|||
var authorization = "q-sign-algorithm=sha1&q-ak=" + SecretId + "&q-sign-time=" + singtime + "&q-key-time=" + singtime + "&q-header-list=" + qheaderlist + "&q-url-param-list=" + qurlparamlist + "&q-signature=" + s4; |
|||
return authorization; |
|||
|
|||
} |
|||
public string EncryptToSHA1(string str) |
|||
{ |
|||
var buffer = Encoding.UTF8.GetBytes(str); |
|||
var data = System.Security.Cryptography.SHA1.Create().ComputeHash(buffer); |
|||
|
|||
var sb = new StringBuilder(); |
|||
foreach (var t in data) |
|||
{ |
|||
sb.Append(t.ToString("X2")); |
|||
} |
|||
|
|||
return sb.ToString().ToLower(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// HMAC-SHA1加密算法
|
|||
/// </summary>
|
|||
/// <param name="secret">密钥</param>
|
|||
/// <param name="strOrgData">源文</param>
|
|||
/// <returns></returns>
|
|||
public string HmacSha1Sign(string EncryptText, string EncryptKey) |
|||
{ |
|||
HMACSHA1 myHMACSHA1 = new HMACSHA1(Encoding.Default.GetBytes(EncryptKey)); |
|||
byte[] RstRes = myHMACSHA1.ComputeHash(Encoding.Default.GetBytes(EncryptText)); |
|||
StringBuilder EnText = new StringBuilder(); |
|||
foreach (byte Byte in RstRes) |
|||
{ |
|||
EnText.AppendFormat("{0:x2}", Byte); |
|||
} |
|||
return EnText.ToString(); |
|||
} |
|||
#endregion
|
|||
|
|||
#region 文件处理,上传,下载,删除
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// put 方式上传文件
|
|||
/// </summary>
|
|||
/// <param name="url">路径</param>
|
|||
/// <param name="remotePath">存的地址</param>
|
|||
/// <param name="localPath">本地文件地址</param>
|
|||
/// <returns></returns>
|
|||
public string NewUpload(string url, string remotePath, string localPath) |
|||
{ |
|||
var sign = gettxkey("put", remotePath, "", ""); |
|||
string strurl = url + remotePath + "?sign=" + sign; |
|||
return HttpPut(strurl, localPath, sign); |
|||
|
|||
} |
|||
public string HttpPut(string inUrl, string inFilePath, string sign) |
|||
{ |
|||
//服务器路径
|
|||
string isok = "ok"; |
|||
|
|||
//文件路径
|
|||
// string fileName = "mysales.txt";
|
|||
|
|||
// 得到文件名,文件扩展名字,服务器路径
|
|||
|
|||
// 创建WebClient实例
|
|||
WebClient myWebClient = new WebClient(); |
|||
//header.Add("Authorization", sign);
|
|||
myWebClient.Headers.Add("Authorization", sign); |
|||
//访问权限设置
|
|||
myWebClient.Credentials = CredentialCache.DefaultCredentials; |
|||
|
|||
// 要上传的文件
|
|||
FileStream fs = new FileStream(inFilePath, FileMode.Open, FileAccess.Read); |
|||
BinaryReader br = new BinaryReader(fs); |
|||
try |
|||
{ |
|||
byte[] postArray = br.ReadBytes((int)fs.Length); |
|||
Stream postStream = myWebClient.OpenWrite(inUrl, "PUT"); |
|||
if (postStream.CanWrite) |
|||
{ |
|||
postStream.Write(postArray, 0, postArray.Length); |
|||
|
|||
} |
|||
else |
|||
{ |
|||
|
|||
} |
|||
postStream.Close(); |
|||
} |
|||
catch (WebException errMsg) |
|||
{ |
|||
isok = errMsg.Message; |
|||
} |
|||
return isok; |
|||
} |
|||
/// <summary>
|
|||
/// 删除文件
|
|||
/// </summary>
|
|||
/// <param name="url"></param>
|
|||
/// <param name="remotePath">文件路径</param>
|
|||
/// <returns></returns>
|
|||
public string NEWDeleteFile(string url, string remotePath) |
|||
{ |
|||
|
|||
string message = "ok"; |
|||
var sign = gettxkey("DELETE", remotePath, "", ""); |
|||
|
|||
string strurl = url + remotePath; |
|||
|
|||
var request = (HttpWebRequest)WebRequest.Create(strurl); |
|||
|
|||
request.Method = "DELETE"; |
|||
request.Headers.Add("Authorization", sign); |
|||
|
|||
try |
|||
{ |
|||
var response = (HttpWebResponse)request.GetResponse(); |
|||
|
|||
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); |
|||
|
|||
|
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
message = ex.Message; |
|||
} |
|||
return message; |
|||
} |
|||
/// <summary>
|
|||
/// 文件下载
|
|||
/// </summary>
|
|||
/// <param name="url"></param>
|
|||
/// <param name="remotePath">下载地址</param>
|
|||
/// <param name="path">保存地址</param>
|
|||
/// <returns></returns>
|
|||
public string FileDownload(string url, string remotePath, string path) |
|||
{ |
|||
|
|||
string strisok = "ok"; |
|||
string tempPath = System.IO.Path.GetDirectoryName(path) + @"\temp"; |
|||
System.IO.Directory.CreateDirectory(tempPath); //创建临时文件目录
|
|||
string tempFile = tempPath + @"\" + System.IO.Path.GetFileName(path) + ".temp"; //临时文件
|
|||
if (System.IO.File.Exists(tempFile)) |
|||
{ |
|||
System.IO.File.Delete(tempFile); //存在则删除
|
|||
} |
|||
try |
|||
{ |
|||
FileStream fs = new FileStream(tempFile, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); |
|||
// 设置参数
|
|||
HttpWebRequest request = WebRequest.Create(url + remotePath) as HttpWebRequest; |
|||
request.Method = "get"; |
|||
var sign = gettxkey("get", remotePath, "", ""); |
|||
request.Headers.Add("Authorization", sign); |
|||
//发送请求并获取相应回应数据
|
|||
HttpWebResponse response = request.GetResponse() as HttpWebResponse; |
|||
//直到request.GetResponse()程序才开始向目标网页发送Post请求
|
|||
Stream responseStream = response.GetResponseStream(); |
|||
//创建本地文件写入流
|
|||
//Stream stream = new FileStream(tempFile, FileMode.Create);
|
|||
byte[] bArr = new byte[1024]; |
|||
int size = responseStream.Read(bArr, 0, (int)bArr.Length); |
|||
while (size > 0) |
|||
{ |
|||
//stream.Write(bArr, 0, size);
|
|||
fs.Write(bArr, 0, size); |
|||
size = responseStream.Read(bArr, 0, (int)bArr.Length); |
|||
} |
|||
//stream.Close();
|
|||
fs.Close(); |
|||
responseStream.Close(); |
|||
System.IO.File.Move(tempFile, path); |
|||
//删除文件夹 tempPath
|
|||
Directory.Delete(tempPath, true); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
strisok = ex.Message; |
|||
} |
|||
|
|||
return strisok; |
|||
|
|||
} |
|||
#endregion
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
} |
@ -1,7 +1,8 @@ |
|||
{ |
|||
"ConnectionStrings": { |
|||
//���Ի����������ã��DZ�Ҫ���ڱ��ؽ��п������� |
|||
"DefaultConnection": "Server=81.71.148.57;Port=43306;Database=znyc_dispatching;Uid=znyc;Pwd=bIQISVSO;Charset=utf8mb4;AllowLoadLocalInfile=true" |
|||
//"DefaultConnection": "Server=81.71.148.57;Port=43306;Database=znyc_dispatching;Uid=guest;Pwd=4Y2e2WtekfDYWfT8;Charset=utf8mb4;AllowLoadLocalInfile=true", |
|||
"DefaultConnection": "Server=81.71.148.57; Port=43306; Database=znyc_dispatching; Uid=znyc; Pwd=bIQISVSO; Charset=utf8mb4" |
|||
//"DefaultConnection": "Server=127.0.0.1;Port=3306;Database=znyc_dispatching;Uid=root;Pwd=123456;Charset=utf8mb4" |
|||
} |
|||
} |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue