You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							70 lines
						
					
					
						
							3.2 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							70 lines
						
					
					
						
							3.2 KiB
						
					
					
				| from fastapi import Request | |
| from sqlalchemy.ext.asyncio import AsyncSession | |
| from exceptions.exception import ServiceException | |
| from module_admin.dao.dataast_dao import DataAstDao | |
| from module_admin.entity.vo.dataast_vo import DataAstApprModel,DataAstInfoModel,DataAstApprBatchModel | |
| from utils.common_util import CamelCaseUtil | |
| import uuid | |
| from module_admin.entity.vo.approval_vo import ApplyModel | |
| from module_admin.service.approval_service import ApprovalService | |
| from module_admin.entity.vo.common_vo import CrudResponseModel | |
| 
 | |
| 
 | |
| 
 | |
| class DataAstService: | |
|     """ | |
|     数据源标准服务层 | |
|     """ | |
|     @classmethod | |
|     async def get_dataast_appr_list(cls, query_db: AsyncSession, query_object: DataAstApprModel, is_page: bool = False): | |
|         return await DataAstDao.get_dataast_appr_list(query_object.flowId, query_db) | |
|      | |
| 
 | |
| 
 | |
|     # @classmethod | |
|     # async def add_dataasts_appr(cls, query_db: AsyncSession, model: DataAstInfoModel): | |
|     #     # if not await cls.check_dict_unique_services(query_db, model): | |
|     #     #     raise ServiceException(message=f"数据资产编号 {model.ast_no} 已存在") | |
|     #     model.onum=str(uuid.uuid4()) | |
|     #     model.data_ast_stat="1" | |
|     #     apprModel = DataAstApprModel(**model.model_dump(exclude_unset=True, by_alias=True)) | |
|     #     apprModel.changeType="add" | |
|     #     apprModel.compareId=model.onum | |
|     #     apprModel.oldInstId=model.onum | |
|     #     apprModel.approStatus="waiting" | |
|     #     apprModel.flowId=str(uuid.uuid4()) | |
|     #     await DataAstDao.add_dataast_appr(query_db, apprModel) | |
|     #     applyModel = ApplyModel() | |
|     #     applyModel.businessType = "dataAssetMain" | |
|     #     applyModel.businessId = apprModel.flowId | |
|     #     applyModel.applicant = apprModel.create_by | |
|     #     await ApprovalService.apply_services(query_db, applyModel, 'dataAssetMain') | |
|     #     return CrudResponseModel(is_success=True, message='新增数据资产成功')    | |
|      | |
|     @classmethod | |
|     async def add_dataasts_appr(cls, query_db: AsyncSession, models: DataAstApprBatchModel,username: str): | |
|         # if not await cls.check_dict_unique_services(query_db, model): | |
|         #     raise ServiceException(message=f"数据资产编号 {model.ast_no} 已存在") | |
|         flowId = str(uuid.uuid4()) #流程编号 | |
|         for model in models.assetItems: | |
|             model.onum=str(uuid.uuid4()) | |
|             model.data_ast_stat="1" | |
|             apprModel = DataAstApprModel(**model.model_dump(exclude_unset=True, by_alias=True)) | |
|             apprModel.changeType="add" | |
|             apprModel.compareId=model.onum | |
|             apprModel.oldInstId=model.onum | |
|             apprModel.approStatus="waiting" | |
|             apprModel.flowId=flowId | |
|              | |
|             await DataAstDao.add_dataast_appr(query_db, apprModel) | |
|         applyModel = ApplyModel() | |
|         applyModel.businessType = "dataAssetMain" | |
|         applyModel.businessId = flowId | |
|         applyModel.applicant = username | |
|         await ApprovalService.apply_services(query_db, applyModel, 'dataAssetMain') | |
|         return CrudResponseModel(is_success=True, message='新增数据资产成功')    | |
| 
 | |
| 
 | |
|     @classmethod | |
|     async def get_ast_main_appr_list(cls, query_db: AsyncSession, flowId: str, is_page: bool = False): | |
|         return await DataAstDao.get_ast_main_appr_list(flowId, query_db) |