Files

39 lines
1.8 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
import io, sys, pymysql
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
conn = pymysql.connect(host='192.168.1.161', user='devgps', password='dev@2021GPS',
database='zentao_dev_2026', charset='utf8mb4')
cur = conn.cursor()
def q(sql):
cur.execute(sql); return cur.fetchall()
# 6月工作天数(周一~周五)
import datetime
wd = sum(1 for i in range(1,31) if datetime.date(2026,6,i).weekday() < 5)
print("2026-06 工作天数:", wd)
# KFZ 开发人员(user_type=3)
devs = q("SELECT account, nickname FROM zt_user WHERE user_type=3 AND deleted='0'")
print("KFZ 开发人数:", len(devs))
# 陈浩 consumed(6月完成任务实际工时)
ch = q("""SELECT account, nickname FROM zt_user WHERE nickname LIKE '%陈浩%' OR account LIKE '%chenhao%'""")
print("陈浩账号:", ch)
acc = ch[0][0]
consumed = q(f"""SELECT SUM(t.consumed) FROM zt_task t
WHERE t.assignedTo='{acc}' AND t.deleted='0' AND t.status NOT IN ('cancel','closed')
AND t.finishedDate>='2026-06-01' AND t.finishedDate<'2026-07-01'""")[0][0]
est = q(f"""SELECT SUM(t.estimate) FROM zt_task t
WHERE t.assignedTo='{acc}' AND t.deleted='0' AND t.status NOT IN ('cancel','closed')
AND t.finishedDate>='2026-06-01' AND t.finishedDate<'2026-07-01'""")[0][0]
print(f"陈浩 6月 consumed={consumed} estimate={est}")
# 团队请假(it_approval 6月,KFZ 人员)
leave = q(f"""SELECT SUM(a.applyDays) FROM it_approval a JOIN zt_user u ON u.nickname=a.applyUserName
WHERE u.user_type=3 AND u.deleted='0' AND a.applyTimeStart>='2026-06-01' AND a.applyTimeStart<'2026-07-01'""")
print("团队6月请假(小时, applyDays字段):", leave[0][0])
# 列下 it_approval 字段确认
cur.execute("SHOW COLUMNS FROM it_approval")
print("it_approval cols:", [r[0] for r in cur.fetchall()])