Commit a890e9f9 by dong

fix20230106

parent c14ed130
......@@ -241,7 +241,7 @@ def upload_project_data2():
return jsonify(code=RET.SESSIONERR, msg="进行操作时用户信息校验失败,请重新登陆后尝试!")
# 上传的文件
file = request.files['file']
print(file.filename) # 打印文件名
# print(file.filename) # 打印文件名
try:
f = file.read() # 文件内容
......
......@@ -781,7 +781,7 @@ def upload_project_data1():
table = data.sheets()[0]
names = data.sheet_names() # 返回book中所有工作表的名字
status = data.sheet_loaded(names[0]) # 检查sheet1是否导入完毕
print(status)
# print(status)
nrows = table.nrows # 获取该sheet中的有效行数
except Exception as e:
current_app.logger.error(e)
......
......@@ -649,7 +649,7 @@ def export_jc_data1(data_time, path, pro_path):
sheet_name = k
sheet = excel.add_sheet(sheet_name)
head_list = v
print(head_list)
# print(head_list)
for j in range(len(head_list)):
sheet.write(0, j, head_list[j])
# 写入数据,从第二行(i+1)
......@@ -778,7 +778,7 @@ def export_jc_data2(data_time, path, pro_path):
sheet_name = k
sheet = excel.add_sheet(sheet_name)
head_list = v
print(head_list)
# print(head_list)
for j in range(len(head_list)):
sheet.write(0, j, head_list[j])
# 写入数据,从第二行(i+1)
......
......@@ -33,7 +33,7 @@ def get_fixed_role_detail():
try:
chart_obj = OrganizationChart.query.get(role_id)
print(chart_obj)
# print(chart_obj)
data = {
"three_role": chart_obj.three_role,
"page_permission_id": eval(chart_obj.page_permission_id),
......
......@@ -16,10 +16,6 @@ def upload_daily_picture(file_name, file):
bucket_name = "zysf-store"
endpoint = "oss-cn-beijing.aliyuncs.com"
bucket = oss2.Bucket(auth, endpoint, bucket_name)
# file_name = file_name.split('.')
# time_stamp = '{0:%Y%m%d%H%M%S}'.format(datetime.now())
# file_name = file_name[0] + time_stamp + '.' + file_name[1]
# file_name = file_name[0] + '.' + file_name[1]
bucket.put_object('晋城招商图谱平台/产业大类图标/' + file_name, file)
icon_url = "https://{}.{}/{}".format(bucket_name, endpoint, '/晋城招商图谱平台/产业大类图标/' + file_name)
time.sleep(1)
......
......@@ -57,7 +57,7 @@ def org_downbox():
continue
groups_data = [{"id": group.id, "name": group.name} for group in groups]
sec.update({"children": groups_data})
print(sec)
# print(sec)
return jsonify(code=RET.OK, data=gover_data, msg="查询成功!")
......@@ -228,7 +228,9 @@ def update_user():
if password and password1:
if password != password1:
return jsonify(code=RET.PARAMERR, msg="密码和确认密码不一致!")
user.password = password
else:
user.password = password
db.session.commit()
return jsonify(code=RET.OK, msg="修改成功")
except Exception as e:
......@@ -249,9 +251,6 @@ def update_account():
return jsonify(code=RET.PARAMERR, msg="参数不完整")
try:
user = User.query.get(_id)
# if not user.role and status == 1: # 没有角色,想通过
# return jsonify(code=RET.DATAERR, msg="请先在编辑,为用户添加职级角色")
user.status = status
db.session.commit()
dict_zh = {1: "通过", 2: "在审", 3: "驳回"}
......
......@@ -67,7 +67,7 @@ def verify_identity(token, action_name):
elif section:
belong_unit = section
print(mobile)
# print(mobile)
# if real_name:
user_name = user_obj.real_name # 真实姓名
# elif name and real_name:
......@@ -78,7 +78,7 @@ def verify_identity(token, action_name):
# user_name = real_name
# else:
# user_name = ''
return section, user_name, operation_mobile, user_id, role_id, belong_unit
return section, user_name, operation_mobile, user_id, belong_unit
def verify_token(token):
......
......@@ -43,6 +43,6 @@ if __name__ == '__main__':
'pub_date': '2021-07-19', 'sales': 1, 'price': 12.9, 'type': '榜单'}
# print(encrypt(json.dumps(data)))
print(encrypt("qwe"))
# print(encrypt("qwe"))
# print(decrypt(res))
# print(json.loads(decrypt(res)))
......@@ -244,7 +244,7 @@ def search():
data = es.search(index="jincheng_pictext_index_202202221626_29780d68", body=body)
data_list = []
print(data_list)
# print(data_list)
size = data["hits"]['total']
# 数据的列表添加进去
......@@ -344,7 +344,7 @@ def create_body(page, page_size, args_query, args_term):
for k, v in args_term.items():
body["query"]["bool"]["must"].append({"match": {"{}".format(k): "{}".format(v)}})
print(body)
# print(body)
return body
# 原始
......
......@@ -77,7 +77,9 @@ def find_up_thr(name_query, relation):
def get_cluster():
try:
cluster_obj = IndustryChain.query.filter_by(industry_type=0, status=1).all()
data = [{"id": i.id, 'name': i.industry_name, "icon": i.icon_url, "icon1": i.icon_url1} for i in cluster_obj]
data = [{"id": i.id, 'name': i.industry_name, 'industry_level': 1,
"icon": i.icon_url, "icon1": i.icon_url1}
for i in cluster_obj]
return jsonify(code=RET.OK, msg='产业集群名称获取成功!', data=data)
except Exception as e:
current_app.logger.error(e)
......@@ -98,7 +100,7 @@ def industry_cluster():
find_up_thr1(2, industry_id),
find_up_thr1(3, industry_id)]
}
print(result)
# print(result)
except Exception as e:
current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="数据异常")
......@@ -108,7 +110,7 @@ def industry_cluster():
def get_count(chain_name):
company_count = Company.query.filter(
Company.product_all.like('%{}%'.format(chain_name))).count()
print(chain_name + '===' + str(company_count))
# print(chain_name + '===' + str(company_count))
return company_count
......@@ -421,7 +423,7 @@ def get_data(name, industry_level, select_flag, page, perpage):
}
return factory_data
except Exception as e:
print(e)
# print(e)
current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="数据库查询错误")
......@@ -474,7 +476,7 @@ def industry_policy():
size = ''
name = Industry.query.filter_by(nid=inid).first().oname # 获取导航对应的真名
# name = '煤层气'
print(name)
# print(name)
if industry_level == 1:
if policy_level == 1: # 国家级
indu_policy = InduPolicy.query.filter(
......@@ -704,7 +706,7 @@ def get_zaiti_detail_data():
req_dict = request.get_json()
id = req_dict.get('id')
cate_id = req_dict.get('cate_id') # 1行政区,2园区,3土地,4楼宇,5厂房
print(cate_id)
# print(cate_id)
if cate_id in [1, 2]:
try:
......@@ -1146,7 +1148,7 @@ def attract_map():
if province and city and district: # 区数据
num = enterprise.filter_by(province=province, city=city, district=district).count()
district_data = Company.query.filter_by(province=province, city=city, district=district).first()
print(district_data)
# print(district_data)
if district_data:
df.append({"name": district,
"value": num,
......
......@@ -60,22 +60,22 @@ def show_area():
# 获取土地总面积
area_obj_list = com.get_total_land_area('', '', district_name, '', '')
total_area = sum([float(area_obj.total_area if area_obj.total_area else 0) for area_obj in area_obj_list])
print(total_area)
# print(total_area)
# 获取工业用地面积
gong_area_obj_list = com.get_total_land_area('', '', district_name, '工业用地', '')
gong_total_area = round(sum([float(area_obj.total_area if area_obj.total_area else 0) for area_obj in gong_area_obj_list]), 2)
print(gong_total_area)
# print(gong_total_area)
# 获取商业用地面积
shang_area_obj_list = com.get_total_land_area('', '', district_name, '商业用地', '')
shang_total_area = round(sum([float(area_obj.total_area if area_obj.total_area else 0) for area_obj in shang_area_obj_list]), 2)
print(shang_total_area)
# print(shang_total_area)
# 其他用地
other_area = round((total_area - gong_total_area - shang_total_area), 2)
area_dic = {"industrial": gong_total_area, "business": shang_total_area, "other": other_area}
print(area_dic)
# print(area_dic)
area_data.append(area_dic)
except Exception as e:
current_app.logger.error(e)
......@@ -85,11 +85,11 @@ def show_area():
# 获取今年厂房总面积
current_area_obj_list = com.get_total_factory_area(current_year, current_day, district_name)
current_total_area = round(sum([float(area_obj.factory_area if area_obj.factory_area else 0) for area_obj in current_area_obj_list]), 2)
print(current_total_area)
# print(current_total_area)
# 获取去年厂房总面积
last_area_obj_list = com.get_total_factory_area(last_year, last_year_day, district_name)
last_total_area = round(sum([float(area_obj.factory_area if area_obj.factory_area else 0) for area_obj in last_area_obj_list]), 2)
print(last_total_area)
# print(last_total_area)
# 计算同比
if last_total_area != 0:
total_area_rate = round(((current_total_area - last_total_area) / last_total_area) * 100, 2)
......@@ -102,13 +102,13 @@ def show_area():
sum([float(area_obj.empty_area if area_obj.empty_area else 0) for area_obj in current_empty_area_obj_list]), 2)
factory_current_total_area = round(
sum([float(area_obj.factory_area if area_obj.factory_area else 0) for area_obj in current_empty_area_obj_list]), 2)
print(factory_current_empty_area)
# print(factory_current_empty_area)
# 获取去年当期总闲置厂房面积
last_empty_area_obj_list = com.get_empty_factory_area(last_year, last_year_day, '', district_name)
factory_last_empty_area = round(sum([float(area_obj.empty_area if area_obj.empty_area else 0) for area_obj in last_empty_area_obj_list]), 2)
factory_last_total_area = round(sum([float(area_obj.factory_area if area_obj.factory_area else 0) for area_obj in last_empty_area_obj_list]), 2)
print(factory_last_empty_area)
# print(factory_last_empty_area)
# 计算总闲置面积同比
if factory_last_empty_area != 0:
factory_empty_rate = round(((factory_current_empty_area - factory_last_empty_area) / factory_last_empty_area) * 100, 2)
......@@ -156,11 +156,11 @@ def show_area():
com = Common()
current_area_obj_list = com.get_total_build_area(current_year, current_day, district_name)
current_total_area = round(sum([float(area_obj.build_area if area_obj.build_area else 0) for area_obj in current_area_obj_list]), 2)
print(current_total_area)
# print(current_total_area)
# 获取去年厂房总面积
last_area_obj_list = com.get_total_build_area(last_year, last_year_day, district_name)
last_total_area = round(sum([float(area_obj.build_area if area_obj.build_area else 0) for area_obj in last_area_obj_list]), 2)
print(last_total_area)
# print(last_total_area)
# 计算同比
if last_total_area != 0:
total_area_rate = round(((current_total_area - last_total_area) / last_total_area) * 100, 2)
......@@ -173,12 +173,12 @@ def show_area():
sum([float(area_obj.empty_area if area_obj.empty_area else 0) for area_obj in current_empty_area_obj_list]), 2)
build_current_total_area = round(
sum([float(area_obj.total_area if area_obj.total_area else 0) for area_obj in current_empty_area_obj_list]), 2)
print(build_current_empty_area)
# print(build_current_empty_area)
# 获取去年当期总闲置厂房面积
last_empty_area_obj_list = com.get_empty_build_area(last_year, last_year_day, '', district_name)
build_last_empty_area = round(sum([float(area_obj.empty_area if area_obj.empty_area else 0) for area_obj in last_empty_area_obj_list]), 2)
build_last_total_area = round(sum([float(area_obj.total_area if area_obj.total_area else 0) for area_obj in last_empty_area_obj_list]), 2)
print(build_last_empty_area)
# print(build_last_empty_area)
if build_last_empty_area != 0:
build_empty_rate = round(((build_current_empty_area - build_last_empty_area) / build_last_empty_area) * 100, 2)
else:
......
......@@ -88,7 +88,7 @@ def attract_map():
if province and city and district: # 区数据
num = enterprise.filter_by(province=province, city=city, district=district).count()
district_data = Enterprise.query.filter_by(province=province, city=city, district=district).first()
print(district_data)
# print(district_data)
if district_data:
df.append({"name": district,
"value": num,
......
......@@ -204,7 +204,7 @@ def topt():
company = enterprise.filter_by(quoted_company=1).group_by(Enterprise.company_name,
Enterprise.takingn).order_by(
Enterprise.takingn.desc()).limit(10).all()
print(company)
# print(company)
if company:
sums = float(company[0].takingn if company[0].takingn else 1)
data = [
......@@ -222,7 +222,7 @@ def topt():
Enterprise.num_patent.desc()).limit(10).all()
if company:
sums = float(company[0].num_patent if company[0].num_patent else 1)
print(sums)
# print(sums)
data = [
{
"id": item.id,
......
......@@ -59,7 +59,7 @@ def send_phone_code():
data = send_code(mobile, sms_code)
if sms_type == 3: # 密码重置验证码
data = send_reset_password_code(mobile, sms_code)
print(data)
# print(data)
if data['Message'] == 'OK':
# 保存真实的短信验证码
try:
......@@ -247,7 +247,7 @@ def login_bypwd():
# 判断错误次数是否超过限制,如果超过则10分钟内禁止此IP登录
user_ip = request.remote_addr
print("IP地址:", user_ip)
# print("IP地址:", user_ip)
# 获取ip的锁定时间
try:
......@@ -301,11 +301,27 @@ def login_bypwd():
# 若成功保存登录状态
token = create_token(user.id)
# 页面权限列表
page_permission_list = ''
fun_permission_list = ''
org_obj = user.org
if org_obj:
page_permission_list = eval(org_obj.page_permission_id)
fun_permission_list = eval(org_obj.fun_permission_id)
time = datetime.now()
current_app.logger.error(
'++++++++++++++++++++++++++++登录日志>>>{}:{}通过使用手机-密码登录成功了!+++++++++++++++++++++++=++'.format(time, mobile))
return jsonify(code=RET.OK, msg="登录成功", data={"token": token, "flag": user.flag})
# return jsonify(code=RET.OK, msg="登录成功", token=token, flag=user.flag,
# page_permission_list=page_permission_list,
# fun_permission_list=fun_permission_list)
return jsonify(code=RET.OK,
data={"msg": "登录成功",
"token": token,
"flag": user.flag,
"page_permission_list": page_permission_list,
"fun_permission_list": fun_permission_list})
# 微信授权
......@@ -502,7 +518,7 @@ def register():
# 判断并添加用户信息
try:
ouser = User.query.filter_by(mobile=mobile).first()
print(ouser)
# print(ouser)
if ouser and ouser.flag == 1 and ouser.status == 0: # 外部访客被禁止
return jsonify(code=RET.DATAEXIST, msg="当前用户被禁止,请联系管理员")
......@@ -716,7 +732,7 @@ def change_password():
return jsonify(code=RET.DATAERR, msg="密码长度最少为8位")
# 密码应设置为包含大小写字母、数字、特殊符号'!@#$%^&*()_+=-'
if not (re.search(r'\d+', new_password) and re.search(r'[a-z]+', new_password) and re.search(r'[A-Z]+',
new_password) and re.search(
new_password) and re.search(
r'.[!@#$%^&*()_+=-]+', new_password)):
return jsonify(code=RET.DATAERR, msg="密码应设置为包含大小写字母、数字、特殊符号'!@#$%^&*()_+=-'")
......@@ -843,15 +859,15 @@ def get_collect():
"create_time": create_time.create_time.strftime('%Y-%m-%d %H:%M:%S'),
"build_date": i.build_date.strftime("%Y-%m-%d") if i.build_date else "-",
"high_new": '高新技术企业' if i.high_new == '1' else '',
"tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '',
"scale": '规模以上企业' if i.scale == '1' else '',
"serve": '限额以上服务业' if i.serve == '1' else ''
"tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '',
"scale": '规模以上企业' if i.scale == '1' else '',
"serve": '限额以上服务业' if i.serve == '1' else ''
})
else:
continue
......@@ -862,15 +878,15 @@ def get_collect():
"create_time": create_time.create_time.strftime('%Y-%m-%d %H:%M:%S'),
"build_date": i.build_date.strftime("%Y-%m-%d") if i.build_date else "-",
"high_new": '高新技术企业' if i.high_new == '1' else '',
"tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '',
"scale": '规模以上企业' if i.scale == '1' else '',
"serve": '限额以上服务业' if i.serve == '1' else ''
"tbe": '科技型中小企业' if i.tbe == '1' else '',
"quoted_company": '上市企业' if i.quoted_company == '1' else '',
"sxmon": '山西民营100强' if i.sxmon == '1' else '',
"zjtg": '山西专精特新企业' if i.zjtg == '1' else '',
"unicorn": '独角兽企业' if i.unicorn == '1' else '',
"dengl": '瞪羚' if i.dengl == '1' else '',
"isfive": '中国500强' if i.isfive == '1' else '',
"scale": '规模以上企业' if i.scale == '1' else '',
"serve": '限额以上服务业' if i.serve == '1' else ''
})
except Exception as e:
current_app.logger.error(e)
......@@ -984,7 +1000,7 @@ def cancel_collect():
id = req_dict.get("id")
classify = req_dict.get("classify")
choice = req_dict.get("choice")
print(id, classify, choice)
# print(id, classify, choice)
if classify == 1 and not all([id, classify, choice]):
return jsonify(code=RET.PARAMERR, msg="数据不全")
......@@ -1020,4 +1036,3 @@ def cancel_collect():
except Exception as e:
current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="数据库错误")
......@@ -341,7 +341,7 @@ def delete():
id = req_dict.get("id")
classify = req_dict.get("classify")
choice = req_dict.get("choice")
print(id, classify, choice)
# print(id, classify, choice)
if not all([id, classify, choice]):
return jsonify(code=RET.PARAMERR, msg="数据不全")
......
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