This commit is contained in:
han0
2024-12-25 11:31:31 +08:00
parent 370a4861dd
commit 0e528d81e0
7 changed files with 161 additions and 31 deletions

View File

@@ -7,6 +7,10 @@ from commons.models.price_publish import PricePublish
from commons.models.price_result import PriceResult
MATERIAL_ID_TYPE_1 = []
MATERIAL_ID_TYPE_2 = []
class Collector:
def __init__(self, year, month, force=True):
@@ -14,8 +18,6 @@ class Collector:
self.month = month
self.force = True # todo-2 已发布的价格不在覆盖计算
# todo-2 材料id映射
def get_avg(self):
query = PricePublish.get_query(name_in=(
'杉原木',
@@ -229,20 +231,81 @@ class Collector:
).upsert()
def get_from_result(self):
query = PriceResult.get_query(self.year, self.month, name_in=(
'光圆钢筋',
'带肋钢筋',
'型钢',
'钢绞线',
'32.5级水泥',
'42.5级水泥',
'进口沥青',
'国产沥青',
'进口改性沥青',
'国产改性沥青',
'汽油89',
'汽油92',
'柴油0',
query = PriceResult.get_query(self.year, self.month, material_id_in=(
'2001001',
'2001002',
'2001008',
'2003004',
'2003005',
'2003005001',
'5509001',
'5509002',
'5509003',
'3001001002',
'3001001001',
'3001002002',
'3001002001',
'3003002001',
'3003002002',
'3003003',
'4003001001',
'4003001002',
'4003002002',
'4003002001',
'4005001',
'2001003',
'2001006',
'2001013',
'2003006',
'2003007',
'2003008',
'2003009',
'2004004',
'2003012',
'2001019',
'2003015',
'2003016',
'2003017001',
'2003017002',
'2003021',
'2003022',
'6001002',
'6001003',
'6001059',
'6001071',
'6001080',
'6001086',
'6001089',
'6001092',
'6003001',
'6003003',
'6005005',
'6005009',
'6005015',
'2005002',
'2009028',
'6007002',
'2009033',
'2001025',
'2001026',
'6002001',
'6002002',
'6002003',
'6002004',
'6002005',
'6002006',
'5009002',
'5506001',
'5005001',
'5005002',
'5005003',
'5005006',
'5005007',
'5006001',
'5005009',
'5006002',
'5007003001',
'3003001',
))
data = query.all()
for item in data:
@@ -272,7 +335,7 @@ class Collector:
def run(self):
# 当月价
self.get_from_survey()
# self.get_from_survey()
self.get_from_result()
# 近半年平均价
self.get_avg()