集成邮件服务

This commit is contained in:
wcq 2023-10-13 17:00:07 +08:00
parent 5f3e0c31be
commit e5d1042eef
8 changed files with 84 additions and 5 deletions

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9 virtualenv at D:\yuandong_work\project\wd-smebiz\venv" jdkType="Python SDK" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.9 (wd-rating)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">

View File

@ -26,7 +26,7 @@ conf = ConfigParser()
start_model = "dev"
if 'prod' in sys.argv:
start_model = 'prod'
conf_file_path = Path(__file__).parent.parent / 'config' / f'common{"." + start_model if start_model else ""}.ini'
conf_file_path = Path(".") / 'config' / f'common{"." + start_model if start_model else ""}.ini'
print("start_model", start_model)
conf.read(conf_file_path, encoding='utf-8-sig')

View File

@ -0,0 +1,39 @@
import uuid
from datetime import datetime
from typing import List
from sqlalchemy import String, DateTime, func, Boolean, ForeignKey
from sqlalchemy.orm import Mapped, mapped_column, relationship
from utils.sqlalchemy_common_utils import SalBase
from ...common import Base
class UploadFileItem(Base, SalBase):
"""
上传文件项
"""
__tablename__ = "upload_file_item"
id: Mapped[str] = mapped_column(String(128), primary_key=True, default=lambda: uuid.uuid4().hex, comment='ID')
collection_id: Mapped[str] = mapped_column(String(255),
ForeignKey('data_collection.id', ondelete='CASCADE', onupdate='CASCADE'))
name: Mapped[str] = mapped_column(String(255), comment="收集名称")
uploaded: Mapped[bool] = mapped_column(Boolean, default=False, comment="上传状态")
upload_time: Mapped[datetime] = mapped_column(DateTime, nullable=True,
comment='上传时间')
org_file_path: Mapped[str] = mapped_column(String(255), comment="原始文件路径", nullable=True)
org_file_name: Mapped[str] = mapped_column(String(255), comment="原始文件名称", nullable=True)
upload_file_path: Mapped[str] = mapped_column(String(255), comment="上传文件路径", nullable=True)
upload_file_name: Mapped[str] = mapped_column(String(255), comment="上传文件名称", nullable=True)
class DataCollection(Base, SalBase):
"""
数据收集表
"""
__tablename__ = "data_collection"
id: Mapped[str] = mapped_column(String(128), primary_key=True, default=lambda: uuid.uuid4().hex, comment='ID')
url: Mapped[str] = mapped_column(String(255), unique=True, comment='收集链接')
passwd: Mapped[str] = mapped_column(String(255), comment='访问密码')
update_time: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), onupdate=func.now(),
comment='更新时间')
files: Mapped[List[UploadFileItem]] = relationship()

View File

@ -0,0 +1,16 @@
from fastapi import APIRouter
from . import schemas
router = APIRouter(tags=["数据收集接口"], prefix='/data_collection')
need_files = [
{"name": "资产负债表", "path": ""},
{"name": "", "path": ""},
{"name": "", "path": ""},
{"name": "", "path": ""},
{"name": "", "path": ""},
]
@router.post('/create')
def data_collection_create(req: schemas.DataCollectionCreateReq):
pass

View File

@ -0,0 +1,12 @@
from enum import Enum
from pydantic import BaseModel
# class FileNeedInfoItem(BaseModel):
# id: str
# name: str
class DataCollectionCreateReq(BaseModel):
rate_id: str

View File

@ -12,7 +12,7 @@ router = APIRouter(
def setting_get():
conf.read(conf_file_path, encoding='utf-8-sig')
data = deepcopy(conf._sections)
data = {k: v for k, v in data.items() if k in ['rate_utils']}
# data = {k: v for k, v in data.items() if k in ['rate_utils']}
return schemas.SettingGetRes(data=data)

View File

@ -13,4 +13,4 @@ jurigged~=0.5.5
python-jose
sqlalchemy_utils
numpy~=1.25.2
openpyxl
fastapi-mail

View File

@ -0,0 +1,10 @@
config = {
"url": "",
"passwd": "",
"files": [
{"org_path": "", "name": "资产负债表", "upload_path": ""},
{"org_path": "", "name": "利润表", "upload_path": ""},
{"org_path": "", "name": "现金流量表", "upload_path": ""},
{"org_path": "", "name": "经营情况表", "upload_path": ""},
]
}