Commit 123c3e79 by dong

fix20230302

parent 28d84269
...@@ -16,6 +16,7 @@ from flask_qiniustorage import Qiniu ...@@ -16,6 +16,7 @@ from flask_qiniustorage import Qiniu
db = SQLAlchemy() # 创建数据库连接 db = SQLAlchemy() # 创建数据库连接
qiniu_store = Qiniu() # 创建七牛云连接 qiniu_store = Qiniu() # 创建七牛云连接
redis_store = None # 创建变量避免导入错误,在函数中进行初始化 redis_store = None # 创建变量避免导入错误,在函数中进行初始化
SERVER_NAME = None
# 配置日志信息 # 配置日志信息
# 创建日志记录器,指明日志保存的路径、每个日志文件的最大大小、保存的日志文件个数上限 # 创建日志记录器,指明日志保存的路径、每个日志文件的最大大小、保存的日志文件个数上限
...@@ -59,6 +60,10 @@ def creat_app(config_name): ...@@ -59,6 +60,10 @@ def creat_app(config_name):
config_class = config_map.get(config_name) config_class = config_map.get(config_name)
app.config.from_object(config_class) app.config.from_object(config_class)
# 域名
global SERVER_NAME
SERVER_NAME = 'https://jincheng.industrychain.online'
# 绑定SQLAlchemy的app对象 # 绑定SQLAlchemy的app对象
db.init_app(app) db.init_app(app)
......
...@@ -12,6 +12,7 @@ from sqlalchemy import and_ ...@@ -12,6 +12,7 @@ from sqlalchemy import and_
import zipfile import zipfile
from apps.models import * from apps.models import *
from apps import SERVER_NAME
from apps.models import ProjectManagement from apps.models import ProjectManagement
from apps.utils.response_code import RET from apps.utils.response_code import RET
...@@ -236,7 +237,7 @@ def download_project_template(): ...@@ -236,7 +237,7 @@ def download_project_template():
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.SESSIONERR, msg="进行操作时用户信息校验失败,请重新登陆后尝试!") return jsonify(code=RET.SESSIONERR, msg="进行操作时用户信息校验失败,请重新登陆后尝试!")
project_template = "http://39.100.39.50:8008/aaa_statics/template_file/招商引资项目表.xlsx" project_template = SERVER_NAME + "/aaa_statics/template_file/招商引资项目表.xlsx"
return jsonify(code=RET.OK, data=project_template, msg="模板下载成功!") return jsonify(code=RET.OK, data=project_template, msg="模板下载成功!")
...@@ -468,8 +469,8 @@ def batch_export_project5(): ...@@ -468,8 +469,8 @@ def batch_export_project5():
# pro_path = 'http://39.100.39.50:5050/statics/project_file/' # 项目路径 # pro_path = 'http://39.100.39.50:5050/statics/project_file/' # 项目路径
path = './apps/static/project_file/' path = './apps/static/project_file/'
pro_path = 'http://39.100.39.50:5050/static/project_file/' # 项目路径 # pro_path = 'http://39.100.39.50:5050/static/project_file/' # 项目路径
# pro_path = 'http://192.168.1.4:5000/statics/project_file/' # 项目路径 pro_path = SERVER_NAME + '/static/project_file/' # 项目路径
if not select_id_list: if not select_id_list:
return jsonify(code=RET.PARAMERR, msg="参数不能为空!") return jsonify(code=RET.PARAMERR, msg="参数不能为空!")
target_data_list = [] target_data_list = []
...@@ -789,11 +790,14 @@ def download_project_template1(): ...@@ -789,11 +790,14 @@ def download_project_template1():
return jsonify(code=RET.SESSIONERR, msg="进行操作时用户信息校验失败,请重新登陆后尝试!") return jsonify(code=RET.SESSIONERR, msg="进行操作时用户信息校验失败,请重新登陆后尝试!")
project_template = '' project_template = ''
if flag == 1: if flag == 1:
project_template = "http://39.100.39.50:8008/aaa_statics/template_file/山西省各市完成情况表.xlsx" # project_template = "http://39.100.39.50:8008/aaa_statics/template_file/山西省各市完成情况表.xlsx"
project_template = SERVER_NAME + "/aaa_statics/template_file/山西省各市完成情况表.xlsx"
if flag == 2: if flag == 2:
project_template = "http://39.100.39.50:8008/aaa_statics/template_file/晋城市及县区年度目标表.xlsx" # project_template = "http://39.100.39.50:8008/aaa_statics/template_file/晋城市及县区年度目标表.xlsx"
project_template = SERVER_NAME + "/aaa_statics/template_file/晋城市及县区年度目标表.xlsx"
if flag == 3: if flag == 3:
project_template = "http://39.100.39.50:8008/aaa_statics/template_file/晋城市及县区固投到位资金完成情况.xlsx" # project_template = "http://39.100.39.50:8008/aaa_statics/template_file/晋城市及县区固投到位资金完成情况.xlsx"
project_template = SERVER_NAME + "/aaa_statics/template_file/晋城市及县区固投到位资金完成情况.xlsx"
return jsonify(code=RET.OK, data=project_template, msg="模板下载成功!") return jsonify(code=RET.OK, data=project_template, msg="模板下载成功!")
...@@ -1095,7 +1099,7 @@ def download_shanxi_data(): ...@@ -1095,7 +1099,7 @@ def download_shanxi_data():
data_time = req_dic["data_time"] data_time = req_dic["data_time"]
path = './apps/statics/project_file/' path = './apps/statics/project_file/'
# pro_path = 'http://39.100.39.50:8008/aaa_statics/project_file/' # 项目路径 # pro_path = 'http://39.100.39.50:8008/aaa_statics/project_file/' # 项目路径
pro_path = 'http://192.168.1.4:5000/statics/project_file/' # 项目路径 pro_path = SERVER_NAME + '/aaa_statics/project_file/' # 项目路径
if not data_time: if not data_time:
return jsonify(code=RET.PARAMERR, msg="参数不能为空!") return jsonify(code=RET.PARAMERR, msg="参数不能为空!")
target_data_list = [] target_data_list = []
...@@ -1492,8 +1496,8 @@ def download_jc_data(): ...@@ -1492,8 +1496,8 @@ def download_jc_data():
req_dic = request.get_json() req_dic = request.get_json()
year = req_dic["year"] year = req_dic["year"]
path = './apps/statics/project_file/' path = './apps/statics/project_file/'
pro_path = 'http://39.100.39.50:8008/aaa_statics/project_file/' # 项目路径 # pro_path = 'http://39.100.39.50:8008/aaa_statics/project_file/' # 项目路径
# pro_path = 'http://192.168.1.4:5000/statics/project_file/' # 项目路径 pro_path = SERVER_NAME + '/aaa_statics/project_file/' # 项目路径
if not year: if not year:
return jsonify(code=RET.PARAMERR, msg="参数不能为空!") return jsonify(code=RET.PARAMERR, msg="参数不能为空!")
target_data_list = [] target_data_list = []
...@@ -1794,8 +1798,8 @@ def download_money_arrive(): ...@@ -1794,8 +1798,8 @@ def download_money_arrive():
req_dic = request.get_json() req_dic = request.get_json()
data_time = req_dic["data_time"] data_time = req_dic["data_time"]
path = './apps/statics/project_file/' path = './apps/statics/project_file/'
pro_path = 'http://39.100.39.50:8008/aaa_statics/project_file/' # 项目路径 # pro_path = 'http://39.100.39.50:8008/aaa_statics/project_file/' # 项目路径
# pro_path = 'http://192.168.1.4:5000/statics/project_file/' # 项目路径 pro_path = SERVER_NAME + '/aaa_statics/project_file/' # 项目路径
if not data_time: if not data_time:
return jsonify(code=RET.PARAMERR, msg="参数不能为空!") return jsonify(code=RET.PARAMERR, msg="参数不能为空!")
target_data_list = [] target_data_list = []
......
...@@ -15,6 +15,7 @@ from apps.models import * ...@@ -15,6 +15,7 @@ from apps.models import *
from apps.util import login_required, verify_token from apps.util import login_required, verify_token
from apps.inves_manage import api_manage from apps.inves_manage import api_manage
from apps.utils.response_code import RET from apps.utils.response_code import RET
from apps import SERVER_NAME
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
...@@ -937,7 +938,8 @@ def download_xlsx(): ...@@ -937,7 +938,8 @@ def download_xlsx():
# except Exception as e: # except Exception as e:
# current_app.logger.error(e) # current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="进行{}操作时用户信息校验失败,请重新登陆后尝试!".format(action_name)) # return jsonify(code=RET.DBERR, msg="进行{}操作时用户信息校验失败,请重新登陆后尝试!".format(action_name))
build_template = "http://39.100.39.50:8008/aaa_statics/template_file/线索库上传模板.xlsx" # build_template = "http://39.100.39.50:8008/aaa_statics/template_file/线索库上传模板.xlsx"
build_template = SERVER_NAME + "/aaa_statics/template_file/线索库上传模板.xlsx"
return jsonify(code=RET.OK, data=build_template, msg="链接获取成功!") return jsonify(code=RET.OK, data=build_template, msg="链接获取成功!")
...@@ -1753,7 +1755,8 @@ def batch_export_project1(): ...@@ -1753,7 +1755,8 @@ def batch_export_project1():
select_id_list = req_dic["select_id_list"] select_id_list = req_dic["select_id_list"]
path = './apps/static/project_file/' path = './apps/static/project_file/'
# pro_path = 'D:/中研项目代码/flask_jincheng/apps/statics/project_file/' # pro_path = 'D:/中研项目代码/flask_jincheng/apps/statics/project_file/'
pro_path = 'http://39.100.39.50:5050/static/project_file/' # 项目路径 # pro_path = 'http://39.100.39.50:5050/static/project_file/' # 项目路径
pro_path = SERVER_NAME + '/static/project_file/' # 项目路径
if not select_id_list: if not select_id_list:
return jsonify(code=RET.PARAMERR, msg="参数不能为空!") return jsonify(code=RET.PARAMERR, msg="参数不能为空!")
target_data_list = [] target_data_list = []
......
...@@ -7,6 +7,7 @@ from flask import request, current_app, jsonify ...@@ -7,6 +7,7 @@ from flask import request, current_app, jsonify
from sqlalchemy import and_ from sqlalchemy import and_
from apps.models import * from apps.models import *
from apps import SERVER_NAME
from apps.util import verify_token, verify_identity from apps.util import verify_token, verify_identity
...@@ -253,7 +254,8 @@ def download_xlsx(): ...@@ -253,7 +254,8 @@ def download_xlsx():
return jsonify(code=RET.PARAMERR, msg="参数不能为空!") return jsonify(code=RET.PARAMERR, msg="参数不能为空!")
if template_type == 1: # 楼宇的模板标识 if template_type == 1: # 楼宇的模板标识
build_template = "http://39.100.39.50:8008/aaa_statics/carrier_template/楼宇信息表.xlsx" # build_template = "http://39.100.39.50:8008/aaa_statics/carrier_template/楼宇信息表.xlsx"
build_template = SERVER_NAME + "/aaa_statics/carrier_template/楼宇信息表.xlsx"
operation_message = "进行了下载楼宇数据模板操作" operation_message = "进行了下载楼宇数据模板操作"
upload_time = datetime.now() upload_time = datetime.now()
log = OperationLog(read_type=0, operation_people_id=user_id, operation_people_belong=belong_unit, operation_time=upload_time, log = OperationLog(read_type=0, operation_people_id=user_id, operation_people_belong=belong_unit, operation_time=upload_time,
...@@ -264,7 +266,8 @@ def download_xlsx(): ...@@ -264,7 +266,8 @@ def download_xlsx():
return build_template return build_template
if template_type == 2: # 土地的模板标识 if template_type == 2: # 土地的模板标识
land_template = "http://39.100.39.50:8008/aaa_statics/carrier_template/土地信息表.xlsx" # land_template = "http://39.100.39.50:8008/aaa_statics/carrier_template/土地信息表.xlsx"
land_template = SERVER_NAME + "/aaa_statics/carrier_template/土地信息表.xlsx"
operation_message = "进行了下载土地数据模板操作" operation_message = "进行了下载土地数据模板操作"
upload_time = datetime.now() upload_time = datetime.now()
log = OperationLog(read_type=0, operation_people_id=user_id, operation_people_belong=belong_unit, operation_time=upload_time, log = OperationLog(read_type=0, operation_people_id=user_id, operation_people_belong=belong_unit, operation_time=upload_time,
...@@ -275,8 +278,8 @@ def download_xlsx(): ...@@ -275,8 +278,8 @@ def download_xlsx():
return land_template return land_template
if template_type == 3: # 厂房的模板标识 if template_type == 3: # 厂房的模板标识
# factory_template = "http://39.100.39.50:8008/aaa_statics/carrier_template/carrier_factory.xlsx" # factory_template = "http://39.100.39.50:8008/aaa_statics/carrier_template/厂房信息表.xlsx"
factory_template = "http://39.100.39.50:8008/aaa_statics/carrier_template/厂房信息表.xlsx" factory_template = SERVER_NAME + "/aaa_statics/carrier_template/厂房信息表.xlsx"
operation_message = "进行了下载厂房数据模板操作" operation_message = "进行了下载厂房数据模板操作"
upload_time = datetime.now() upload_time = datetime.now()
log = OperationLog(read_type=0, operation_people_id=user_id, operation_people_belong=belong_unit, operation_time=upload_time, log = OperationLog(read_type=0, operation_people_id=user_id, operation_people_belong=belong_unit, operation_time=upload_time,
......
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