Browse Source

账号失效检查自动任务无效错误修复

沈静伟 3 years ago
parent
commit
d9f4153632
1 changed files with 4 additions and 5 deletions
  1. 4 5
      src/dsb/com/cnd3b/service/SQL/失效账号查询.sql

+ 4 - 5
src/dsb/com/cnd3b/service/SQL/失效账号查询.sql

@@ -1,16 +1,15 @@
-select distinct t1.tenterprise_userid as userid,tagentsid
+select distinct t1.tenterprise_userid as userid,t1.tagentsid
 from tenterprise_users t1
          inner join tenterprise t2 on t1.siteid = t2.siteid and (fenddate is null or fenddate > getdate())
          --inner join tuserrequestlog t3 on t1.siteid=t3.siteid and t1.tenterprise_userid=t3.tenterprise_userid
          inner join tappmodelauth t5 on t1.siteid = t5.siteid and t5.fisdefault = 1
 where  ((t1.fusertype = '¾­ÏúÉÌ' and t5.fagentamount > 0) or
        (t1.fusertype = 'ÆóÒµ' and t5.fenterpriseuseramount > 0))
-       and exists(
+       and not exists(
 		   select siteid,tpayinfoid,tagentsid,tenterprise_userid from tpayinfo
-		   where (fbegdate > GETDATE() or fenddate < GETDATE()) and t1.siteid=tpayinfo.siteid and (
+		   where (fbegdate <= GETDATE() and fenddate >= GETDATE()) and t1.siteid=tpayinfo.siteid and (
 		   (t1.fusertype = '¾­ÏúÉÌ' and t1.tagentsid = tpayinfo.tagentsid) or
                                                              (t1.fusertype = 'ÆóÒµ' and t1.tenterprise_userid = tpayinfo.tenterprise_userid)
 		   )
         )and isnull(t1.accesstoken,'') !=''
-group by t1.tenterprise_userid,tagentsid
---having max(t3.flastrequestdate)>DATEADD(DAY,-3, GETDATE())
+--group by t1.tenterprise_userid,t1.tagentsid  --having max(t3.flastrequestdate)>DATEADD(DAY,-3, GETDATE())