From e9f4bf050a030b8f6ade4d447960c8c3ff363baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E6=88=90=E6=A5=BC?= <799806631@qq.com> Date: Wed, 23 Apr 2025 11:00:21 +0800 Subject: [PATCH] 1 --- .../ServiceApp/IdleLand/IdleLandApp.cs | 49 +++++++++++++++---- .../ServiceControllers/IdleLandController.cs | 4 +- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/OpenAuth.App/ServiceApp/IdleLand/IdleLandApp.cs b/OpenAuth.App/ServiceApp/IdleLand/IdleLandApp.cs index 7fb2d2e..75c8dc6 100644 --- a/OpenAuth.App/ServiceApp/IdleLand/IdleLandApp.cs +++ b/OpenAuth.App/ServiceApp/IdleLand/IdleLandApp.cs @@ -88,7 +88,7 @@ namespace OpenAuth.App return result; } - + public dynamic GetCenterPoints(string tablename, string filter) { StringBuilder sql = new StringBuilder(); @@ -116,11 +116,11 @@ namespace OpenAuth.App { return org.BizCode; } - else + else { return ""; } - + } else { @@ -128,13 +128,44 @@ namespace OpenAuth.App } } - public async Task GetSequenceGen(string prefix) - { - var orderNumber = await _sequenceGenerator.NextAsync( - prefix, - $"{prefix}-{{0:00000}}"); + //public async Task GetSequenceGen(string prefix) + //{ + // var orderNumber = await _sequenceGenerator.NextAsync( + // prefix, + // $"{prefix}-{{0:00000}}"); - return orderNumber; + // return orderNumber; + //} + + public async Task GetSequenceGen(decimal lat, decimal lng, string prefix) + { + var sql = $" SELECT bsm FROM shp_drone_community where ST_Within(st_geomfromtext('POINT({lng} {lat})',4326), geom) = 't'"; + var model = await client.SqlQueryable(sql).FirstAsync(); + string bizCode = ""; + if (model != null) + { + string bsm = model.bsm; + var org = await client.Queryable().FirstAsync(a => a.Id.ToString() == bsm); + if (org != null) + { + bizCode = org.BizCode; + } + else + { + bizCode = ""; + } + + } + else + { + bizCode = ""; + } + + var orderNumber = await _sequenceGenerator.NextAsync( + prefix, + $"{prefix}-{{0:00000}}"); + + return bizCode + "-" + orderNumber; } } } diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/IdleLandController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/IdleLandController.cs index 7ea9137..9b18b07 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/IdleLandController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/IdleLandController.cs @@ -125,12 +125,12 @@ namespace OpenAuth.WebApi.Controllers /// 前置类型 /// [HttpGet] - public async Task> GetSequenceGen(string prefix) + public async Task> GetSequenceGen(decimal lat, decimal lng,string prefix) { var result = new Response(); try { - result.Result = await app.GetSequenceGen(prefix); + result.Result = await app.GetSequenceGen(lat,lng,prefix); } catch (Exception ex) {