Commit 6f332410 by dong

fix20221223

parent ce824d1d
...@@ -1452,12 +1452,12 @@ def carrier_edit_land(): ...@@ -1452,12 +1452,12 @@ def carrier_edit_land():
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.SESSIONERR, msg="进行{}操作时用户信息校验失败,请重新登陆后尝试!".format(action_name)) return jsonify(code=RET.SESSIONERR, msg="进行{}操作时用户信息校验失败,请重新登陆后尝试!".format(action_name))
if role_id == 3: # 如果是办事员可以编辑自己提报的内容 # if role_id == 3: # 如果是办事员可以编辑自己提报的内容
pass # pass
if role_id == 2: # 市直部门这区县领导可以编辑该部门所有办事员提报的内容 # if role_id == 2: # 市直部门这区县领导可以编辑该部门所有办事员提报的内容
pass # pass
if role_id == 1: # 局领导能看到所有审核通过的内容 # if role_id == 1: # 局领导能看到所有审核通过的内容
return jsonify(code=RET.THIRDERR, msg="局领导不能编辑数据。") # return jsonify(code=RET.THIRDERR, msg="局领导不能编辑数据。")
land_id = req_dic['land_id'] land_id = req_dic['land_id']
district_name = req_dic['district_name'] district_name = req_dic['district_name']
land_name = req_dic['land_name'] land_name = req_dic['land_name']
...@@ -2329,7 +2329,6 @@ def show_log(): ...@@ -2329,7 +2329,6 @@ def show_log():
req_dic = request.get_json() req_dic = request.get_json()
pop_flag = req_dic['pop_flag'] # ture or false pop_flag = req_dic['pop_flag'] # ture or false
filter_time = req_dic['filter_time'] filter_time = req_dic['filter_time']
# token = req_dic['token']
token = request.headers['token'] token = request.headers['token']
action_name = '获取日志信息' action_name = '获取日志信息'
try: try:
...@@ -2344,55 +2343,61 @@ def show_log(): ...@@ -2344,55 +2343,61 @@ def show_log():
try: try:
log_num = '' log_num = ''
if filter_time: if filter_time:
if role_id == 3: # 如果是办事员智能看到自己提报的内容 # if role_id == 3: # 如果是办事员智能看到自己提报的内容
log_obj = OperationLog.query.filter(and_(OperationLog.operation_time.like('%{}%'.format(filter_time)), # log_obj = OperationLog.query.filter(and_(OperationLog.operation_time.like('%{}%'.format(filter_time)),
OperationLog.operation_people_id == user_id)) # OperationLog.operation_people_id == user_id))
if role_id == 2: # 市直部门这区县领导智能看到该部门所有办事员提报的内容 # if role_id == 2: # 市直部门这区县领导智能看到该部门所有办事员提报的内容
log_obj = OperationLog.query.filter(and_(OperationLog.operation_time.like('%{}%'.format(filter_time)), # log_obj = OperationLog.query.filter(and_(OperationLog.operation_time.like('%{}%'.format(filter_time)),
OperationLog.operation_people_belong == belong_unit)) # OperationLog.operation_people_belong == belong_unit))
if role_id == 1: # 局领导能看到所有审核通过和自己驳回的内容 # if role_id == 1: # 局领导能看到所有审核通过和自己驳回的内容
log_obj = OperationLog.query.filter(OperationLog.operation_time.like('%{}%'.format(filter_time))) # log_obj = OperationLog.query.filter(OperationLog.operation_time.like('%{}%'.format(filter_time)))
# log_obj_list = log_obj.order_by(
# OperationLog.operation_time.desc()).paginate(page, per_page).items
log_obj = OperationLog.query.filter(OperationLog.operation_time.like('%{}%'.format(filter_time)))
log_obj_list = log_obj.order_by( log_obj_list = log_obj.order_by(
OperationLog.operation_time.desc()).paginate(page, per_page).items OperationLog.operation_time.desc()).paginate(page, per_page).items
else: else:
if role_id == 3: # 如果是办事员智能看到自己提报的内容 # if role_id == 3: # 如果是办事员智能看到自己提报的内容
log_obj = OperationLog.query.filter(OperationLog.operation_people_id == user_id) # log_obj = OperationLog.query.filter(OperationLog.operation_people_id == user_id)
log_num = log_obj.count() # log_num = log_obj.count()
if pop_flag: # if pop_flag:
month_day = datetime.now().strftime("%Y-%m-01 00:00:00") # month_day = datetime.now().strftime("%Y-%m-01 00:00:00")
login_time_obj = OperationLog.query.filter(OperationLog.operation_people_id == user_id, # login_time_obj = OperationLog.query.filter(OperationLog.operation_people_id == user_id,
OperationLog.action.like('%登录%'), # OperationLog.action.like('%登录%'),
OperationLog.operation_time >= month_day).all() # OperationLog.operation_time >= month_day).all()
if len(login_time_obj) == 1: # if len(login_time_obj) == 1:
current_month = datetime.now().strftime("%Y-%m-26 00:00:00") # current_month = datetime.now().strftime("%Y-%m-26 00:00:00")
log_obj1 = OperationLog.query.filter(OperationLog.operation_people_id == user_id, # log_obj1 = OperationLog.query.filter(OperationLog.operation_people_id == user_id,
OperationLog.action == '导入', # OperationLog.action == '导入',
OperationLog.operation_time < current_month).all() # OperationLog.operation_time < current_month).all()
if not log_obj1: # if not log_obj1:
# 记录日志 # # 记录日志
upload_time = datetime.now() # upload_time = datetime.now()
current_year = datetime.now().year # current_year = datetime.now().year
operation_message = "请及时上传{}年{}月土地、商业楼宇、标准厂房数据;如无请忽略。".format(str(current_year), current_month) # operation_message = "请及时上传{}年{}月土地、商业楼宇、标准厂房数据;如无请忽略。".format(str(current_year), current_month)
log = OperationLog(read_type=0, operation_people_id=user_id, operation_time=upload_time, # log = OperationLog(read_type=0, operation_people_id=user_id, operation_time=upload_time,
operation_people=user_name, # operation_people=user_name,
section=section, # section=section,
operation_message=operation_message, operation_mobile='', # operation_message=operation_message, operation_mobile='',
action='使用密码登录成功') # action='使用密码登录成功')
db.session.add(log) # db.session.add(log)
db.session.commit() # db.session.commit()
return jsonify(code=RET.WARNING, msg='25号之前还未上传数据!') # return jsonify(code=RET.WARNING, msg='25号之前还未上传数据!')
else: # else:
return jsonify(code=RET.OK, msg='本月不是第一次登录,无需提示!') # return jsonify(code=RET.OK, msg='本月不是第一次登录,无需提示!')
#
if role_id == 2: # 市直部门这区县领导智能看到该部门所有办事员提报的内容 # if role_id == 2: # 市直部门这区县领导智能看到该部门所有办事员提报的内容
log_obj = OperationLog.query.filter(OperationLog.operation_people_belong == belong_unit) # log_obj = OperationLog.query.filter(OperationLog.operation_people_belong == belong_unit)
log_num = log_obj.count() # log_num = log_obj.count()
#
if role_id == 1: # 局领导能看到所有审核通过和自己驳回的内容 # if role_id == 1: # 局领导能看到所有审核通过和自己驳回的内容
log_obj = OperationLog.query.filter() # log_obj = OperationLog.query.filter()
log_num = log_obj.count() # log_num = log_obj.count()
log_obj_list = log_obj.order_by( # log_obj_list = log_obj.order_by(
OperationLog.operation_time.desc()).paginate(page, per_page).items # OperationLog.operation_time.desc()).paginate(page, per_page).items
log_obj = OperationLog.query.filter()
log_num = log_obj.count()
log_obj_list = log_obj.order_by(OperationLog.operation_time.desc()).paginate(page, per_page).items
print(log_obj_list) print(log_obj_list)
if log_obj_list: if log_obj_list:
data = [{ data = [{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment