update
This commit is contained in:
parent
0a4f5b97fd
commit
95882d5f96
@ -247,6 +247,14 @@ async def daily_partner_settlement():
|
||||
|
||||
settlement_history = []
|
||||
for stat in yesterday_stats:
|
||||
community = db.query(CommunityDB).filter(
|
||||
CommunityDB.id == stat.community_id,
|
||||
CommunityDB.community_profit_sharing != None
|
||||
).first()
|
||||
|
||||
if not community:
|
||||
logger.info(f"小区 {stat.community_name} 没有分成比例,跳过结算")
|
||||
continue
|
||||
|
||||
# 检查是否已存在该日期的结算记录
|
||||
existing_settlement = db.query(SettlementHistoryDB).filter(
|
||||
@ -270,10 +278,6 @@ async def daily_partner_settlement():
|
||||
total_original_amount += stat.total_original_amount
|
||||
total_final_amount += stat.total_final_amount
|
||||
|
||||
community = db.query(CommunityDB).filter(
|
||||
CommunityDB.id == stat.community_id
|
||||
).first()
|
||||
|
||||
# 找到所有的运营商
|
||||
community_sets = db.query(CommunitySet).filter(
|
||||
CommunitySet.community_set_mappings.any(
|
||||
@ -377,7 +381,7 @@ async def daily_partner_settlement():
|
||||
settle_details=settle_details
|
||||
)
|
||||
settlement_history.append(settlement)
|
||||
|
||||
|
||||
db.add_all(settlement_history)
|
||||
db.commit()
|
||||
|
||||
|
||||
BIN
jobs.sqlite
BIN
jobs.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user