From 2cc45561a1426d76afd2b3b189df6c0d02146d4a Mon Sep 17 00:00:00 2001 From: robin Date: Tue, 19 Jun 2018 16:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A1=A5=E5=BD=95=E6=94=B6?= =?UTF-8?q?=E6=AC=BE=E5=8D=95=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3QingDaoWanFu.Web/PluginClass.cs | 1 + B3QingDaoWanFu/B3QingDaoWanFu.csproj | 1 + B3QingDaoWanFu/Tasks/CreatGatheringTask.cs | 71 ++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 B3QingDaoWanFu/Tasks/CreatGatheringTask.cs diff --git a/B3QingDaoWanFu.Web/PluginClass.cs b/B3QingDaoWanFu.Web/PluginClass.cs index 0a3c512..6e23eab 100644 --- a/B3QingDaoWanFu.Web/PluginClass.cs +++ b/B3QingDaoWanFu.Web/PluginClass.cs @@ -37,6 +37,7 @@ namespace BWP.B3QingDaoWanFu GlobalFlags.On(B3SaleConsts.Flags.EnableABCPay); TimerConfig.Register(() => "* * * * *", new QueryTrustPayTask()); + TimerConfig.Register(() => "*/5 * * * *", new QueryNoGatheringTrustPayTask()); } } } diff --git a/B3QingDaoWanFu/B3QingDaoWanFu.csproj b/B3QingDaoWanFu/B3QingDaoWanFu.csproj index 372f1c5..c36f554 100644 --- a/B3QingDaoWanFu/B3QingDaoWanFu.csproj +++ b/B3QingDaoWanFu/B3QingDaoWanFu.csproj @@ -169,6 +169,7 @@ + diff --git a/B3QingDaoWanFu/Tasks/CreatGatheringTask.cs b/B3QingDaoWanFu/Tasks/CreatGatheringTask.cs new file mode 100644 index 0000000..287d78a --- /dev/null +++ b/B3QingDaoWanFu/Tasks/CreatGatheringTask.cs @@ -0,0 +1,71 @@ +using System; +using BWP.B3Frameworks; +using BWP.B3Frameworks.Utils; +using BWP.B3QingDaoWanFu.BL; +using BWP.B3QingDaoWanFu.BO; +using BWP.B3QingDaoWanFu.BO.NamedValueTemplate; +using BWP.B3QingDaoWanFu.Utils; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using TSingSoft.WebPluginFramework; +using TSingSoft.WebPluginFramework.QueueTasks; +using TSingSoft.WebPluginFramework.TimerTasks; + +namespace BWP.B3QingDaoWanFu.Tasks { + [Serializable] + public class QueryNoGatheringTrustPayTask : ITimerTask { + public void Execute() { + var query = new DQueryDom(new JoinAlias(typeof(TrustPay))); + query.Where.Conditions.Add(DQCondition.EQ("PayState", 付款状态.付款成功)); + query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("Gathering_ID"))); + query.Columns.Add(DQSelectColumn.Field("ID")); + var list = query.EExecuteList(); + + foreach (var id in list) { + QueueTaskService.Add(new CreatGatheringTask(id)); + } + } + public string Name { + get { return "查询未创建收款单的农行付款"; } + } + } + + [Serializable] + public class CreatGatheringTask : ITimerTask { + private readonly long _trustPayID; + + public CreatGatheringTask() { + + } + + public CreatGatheringTask(long id) { + _trustPayID = id; + } + + public void Execute() { + + using (var session = Dmo.NewSession()) { + var config = new WanFuOnlineConfig(); + var bl = BIFactory.Create(session); + + long gatheringID; + var trustPay = InnerBLUtil.GetSingleDmo(session, "ID", _trustPayID, "AccountCustomer_ID", "PayState", "Gathering_ID", "Money", "Domain_ID"); + using (new SpecialDomainUserBLScope(config.DomainUserForTrustPay.Value)) { + bl.CreateGathering(trustPay, out gatheringID); + } + trustPay.Gathering_ID = gatheringID; + InnerBLUtil.UpdateEntityProperties(session, trustPay, "Gathering_ID"); + session.Commit(); + } + + } + + public string Name { + get { + return string.Format(string.Format("付款单No.{0}补录收款单", _trustPayID)); + } + } + + } +} \ No newline at end of file