1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XYY.TaskTrack.Standard;
- using XYY.TaskTrack.Standard.TaskModel;
- namespace XYY.WindowsService.MQ
- {
- public interface IFeeBaseFileJobSub : IBaseConsumer<GenerateFeeBaseFileMessage>
- {
- }
- public class FeeBaseFileJobSub : IFeeBaseFileJobSub
- {
- public async Task Consume(GenerateFeeBaseFileMessage message)
- {
- string msgSubmary = null;
- try
- {
- RestSharp.RestClient client = new RestSharp.RestClient("http://120.24.149.148:9521/api/FinanceQuotation/GenerateFeeBaseFile");
- RestSharp.RestRequest request = new RestSharp.RestRequest(RestSharp.Method.POST);
- request.AddJsonBody(message);
- request.AddHeader("Authorization", "token A2DGA5DGAD2DGC6CEB59F383A6615GE2");
- var response = client.Execute(request);
- string idStr = string.Join(",", message.FeeBaseIds);
- int approveId = message.ApproveId;
- string versionName = message.FeeBaseVersionName;
- msgSubmary = $"{DateTime.Now.ToString_yyyyMMddHHmmss()} Feebase ID:{idStr},Approve Id: {approveId},Version Name:{versionName}";
- if (response.StatusCode == System.Net.HttpStatusCode.OK)
- {
- Console.WriteLine($"生成报价文件消息推送成功:{msgSubmary}");
- }
- else
- {
- Console.WriteLine($"生成报价文件消息推送失败:{msgSubmary}," + (response.Content ?? response.ErrorMessage));
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine($"生成报价文件消息推送异常:{msgSubmary},消息推送错误 {ex.Message}");
- }
- }
- }
- }
|