725 lines
33 KiB
C#
725 lines
33 KiB
C#
using ce.autofac.extension;
|
||
using Infrastructure;
|
||
using Infrastructure.Extensions;
|
||
using Infrastructure.Helpers;
|
||
using Microsoft.Extensions.Configuration;
|
||
using Newtonsoft.Json;
|
||
using NPOI.Util;
|
||
using OpenAuth.App.BaseApp.WFTask;
|
||
using OpenAuth.App.BasicQueryService;
|
||
using OpenAuth.App.Interface;
|
||
using OpenAuth.App.WorkFlow;
|
||
using OpenAuth.Repository;
|
||
using OpenAuth.Repository.Domain;
|
||
using SqlSugar;
|
||
using WFTask = OpenAuth.Repository.Domain.WFTask;
|
||
|
||
|
||
namespace OpenAuth.App.ServiceApp.DroneCaseInfo;
|
||
|
||
[BLLName("toNonGrain")]
|
||
public class ToNonGrainWorkMethod : IWorkFlowMethod
|
||
{
|
||
private readonly WFProcessApp _processApp;
|
||
private readonly DroneCaseInfoSingleApp _droneCaseInfoSingleApp;
|
||
private readonly DroneCaseInfoFLHApp _droneCaseInfoFLHApp;
|
||
private readonly IConfiguration _configuration;
|
||
private readonly WFSchemeInfoApp _wfSchemeInfoApp;
|
||
private readonly WFTaskApp _wfTaskApp;
|
||
private readonly IAuth _auth;
|
||
private readonly ISqlSugarClient _client;
|
||
CommonDataManager _commonDataManager;
|
||
|
||
public ToNonGrainWorkMethod(WFProcessApp processApp, DroneCaseInfoSingleApp droneCaseInfoSingleApp,
|
||
DroneCaseInfoFLHApp droneCaseInfoFLHApp, IConfiguration configuration, WFSchemeInfoApp wfSchemeInfoApp,
|
||
IAuth auth, WFTaskApp wfTaskApp, ISqlSugarClient sqlSugarClient, CommonDataManager commonDataManager)
|
||
{
|
||
_processApp = processApp;
|
||
_droneCaseInfoSingleApp = droneCaseInfoSingleApp;
|
||
_droneCaseInfoFLHApp = droneCaseInfoFLHApp;
|
||
_configuration = configuration;
|
||
_wfSchemeInfoApp = wfSchemeInfoApp;
|
||
_auth = auth;
|
||
_wfTaskApp = wfTaskApp;
|
||
_client = sqlSugarClient;
|
||
_commonDataManager = commonDataManager;
|
||
}
|
||
|
||
public async Task Execute(WfMethodParameter parameter)
|
||
{
|
||
var user = _auth.GetCurrentUser();
|
||
|
||
Console.WriteLine("==============================================");
|
||
var caseId = parameter.ProcessId;
|
||
// 取得案件信息
|
||
var originCaseInfo = _droneCaseInfoSingleApp.GetCaseInfoById1(caseId);
|
||
if (originCaseInfo.is_illegal.Equals(1)
|
||
&& originCaseInfo.is_closed.Equals(0)
|
||
&& originCaseInfo.weifaleixing.Equals(1)
|
||
&& originCaseInfo.handle_status_id.Equals(5) && originCaseInfo.handle_status_name.Equals("已归档")
|
||
&& !string.IsNullOrEmpty(originCaseInfo.gengdi_area) && double.Parse(originCaseInfo.gengdi_area) > 0)
|
||
{
|
||
var caseno = originCaseInfo.case_no;
|
||
// 验证非粮化是否存在该专题
|
||
if (_droneCaseInfoFLHApp.ExistCase(caseno))
|
||
{
|
||
return;
|
||
}
|
||
|
||
// 违法用地专题判断违法+非粮化+已归档+耕地不为0的图斑
|
||
// 非粮化案件信息
|
||
var nonGrainCaseInfo = originCaseInfo.MapTo<DroneCaseInfoFLHSpecial>();
|
||
|
||
if (!string.IsNullOrEmpty(originCaseInfo.jieshou_time))
|
||
{
|
||
nonGrainCaseInfo.jieshou_time = DateTime.Parse(originCaseInfo.jieshou_time);
|
||
}
|
||
|
||
//nonGrainCaseInfo.jieshou_time = null;
|
||
nonGrainCaseInfo.hexiaotime = null;
|
||
var newProcessId = Guid.NewGuid().ToString();
|
||
nonGrainCaseInfo.Id = newProcessId;
|
||
nonGrainCaseInfo.handle_status_id = 0;
|
||
nonGrainCaseInfo.handle_status_name = "待接收";
|
||
// 去掉字段
|
||
nonGrainCaseInfo.verifytime = null;
|
||
nonGrainCaseInfo.verifyuser = null;
|
||
nonGrainCaseInfo.verifyuserid = null;
|
||
nonGrainCaseInfo.verifytime = null;
|
||
nonGrainCaseInfo.verifystatus = null;
|
||
nonGrainCaseInfo.hexiaotime = null;
|
||
nonGrainCaseInfo.is_drawback = null;
|
||
//nonGrainCaseInfo.is_shijibohui = null;
|
||
//nonGrainCaseInfo.xianjiyijian = null;
|
||
nonGrainCaseInfo.hexiaotime = null;
|
||
nonGrainCaseInfo.hexiaoren = null;
|
||
nonGrainCaseInfo.is_illegal = null;
|
||
nonGrainCaseInfo.examiner_id = null;
|
||
nonGrainCaseInfo.examiner_name = null;
|
||
|
||
nonGrainCaseInfo.examine_time = null;
|
||
nonGrainCaseInfo.measure_name = null;
|
||
nonGrainCaseInfo.opinion = null;
|
||
nonGrainCaseInfo.result = null;
|
||
nonGrainCaseInfo.result_name = null;
|
||
nonGrainCaseInfo.opinion_name = null;
|
||
nonGrainCaseInfo.handletime = null;
|
||
nonGrainCaseInfo.handleuser = null;
|
||
nonGrainCaseInfo.handleusername = null;
|
||
nonGrainCaseInfo.is_assist = null;
|
||
nonGrainCaseInfo.measure_name_deal = null; //处理措施
|
||
nonGrainCaseInfo.qita_use_to = null; //其他实际用途
|
||
nonGrainCaseInfo.illegal_contact = null; //违法联系人
|
||
nonGrainCaseInfo.illegal_shenfenzhenghao = null; //违法人身份证号
|
||
nonGrainCaseInfo.investigation_type = null; //查处类型
|
||
nonGrainCaseInfo.investigation_result = null; //查处结果
|
||
nonGrainCaseInfo.registr_number = null; //立案号
|
||
nonGrainCaseInfo.actual_use_to = null; //实际用途
|
||
nonGrainCaseInfo.transactor_id = null; //办理人ID
|
||
nonGrainCaseInfo.transactor_name = null; //办理人
|
||
nonGrainCaseInfo.transact_time = null; //办理时间
|
||
nonGrainCaseInfo.fujian = null; //附件
|
||
nonGrainCaseInfo.jieshou_people = null; //接收人
|
||
nonGrainCaseInfo.jieshou_time = null; //接收时间
|
||
nonGrainCaseInfo.pandingyijushuoming = null; //判定依据说明
|
||
nonGrainCaseInfo.xiangmumc = null; //项目名称
|
||
nonGrainCaseInfo.xiangmuzhuti = null; //项目主体
|
||
nonGrainCaseInfo.weifaleixing = null; //违法类型(0非农化1非粮化)
|
||
nonGrainCaseInfo.yanshoubiao = null; //验收表
|
||
nonGrainCaseInfo.zhenggaifujian = null; //整改附件
|
||
nonGrainCaseInfo.chaichufugenghoupic = null; //拆除复耕后照片
|
||
nonGrainCaseInfo.is_jieshou = null; //是否接收
|
||
nonGrainCaseInfo.is_split = 0; //是否拆分
|
||
nonGrainCaseInfo.hefafujian = null; //合法附件
|
||
nonGrainCaseInfo.qitafujian = null; //其他附件
|
||
nonGrainCaseInfo.bubanzhaopian = null; //补办手续照片
|
||
nonGrainCaseInfo.xchczhaopian = null; //现场核查照片
|
||
nonGrainCaseInfo.wrjffzhaopian = null; //无人机复飞照片
|
||
|
||
// 复制一份图斑
|
||
var shp = _droneCaseInfoSingleApp.GetShpData(nonGrainCaseInfo.geomid);
|
||
var geoms = "";
|
||
foreach (var droneShpData in shp)
|
||
{
|
||
var gidStr = _commonDataManager.GetMaxKeyVal("gid", "drone_shp_data", 1);
|
||
geoms += gidStr + ",";
|
||
droneShpData.relid = nonGrainCaseInfo.Id;
|
||
// 多图斑处置
|
||
droneShpData.gid = gidStr.ToInt();
|
||
droneShpData.relid = nonGrainCaseInfo.Id;
|
||
_droneCaseInfoSingleApp.SaveShpData(droneShpData);
|
||
}
|
||
|
||
geoms = geoms.TrimEnd(',');
|
||
nonGrainCaseInfo.geomid = geoms;
|
||
|
||
var finish = _droneCaseInfoFLHApp.AddCaseInfo(nonGrainCaseInfo);
|
||
if (finish)
|
||
{
|
||
// 非粮化code
|
||
try
|
||
{
|
||
var schemeCode = _configuration.GetSection("AppSetting:DroneCaseInfoNonFoodSchemeCode").Value;
|
||
var schemeInfo = _wfSchemeInfoApp.SelectBySchemeCode(schemeCode);
|
||
// 发起新流程
|
||
var instanceInfo = new WFInstanceInfo
|
||
{
|
||
pkeyValue = newProcessId,
|
||
pkey = "Id",
|
||
schemeId = schemeInfo.SchemeId
|
||
};
|
||
instanceInfo.pkeyValue = newProcessId;
|
||
_processApp.SaveDraft(nonGrainCaseInfo.Id, schemeCode, user.User.Id + "",
|
||
Json.ToJson(instanceInfo), "", "", "", 0,
|
||
nonGrainCaseInfo.case_description).Wait();
|
||
_processApp.Create(nonGrainCaseInfo.Id, "", user.User.Id + "", null, Json.ToJson(instanceInfo),
|
||
nonGrainCaseInfo.case_description).Wait();
|
||
// 补充任务信息
|
||
|
||
/*
|
||
var node1 = _wfTaskApp.GetNodeByProcessId(nonGrainCaseInfo.Id);
|
||
var node2 = new WFTask(); // 脚本节点
|
||
var node3 = new WFTask();
|
||
var node4 = new WFTask();
|
||
var node5 = new WFTask(); // 脚本节点
|
||
|
||
//node1.Id = Guid.NewGuid().ToString();
|
||
node2.Id = Guid.NewGuid().ToString();
|
||
node3.Id = Guid.NewGuid().ToString();
|
||
node4.Id = Guid.NewGuid().ToString();
|
||
node5.Id = Guid.NewGuid().ToString();
|
||
|
||
//node1.Token = Guid.NewGuid().ToString();
|
||
node2.Token = Guid.NewGuid().ToString();
|
||
node3.Token = Guid.NewGuid().ToString();
|
||
node4.Token = Guid.NewGuid().ToString();
|
||
node5.Token = Guid.NewGuid().ToString();
|
||
|
||
//node1.Type = 7;
|
||
node2.Type = 10;
|
||
node3.Type = 7;
|
||
node4.Type = 7;
|
||
node5.Type = 10;
|
||
|
||
//node1.ProcessTitle = nonGrainCaseInfo.case_description;
|
||
node2.ProcessTitle = null;
|
||
node3.ProcessTitle = nonGrainCaseInfo.case_description;
|
||
node4.ProcessTitle = nonGrainCaseInfo.case_description;
|
||
node5.ProcessTitle = null;
|
||
|
||
//node1.ProcessCode = schemeCode;
|
||
node2.ProcessCode = null;
|
||
node3.ProcessCode = schemeCode;
|
||
node4.ProcessCode = schemeCode;
|
||
node5.ProcessCode = null;
|
||
|
||
//node1.ProcessId = nonGrainCaseInfo.Id;;
|
||
node2.ProcessId = nonGrainCaseInfo.Id;
|
||
;
|
||
node3.ProcessId = nonGrainCaseInfo.Id;
|
||
;
|
||
node4.ProcessId = nonGrainCaseInfo.Id;
|
||
;
|
||
node5.ProcessId = nonGrainCaseInfo.Id;
|
||
;
|
||
|
||
//node1.ProcessUserId = user.User.Id + "";
|
||
node2.ProcessUserId = null;
|
||
node3.ProcessUserId = user.User.Id + "";
|
||
node4.ProcessUserId = user.User.Id + "";
|
||
node5.ProcessUserId = null;
|
||
|
||
//node1.ProcessUserName = user.User.Name;
|
||
node2.ProcessUserName = null;
|
||
node3.ProcessUserName = user.User.Name;
|
||
node4.ProcessUserName = user.User.Name;
|
||
node5.ProcessUserName = null;
|
||
|
||
//node1.UnitId = "Activity_02tspis";
|
||
node2.UnitId = "Activity_13vfcwg";
|
||
node3.UnitId = "Activity_1aiy5ea";
|
||
node4.UnitId = "Activity_1t58a1v";
|
||
node5.UnitId = "Activity_09zxeay";
|
||
|
||
//node1.UnitName = "待接收";
|
||
node2.UnitName = "111";
|
||
node3.UnitName = "待填报";
|
||
node4.UnitName = "待整改";
|
||
node5.UnitName = "任务节点";
|
||
|
||
//node1.PrevUnitId = "Event_0li55cb";
|
||
node2.PrevUnitId = "Activity_02tspis";
|
||
node3.PrevUnitId = "Activity_02tspis";
|
||
node4.PrevUnitId = "Activity_1aiy5ea";
|
||
node5.PrevUnitId = "Activity_1aiy5ea";
|
||
|
||
//node1.PrevUnitName = "开始节点";
|
||
node2.PrevUnitName = "待接收";
|
||
node3.PrevUnitName = "111";
|
||
node4.PrevUnitName = "任务节点";
|
||
node5.PrevUnitName = null;
|
||
|
||
//node1.PrevToken = "create";
|
||
node2.PrevToken = node1.Token; // 脚本节点
|
||
node3.PrevToken = node1.Token;
|
||
node4.PrevToken = node3.Token;
|
||
node5.PrevToken = node3.Token; // 脚本节点
|
||
|
||
//node1.PrevTaskId = "create";
|
||
node2.PrevTaskId = null; // 脚本节点
|
||
node3.PrevTaskId = node1.Id;
|
||
node4.PrevTaskId = node3.Id;
|
||
node5.PrevTaskId = null; // 脚本节点
|
||
|
||
//node1.UserId = user.User.Id + "";
|
||
node2.UserId = null; // 脚本节点
|
||
node3.UserId = user.User.Id + "";
|
||
node4.UserId = user.User.Id + "";
|
||
node5.UserId = null; // 脚本节点
|
||
|
||
//node1.UserName = user.User.Name + "";
|
||
node2.UserName = null; // 脚本节点
|
||
node3.UserName = user.User.Name + "";
|
||
node4.UserName = user.User.Name + "";
|
||
node5.UserName = null; // 脚本节点
|
||
|
||
node1.State = 3;
|
||
node2.State = null;
|
||
node3.State = 3;
|
||
node4.State = 1;
|
||
node5.State = null;
|
||
|
||
node1.IsAgree = 1;
|
||
node2.IsAgree = null;
|
||
node3.IsAgree = 1;
|
||
node4.IsAgree = null; // 还未审核
|
||
node5.IsAgree = null;
|
||
|
||
node1.IsLast = 1;
|
||
node2.IsLast = 1;
|
||
node3.IsLast = 1;
|
||
node4.IsLast = 1;
|
||
node5.IsLast = 1;
|
||
|
||
node1.Sort = 0;
|
||
node2.Sort = 0;
|
||
node3.Sort = 0;
|
||
node4.Sort = 0;
|
||
node5.Sort = 0;
|
||
|
||
//node1.CreateUserId = user.User.Id + "";
|
||
node2.CreateUserId = user.User.Id + "";
|
||
node3.CreateUserId = user.User.Id + "";
|
||
node4.CreateUserId = user.User.Id + "";
|
||
node5.CreateUserId = user.User.Id + "";
|
||
|
||
//node1.CreateUserName = user.User.Name;
|
||
node2.CreateUserName = user.User.Name;
|
||
node3.CreateUserName = user.User.Name;
|
||
node4.CreateUserName = user.User.Name;
|
||
node5.CreateUserName = user.User.Name;
|
||
|
||
node1.IsBatchAudit = 0;
|
||
node2.IsBatchAudit = null;
|
||
node3.IsBatchAudit = 0;
|
||
node4.IsBatchAudit = 0;
|
||
node5.IsBatchAudit = null;
|
||
|
||
node1.IsReject = 0;
|
||
node2.IsReject = null;
|
||
node3.IsReject = 0;
|
||
node4.IsReject = 0;
|
||
node5.IsReject = null;
|
||
|
||
|
||
node1.SuperviseId = 0;
|
||
node2.SuperviseId = 0;
|
||
node3.SuperviseId = 0;
|
||
node4.SuperviseId = 0;
|
||
node5.SuperviseId = 0;
|
||
|
||
node1.IsRetract = 0;
|
||
node2.IsRetract = null;
|
||
node3.IsRetract = 0;
|
||
node4.IsRetract = 0;
|
||
node5.IsRetract = null;
|
||
|
||
//ode1.CreateDate = DateTime.Now;
|
||
node2.CreateDate = DateTime.Now;
|
||
node3.CreateDate = DateTime.Now;
|
||
node4.CreateDate = DateTime.Now;
|
||
node5.CreateDate = DateTime.Now;
|
||
|
||
_wfTaskApp.Update(node1);
|
||
_wfTaskApp.OriginalAdd(node2);
|
||
_wfTaskApp.OriginalAdd(node3);
|
||
_wfTaskApp.OriginalAdd(node4);
|
||
_wfTaskApp.OriginalAdd(node5);
|
||
*/
|
||
|
||
// start 复制图片或附件
|
||
|
||
var imageRefs = _client.Queryable<DroneImageRef>()
|
||
.Where(t => t.CaseId == caseId)
|
||
.Select(t => new DroneImageRef
|
||
{
|
||
FilePath = t.FilePath,
|
||
Orientation = t.Orientation,
|
||
Lng = t.Lng,
|
||
Lat = t.Lat
|
||
}).ToList();
|
||
//start---复制图片或附件
|
||
using var httpClient = new HttpClient();
|
||
// http://192.168.10.125:9011/DroneEnforcement/2024/20241112/Image_Water_1731054661277.jpeg
|
||
var config = ConfigHelper.GetConfigRoot();
|
||
var baseUrl = config["ImgServer"];
|
||
Console.WriteLine("ImgServerbaseUrl" + baseUrl);
|
||
var url = baseUrl + "/api/Platform/NewCopyImg";
|
||
// 文件路径 字段
|
||
var files = new Dictionary<string, string>();
|
||
// 方向角图片
|
||
var images = "";
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.anjianzhaopian))
|
||
{
|
||
var temp = nonGrainCaseInfo.anjianzhaopian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "anjianzhaopian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 拆除复耕
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.chaichufugenghoupic))
|
||
{
|
||
var temp = nonGrainCaseInfo.chaichufugenghoupic.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "chaichufugenghoupic");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 补办照片
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.bubanzhaopian))
|
||
{
|
||
var temp = nonGrainCaseInfo.bubanzhaopian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "bubanzhaopian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 图斑图片
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.casepic))
|
||
{
|
||
var temp = nonGrainCaseInfo.casepic.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "casepic");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 附件
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.fujian))
|
||
{
|
||
var temp = nonGrainCaseInfo.fujian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "fujian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 整改附件
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.zhenggaifujian))
|
||
{
|
||
var temp = nonGrainCaseInfo.zhenggaifujian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "zhenggaifujian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 合法附件
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.hefafujian))
|
||
{
|
||
var temp = nonGrainCaseInfo.hefafujian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "hefafujian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 其它附近
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.qitafujian))
|
||
{
|
||
var temp = nonGrainCaseInfo.qitafujian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "qitafujian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
// 无人机复飞
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.wrjffzhaopian))
|
||
{
|
||
var temp = nonGrainCaseInfo.wrjffzhaopian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "wrjffzhaopian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
//现场核查照片
|
||
if (!string.IsNullOrEmpty(nonGrainCaseInfo.xchczhaopian))
|
||
{
|
||
var temp = nonGrainCaseInfo.xchczhaopian.Trim(',');
|
||
var imgArray = temp.Split(",");
|
||
foreach (var se in imgArray)
|
||
{
|
||
files.Add(se, "xchczhaopian");
|
||
}
|
||
|
||
images += "," + temp;
|
||
}
|
||
|
||
images = images.Trim(',');
|
||
var param = new Dictionary<string, string>()
|
||
{
|
||
{ "path", images }
|
||
};
|
||
var content = new FormUrlEncodedContent(param);
|
||
// 图片方向角信息
|
||
var newImgRefs = new List<DroneImageRef>(imageRefs.Count);
|
||
// 清理数据
|
||
nonGrainCaseInfo.anjianzhaopian = null;
|
||
nonGrainCaseInfo.fujian = null;
|
||
nonGrainCaseInfo.chaichufugenghoupic = null;
|
||
//补办
|
||
nonGrainCaseInfo.bubanzhaopian = null;
|
||
nonGrainCaseInfo.casepic = null;
|
||
nonGrainCaseInfo.zhenggaifujian = null;
|
||
nonGrainCaseInfo.hefafujian = null;
|
||
nonGrainCaseInfo.qitafujian = null;
|
||
nonGrainCaseInfo.wrjffzhaopian = null;
|
||
nonGrainCaseInfo.xchczhaopian = null;
|
||
nonGrainCaseInfo.pre_phase_img = null;
|
||
nonGrainCaseInfo.later_phase_img = null;
|
||
// 复制图片
|
||
if (!string.IsNullOrEmpty(images))
|
||
{
|
||
var copyFileResponse = await httpClient.PostAsync(url, content);
|
||
if (copyFileResponse.IsSuccessStatusCode)
|
||
{
|
||
var resultContent = await copyFileResponse.Content.ReadAsStringAsync();
|
||
var obj = JsonConvert.DeserializeObject<Response<List<SysUploadFileNew>>>(resultContent);
|
||
if (!obj.Code.Equals(200))
|
||
{
|
||
throw new Exception("复制文件失败");
|
||
}
|
||
|
||
foreach (var sysUploadFileNew in obj.Result)
|
||
{
|
||
sysUploadFileNew.Id = SnowFlakeSingle.instance.getID();
|
||
var originalPath = sysUploadFileNew.OriginalPath;
|
||
var newFilePath = sysUploadFileNew.FilePath;
|
||
var imgRef = imageRefs.FirstOrDefault(x => x.FilePath.Equals(originalPath));
|
||
if (imgRef != null)
|
||
{
|
||
// 填充信息
|
||
var temp = imgRef.Copy();
|
||
temp.Id = Guid.NewGuid().ToString();
|
||
temp.CaseId = nonGrainCaseInfo.Id;
|
||
temp.CreateTime = DateTime.Now;
|
||
temp.FilePath = newFilePath;
|
||
newImgRefs.Add(temp);
|
||
}
|
||
|
||
var field = files[originalPath];
|
||
switch (field)
|
||
{
|
||
case "fujian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.fujian))
|
||
{
|
||
nonGrainCaseInfo.fujian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.fujian =
|
||
nonGrainCaseInfo.fujian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "anjianzhaopian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.anjianzhaopian))
|
||
{
|
||
nonGrainCaseInfo.anjianzhaopian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.anjianzhaopian =
|
||
nonGrainCaseInfo.anjianzhaopian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "chaichufugenghoupic":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.chaichufugenghoupic))
|
||
{
|
||
nonGrainCaseInfo.chaichufugenghoupic = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.chaichufugenghoupic =
|
||
nonGrainCaseInfo.chaichufugenghoupic + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "bubanzhaopian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.bubanzhaopian))
|
||
{
|
||
nonGrainCaseInfo.bubanzhaopian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.bubanzhaopian =
|
||
nonGrainCaseInfo.bubanzhaopian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "casepic":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.casepic))
|
||
{
|
||
nonGrainCaseInfo.casepic = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.casepic = nonGrainCaseInfo.casepic + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "zhenggaifujian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.zhenggaifujian))
|
||
{
|
||
nonGrainCaseInfo.zhenggaifujian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.zhenggaifujian =
|
||
nonGrainCaseInfo.zhenggaifujian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "hefafujian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.hefafujian))
|
||
{
|
||
nonGrainCaseInfo.hefafujian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.hefafujian =
|
||
nonGrainCaseInfo.hefafujian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "qitafujian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.qitafujian))
|
||
{
|
||
nonGrainCaseInfo.qitafujian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.qitafujian =
|
||
nonGrainCaseInfo.qitafujian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "wrjffzhaopian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.wrjffzhaopian))
|
||
{
|
||
nonGrainCaseInfo.wrjffzhaopian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.wrjffzhaopian =
|
||
nonGrainCaseInfo.wrjffzhaopian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
case "xchczhaopian":
|
||
if (string.IsNullOrEmpty(nonGrainCaseInfo.xchczhaopian))
|
||
{
|
||
nonGrainCaseInfo.xchczhaopian = newFilePath;
|
||
}
|
||
else
|
||
{
|
||
nonGrainCaseInfo.xchczhaopian =
|
||
nonGrainCaseInfo.xchczhaopian + "," + newFilePath;
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (obj.Result.Count > 0)
|
||
{
|
||
_client.Insertable(obj.Result).ExecuteCommand();
|
||
}
|
||
|
||
if (newImgRefs.Count > 0)
|
||
{
|
||
// 保存图片方向角信息
|
||
_client.Insertable(newImgRefs).ExecuteCommand();
|
||
}
|
||
|
||
_client.Updateable(nonGrainCaseInfo).ExecuteCommand();
|
||
}
|
||
else
|
||
{
|
||
throw new Exception("复制文件失败");
|
||
}
|
||
}
|
||
|
||
// end
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
// 删除案件记录
|
||
_droneCaseInfoFLHApp.DeleteCase(nonGrainCaseInfo.Id);
|
||
// 打印错误
|
||
Console.WriteLine("当前时间:" + DateTime.Now.ToString());
|
||
Console.WriteLine("异常信息:" + ex.Message);
|
||
Console.WriteLine("异常对象:" + ex.Source);
|
||
Console.WriteLine("调用堆栈:\n" + ex.StackTrace);
|
||
throw;
|
||
}
|
||
}
|
||
}
|
||
|
||
Console.WriteLine("==============================================");
|
||
}
|
||
} |