1每天夜间获取OA系统项目设计图纸数据接口调整

This commit is contained in:
2025-11-25 10:27:40 +08:00
parent 65d027e559
commit da6fb67fe0
5 changed files with 134 additions and 14 deletions
+83 -1
View File
@@ -823,7 +823,7 @@ namespace BLL
private static readonly string GetApiUrl = "https://getapi.cwcec.com/api/WebApi";
/// <summary>
/// 接收保存数据
/// 接收保存数据【数字档案馆推送】
/// </summary>
/// <param name="items"></param>
public static string SaveDesignDrawingData(List<OADesignDrawingDataItem> items)
@@ -880,6 +880,88 @@ namespace BLL
}
}
/// <summary>
/// 质量管理设计图纸——获取OA图纸数据
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
public static string GetIDPOADesignDrawingData(string startDate = "", string endDate = "")
{
try
{
string message = string.Empty;
////五环主数据项目Code
//string projectCode = string.Empty;
//if (!string.IsNullOrWhiteSpace(projectId))
//{//根据施工平台项目Id获取主数据项目Code
// var getPro = ProjectService.GetProjectByProjectId(projectId);
// projectCode = getPro.ProjectCode;
//}
if (string.IsNullOrWhiteSpace(startDate))
{
startDate = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd");
}
if (string.IsNullOrWhiteSpace(endDate))
{
endDate = DateTime.Now.AddDays(+1).ToString("yyyy-MM-dd");
}
string url = $"{GetApiUrl}/GetSendInfo?BeginTime={startDate}&EndTime={endDate}";
//if (!string.IsNullOrWhiteSpace(projectCode)) { url = $"{url}&item_id={projectCode}"; }
//ErrLogInfo.WriteLog($"接口地址{url}");
//var returndata = "[{\"item_id\":\"22150\",\"modifiedTime\":\"2022/3/9 15:21:32\",\"folderNo\":\"22150-21000-WT2501-001\",\"isUpgrade\":\"D00\",\"fileType\":\"非设备蓝图\",\"senderName\":\"吴荟\",\"receiverAddress\":\"新疆哈密市伊吾县淖毛湖镇广汇生活区12号楼\",\"receiverName\":\"李娟\",\"receiverType\":\"业主\",\"receiverUnit\":\"哈密广汇环保科技有限公司\"},{\"item_id\":\"22150\",\"modifiedTime\":\"2022/3/9 15:21:33\",\"folderNo\":\"22150-21000-WT4401-001\",\"isUpgrade\":\"D00\",\"fileType\":\"非设备蓝图\",\"senderName\":\"吴荟\",\"receiverAddress\":\"新疆哈密市伊吾县淖毛湖镇广汇生活区12号楼\",\"receiverName\":\"李娟\",\"receiverType\":\"业主\",\"receiverUnit\":\"哈密广汇环保科技有限公司\"},{\"item_id\":\"22150\",\"modifiedTime\":\"2022/3/19 15:23:33\",\"folderNo\":\"22150-21000-WT4401-001\",\"isUpgrade\":\"D00\",\"fileType\":\"非设备蓝图\",\"senderName\":\"吴荟\",\"receiverAddress\":\"新疆哈密市伊吾县淖毛湖镇广汇生活区12号楼\",\"receiverName\":\"李娟\",\"receiverType\":\"业主\",\"receiverUnit\":\"哈密广汇环保科技有限公司\"}]";
var returndata = BLL.APIGetHttpService.OutsideHttp(url, "GET", null, null, null);
if (!string.IsNullOrEmpty(returndata))
{
ErrLogInfo.WriteLog($"【{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}获取OA图纸数据({startDate}至{endDate}):】{returndata}");
int succ = 0;
int err = 0;
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
List<OADesignDrawingDataItem> responseData = OADesignDrawingDataItems.FromJson(returndata);
responseData = responseData.Where(x => !string.IsNullOrWhiteSpace(x.uuid) == true).ToList();
foreach (var item in responseData)
{
IDP_DesignDrawing newItem = db.IDP_DesignDrawing.FirstOrDefault(x => x.IdpfileId == item.uuid);
//IDP_DesignDrawing newItem = db.IDP_DesignDrawing.FirstOrDefault(x => x.StockId == item.RdpId && x.ThirdId == item.fileid);
//IDP_DesignDrawing newItem = db.IDP_DesignDrawing.FirstOrDefault(x => x.StockId == item.RdpId && x.FormatFileCode == item.doc_no && x.FormatFileName == item.maintitle);
if (newItem != null)
{
newItem.RdpId = item.RdpId;
newItem.Fileid = item.fileid;
//newItem.StockId = item.RdpId;
//newItem.ThirdId = item.fileid;
newItem.Upfileid = item.upfileid;
newItem.Maintitle = item.maintitle;
newItem.Doc_no = item.doc_no;
newItem.Bc = item.bc;
newItem.Archnumber = item.archnumber;
newItem.Sendtime = item.sendtime;
newItem.Printtime = item.printtime;
newItem.Ifmail = item.ifmail;
db.SubmitChanges();
succ++;
}
else
{
err++;
}
}
message = $"总数{(succ + err)}条;失败{err}条,成功{succ}条!";
}
}
else
{
message = "无数据";
}
return message;
}
catch (WebException ex)
{
return ex.Message;
}
}
/// <summary>
/// 质量管理设计图纸——更新蓝图寄出信息
/// </summary>