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