Commit a24451db by dong

fix20221127

parent 353e4091
...@@ -76,11 +76,11 @@ def search_project1(): ...@@ -76,11 +76,11 @@ def search_project1():
ProjectManagement.project_name == project_name if project_name else text(''), ProjectManagement.project_name == project_name if project_name else text(''),
ProjectManagement.district == district if district else text(''), ProjectManagement.district == district if district else text(''),
ProjectManagement.development_area == development_area if development_area else text(''), ProjectManagement.development_area == development_area if development_area else text(''),
ProjectManagement.investor_name >= investor_name[0] if investor_name else text(''), ProjectManagement.investment_volume >= investment_volume[0] if investment_volume else text(''),
ProjectManagement.investor_name < investor_name[1] if investor_name else text(''), ProjectManagement.investment_volume < investment_volume[1] if investment_volume else text(''),
ProjectManagement.investor_district.like('%{}%'.format(investor_district)) if investor_district else text(''), ProjectManagement.investor_district.like('%{}%'.format(investor_district)) if investor_district else text(''),
ProjectManagement.industry == industry if industry else text(''), ProjectManagement.industry == industry if industry else text(''),
ProjectManagement.investment_volume == investment_volume if investment_volume else text(''), ProjectManagement.investor_name == investor_name if investor_name else text(''),
ProjectManagement.project_progress == project_progress if project_progress else text(''), ProjectManagement.project_progress == project_progress if project_progress else text(''),
ProjectManagement.project_year == project_year if project_year else text(''), ProjectManagement.project_year == project_year if project_year else text(''),
ProjectManagement.is_delete == 0 ProjectManagement.is_delete == 0
...@@ -201,6 +201,22 @@ def download_project_template(): ...@@ -201,6 +201,22 @@ def download_project_template():
return jsonify(code=RET.OK, data=project_template, msg="模板下载成功!") return jsonify(code=RET.OK, data=project_template, msg="模板下载成功!")
def get_industry_level(industry1, industry2):
# 判断项目产业
industry_level = ''
if industry1 and industry1 == '现代农业':
industry_level = '第一产业'
if industry1 and industry1 == '文化旅游产业':
industry_level = '第三产业'
if industry2 and industry2 in ["商贸物流", "商务服务业", "房地产", "康养", "其他"]:
industry_level = '第三产业'
if industry2 and industry2 in ["煤炭先进产能和安全改造", "电力", "焦化", "冶金", "食品", "纺织",
"轻工", "其他工业技术改造", "节能环保产业", "煤层气产业", "煤化工产业", "新一代信息技术产业",
"高端装备制造业", "新材料产业", "新能源产业", "新能源汽车产业", "生物产业"]:
industry_level = '第二产业'
return industry_level
# 批量导入 # 批量导入
@api_manage.route("/UploadProjectData2", methods=["POST"]) @api_manage.route("/UploadProjectData2", methods=["POST"])
def upload_project_data2(): def upload_project_data2():
...@@ -282,7 +298,9 @@ def upload_project_data2(): ...@@ -282,7 +298,9 @@ def upload_project_data2():
if not project_name: if not project_name:
return jsonify(code=RET.PARAMERR, msg='项目名称不能为空!') return jsonify(code=RET.PARAMERR, msg='项目名称不能为空!')
project_obj_list = ProjectManagement.query.all() # 项目编号 project_obj_list = ProjectManagement.query.all()
# 构造项目编号
time_strf = datetime.now().strftime("%Y%m%d") time_strf = datetime.now().strftime("%Y%m%d")
max_project_num = '' max_project_num = ''
if project_obj_list: if project_obj_list:
...@@ -296,6 +314,12 @@ def upload_project_data2(): ...@@ -296,6 +314,12 @@ def upload_project_data2():
project_num = time_strf + num project_num = time_strf + num
else: else:
project_num = time_strf + '001' project_num = time_strf + '001'
if industry1 and industry2:
industry_level = get_industry_level(industry1, industry2)
if industry1 and not industry2:
industry_level = get_industry_level(industry1, '')
try: try:
# 写入数据库 # 写入数据库
file_time = datetime.now().strftime("%Y-%m-%d %H:%M") file_time = datetime.now().strftime("%Y-%m-%d %H:%M")
...@@ -312,7 +336,8 @@ def upload_project_data2(): ...@@ -312,7 +336,8 @@ def upload_project_data2():
investor_district=provence + "/" + city, investor_district=provence + "/" + city,
industry=industry1, industry=industry1,
industry2=industry2, industry2=industry2,
investment_volume=country + provence + city, industry_level=industry_level,
investment_volume=investment_volume,
construction_content=construction_content, construction_content=construction_content,
construction_nature=construction_nature, construction_nature=construction_nature,
project_address=project_address, project_address=project_address,
...@@ -563,6 +588,16 @@ def project_edit(): ...@@ -563,6 +588,16 @@ def project_edit():
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="进行编辑项目信息操作时用户信息校验失败,请重新登陆后尝试!")
if '-' in industry:
industry = industry.spilt('-')
industry1 = industry[0]
industry2 = industry[1]
else:
industry1 = industry
industry2 = ''
industry_level = get_industry_level(industry1, industry2)
try: try:
project_obj = ProjectManagement.query.filter_by(id=project_id, is_delete=0).first() project_obj = ProjectManagement.query.filter_by(id=project_id, is_delete=0).first()
if not project_obj: if not project_obj:
...@@ -573,7 +608,9 @@ def project_edit(): ...@@ -573,7 +608,9 @@ def project_edit():
project_obj.development_area = development_area project_obj.development_area = development_area
project_obj.attract_name = attract_name project_obj.attract_name = attract_name
project_obj.investor_name = investor_name project_obj.investor_name = investor_name
project_obj.industry = industry project_obj.industry = industry1
project_obj.industry2 = industry2
project_obj.industry_level = industry_level
project_obj.investment_volume = investment_volume project_obj.investment_volume = investment_volume
project_obj.construction_content = construction_content project_obj.construction_content = construction_content
project_obj.project_address = project_address project_obj.project_address = project_address
......
...@@ -24,35 +24,6 @@ from apps.inves_manage.siku_view import get_num, upload_daily_picture ...@@ -24,35 +24,6 @@ from apps.inves_manage.siku_view import get_num, upload_daily_picture
"""项目总览""" """项目总览"""
# @api_manage.route("/Overview", methods=["GET"])
# def overview():
# try:
# project_obj_count1 = 0
# project_obj_count2 = 0
# project_obj_count3 = 0
# project_obj_list = ProjectManagement.query.all()
# for project_obj in project_obj_list:
# if project_obj.sign_time:
# project_obj_count1 += 1
# if project_obj.start_time:
# project_obj_count2 += 1
# if project_obj.end_time:
# project_obj_count3 += 1
# data = {
# "project_obj_count1": project_obj_count1,
# "project_obj_count2": project_obj_count2,
# "project_obj_count3": project_obj_count3,
# }
# print('签约时间:{},开工时间:{},竣工时间:{},'.format(
# project_obj_count1,
# project_obj_count2,
# project_obj_count3))
# return jsonify(code=RET.OK, data=data, msg="查询成功!")
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="查询出错!")
@api_manage.route("/ProjectStalker", methods=["POST"]) # 项目跟踪 @api_manage.route("/ProjectStalker", methods=["POST"]) # 项目跟踪
def project_stalker(): def project_stalker():
req_dic = request.get_json() req_dic = request.get_json()
...@@ -138,56 +109,3 @@ def project_map(): ...@@ -138,56 +109,3 @@ def project_map():
except Exception as e: except Exception as e:
current_app.logger.error(e) current_app.logger.error(e)
return jsonify(code=RET.DBERR, msg="操作失败!数据库查询错误") return jsonify(code=RET.DBERR, msg="操作失败!数据库查询错误")
# 获取项目列表
# @api_manage.route("/SearchProject2", methods=["POST"])
# def search_project2():
# req_dic = request.get_json()
# token = request.headers['token']
# project_stalker = req_dic['project_stalker']
# district = req_dic['district']
# page = req_dic['page']
# per_page = req_dic['per_page']
#
# try:
# user_obj = verify_token(token)
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.SESSIONERR, msg="进行操作时用户信息校验失败,请重新登陆后尝试!")
#
# try:
# project_obj = ProjectManagement.query.filter(
# and_(ProjectManagement.project_stalker == project_stalker if project_stalker else text(''),
# ProjectManagement.district == district if district else text(''),
# ))
#
# if not project_obj.all():
# return jsonify(code=RET.NODATA, msg='没有符合条件的数据!')
# project_size = project_obj.count()
#
# project_obj_list = project_obj.order_by(ProjectManagement.upload_time.desc()).paginate(page, per_page).items
# if project_obj_list:
# data = [{
# "id": project_obj.id,
# "project_stalker": project_obj.project_stalker,
# "project_name": project_obj.project_name,
# "district": project_obj.district,
# "development_area": project_obj.development_area,
# "attract_name": project_obj.attract_name,
# "investor_name": project_obj.investor_name,
# "investor_district": project_obj.investor_district,
# "industry": project_obj.industry,
# "investment_volume": project_obj.investment_volume,
# "construction_content": project_obj.construction_content,
# "project_address": project_obj.project_address,
# "project_progress": project_obj.project_progress,
# "project_problem": project_obj.project_problem,
# "project_year": project_obj.project_year
# } for project_obj in project_obj_list]
# return jsonify(code=RET.OK, data={"data": data, "size": project_size, "msg": "数据获取成功!"})
#
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="查询数据库错误!")
...@@ -1183,6 +1183,7 @@ class ProjectManagement(db.Model): ...@@ -1183,6 +1183,7 @@ class ProjectManagement(db.Model):
investor_district = db.Column(db.String(30), comment='投资方所在地') investor_district = db.Column(db.String(30), comment='投资方所在地')
industry = db.Column(db.String(20), comment='所属行业-一级产业') industry = db.Column(db.String(20), comment='所属行业-一级产业')
industry2 = db.Column(db.String(20), comment='所属行业-二级产业') industry2 = db.Column(db.String(20), comment='所属行业-二级产业')
industry_level = db.Column(db.String(20), comment='所属项目产业级别')
investment_volume = db.Column(db.Float, comment='总投资额(万元)') investment_volume = db.Column(db.Float, comment='总投资额(万元)')
construction_content = db.Column(db.String(30), comment='建设内容') construction_content = db.Column(db.String(30), comment='建设内容')
project_address = db.Column(db.String(20), comment='项目选址') project_address = db.Column(db.String(20), comment='项目选址')
......
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