|
|
|
|
using DSWeb.Common;
|
|
|
|
|
using DSWeb.Common.DB;
|
|
|
|
|
using DSWeb.Common.Helper;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using Quartz;
|
|
|
|
|
using RabbitMQ.Client;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.Caching;
|
|
|
|
|
using System.Runtime.Remoting.Contexts;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Service.Output
|
|
|
|
|
{
|
|
|
|
|
//配置了舱单数据输出到ds7的公司,自动将舱单数据发送到消息队列
|
|
|
|
|
public class JobFanWeiToDS7 : IJob
|
|
|
|
|
{
|
|
|
|
|
//private const string ExchangeName = "output";
|
|
|
|
|
//private const string QueuePrefix = "djy.output.cangdan.ds7.";
|
|
|
|
|
|
|
|
|
|
private ILog log = LogManager.GetLogger(typeof(JobFanWeiToDS7));
|
|
|
|
|
//private string rabbitUri = ConfigurationManager.AppSettings["OutputDS7MQUri"];
|
|
|
|
|
|
|
|
|
|
string OAconnStr = ConfigurationManager.AppSettings["OAconnStr"];
|
|
|
|
|
string DS7connStr = ConfigurationManager.AppSettings["DS7connStr"];
|
|
|
|
|
string DS7URL = ConfigurationManager.AppSettings["DS7URL"];
|
|
|
|
|
|
|
|
|
|
public void Execute(IJobExecutionContext context)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int reqTimeout = Convert.ToInt32(context.JobDetail.JobDataMap.GetString("RequestTimeout"));
|
|
|
|
|
|
|
|
|
|
var dc1 = new OtherDB(OAconnStr);
|
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext(DS7connStr);
|
|
|
|
|
|
|
|
|
|
//从cdc中寻找待读取审核结果的业务
|
|
|
|
|
var 待审核付费申请List = cdc.ch_fee_payapplication.Where(x => x.BILLSTATUS == 2 && x.PAYAPPID != null && x.PAYAPPID != "").ToList();
|
|
|
|
|
|
|
|
|
|
if (待审核付费申请List == null || 待审核付费申请List.Count <= 0) return;
|
|
|
|
|
|
|
|
|
|
var idList = 待审核付费申请List.Select(s => s.PAYAPPID).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//从dc1中寻找这些id的业务的审核结果
|
|
|
|
|
var 审核结果List = dc1.view_pjrequestbas.Where(x => x.workflowid == 79 && x.currentnodetype == "3" && idList.Contains(x.requestid.ToString())).ToList();
|
|
|
|
|
|
|
|
|
|
//var AuditGidlistStr = "";
|
|
|
|
|
|
|
|
|
|
foreach (var item in 审核结果List)
|
|
|
|
|
{
|
|
|
|
|
SetAudit(dc1, cdc, DS7URL, item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//将审核完成的更新至cdc中的业务中
|
|
|
|
|
//update ch_fee_payapplication set BILLSTATUS=0,AUDITUSER='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BILLNO=@BILLNO");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
log.Debug($"catch:{ex.Message}");
|
|
|
|
|
log.Error(ex.Message);
|
|
|
|
|
log.Error(ex.StackTrace);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetAudit(OtherDB dc1, CommonDataContext cdc, string DS7URL, view_pjrequestbas_md Audititem)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//根据oa系统的userid查找ds7系统的userid
|
|
|
|
|
|
|
|
|
|
var OAUser = dc1.view_hrmresource.FirstOrDefault(x => x.id == Audititem.lastoperator);
|
|
|
|
|
|
|
|
|
|
var ds7user = cdc.VW_user.Where(x => x.SHOWNAME == OAUser.lastname).ToList();
|
|
|
|
|
|
|
|
|
|
//var ds7user = cdc.VW_user.Where(x => x.SHOWNAME == "系统管理员").ToList();
|
|
|
|
|
|
|
|
|
|
if (ds7user != null && ds7user.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var userid = ds7user[0].USERID;
|
|
|
|
|
|
|
|
|
|
var dic = new Dictionary<string, string> {
|
|
|
|
|
{ "requestid",Audititem.requestid.ToString()},
|
|
|
|
|
{ "userid",userid}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
string rtn = WebRequestHelper.DoPost(DS7URL, dic, 12000);
|
|
|
|
|
|
|
|
|
|
log.Debug("rtn=" + rtn);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|