diff --git a/OpenAuth.App/OpenAuth.App.csproj b/OpenAuth.App/OpenAuth.App.csproj index 19a5995..477c4f5 100644 --- a/OpenAuth.App/OpenAuth.App.csproj +++ b/OpenAuth.App/OpenAuth.App.csproj @@ -52,6 +52,7 @@ + diff --git a/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs b/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs index 3ea631b..43a1a7d 100644 --- a/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs +++ b/OpenAuth.App/ServiceApp/MiManager/MiViolationReportApp.cs @@ -1,9 +1,11 @@ +using DocumentFormat.OpenXml.Office.CustomUI; using Infrastructure; using OpenAuth.App.BaseApp.Base; using OpenAuth.App.Interface; using OpenAuth.App.Request; using OpenAuth.App.Response; +using OpenAuth.App.ServiceApp.Request; using OpenAuth.Repository; using OpenAuth.Repository.Domain; using SqlSugar; @@ -26,7 +28,7 @@ namespace OpenAuth.App /// 分页 /// public async Task>>> LoadAllPage(PageReq request) - { + { RefAsync totalCount = 0; var result = new PageInfo(); var list = await base.Repository.AsQueryable() @@ -53,7 +55,7 @@ namespace OpenAuth.App /// 添加 /// public async Task> Add(MiViolationReport model) - { + { var flag = await Repository.InsertAsync(model); return new Response @@ -71,14 +73,14 @@ namespace OpenAuth.App /// public async Task> Delete(List models) { - var flag = await Repository.DeleteAsync(models); + var flag = await Repository.DeleteAsync(models); + + return new Response + { + Result = flag, + Message = flag == true ? "success" : "error" + }; - return new Response - { - Result = flag, - Message = flag == true ? "success" : "error" - }; - } /// @@ -104,7 +106,7 @@ namespace OpenAuth.App public async Task> AssignModule() { using (var uwo = UnitWork.CreateContext()) - { + { //await uwo.SysRoleElement.InsertRangeAsync(model.ElementIds.Select(a => new SysRoleElement { RoleId = model.RoleId, ElementId = a }).ToList()); var flag = uwo.Commit(); @@ -116,5 +118,61 @@ namespace OpenAuth.App } } + public async Task> Report(MiViolationReportRequest request) + { + using (var uwo = UnitWork.CreateContext()) + { + //上报信息 + var model = request.MapTo(); + model.Id = Guid.NewGuid().ToString(); + model.Status = "待处理"; + + //现场照片 + var photos = request.SencePhotos.MapToList(); + photos.ForEach(a => + { + a.Id = Guid.NewGuid().ToString(); + a.ViolationReportId = model.Id; + }); + + var vehicleList = new List(); + var vehicleImageList = new List(); + foreach (var item in request.Vehicles) + { + //车辆信息 + var vehicle = item.MapTo(); + vehicle.Id = Guid.NewGuid().ToString(); + vehicle.ViolationReportId = model.Id; + + //车辆图片 + var images = item.VehicleImages.MapToList(); + images.ForEach(a => + { + a.Id = Guid.NewGuid().ToString(); + a.ViolationReportId = model.Id; + a.ParkingId = model.ParkingId; + a.VehicleId = vehicle.Id; + vehicleImageList.Add(a); + + }); + + vehicleList.Add(vehicle); + } + + await uwo.MiViolationReport.InsertAsync(model); + await uwo.MiScenePhoto.InsertRangeAsync(photos); + await uwo.MiVehicle.InsertRangeAsync(vehicleList); + await uwo.MiVehicleImage.InsertRangeAsync(vehicleImageList); + + + var flag = uwo.Commit(); + return new Response + { + Result = flag, + Message = flag == true ? "success" : "error" + }; + } + } + } } \ No newline at end of file diff --git a/OpenAuth.App/ServiceApp/MiManager/Request/MiViolationReportRequest.cs b/OpenAuth.App/ServiceApp/MiManager/Request/MiViolationReportRequest.cs new file mode 100644 index 0000000..f9d53ee --- /dev/null +++ b/OpenAuth.App/ServiceApp/MiManager/Request/MiViolationReportRequest.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.Request +{ + public class MiViolationReportRequest + { + /// + /// Desc:标题 + /// Default: + /// Nullable:False + /// + public string Title { get; set; } + /// + /// Desc:当事人姓名 + /// Default: + /// Nullable:True + /// + public string PartyName { get; set; } + + /// + /// Desc:当事人电话 + /// Default: + /// Nullable:True + /// + public string PartyPhone { get; set; } + + /// + /// Desc:违法类型 + /// Default: + /// Nullable:True + /// + public string ViolationType { get; set; } + + /// + /// Desc:问题描述 + /// Default: + /// Nullable:True + /// + public string ProblemDescription { get; set; } + + /// + /// Desc:处理意见 + /// Default: + /// Nullable:True + /// + public string HandlingOpinion { get; set; } + + /// + /// Desc:停车场 id + /// Default: + /// Nullable:True + /// + public string ParkingId { get; set; } + + /// + /// Desc:经度 + /// Default: + /// Nullable:True + /// + public decimal? Lng { get; set; } + + /// + /// Desc:纬度 + /// Default: + /// Nullable:True + /// + public decimal? Lat { get; set; } + + /// + /// Desc:处理单位 + /// Default: + /// Nullable:True + /// + public string HandlingUnit { get; set; } + + /// + /// Desc:处理人 + /// Default: + /// Nullable:True + /// + public string Handler { get; set; } + + /// + /// Desc:处理时间 + /// Default: + /// Nullable:True + /// + public DateTime? HandlingTime { get; set; } + + /// + /// Desc:上报时间 + /// Default:DateTime.Now + /// Nullable:True + /// + public DateTime? ReportTime { get; set; } + + /// + /// Desc:上报人 + /// Default: + /// Nullable:True + /// + public string Reporter { get; set; } + + /// + /// Desc:盗采点id + /// Default: + /// Nullable:True + /// + public string MinePointId { get; set; } + /// + /// 上报单位 + /// + public string ReportUnit { get; set; } + + /// + /// 现场图片 + /// + public List SencePhotos { get; set; } + /// + /// 车辆信息 + /// + public List Vehicles { get; set; } + + } +} diff --git a/OpenAuth.App/ServiceApp/MiManager/Request/SencePhoto.cs b/OpenAuth.App/ServiceApp/MiManager/Request/SencePhoto.cs new file mode 100644 index 0000000..3d5e1d1 --- /dev/null +++ b/OpenAuth.App/ServiceApp/MiManager/Request/SencePhoto.cs @@ -0,0 +1,22 @@ +using DocumentFormat.OpenXml.Bibliography; +using DocumentFormat.OpenXml.Office2010.Excel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.Request +{ + /// + /// 现场图片 + /// + public class SencePhoto + { + public string Image { get; set; } + public double Lng { get; set; } + public double Lat { get; set; } + public double Angle { get; set; } + public DateTime CreateTime { get; set; } + } +} diff --git a/OpenAuth.App/ServiceApp/MiManager/Request/Vehicle.cs b/OpenAuth.App/ServiceApp/MiManager/Request/Vehicle.cs new file mode 100644 index 0000000..b7d48ae --- /dev/null +++ b/OpenAuth.App/ServiceApp/MiManager/Request/Vehicle.cs @@ -0,0 +1,47 @@ +using DocumentFormat.OpenXml.Office2010.Excel; +using OpenAuth.App.ServiceApp.MiManager.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.Request +{ + /// + /// 车辆信息 + /// + public class Vehicle + { + /// + /// 牌照/编码 + /// + public string LicensePlate { get; set; } + /// + /// 类型 + /// + public string Type { get; set; } + /// + /// 姓名 + /// + public string Name { get; set; } + /// + /// 身份证 + /// + public string IdCard { get; set; } + /// + /// 电话 + /// + public string Phone { get; set; } + /// + /// 创建时间 + /// + public string CreateTime { get; set; } + + /// + /// 图片 + /// + public List VehicleImages { get; set; } + + } +} diff --git a/OpenAuth.App/ServiceApp/MiManager/Request/VehicleImage.cs b/OpenAuth.App/ServiceApp/MiManager/Request/VehicleImage.cs new file mode 100644 index 0000000..2d18e7d --- /dev/null +++ b/OpenAuth.App/ServiceApp/MiManager/Request/VehicleImage.cs @@ -0,0 +1,31 @@ +using DocumentFormat.OpenXml.Bibliography; +using DocumentFormat.OpenXml.Office2010.Excel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.MiManager.Request +{ + /// + /// 车辆图片 + /// + public class VehicleImage + { + /// + /// 图片 + /// + public string Image { get; set; } + public string Lng { get; set; } + public string Lat { get; set; } + /// + /// 角度 + /// + public string Angle { get; set; } + /// + /// 创建时间 + /// + public string CreateTime { get; set; } + } +} diff --git a/OpenAuth.Repository/Domain/MiVehicleImage.cs b/OpenAuth.Repository/Domain/MiVehicleImage.cs index 76432a8..7ac6b80 100644 --- a/OpenAuth.Repository/Domain/MiVehicleImage.cs +++ b/OpenAuth.Repository/Domain/MiVehicleImage.cs @@ -11,65 +11,70 @@ namespace OpenAuth.Repository.Domain [SugarTable("mi_vehicle_image")] public partial class MiVehicleImage { - public MiVehicleImage(){ + public MiVehicleImage() + { - } - /// - /// Desc:图片ID - /// Default: - /// Nullable:False - /// - public string Id {get;set;} + } + /// + /// Desc:图片ID + /// Default: + /// Nullable:False + /// + public string Id { get; set; } - /// - /// Desc:违法信息id - /// Default: - /// Nullable:True - /// - public string ViolationReportId {get;set;} + /// + /// Desc:违法信息id + /// Default: + /// Nullable:True + /// + public string ViolationReportId { get; set; } - /// - /// Desc:图片 - /// Default: - /// Nullable:False - /// - public string Image {get;set;} + /// + /// Desc:图片 + /// Default: + /// Nullable:False + /// + public string Image { get; set; } - /// - /// Desc:经度 - /// Default: - /// Nullable:True - /// - public decimal? Lng {get;set;} + /// + /// Desc:经度 + /// Default: + /// Nullable:True + /// + public decimal? Lng { get; set; } - /// - /// Desc:纬度 - /// Default: - /// Nullable:True - /// - public decimal? Lat {get;set;} + /// + /// Desc:纬度 + /// Default: + /// Nullable:True + /// + public decimal? Lat { get; set; } - /// - /// Desc:拍摄角度 - /// Default: - /// Nullable:True - /// - public decimal? Angle {get;set;} + /// + /// Desc:拍摄角度 + /// Default: + /// Nullable:True + /// + public decimal? Angle { get; set; } - /// - /// Desc:停车场 id - /// Default: - /// Nullable:True - /// - public string ParkingId {get;set;} + /// + /// Desc:停车场 id + /// Default: + /// Nullable:True + /// + public string ParkingId { get; set; } - /// - /// Desc:创建时间 - /// Default:DateTime.Now - /// Nullable:True - /// - public DateTime? CreateTime {get;set;} + /// + /// Desc:创建时间 + /// Default:DateTime.Now + /// Nullable:True + /// + public DateTime? CreateTime { get; set; } + /// + /// 车辆 Id + /// + public string VehicleId { get; set; } } } diff --git a/OpenAuth.Repository/Domain/MiViolationReport.cs b/OpenAuth.Repository/Domain/MiViolationReport.cs index 8c31b17..62b74ec 100644 --- a/OpenAuth.Repository/Domain/MiViolationReport.cs +++ b/OpenAuth.Repository/Domain/MiViolationReport.cs @@ -11,128 +11,133 @@ namespace OpenAuth.Repository.Domain [SugarTable("mi_violation_report")] public partial class MiViolationReport { - public MiViolationReport(){ + public MiViolationReport() + { - } - /// - /// Desc:违法上报ID - /// Default: - /// Nullable:False - /// - public string Id {get;set;} + } + /// + /// Desc:违法上报ID + /// Default: + /// Nullable:False + /// + public string Id { get; set; } - /// - /// Desc:标题 - /// Default: - /// Nullable:False - /// - public string Title {get;set;} + /// + /// Desc:标题 + /// Default: + /// Nullable:False + /// + public string Title { get; set; } - /// - /// Desc:状态 - /// Default:'待处理'::character varying - /// Nullable:True - /// - public string Status {get;set;} + /// + /// Desc:状态 + /// Default:'待处理'::character varying + /// Nullable:True + /// + public string Status { get; set; } - /// - /// Desc:当事人姓名 - /// Default: - /// Nullable:True - /// - public string PartyName {get;set;} + /// + /// Desc:当事人姓名 + /// Default: + /// Nullable:True + /// + public string PartyName { get; set; } - /// - /// Desc:当事人电话 - /// Default: - /// Nullable:True - /// - public string PartyPhone {get;set;} + /// + /// Desc:当事人电话 + /// Default: + /// Nullable:True + /// + public string PartyPhone { get; set; } - /// - /// Desc:违法类型 - /// Default: - /// Nullable:True - /// - public string ViolationType {get;set;} + /// + /// Desc:违法类型 + /// Default: + /// Nullable:True + /// + public string ViolationType { get; set; } - /// - /// Desc:问题描述 - /// Default: - /// Nullable:True - /// - public string ProblemDescription {get;set;} + /// + /// Desc:问题描述 + /// Default: + /// Nullable:True + /// + public string ProblemDescription { get; set; } - /// - /// Desc:处理意见 - /// Default: - /// Nullable:True - /// - public string HandlingOpinion {get;set;} + /// + /// Desc:处理意见 + /// Default: + /// Nullable:True + /// + public string HandlingOpinion { get; set; } - /// - /// Desc:停车场 id - /// Default: - /// Nullable:True - /// - public string ParkingId {get;set;} + /// + /// Desc:停车场 id + /// Default: + /// Nullable:True + /// + public string ParkingId { get; set; } - /// - /// Desc:经度 - /// Default: - /// Nullable:True - /// - public decimal? Lng {get;set;} + /// + /// Desc:经度 + /// Default: + /// Nullable:True + /// + public decimal? Lng { get; set; } - /// - /// Desc:纬度 - /// Default: - /// Nullable:True - /// - public decimal? Lat {get;set;} + /// + /// Desc:纬度 + /// Default: + /// Nullable:True + /// + public decimal? Lat { get; set; } - /// - /// Desc:处理单位 - /// Default: - /// Nullable:True - /// - public string HandlingUnit {get;set;} + /// + /// Desc:处理单位 + /// Default: + /// Nullable:True + /// + public string HandlingUnit { get; set; } - /// - /// Desc:处理人 - /// Default: - /// Nullable:True - /// - public string Handler {get;set;} + /// + /// Desc:处理人 + /// Default: + /// Nullable:True + /// + public string Handler { get; set; } - /// - /// Desc:处理时间 - /// Default: - /// Nullable:True - /// - public DateTime? HandlingTime {get;set;} + /// + /// Desc:处理时间 + /// Default: + /// Nullable:True + /// + public DateTime? HandlingTime { get; set; } - /// - /// Desc:上报时间 - /// Default:DateTime.Now - /// Nullable:True - /// - public DateTime? ReportTime {get;set;} + /// + /// Desc:上报时间 + /// Default:DateTime.Now + /// Nullable:True + /// + public DateTime? ReportTime { get; set; } - /// - /// Desc:上报人 - /// Default: - /// Nullable:True - /// - public string Reporter {get;set;} + /// + /// Desc:上报人 + /// Default: + /// Nullable:True + /// + public string Reporter { get; set; } - /// - /// Desc:盗采点id - /// Default: - /// Nullable:True - /// - public string MinePointId {get;set;} + /// + /// Desc:盗采点id + /// Default: + /// Nullable:True + /// + public string MinePointId { get; set; } + /// + /// 上报单位 + /// + public string ReportUnit { get; set; } } } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs index 88096e7..cb88c7c 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/MiViolationReportController.cs @@ -1,13 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; +using DocumentFormat.OpenXml.EMMA; using Infrastructure; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using OpenAuth.App; using OpenAuth.App.Request; using OpenAuth.App.Response; +using OpenAuth.App.ServiceApp.Request; using OpenAuth.Repository.Domain; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; namespace OpenAuth.WebApi.Controllers { @@ -48,7 +50,7 @@ namespace OpenAuth.WebApi.Controllers var result = new Response(); try { - result.Result =await _app.Get(id); + result.Result = await _app.Get(id); } catch (Exception ex) { @@ -130,6 +132,31 @@ namespace OpenAuth.WebApi.Controllers return result; } #endregion + + #region 上报 + /// + /// 上报 + /// + /// + /// + public async Task> Report(MiViolationReportRequest request) + { + var result = new Response(); + try + { + result = await _app.Report(request); + + } + catch (Exception ex) + { + result.Code = 500; + result.Message = ex.InnerException?.Message ?? ex.Message; + } + + return result; + } + #endregion + #endregion } } \ No newline at end of file