#2 一事多报更新

오픈
sjw sjw/develop 에서 sjw/master 로 4 commits 를 머지하려 합니다

+ 6 - 4
src/dsb/com/cnd3b/common/restful/SQL/手机账号列表查询.sql

@@ -23,10 +23,12 @@ select t1.tenterprise_userid
            when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
                                            (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then 1
            else 0 end                                                                as fisneedpay,
-       case
-           when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
-                                           (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '当前账号未激活'
-           else '' end                                                               as fioserrmsg,
+      case
+       when t6.tpayinfoid IS null and not exists(select *from tpayinfo where tagentsid=t1.tagentsid OR tenterprise_userid=t1.tenterprise_userid) and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
+                                                 (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '当前账号未激活'
+                 when t6.tpayinfoid IS null and exists(select *from tpayinfo where tagentsid=t1.tagentsid OR tenterprise_userid=t1.tenterprise_userid) and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
+                                                 (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '账号已到期,请前往续费'
+                 else '' end                                                               as fioserrmsg,
        case
            when t6.tpayinfoid IS null and t1.fusertype = '经销商' then t5.fagentamount
            when t6.tpayinfoid IS null and t1.fusertype = '企业' then t5.FENTERPRISEUSERAMOUNT

+ 5 - 4
src/dsb/com/cnd3b/common/restful/SQL/持久化账号列表查询.sql

@@ -23,10 +23,11 @@ select t1.tenterprise_userid
            when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
                                            (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then 1
            else 0 end                                                               as fisneedpay,
-       case
-           when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
-                                           (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '当前账号未激活'
-           else '' end                                                              as fioserrmsg,
+      case when t6.tpayinfoid IS null and not exists(select *from tpayinfo where tagentsid=t1.tagentsid OR tenterprise_userid=t1.tenterprise_userid) and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
+                                                 (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '当前账号未激活'
+                 when t6.tpayinfoid IS null and exists(select *from tpayinfo where tagentsid=t1.tagentsid OR tenterprise_userid=t1.tenterprise_userid) and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
+                                                 (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '账号已到期,请前往续费'
+                 else '' end                                                               as fioserrmsg,
        case
            when t6.tpayinfoid IS null and t1.fusertype = '经销商' then t5.fagentamount
            when t6.tpayinfoid IS null and t1.fusertype = '企业' then t5.FENTERPRISEUSERAMOUNT

+ 5 - 4
src/dsb/com/cnd3b/common/restful/SQL/账号列表查询.sql

@@ -23,10 +23,11 @@ select t1.tenterprise_userid
            when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
                                            (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then 1
            else 0 end                                                                as fisneedpay,
-       case
-           when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
-                                           (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '当前账号未激活'
-           else '' end                                                               as fioserrmsg,
+      case when t6.tpayinfoid IS null and not exists(select *from tpayinfo where tagentsid=t1.tagentsid OR tenterprise_userid=t1.tenterprise_userid) and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
+                                                 (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '当前账号未激活'
+                 when t6.tpayinfoid IS null and exists(select *from tpayinfo where tagentsid=t1.tagentsid OR tenterprise_userid=t1.tenterprise_userid) and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
+                                                 (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '账号已到期,请前往续费'
+                 else '' end                                                               as fioserrmsg,
        case
            when t6.tpayinfoid IS null and t1.fusertype = '经销商' then t5.fagentamount
            when t6.tpayinfoid IS null and t1.fusertype = '企业' then t5.FENTERPRISEUSERAMOUNT

+ 1 - 1
src/dsb/com/cnd3b/restcontroller/system/payment/payment.java

@@ -129,7 +129,7 @@ public class payment extends Controller {
             }
             nativepay.after();
             if (!codeurl.equals("")) {
-                return getSucReturnObject().setData(codeurl).toString();
+                return getSucReturnObject().setData(JSONObject.parseObject(codeurl)).toString();
             }
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -1,15 +1,6 @@
-select distinct t1.tenterprise_userid as userid
+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(
-		   select siteid,tpayinfoid,tagentsid,tenterprise_userid from tpayinfo
-		   where (fbegdate > GETDATE() or 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)
-		   )
-        )
-group by t1.tenterprise_userid  having max(t3.flastrequestdate)>DATEADD(DAY,-3, GETDATE())
+         inner join tappmodelauth t5 on t1.siteid = t5.siteid and t5.fisdefault = 1 and((t1.fusertype = '经销商' and t5.fagentamount > 0) or (t1.fusertype = '企业' and t5.fenterpriseuseramount > 0))
+		 left join tpayinfo t6 on  t6.fbegdate <= GETDATE() and t6.fenddate >= GETDATE() and t1.siteid=t6.siteid and (( t1.fusertype = '经销商' and t1.tagentsid = t6.tagentsid) or (t1.fusertype = '企业' and t1.tenterprise_userid = t6.tenterprise_userid))
+where  isnull(t1.accesstoken,'') !='' and t6.tpayinfoid is null

+ 2 - 4
src/dsb/com/cnd3b/service/UserAutoLogOut.java

@@ -33,16 +33,14 @@ public class UserAutoLogOut extends BaseClass implements Runnable {
         DBConnect dbConnect = new DBConnect();
         SQLFactory factory = new SQLFactory(this, "ʧЧÕ˺Ųéѯ");
         Rows rows = dbConnect.runSqlQuery(factory.getSQL());
-        ArrayList<String> sqllist = new ArrayList<>();
         for (Row row : rows) {
-            String userid = row.getString("userid");
+            long userid = row.getLong("userid");
             if (parameter.userIdList.containsKey(userid)) {
                 String token = parameter.userIdList.get(userid).getString("token");
                 parameter.tokenlist.remove(token);
                 parameter.userIdList.remove(userid);
-                sqllist.add("update tenterprise_users set accesstoken=null where accesstoken='" + token + "'");
             }
+            dbConnect.runSqlUpdate("update tenterprise_users set accesstoken=null where tenterprise_userid='" + userid + "'");
         }
-        new DBConnect().runSqlUpdate(sqllist);
     }
 }