示例#1
0
 def status(self, bugId, status, currentUser):
     """
     查询调试记录列表
     """
     try:
         bugSQL = """
             UPDATE man_pro_bug
             SET
                 BUG_STATUS='{status}',
                 HANDLE_BY='{handleBy}',
                 HANDLE_TIME='{handleTime}'
             WHERE BUG_ID='{bugId}';
             """.format(status='created' if status == 'reset' else status,
                        handleBy=currentUser,
                        handleTime=Utils.getLocalTime(),
                        bugId=bugId)
         recordSQL = """
             INSERT INTO man_bug_record(
                 ID,
                 BUG_ID,
                 BUG_STATUS,
                 HANDLE_BY,
                 HANDLE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}'
             );
             """.format(Utils.makeId(), bugId, status, currentUser,
                        Utils.getLocalTime())
         Utils.log('更新问题状态SQL', bugSQL)
         Utils.log('插入调试记录SQL', recordSQL)
         return PySQL.execute(bugSQL) > 0 and PySQL.execute(recordSQL) > 0
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return False
示例#2
0
 def reset(self, userId, currentAuth):
     """
     重置用户密码 111111
     """
     count = 0
     try:
         besql = """
             SELECT 1 FROM man_auth_user
             WHERE USER_ID='{}'
             AND USER_PWD='96e79218965eb72c92a549dd5a330112';
             """.format(userId)
         res = PySQL.execute(besql)
         if res > 0:
             Utils.log('愿密码已为默认值')
             return True
         sql = """
             UPDATE man_auth_user
             SET USER_PWD=Default
             WHERE USER_ID='{}'
             AND USER_AUTH >= '{}';
             """.format(userId, currentAuth)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
         print(count)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#3
0
 def insert(self, proId, proName, modId, modName, bugTitle, bugLevel,
            bugDes, userId, currentUser):
     """
     添加新建问题记录
     """
     count = 0
     try:
         bugId = Utils.makeId()
         sql = """
             INSERT INTO man_pro_bug(
                 BUG_ID,
                 PRO_ID,
                 PRO_NAME,
                 MODULE_ID,
                 MODULE_NAME,
                 BUG_TITLE,
                 BUG_LEVEL,
                 BUG_DES,
                 CREATE_BY,
                 CREATE_TIME,
                 HANDLE_BY,
                 HANDLE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}','{}','{}','{}','{}','{}','{}'
             );
             """.format(bugId, proId, proName, modId, modName, bugTitle,
                        bugLevel, bugDes, currentUser, Utils.getLocalTime(),
                        userId if userId else currentUser,
                        Utils.getLocalTime())
         recordSQL = """
             INSERT INTO man_bug_record(
                 ID,
                 BUG_ID,
                 BUG_STATUS,
                 HANDLE_BY,
                 HANDLE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}'
             );
             """.format(Utils.makeId(), bugId, 'created', currentUser,
                        Utils.getLocalTime())
         Utils.log('打印新建问题SQL', sql)  # print log
         count = PySQL.execute(sql)
         PySQL.execute(recordSQL)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#4
0
 def insert(self, userId, userName, userAuth, userLogin, userCreator):
     """
     添加用户记录
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_auth_user(
                 USER_ID,
                 USER_NAME,
                 USER_AUTH,
                 USER_LOGIN,
                 USER_CREATOR,
                 USER_CRE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}'
             );
             """.format(userId, userName, userAuth, userLogin, userCreator,
                        Utils.getLocalTime())
         Utils.log('添加用户记录SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#5
0
 def insert(self, proName, proType, proUse, proDes, userCreator):
     """
     添加 project 记录
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_pro_info(
                 PRO_ID,
                 PRO_NAME,
                 PRO_TYPE,
                 PRO_LEADER,
                 PRO_USE,
                 PRO_CRE_TIME,
                 PRO_DES
             )VALUES(
                 '{}','{}','{}','{}','{}','{}','{}'
             );
             """.format(self.makeProId(), proName, proType, userCreator,
                        proUse, Utils.getLocalTime(), proDes)
         Utils.log('打印创建项目SQL', sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#6
0
 def inset(self, fileName, projectId, projectName, uploadBy):
     """
     上传文件信息入库
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_pro_file(
                 ID,
                 FILE_NAME,
                 PRO_ID,
                 PRO_NAME,
                 UPLOAD_BY,
                 UPLOAD_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}'
             );
             """.format(Utils.makeId(), fileName, projectId, projectName,
                        uploadBy, Utils.getLocalTime())
         Utils.log('打印上传文件信息入库SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#7
0
 def append(self, proId, proName, userCreator, allUsers):
     """
     添加 project 记录
     """
     count = 0
     try:
         tmp = []
         for u in allUsers:
             tmp.append("('{}','{}','{}','{}','{}')".format(
                 proId, proName, u['userId'], u['userName'], userCreator))
         t = ",".join(tmp)
         Utils.log(t)
         sql = """
             INSERT INTO man_pro_member(
                 PRO_ID,
                 PRO_NAME,
                 USER_ID,
                 USER_NAME,
                 USER_CREATOR
             )VALUES
             {};
             """.format(t)
         Utils.log('打印创建项目SQL', sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#8
0
 def insert(self, proId, userId, modId, modName, modDes, modStart, modEnd):
     """
     添加分配任务记录
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_pro_task(
                 PRO_ID,
                 USER_ID,
                 MODULE_ID,
                 MODULE_NAME,
                 MODULE_DES,
                 MODULE_START,
                 MODULE_END,
                 CREATE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}','{}','{}','{}'
             );
             """.format(proId, userId, modId, modName, modDes, modStart,
                        modEnd, Utils.getLocalTime())
         Utils.log('打印创建项目SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#9
0
 def valid(self, proId):
     """
     校验项目是否已分配成员和模块
     """
     count = 0
     try:
         userSQl = """
             SELECT 1 from man_pro_member
             WHERE PRO_ID='{proId}';
             """.format(proId=proId)
         moduleSQL = """
             SELECT 1 from man_pro_module
             WHERE PRO_ID='{proId}';
             """.format(proId=proId)
         count = 1 if PySQL.execute(userSQl) > 0 or PySQL.execute(
             moduleSQL) > 0 else 0
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#10
0
 def updatePwd(self, id, pwd, new):
     """
     检查登录信息,修改账户密码
     """
     try:
         sql = "UPDATE man_auth_user SET USER_PWD='{2}' WHERE USER_ID='{0}' AND USER_PWD='{1}';".format(
             id, pwd, new)
         return PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
         return 0
示例#11
0
 def delete(self, fileId, userCreator):
     """
     删除文件
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_file
             WHERE ID='{}';
             """.format(fileId)
         Utils.log("删除项目文件", sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#12
0
 def delete(self, modId):
     """
     删除任务进度
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_rate
             WHERE MODULE_ID='{}';
             """.format(modId)
         Utils.log(sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#13
0
 def delete(self, proId):
     """
     删除 project 记录
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_info
             WHERE PRO_ID='{}';
             """.format(proId)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#14
0
 def remove(self, proId, userId):
     """
     移除成员信息, 如果已分配任务则不能移除
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_pro_member
             WHERE PRO_ID='{proId}'
             AND USER_ID='{userId}';
             """.format(proId=proId, userId=userId)
         Utils.log('打印移除成员SQL', sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#15
0
 def valid(self, proId, userId):
     """
     校验成员是否已分配任务
     """
     count = 0
     try:
         SQL = """
             SELECT 1 FROM man_pro_task
             WHERE PRO_ID='{proId}'
             AND USER_ID='{userId}';
             """.format(proId=proId, userId=userId)
         Utils.log('打印校验成员SQL', SQL)  # print log
         count = PySQL.execute(SQL)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#16
0
 def delete(self, userId, currentAuth):
     """
     删除用户记录
     """
     count = 0
     try:
         sql = """
             DELETE FROM man_auth_user
             WHERE USER_ID='{}'
             AND USER_AUTH > '{}';
             """.format(userId, currentAuth)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#17
0
 def update(self, proId, proType, proUse, proDes):
     """
     修改 project 记录
     """
     count = 0
     try:
         sql = """
             UPDATE man_pro_info SET 
                 PRO_TYPE='{}',
                 PRO_USE='{}',
                 PRO_DES='{}'
             WHERE PRO_ID='{}';
             """.format(proType, proUse, proDes, proId)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#18
0
 def update(self, userId, userName, userAuth, userLogin, currentAuth):
     """
     修改用户记录
     """
     count = 0
     try:
         sql = """
             UPDATE man_auth_user SET
                 USER_NAME='{}',
                 USER_AUTH='{}',
                 USER_LOGIN='******'
             WHERE USER_ID='{}'
             AND USER_AUTH > '{}';
             """.format(userName, userAuth, userLogin, userId, currentAuth)
         Utils.log(sql)  # print log
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#19
0
 def update(self, data, currentUser):
     """
     更新任务进度
     """
     count = 0
     try:
         sql = """
             UPDATE man_pro_rate SET
                 TASK_RATE={},
                 UPDATE_BY='{}',
                 UPDATE_TIME='{}'
             WHERE TASK_RATE != {}
             AND USER_ID='{}'
             AND MODULE_ID='{}';
             """.format(data['TASK_RATE'], currentUser,
                        Utils.getLocalTime(), data['TASK_RATE'],
                        data['USER_ID'], data['MODULE_ID'])
         Utils.log('打印更新任务进度SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0
示例#20
0
 def insert(self, userId, modId, currentUser):
     """
     初始化任务进度
     """
     count = 0
     try:
         sql = """
             INSERT INTO man_pro_rate(
                 USER_ID,
                 MODULE_ID,
                 TASK_RATE,
                 UPDATE_BY,
                 UPDATE_TIME
             )VALUES(
                 '{}','{}','{}','{}','{}'
             );
             """.format(userId, modId, 0, currentUser, Utils.getLocalTime())
         Utils.log('打印任务进度SQL', sql)
         count = PySQL.execute(sql)
     except Exception as e:
         print('ERROR {}'.format(e))
         Utils.log('ERROR {}'.format(e))
     return count > 0