This commit is contained in:
2025-07-03 18:42:35 +08:00
parent 980648fa6e
commit b004037b4d
7 changed files with 168 additions and 63 deletions
Binary file not shown.
@@ -8,21 +8,13 @@
"VerticalTabListWidth": 256, "VerticalTabListWidth": 256,
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 386, "DockedWidth": 200,
"SelectedChildIndex": -1, "SelectedChildIndex": -1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}" "Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}"
}, },
{
"$type": "Bookmark",
"Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" "Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
@@ -51,14 +43,6 @@
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:3:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}" "Name": "ST:3:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}"
}, },
{
"$type": "Bookmark",
"Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}" "Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}"
@@ -67,6 +51,18 @@
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}" "Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}"
}, },
{
"$type": "Bookmark",
"Name": "ST:137:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
},
{
"$type": "Bookmark",
"Name": "ST:138:0:{1fc202d4-d401-403c-9834-5b218574bb67}"
},
{
"$type": "Bookmark",
"Name": "ST:136:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}" "Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}"
@@ -77,7 +73,7 @@
}, },
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" "Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
} }
] ]
} }
+5
View File
@@ -92,6 +92,11 @@ namespace BLL
{ {
return Funs.DB.Sys_Const.FirstOrDefault(e => e.ConstValue == constValue && e.GroupId == groupId); return Funs.DB.Sys_Const.FirstOrDefault(e => e.ConstValue == constValue && e.GroupId == groupId);
} }
public static Sys_Const GetConstByConstText(string constText)
{
return Funs.DB.Sys_Const.FirstOrDefault(e => e.ConstText == constText);
}
public static void DeleteConstValueBygroupId(string groupId) public static void DeleteConstValueBygroupId(string groupId)
{ {
var q = Funs.DB.Sys_Const.Where(x => x.GroupId == groupId); var q = Funs.DB.Sys_Const.Where(x => x.GroupId == groupId);
+69 -27
View File
@@ -386,28 +386,17 @@ namespace BLL
select x; select x;
var projectModel=ProjectService.GetProjectByProjectId(projectId); var projectModel=ProjectService.GetProjectByProjectId(projectId);
var contractModel = CostManageService.GetCostManageById(costManageId); var contractModel = CostManageService.GetCostManageById(costManageId);
decimal totalAmount = costData.Sum(x => x.SumMoney ?? 0); //decimal totalAmount = costData.Sum(x => x.SumMoney ?? 0);
var files = new List<object>(); var files = new List<object>();
if (contractModel!=null) if (contractModel!=null)
{ {
var fileDetails = GetBase64FilesWithDetails(contractModel.CostManageId); var url = ConstValue.GetConstByConstText("PU_PUSH_URL")?.ConstValue;
if (fileDetails != null && fileDetails.Count > 0) if (string.IsNullOrEmpty(url))
{ {
files.AddRange(fileDetails); message = "未配置推送接口地址";
return message;
} }
// 构建请求体
var requestBody = new
{
projectNumber = projectModel.ProjectCode,
contractNo = contractNum,
amountHSE = totalAmount.ToString(),
files = files
};
var jsonBody = JsonConvert.SerializeObject(requestBody);
// 调用HSE接口推送数据
var url = "http://172.29.60.33:9037";
var requestGetTokenUrl = url + "/auth/getToken"; var requestGetTokenUrl = url + "/auth/getToken";
string requestGetTokenBody = "{\"username\": \"coadmin\",\"password\": \"coadminPu@2025\"}"; string requestGetTokenBody = "{\"username\": \"coadmin\",\"password\": \"coadminPu@2025\"}";
var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody); var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody);
@@ -428,7 +417,52 @@ namespace BLL
} }
Dictionary<string, string> headers = new Dictionary<string, string>(); Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("Authorization", "Bearer " + accessToken); headers.Add("Authorization", "Bearer " + accessToken);
#region
var getRequestUrl = url + "/pu_api/payCraftAmountToHSE/get";
var getRequestbody= $"{{\"projectNumber\":\"{projectModel.ProjectCode}\",\"contractNo\":\"{contractNum}\"}}";
APICommonService.SaveSysHttpLog("PU_GetPuPayCraftAmount", getRequestUrl, getRequestbody, "Requset");
var getResponse = Funs.RequestPost(getRequestUrl, headers, getRequestbody);
APICommonService.SaveSysHttpLog("PU_GetPuPayCraftAmount", getRequestUrl, getResponse, "Response");
var getResponseStr = JsonConvert.DeserializeObject<JObject>(getResponse);
if (getResponseStr == null)
{
message = "推送数据到HSE系统失败";
return message;
}
else if (getResponseStr["code"]?.ToString() != "200")
{
message = getResponseStr["message"]?.ToString();
return message;
}
var getResponseOutput = JsonConvert.DeserializeObject<List<PuGetApiOutput>>(getResponseStr["data"]?.ToString()) ;
if (getResponseOutput.Any() && getResponseOutput.Count(x=>x.itemNo== costManageId)>0)
{
message = "当前费用已推送,无需重复推送!";
return message;
}
#endregion
#region Pu
var requestUrl = url + "/pu_api/payCraftAmountToHSE/add"; var requestUrl = url + "/pu_api/payCraftAmountToHSE/add";
// 构建请求体
var fileDetails = GetBase64FilesWithDetails(contractModel.CostManageId);
if (fileDetails != null && fileDetails.Count > 0)
{
files.AddRange(fileDetails);
}
List<PuAddApiInput> puAddApiInputs = new List<PuAddApiInput>()
{
new PuAddApiInput()
{
projectNumber = projectModel.ProjectCode,
itemId= costManageId,
contractNo = contractNum,
amountHSE = contractModel.SumMoney.ToString(),
files = files
}
};
var jsonBody = JsonConvert.SerializeObject(puAddApiInputs);
APICommonService.SaveSysHttpLog("PU_AddPuPayCraftAmount", requestUrl, jsonBody, "Requset"); APICommonService.SaveSysHttpLog("PU_AddPuPayCraftAmount", requestUrl, jsonBody, "Requset");
var responseHSE = Funs.RequestPost(requestUrl, headers, jsonBody); var responseHSE = Funs.RequestPost(requestUrl, headers, jsonBody);
var responseHSEStr = JsonConvert.DeserializeObject<JObject>(responseHSE); var responseHSEStr = JsonConvert.DeserializeObject<JObject>(responseHSE);
@@ -438,6 +472,11 @@ namespace BLL
message = "推送数据到HSE系统失败"; message = "推送数据到HSE系统失败";
return message; return message;
} }
else if ( string.IsNullOrEmpty(responseHSEStr["code"]?.ToString()))
{
message = responseHSE;
return message;
}
else if (responseHSEStr["code"]?.ToString() != "200") else if (responseHSEStr["code"]?.ToString() != "200")
{ {
message = responseHSEStr["message"]?.ToString(); message = responseHSEStr["message"]?.ToString();
@@ -448,6 +487,8 @@ namespace BLL
message = ""; message = "";
return message; return message;
} }
#endregion
} }
return message; return message;
@@ -459,7 +500,6 @@ namespace BLL
return "推送数据失败"; return "推送数据失败";
} }
} }
/// <summary> /// <summary>
/// 获取Base64编码的附件文件 /// 获取Base64编码的附件文件
/// </summary> /// </summary>
@@ -468,8 +508,10 @@ namespace BLL
var result = new List<object>(); var result = new List<object>();
// 获取费用管理信息 // 获取费用管理信息
var costManage = GetCostManageById(costManageId); var costManage = GetCostManageById(costManageId);
// 获取附件文件 var costItem = BLL.CostManageItemService.GetCostManageItemByCostManageId(costManageId);
var attachments = AttachFileService.getFileUrl(costManageId); foreach (var item in costItem)
{ // 获取附件文件
var attachments = AttachFileService.getFileUrl(item.CostManageItemId);
if (!string.IsNullOrEmpty(attachments)) if (!string.IsNullOrEmpty(attachments))
{ {
@@ -487,17 +529,17 @@ namespace BLL
{ {
name = file.Name, name = file.Name,
content = base64Content, content = base64Content,
thisamount = costManage?.SumMoney?.ToString() ?? "0", thisamount = item?.PriceMoney?.ToString() ?? "0",
date = costManage?.CostManageDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd") date = costManage?.CompileDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd")
}); });
}
else continue;//只取第一个文件
{
/* message += $"附件文件路径 {fullPath} 不存在!";
ErrLogInfo.WriteLog(message, $"File not found: {fullPath}");*/
} }
} }
} }
}
return result; return result;
} }
+1 -1
View File
@@ -16785,7 +16785,7 @@
</COMReference> </COMReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions> <ProjectExtensions>
<VisualStudio> <VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+61
View File
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class PuGetApiOutput
{
/// <summary>
/// 合同号
/// </summary>
public string contractNo { get; set; }
/// <summary>
/// 项目号
/// </summary>
public string projectNumber { get; set; }
/// <summary>
/// 主键
/// </summary>
public string itemNo { get; set; }
/// <summary>
/// 本次申请费用
/// </summary>
public string amountHSE { get; set; }
}
public class PuAddApiInput
{
/// <summary>
/// 合同号
/// </summary>
public string contractNo { get; set; }
/// <summary>
/// 项目号
/// </summary>
public string projectNumber { get; set; }
/// <summary>
/// 主键
/// </summary>
public string itemId { get; set; }
/// <summary>
/// 本次申请费用
/// </summary>
public string amountHSE { get; set; }
/// <summary>
/// Gets or sets the files.
/// </summary>
/// <value>
/// The files.
/// </value>
public List<object> files { get; set; }
}
}
+1
View File
@@ -245,6 +245,7 @@
<Compile Include="HJGL\sp_index_HJGLItem.cs" /> <Compile Include="HJGL\sp_index_HJGLItem.cs" />
<Compile Include="HSSE\DigDataHSEDataCollectItem.cs" /> <Compile Include="HSSE\DigDataHSEDataCollectItem.cs" />
<Compile Include="HSSE\PageDataPersonInOutItem.cs" /> <Compile Include="HSSE\PageDataPersonInOutItem.cs" />
<Compile Include="HSSE\PuApiOutput.cs" />
<Compile Include="HSSE\PuPayCraftAmountInput.cs" /> <Compile Include="HSSE\PuPayCraftAmountInput.cs" />
<Compile Include="HSSE\WorkPostStatisticItem.cs" /> <Compile Include="HSSE\WorkPostStatisticItem.cs" />
<Compile Include="HSSE\HSSE_HazardTemplate.cs" /> <Compile Include="HSSE\HSSE_HazardTemplate.cs" />