Ejemplo n.º 1
0
def db_init():
    cursor, db = getDBLink(2)
    return db.cursor()
import pymysql, datetime, uuid, time, queue, threading
from time import sleep, ctime
from 补数据专区 import bsUtil, xiancheng
sql = "SELECT * from tss_member_attend_class_record a where a.createTime is null;"
cursor, db = bsUtil.getDBLink(1)
cursor.execute(sql)
contents = cursor.fetchall()
Ejemplo n.º 3
0
import pymysql, datetime, uuid, time

from 补数据专区.bsUtil import getDBLink

sql = "SELECT aa.* ,d.schoolName from (SELECT a.* ,sum(b.amount) as amount  " \
      "from tss_member_check_attendance_history a LEFT JOIN " \
      "tss_right_statistic b on a.checkAttendanceId = b.attendanceId" \
      " where a.attendenceStatus =4  and  b.isDelete=0 GROUP BY a.checkAttendanceId )aa" \
      " LEFT JOIN sys_admin_user c on c.id = aa.adminUserId LEFT JOIN" \
      " sys_school d on d.id =c.schoolId where  aa.amount !=0.00 and" \
      " d.schoolName not in ('线上测试投资','线上测试园2督导专用') "
cursor, db = getDBLink(1)
cursor.execute(sql)
contents = cursor.fetchall()

courseIdSql = "SELECT * from tss_right_statistic where attendanceId ='%s' and isDelete =0"
one = 0
for s in contents:
    cursor.execute(courseIdSql % s[1])
    courseIds = cursor.fetchall()
    if (courseIds is not None and len(courseIds) == 1):
        print(s[1] + " is 只有一条")
        one += 1
        insetSql = "INSERT INTO `tss`.`tss_right_statistic`(`id`, `stuId`, `type`, `responsibilityType`, " \
                   "`attendanceId`, `paymentId`, `returnPremiumId`, `memberPackageId`, `amount`, `adminUserId`, " \
                   "`isDelete`, `createTime`, `updateTime`, `version`, `appointmentManageId`, `addsubtractId`, " \
                   "`supplementaryTime`, `importTime`) VALUES (" \
                   "'%s', " \
                   "'%s', " \
                   "%d, %d, '%s', " \
                   "%s, %s, %s, %s, " \