feat(project):add create price for project monitor
This commit is contained in:
@@ -226,3 +226,27 @@ class ProjectRepository(BaseRepository[ProjectModel]):
|
||||
|
||||
return res.json()
|
||||
|
||||
async def create_project_price(self):
|
||||
|
||||
projects = await use_collection(TaskEnv.CLN_PROJECT).find({'monitor.detail.first_amount':{'$exists':1}}).to_list(None)
|
||||
for project in projects:
|
||||
sum_status = 0
|
||||
sum_adjust = 0
|
||||
status = await use_collection(TaskEnv.CLN_FINANCIAL_STATUS).find({'project_id':project['_id'],'amount':{'$exists':1}}).to_list(None)
|
||||
if status:
|
||||
for i in status:
|
||||
sum_status += i['amount']
|
||||
adjust = await use_collection(TaskEnv.CLN_FINANCIAL_ADJUST).find({'project_id':project['_id'],'amount':{'$exists':1}}).to_list(None)
|
||||
if adjust:
|
||||
for i in adjust:
|
||||
sum_adjust += i['amount']
|
||||
price = {
|
||||
'_id': uuid.uuid4(),
|
||||
'project_id': project['_id'],
|
||||
'first_amount': project['monitor']['detail']['first_amount'],
|
||||
'amount_status':sum_status,
|
||||
'amount_adjust':sum_adjust
|
||||
}
|
||||
await use_collection(TaskEnv.CLN_PROJECT_PRICE_REPORT).insert_one(price)
|
||||
|
||||
|
||||
|
||||
@@ -87,6 +87,10 @@ def fetch(body: TableEngineRequestType = Body(...)):
|
||||
@shrink(repo.fetch_delete)
|
||||
def fetch_delete(body: TableEngineRequestType = Body(...)):
|
||||
pass
|
||||
# @router.get('/price/create_project_price', response_model=TableEngineExport[ThisModel], tags=_tag_base)
|
||||
# @shrink(repo.create_project_price)
|
||||
# def create_project_price():
|
||||
# pass
|
||||
|
||||
|
||||
# @router.post('/get_all', tags=_tag_base)
|
||||
|
||||
Reference in New Issue
Block a user