Compare commits
2 Commits
fb00f42dbe
...
97b0328c08
| Author | SHA1 | Date |
|---|---|---|
|
|
97b0328c08 | |
|
|
a8321bdb9a |
|
|
@ -1242,6 +1242,248 @@ namespace OpenAuth.App.ServiceApp.DroneCaseInfoTaskManage
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 河东设施农业监管shp导入
|
||||
/// </summary>
|
||||
/// <param name="zipFilePath"></param>
|
||||
/// <param name="srid"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="FileNotFoundException"></exception>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public async Task<Response<bool>> ImportCaseInfoShpDataSsny(string zipFilePath, string srid)
|
||||
{
|
||||
var _user = _auth.GetCurrentUser().User;
|
||||
using var db = Repository.AsSugarClient();
|
||||
|
||||
// 开启事务
|
||||
await db.Ado.BeginTranAsync(IsolationLevel.ReadCommitted);
|
||||
// 取得文件完全路径
|
||||
zipFilePath = System.IO.Path.Combine(_filePath, zipFilePath);
|
||||
// 确保ZIP文件存在
|
||||
if (!File.Exists(zipFilePath))
|
||||
{
|
||||
throw new FileNotFoundException("ZIP文件未找到。");
|
||||
}
|
||||
|
||||
// 打开ZIP存档 取除后缀之前的字符串
|
||||
var extractPath = zipFilePath.Substring(0, zipFilePath.LastIndexOf(".", StringComparison.Ordinal)) +
|
||||
"extract";
|
||||
// 解压文件
|
||||
await UnZip(zipFilePath, extractPath);
|
||||
var searchPattern = "*.shp"; // 设置你想要遍历的文件后缀名
|
||||
var fileName = Directory.GetFiles(extractPath, searchPattern, SearchOption.AllDirectories);
|
||||
if (fileName.IsEmpty())
|
||||
{
|
||||
throw new Exception("压缩文件中无shp文件");
|
||||
}
|
||||
|
||||
var shpFileName = fileName[0];
|
||||
var shpFile = System.IO.Path.Combine(extractPath, shpFileName);
|
||||
|
||||
List<DroneSsnyd> datalist = new List<DroneSsnyd>();
|
||||
List<DroneShpData> shplist = new List<DroneShpData>();
|
||||
StringBuilder geomSql = new StringBuilder();
|
||||
//批量更新面积
|
||||
StringBuilder sql = new StringBuilder();
|
||||
Random random = new Random();
|
||||
//批次号
|
||||
//var pici = DateTime.Now.ToString("yyyyMMssHHmmss") + random.Next(1000, 9999).ToString();
|
||||
int i = 0;
|
||||
using (var dataReader = new ShapefileDataReader(shpFile, GeometryFactory.Default))
|
||||
{
|
||||
while (dataReader.Read())
|
||||
{
|
||||
DroneSsnyd cinfo = new DroneSsnyd();
|
||||
cinfo.Id = Guid.NewGuid().ToString();
|
||||
cinfo.createuser = _user.Id.ToString();
|
||||
|
||||
//案件编号
|
||||
if (!dataReader.IsDBNull(1))
|
||||
{
|
||||
var caseinfo = client.Queryable<DroneSsnyd>().Where(r => r.xiangmu_no == dataReader.GetValue(1).ToString()).ToList();
|
||||
if (caseinfo.Count > 0)
|
||||
{
|
||||
throw new Exception("图斑编号" + dataReader.GetValue(1).ToString() + "已存在,请重新整理数据");
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.xiangmu_no = dataReader.GetValue(1).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("图斑编号不能为空,请重新整理数据");
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(2))
|
||||
{
|
||||
cinfo.xiangmu_name = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.xiangmu_name = dataReader.GetValue(2).ToString();
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(3))
|
||||
{
|
||||
cinfo.xiangmu_yt = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.xiangmu_yt = dataReader.GetValue(3).ToString();
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(4))
|
||||
{
|
||||
cinfo.xingzhengquhua = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.xingzhengquhua = dataReader.GetValue(4).ToString();
|
||||
}
|
||||
|
||||
|
||||
if (dataReader.IsDBNull(5))
|
||||
{
|
||||
cinfo.shenqing_area = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
var aa = dataReader.GetValue(5);
|
||||
cinfo.shenqing_area = Convert.ToDecimal(dataReader.GetValue(5).ToString());
|
||||
}
|
||||
if (dataReader.IsDBNull(6))
|
||||
{
|
||||
cinfo.beian_no = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.beian_no = dataReader.GetValue(6).ToString();
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(7))
|
||||
{
|
||||
cinfo.beianriqi = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var value = dataReader.GetValue(7);
|
||||
cinfo.beianriqi = value as DateTime? ?? Convert.ToDateTime(value);
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(8))
|
||||
{
|
||||
cinfo.quanliren = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.quanliren = dataReader.GetValue(8).ToString();
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(9))
|
||||
{
|
||||
cinfo.start_time = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var value = dataReader.GetValue(9);
|
||||
cinfo.start_time = value as DateTime? ?? Convert.ToDateTime(value);
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(10))
|
||||
{
|
||||
cinfo.end_time = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var value = dataReader.GetValue(10);
|
||||
cinfo.end_time = value as DateTime? ?? Convert.ToDateTime(value);
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(11))
|
||||
{
|
||||
cinfo.jianzhujiegou = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.jianzhujiegou = dataReader.GetValue(11).ToString();
|
||||
}
|
||||
|
||||
if (dataReader.IsDBNull(12))
|
||||
{
|
||||
cinfo.shengchan_area = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.shengchan_area = Convert.ToDecimal(dataReader.GetValue(12).ToString());
|
||||
}
|
||||
if (dataReader.IsDBNull(13))
|
||||
{
|
||||
cinfo.fuzhu_area = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cinfo.fuzhu_area = Convert.ToDecimal(dataReader.GetValue(13).ToString());
|
||||
}
|
||||
|
||||
//图斑数据drone_shp_data
|
||||
DroneShpData model = new DroneShpData();
|
||||
model.relid = cinfo.Id;
|
||||
model.createtime = DateTime.Now;
|
||||
model.createuser = _user.Name;
|
||||
//获取主键
|
||||
string _gid = _commonDataManager.GetMaxKeyVal("gid", "drone_shp_data", 1);
|
||||
model.gid = int.Parse(_gid) + i;//转为数字类型
|
||||
i++;
|
||||
cinfo.geomid = model.gid.ToString();
|
||||
|
||||
|
||||
//geom
|
||||
if (!dataReader.IsDBNull(0))
|
||||
{
|
||||
var geometry = (Geometry)dataReader.GetValue(0);
|
||||
if (!geometry.IsValid)
|
||||
{
|
||||
throw new Exception("图斑" + cinfo.xiangmu_no + "未闭合,请重新整理数据");
|
||||
}
|
||||
var geometryForWgs84 = GeometryFactory.Default.WithSRID(int.Parse(srid))
|
||||
.CreateGeometry(geometry);
|
||||
geomSql.AppendFormat($" update drone_shp_data set geom = '{geometryForWgs84.AsText()}' where gid = '{model.gid}';");
|
||||
sql.AppendFormat($" update drone_shp_data set area = st_area(st_transform(ST_SetSRID(geom,4326), 4527)) where gid = '{model.gid}';");
|
||||
}
|
||||
datalist.Add(cinfo);
|
||||
shplist.Add(model);
|
||||
}
|
||||
}
|
||||
|
||||
using (var uow = base.UnitWork.CreateContext())
|
||||
{
|
||||
await uow.DroneSsnyd.InsertRangeAsync(datalist);
|
||||
await uow.DroneShpData.InsertRangeAsync(shplist);
|
||||
await uow.Db.Ado.ExecuteCommandAsync(geomSql.ToString());
|
||||
await uow.Db.Ado.ExecuteCommandAsync(sql.ToString());
|
||||
var flag = uow.Commit();
|
||||
if (flag == true)
|
||||
{
|
||||
return new Response<bool>()
|
||||
{
|
||||
Result = flag,
|
||||
Message = "导入成功"
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Response<bool>()
|
||||
{
|
||||
Result = false,
|
||||
Message = "导入失败"
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ namespace OpenAuth.App.ServiceApp.DroneSsnydManage
|
|||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public List<DroneSsnyd> GetDronssnydExportList(string xiangmumc, string countyid, string streetid,
|
||||
string xiangmuno, string xiangmuyt,int? status)
|
||||
string xiangmuno, DateTime? hechatimebegin, DateTime? hechatimeend, string xiangmuyt,int? status)
|
||||
{
|
||||
//获取当前登录用户
|
||||
var orgs = _auth.GetCurrentUser().Orgs;
|
||||
|
|
@ -345,7 +345,20 @@ namespace OpenAuth.App.ServiceApp.DroneSsnydManage
|
|||
.WhereIF(!string.IsNullOrEmpty(xiangmuno), a => a.xiangmu_no.Contains(xiangmuno))
|
||||
.WhereIF(!issystem, a => (ids.Contains(a.countyid) || ids.Contains(a.streetid)))
|
||||
.WhereIF(status!=null,a=>a.handle_status_id== status)
|
||||
.OrderBy(a => a.end_time, OrderByType.Desc)
|
||||
.LeftJoin<DroneSsnydRcjg>((a, d) => a.Id == d.ssnyd_id)
|
||||
.WhereIF(hechatimebegin != null && hechatimeend != null,
|
||||
(a, d) => (a.hechatime_kg != null && a.hechatime_kg < hechatimeend && a.hechatime_kg >= hechatimebegin)
|
||||
|| (a.hechatime_jz != null && a.hechatime_jz < hechatimeend && a.hechatime_jz >= hechatimebegin)
|
||||
|| (a.hechatime_wg != null && a.hechatime_wg < hechatimeend && a.hechatime_wg >= hechatimebegin)
|
||||
|| (a.hechatime_wgzg != null && a.hechatime_wgzg < hechatimeend && a.hechatime_wgzg >= hechatimebegin)
|
||||
|| (a.hechatime_jzzg != null && a.hechatime_jzzg < hechatimeend && a.hechatime_jzzg >= hechatimebegin)
|
||||
|| (a.hechatime_kgzg != null && a.hechatime_kgzg < hechatimeend && a.hechatime_kgzg >= hechatimebegin)
|
||||
|| (d.hechatime_rc != null && d.hechatime_rc < hechatimeend && d.hechatime_rc >= hechatimebegin)
|
||||
|| (d.hechatime_rczg != null && d.hechatime_rczg < hechatimeend && d.hechatime_rczg >= hechatimebegin)
|
||||
|| (d.hechatime_rcfh != null && d.hechatime_rcfh < hechatimeend && d.hechatime_rcfh >= hechatimebegin))
|
||||
.OrderBy((a, d) => a.end_time, OrderByType.Desc)
|
||||
.Select((a, d) => a)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
return list;
|
||||
|
|
@ -524,7 +537,7 @@ namespace OpenAuth.App.ServiceApp.DroneSsnydManage
|
|||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public PageInfo<List<DroneSsnyd>> GetDronssnydList(string xiangmumc, string countyid, string streetid,
|
||||
string xiangmuno, string xiangmuyt, int? status,
|
||||
string xiangmuno, DateTime? hechatimebegin,DateTime?hechatimeend, string xiangmuyt, int? status,
|
||||
int pageIndex, int pageSize)
|
||||
{
|
||||
int totalCount = 0;
|
||||
|
|
@ -547,7 +560,22 @@ namespace OpenAuth.App.ServiceApp.DroneSsnydManage
|
|||
.WhereIF(!string.IsNullOrEmpty(xiangmuno), a => a.xiangmu_no.Contains(xiangmuno))
|
||||
.WhereIF(!issystem, a => (ids.Contains(a.countyid) || ids.Contains(a.streetid)))
|
||||
.WhereIF(status != null, a => a.handle_status_id == status)
|
||||
.OrderBy(a => a.end_time, OrderByType.Desc)
|
||||
|
||||
.LeftJoin<DroneSsnydRcjg>((a,d)=>a.Id==d.ssnyd_id)
|
||||
.WhereIF(hechatimebegin != null && hechatimeend != null,
|
||||
(a, d) => (a.hechatime_kg != null && a.hechatime_kg < hechatimeend && a.hechatime_kg >= hechatimebegin)
|
||||
|| (a.hechatime_jz != null && a.hechatime_jz < hechatimeend && a.hechatime_jz >= hechatimebegin)
|
||||
|| (a.hechatime_wg != null && a.hechatime_wg < hechatimeend && a.hechatime_wg >= hechatimebegin)
|
||||
|| (a.hechatime_wgzg != null && a.hechatime_wgzg < hechatimeend && a.hechatime_wgzg >= hechatimebegin)
|
||||
|| (a.hechatime_jzzg != null && a.hechatime_jzzg < hechatimeend && a.hechatime_jzzg >= hechatimebegin)
|
||||
|| (a.hechatime_kgzg != null && a.hechatime_kgzg < hechatimeend && a.hechatime_kgzg >= hechatimebegin)
|
||||
|| (d.hechatime_rc != null && d.hechatime_rc < hechatimeend && d.hechatime_rc >= hechatimebegin)
|
||||
|| (d.hechatime_rczg != null && d.hechatime_rczg < hechatimeend && d.hechatime_rczg >= hechatimebegin)
|
||||
|| (d.hechatime_rcfh != null && d.hechatime_rcfh < hechatimeend && d.hechatime_rcfh >= hechatimebegin))
|
||||
|
||||
.OrderBy((a, d) => a.end_time, OrderByType.Desc)
|
||||
.Select((a, d) => a)
|
||||
.Distinct()
|
||||
.ToPageList(pageIndex, pageSize, ref totalCount);
|
||||
|
||||
return new PageInfo<List<DroneSsnyd>>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ namespace OpenAuth.App.ServiceApp.DroneSsnydManage.Request
|
|||
public class DroneSsny : TimeOutReq
|
||||
{
|
||||
public int? status { get; set; }
|
||||
public DateTime? hechatimebegin { get; set; }
|
||||
public DateTime? hechatimeend { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -713,7 +713,7 @@ namespace OpenAuth.Repository.Domain
|
|||
[SugarColumn(IsIgnore = true)] public List<DroneSsnydRcjg> RcjgList { get; set; }
|
||||
|
||||
public string lianxifangshi { get; set; }
|
||||
public string beianriqi { get; set; }
|
||||
public DateTime? beianriqi { get; set; }
|
||||
public string jianzhujiegou { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -309,5 +309,21 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> ImportCaseInfoShpDataSsny(string zipFilePath, string srid)
|
||||
{
|
||||
var response = new Response<bool>();
|
||||
try
|
||||
{
|
||||
response = await _app.ImportCaseInfoShpDataSsny(zipFilePath, srid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -445,6 +445,8 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
/// <param name="countyid">县</param>
|
||||
/// <param name="streetid">镇</param>
|
||||
/// <param name="xiangmuno">项目编号</param>
|
||||
/// <param name="hechatimebegin">核查开始时间</param>
|
||||
/// <param name="hechatimeend">核查结束时间</param>
|
||||
/// <param name="xiangmuyt">项目用途</param>
|
||||
/// <param name="status">项目状态</param>
|
||||
/// <param name="pageIndex"></param>
|
||||
|
|
@ -452,14 +454,14 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Response<PageInfo<List<DroneSsnyd>>> GetDronssnydList(string xiangmumc, string countyid, string streetid,int? status,
|
||||
string xiangmuno, string xiangmuyt,
|
||||
string xiangmuno, DateTime? hechatimebegin, DateTime? hechatimeend, string xiangmuyt,
|
||||
int page, int limit)
|
||||
{
|
||||
var response = new Response<PageInfo<List<DroneSsnyd>>>();
|
||||
try
|
||||
{
|
||||
response.Result =
|
||||
droneSsnyApp.GetDronssnydList(xiangmumc, countyid, streetid, xiangmuno, xiangmuyt, status,page, limit);
|
||||
droneSsnyApp.GetDronssnydList(xiangmumc, countyid, streetid, xiangmuno, hechatimebegin, hechatimeend, xiangmuyt, status,page, limit);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -484,7 +486,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
"项目编号", "项目名称", "乡镇", "村庄", "权利人", "联系方式","行政区划", "备案编号","备案日期","项目状态", "项目开始时间", "项目结束时间", "设施农业类型","建筑结构", "设施农业申请用地面积(公顷)", "生产设施用地(公顷)", "辅助设施用地(公顷)"
|
||||
};
|
||||
var response = droneSsnyApp.GetDronssnydExportList(import.xiangmumc, import.countyid, import.streetid,
|
||||
import.xiangmuno, import.xiangmuyt,import.status);
|
||||
import.xiangmuno, import.hechatimebegin,import.hechatimeend,import.xiangmuyt,import.status);
|
||||
if (response.Count > 0)
|
||||
{
|
||||
var excelRes = droneSsnyApp.ListToExcel(response, headers);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
|
||||
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
|
||||
<NameOfLastUsedPublishProfile>E:\2025\兰陵批后监管\OpenAuth.WebApi\Properties\PublishProfiles\continue.pubxml</NameOfLastUsedPublishProfile>
|
||||
<NameOfLastUsedPublishProfile>continue</NameOfLastUsedPublishProfile>
|
||||
<ActiveDebugProfile>OpenAuthApi</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"AllowedHosts": "*",
|
||||
"DataProtection": "temp-keys/",
|
||||
"ConnectionStrings": {
|
||||
"OpenAuthDBContext": "PORT=5432;Database=drone_enforcement_lanling1;HOST=192.168.10.163;PASSWORD=123456;USER ID=postgres;"
|
||||
"OpenAuthDBContext": "PORT=5432;Database=drone_enforcement_hedong;HOST=192.168.10.163;PASSWORD=123456;USER ID=postgres;"
|
||||
//"OpenAuthDBContext": "PORT=5432;Database=unattended1;HOST=192.168.10.115;PASSWORD=123456;USER ID=postgres;Pooling=False" //PostgreSQL
|
||||
},
|
||||
"AppSetting": {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
"DataProtection": "temp-keys/",
|
||||
"ConnectionStrings": {
|
||||
//"OpenAuthDBContext": "PORT=5432;Database=hopetrycore;HOST=192.168.10.124;PASSWORD=123456;USER ID=postgres;",
|
||||
"OpenAuthDBContext": "PORT=5432;Database=drone_enforcement_lanling1;HOST=192.168.10.163;PASSWORD=123456;USER ID=postgres;"
|
||||
"OpenAuthDBContext": "PORT=5432;Database=drone_enforcement_hedongnew;HOST=192.168.10.163;PASSWORD=123456;USER ID=postgres;"
|
||||
//"OpenAuthDBContext": "PORT=5432;Database=;HOST=192.168.10.131;PASSWORD=123456;USER ID=postgres;"
|
||||
},
|
||||
"AppSetting": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<key id="e941f4a3-b9d7-4d79-b360-db3c9f022b33" version="1">
|
||||
<creationDate>2025-12-10T05:13:26.6793235Z</creationDate>
|
||||
<activationDate>2025-12-10T05:13:26.6505216Z</activationDate>
|
||||
<expirationDate>2026-03-10T05:13:26.6505216Z</expirationDate>
|
||||
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
|
||||
<descriptor>
|
||||
<encryption algorithm="AES_256_CBC" />
|
||||
<validation algorithm="HMACSHA256" />
|
||||
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
|
||||
<!-- Warning: the key below is in an unencrypted form. -->
|
||||
<value>I7gos8GMgyz+gra06GgfjH1zjgF7qvMI471ssYz3+9U2ycUCnVF2rE1l7FtI+7AjGPC/SLxMVFiJ8ZpZwRMVQQ==</value>
|
||||
</masterKey>
|
||||
</descriptor>
|
||||
</descriptor>
|
||||
</key>
|
||||
Loading…
Reference in New Issue