yue 2 settimane fa
parent
commit
b9d125bf34
20 ha cambiato i file con 244 aggiunte e 154 eliminazioni
  1. 2 2
      SourceCode/IntelligentRailwayCosting/.script/cmd/Mysql_BuildRcApp_1.0.0.run.xml
  2. 3 3
      SourceCode/IntelligentRailwayCosting/.script/cmd/Mysql_RunRcApp.run.xml
  3. 13 0
      SourceCode/IntelligentRailwayCosting/.script/cmd/SqlServer_BuildRcApp_1.0.0.run.xml
  4. 12 0
      SourceCode/IntelligentRailwayCosting/.script/cmd/SqlServer_RunRcApp.run.xml
  5. 7 7
      SourceCode/IntelligentRailwayCosting/.script/init_mysql.sql
  6. 2 2
      SourceCode/IntelligentRailwayCosting/Docker/.env
  7. 41 0
      SourceCode/IntelligentRailwayCosting/Docker/docker-compose_mysql.yml
  8. 19 0
      SourceCode/IntelligentRailwayCosting/Docker/docker-compose_sqlserver.yml
  9. 0 1
      SourceCode/IntelligentRailwayCosting/app/config.yml
  10. 6 6
      SourceCode/IntelligentRailwayCosting/app/core/configs/ai_config.py
  11. 5 4
      SourceCode/IntelligentRailwayCosting/app/core/configs/ai_fastgpt_config.py
  12. 17 16
      SourceCode/IntelligentRailwayCosting/app/core/configs/app_config.py
  13. 98 97
      SourceCode/IntelligentRailwayCosting/app/core/dtos/excel_parse.py
  14. 9 8
      SourceCode/IntelligentRailwayCosting/app/core/enum/task.py
  15. 2 1
      SourceCode/IntelligentRailwayCosting/app/stores/__init__.py
  16. 1 2
      SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_mysql/log.py
  17. 3 2
      SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_mysql/project_quota.py
  18. 1 1
      SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_mysql/project_task.py
  19. 1 1
      SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_sqlserver/project_quota.py
  20. 2 1
      SourceCode/IntelligentRailwayCosting/requirements.txt

+ 2 - 2
SourceCode/IntelligentRailwayCosting/.script/cmd/BuildRcApp_1.0.0.run.xml → SourceCode/IntelligentRailwayCosting/.script/cmd/Mysql_BuildRcApp_1.0.0.run.xml

@@ -1,8 +1,8 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="BuildRcApp_1.0.0" type="docker-deploy" factoryName="dockerfile" server-name="104">
+  <configuration default="false" name="Mysql_BuildRcApp_1.0.0" type="docker-deploy" factoryName="dockerfile" server-name="104">
     <deployment type="dockerfile">
       <settings>
-        <option name="imageTag" value="railway_costing-app:1.0.0" />
+        <option name="imageTag" value="railway_costing-app_mysql:1.0.0" />
         <option name="buildOnly" value="true" />
         <option name="contextFolderPath" value="." />
         <option name="sourceFilePath" value="docker/Dockerfile" />

+ 3 - 3
SourceCode/IntelligentRailwayCosting/.script/cmd/RunRcApp.run.xml → SourceCode/IntelligentRailwayCosting/.script/cmd/Mysql_RunRcApp.run.xml

@@ -1,10 +1,10 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="RunRcApp" type="docker-deploy" factoryName="docker-compose.yml" server-name="104">
+  <configuration default="false" name="Mysql_RunRcApp" type="docker-deploy" factoryName="docker-compose.yml" server-name="104">
     <deployment type="docker-compose.yml">
       <settings>
-        <option name="composeProjectName" value="railway_costing" />
+        <option name="composeProjectName" value="railway_costing_mysql" />
         <option name="envFilePath" value="" />
-        <option name="sourceFilePath" value="docker/docker-compose.yml" />
+        <option name="sourceFilePath" value="Docker/docker-compose_mysql.yml" />
       </settings>
     </deployment>
     <method v="2" />

+ 13 - 0
SourceCode/IntelligentRailwayCosting/.script/cmd/SqlServer_BuildRcApp_1.0.0.run.xml

@@ -0,0 +1,13 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="SqlServer_BuildRcApp_1.0.0" type="docker-deploy" factoryName="dockerfile" server-name="104">
+    <deployment type="dockerfile">
+      <settings>
+        <option name="imageTag" value="railway_costing-app_sqlserver:1.0.0" />
+        <option name="buildOnly" value="true" />
+        <option name="contextFolderPath" value="." />
+        <option name="sourceFilePath" value="docker/Dockerfile" />
+      </settings>
+    </deployment>
+    <method v="2" />
+  </configuration>
+</component>

+ 12 - 0
SourceCode/IntelligentRailwayCosting/.script/cmd/SqlServer_RunRcApp.run.xml

@@ -0,0 +1,12 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="SqlServer_RunRcApp" type="docker-deploy" factoryName="docker-compose.yml" server-name="104">
+    <deployment type="docker-compose.yml">
+      <settings>
+        <option name="composeProjectName" value="railway_costing_sqlserver" />
+        <option name="envFilePath" value="" />
+        <option name="sourceFilePath" value="Docker/docker-compose_sqlserver.yml" />
+      </settings>
+    </deployment>
+    <method v="2" />
+  </configuration>
+</component>

+ 7 - 7
SourceCode/IntelligentRailwayCosting/.script/init.sql → SourceCode/IntelligentRailwayCosting/.script/init_mysql.sql

@@ -13,12 +13,12 @@ CREATE TABLE IF NOT EXISTS project_task (
     item_id INT NOT NULL COMMENT '条目序号',
     item_code VARCHAR(255) NOT NULL COMMENT '条目编号',
     file_path TEXT COMMENT '文件路径',
-    process_status TINYINT NOT NULL DEFAULT 0 COMMENT '处理状态(0:未处理,1:处理中, 2:已处理, 3:处理失败)',
+    process_status INT NOT NULL DEFAULT 0 COMMENT '处理状态(0:草稿, 1:待运行, 2:运行中, 200:运行成功, 4:运行失败 5:取消运行)',
     process_time DATETIME COMMENT '处理时间',
     process_error VARCHAR(4000) COMMENT '处理错误信息',
-    send_status TINYINT NOT NULL DEFAULT 0 COMMENT '发送状态(0:未发送,1:发送中 ,2:已发送, 3:发送失败)',
-    send_time DATETIME COMMENT '送时间',
-    send_error VARCHAR(4000) COMMENT '送错误信息',
+    send_status INT NOT NULL DEFAULT 0 COMMENT '推送状态(0:未推送, 1:推送中 ,2:推送成功, 3:推送失败, 4:已修改)',
+    send_time DATETIME COMMENT '送时间',
+    send_error VARCHAR(4000) COMMENT '送错误信息',
     is_del TINYINT NOT NULL DEFAULT 0 COMMENT '是否删除(0:否, 1:是)',
     deleted_by VARCHAR(50) COMMENT '删除人',
     deleted_at DATETIME COMMENT '删除时间',
@@ -52,9 +52,9 @@ CREATE TABLE IF NOT EXISTS project_quota (
     ex_row VARCHAR(4000) COMMENT '该行内容',
     ex_unit VARCHAR(50) COMMENT 'excel中给出的单位',
     ex_amount FLOAT COMMENT 'excel中给出的数量',
-    send_status TINYINT NOT NULL DEFAULT 0 COMMENT '发送状态(0:未发送,1:发送中 ,2:已发送, 3:发送失败)',
-    send_time DATETIME COMMENT '送时间',
-    send_error VARCHAR(4000) COMMENT '送错误信息',
+    send_status INT NOT NULL DEFAULT 0 COMMENT '推送状态(0:未推送,1:推送中 ,2:已推送, 3:推送失败, 4:已修改)',
+    send_time DATETIME COMMENT '送时间',
+    send_error VARCHAR(4000) COMMENT '送错误信息',
     is_del TINYINT NOT NULL DEFAULT 0 COMMENT '是否删除(0:否, 1:是)',
     deleted_by VARCHAR(50) COMMENT '删除人',
     deleted_at DATETIME COMMENT '删除时间',

+ 2 - 2
SourceCode/IntelligentRailwayCosting/Docker/.env

@@ -1,5 +1,5 @@
-MYSQL_ROOT_PASSWORD=123456qwertyu
+MYSQL_ROOT_PASSWORD=123456
 MYSQL_DATABASE=iwb_railway_costing_v1
 MYSQL_USER=iwb_data
-MYSQL_PASSWORD=123456iwb
+MYSQL_PASSWORD=123456
 MYSQL_PORT=3536

+ 41 - 0
SourceCode/IntelligentRailwayCosting/Docker/docker-compose_mysql.yml

@@ -0,0 +1,41 @@
+version: '3.8'
+
+services:
+  rc-mysql:
+    image: mysql:8.0.39
+    container_name: railway_costing-mysql
+    environment:
+      - MYSQL_ROOT_PASSWORD=12345654321
+      - TZ=Asia/Shanghai
+    volumes:
+      - /home/docker/iwb_railway_costing_v1/mysql/log:/var/log/mysql
+      - /home/docker/iwb_railway_costing_v1/mysql/data:/var/lib/mysql
+      - /etc/localtime:/etc/localtime:ro
+      - /home/docker/iwb_railway_costing_v1/app/init_mysql.sql:/docker-entrypoint-initdb.d/init.sql # 挂载 init.sql 文件
+    networks:
+      - railway_costing_mysql_v1
+    restart: always
+
+  rc-app:
+    build:
+      context: ../
+      dockerfile: .
+    image: railway_costing-app_mysql:1.0.0
+    container_name: railway_costing-app_mysql
+    depends_on:
+      - rc-mysql
+    environment:
+      - TZ=Asia/Shanghai
+    volumes:
+      - /home/docker/iwb_railway_costing_v1/app/config_mysql.yml:/app/config.yml
+      - /home/docker/iwb_railway_costing_v1/app/logs:/app/logs
+      - /home/docker/iwb_railway_costing_v1/app/temp_files:/app/temp_files
+    networks:
+      - railway_costing_mysql_v1
+    ports:
+      - "7011:5123"
+    restart: always
+
+networks:
+  railway_costing_mysql_v1:
+    driver: bridge

+ 19 - 0
SourceCode/IntelligentRailwayCosting/Docker/docker-compose_sqlserver.yml

@@ -0,0 +1,19 @@
+version: '3.8'
+
+services:
+  rc-app:
+    build:
+      context: ../
+      dockerfile: .
+    image: railway_costing-app_sqlserver:1.0.0
+    container_name: railway_costing-app_sqlserver
+    environment:
+      - TZ=Asia/Shanghai
+      - ACCEPT_EULA=Y
+    volumes:
+      - /home/docker/iwb_railway_costing_v1/app/config_sqlserver.yml:/app/config.yml
+      - /home/docker/iwb_railway_costing_v1/app/logs:/app/logs
+      - /home/docker/iwb_railway_costing_v1/app/temp_files:/app/temp_files
+    ports:
+      - "7010:5123"
+    restart: always

+ 0 - 1
SourceCode/IntelligentRailwayCosting/app/config.yml

@@ -69,7 +69,6 @@ db:
     user: root
     password: Iwb-2024
     charset: utf8mb4
-  # MySQL 示例数据库配置
   iwb_railway_costing_v1:
     db: iwb_railway_costing_v1
     host: 192.168.0.81

+ 6 - 6
SourceCode/IntelligentRailwayCosting/app/core/configs/ai_config.py

@@ -1,5 +1,6 @@
 class AIConfig:
     """AI应用配置实体类"""
+
     def __init__(self):
         self._api_url = None
         self._api_key = None
@@ -24,12 +25,11 @@ class AIConfig:
 
     def update_config(self, config):
         """更新AI应用配置
-        
+
         Args:
             config: AI应用配置字典
         """
-        self._api_url = config.get('api_url')
-        self._api_key = config.get('api_key')
-        self._model = config.get('model')
-        self._max_tokens = config.get('max_tokens')
-
+        self._api_url = config.get("api_url", "")
+        self._api_key = config.get("api_key", "")
+        self._model = config.get("model", "")
+        self._max_tokens = config.get("max_tokens", "")

+ 5 - 4
SourceCode/IntelligentRailwayCosting/app/core/configs/ai_fastgpt_config.py

@@ -3,6 +3,7 @@ from core.configs.ai_config import AIConfig
 
 class FastGPTAIConfig:
     """FastGPT AI配置管理类"""
+
     _api_url = None
     _api_key = None
     _apps = {}
@@ -36,13 +37,13 @@ class FastGPTAIConfig:
         Args:
             config: FastGPT AI配置字典
         """
-        self._api_url = config.get('api_url')
-        self._api_key = config.get('api_key')
+        self._api_url = config.get("api_url", "")
+        self._api_key = config.get("api_key", "")
         # 更新apps配置
-        apps_config = config.get('apps')
+        apps_config = config.get("apps", {})
         # 更新apps配置
         self._apps = {}
         for app_key, app_config in apps_config.items():
             app = AIConfig()
             app.update_config(app_config)
-            self._apps[app_key] = app
+            self._apps[app_key] = app

+ 17 - 16
SourceCode/IntelligentRailwayCosting/app/core/configs/app_config.py

@@ -1,12 +1,13 @@
 class AppConfig:
     """应用配置管理类"""
+
     _name = ""
     _version = "2020"
     _use_version = True
     _source_path = ""
     _task_api_url = ""
     _task_max_projects_count = 10
-    _task_interval = 300 # 任务执行间隔时间,单位秒
+    _task_interval = 300  # 任务执行间隔时间,单位秒
 
     @property
     def name(self):
@@ -17,35 +18,35 @@ class AppConfig:
         return self._version or "2020"
 
     @property
-    def use_version(self)->bool:
+    def use_version(self) -> bool:
         return self._use_version
 
     @property
-    def source_path(self)->str:
+    def source_path(self) -> str:
         return self._source_path
+
     @property
-    def task_api_url(self)->str:
+    def task_api_url(self) -> str:
         return self._task_api_url
 
     @property
-    def task_max_projects_count(self)->int:
+    def task_max_projects_count(self) -> int:
         return self._task_max_projects_count
+
     @property
-    def task_interval(self)->int:
+    def task_interval(self) -> int:
         return self._task_interval
 
-
-
     def update_config(self, config):
         """更新应用配置
-        
+
         Args:
             config: 应用配置字典
         """
-        self._name = config.get('name','')
-        self._version = config.get('version')
-        self._use_version = config.get('use_version',False)
-        self._source_path = config.get('source_path','./temp_files')
-        self._task_api_url = config.get('task_api_url', '')
-        self._task_max_projects_count = int(config.get('task_max_projects', 10))
-        self._task_interval = int(config.get('task_interval', 300))
+        self._name = config.get("name", "")
+        self._version = config.get("version", "2000")
+        self._use_version = config.get("use_version", False)
+        self._source_path = config.get("source_path", "./temp_files")
+        self._task_api_url = config.get("task_api_url", "")
+        self._task_max_projects_count = int(config.get("task_max_projects", 10))
+        self._task_interval = int(config.get("task_interval", 300))

+ 98 - 97
SourceCode/IntelligentRailwayCosting/app/core/dtos/excel_parse.py

@@ -3,77 +3,67 @@ import base64
 
 
 class ExcelParseZgsDto:
-    def __init__(self,
-                 zgs_id:int,
-                 zgs_name:str):
+    def __init__(self, zgs_id: int, zgs_name: str):
         self.zgs_id = zgs_id
         self.zgs_name = zgs_name
 
     @classmethod
-    def from_dto(cls,dto: TotalBudgetInfoDto):
-        return cls(
-            zgs_id=dto.budget_id,
-            zgs_name=dto.budget_code
-        )
+    def from_dto(cls, dto: TotalBudgetInfoDto):
+        return cls(zgs_id=dto.budget_id, zgs_name=dto.budget_code)
+
     def to_dict(self):
-        return {
-            "zgs_id":self.zgs_id,
-            "zgs_name":self.zgs_name
-        }
+        return {"zgs_id": self.zgs_id, "zgs_name": self.zgs_name}
+
 
 class ExcelParseItemDto:
-    def __init__(self,
-                 item_id:int,
-                 item_code:str,
-                 item_name:str
-                 ):
+    def __init__(self, item_id: int, item_code: str, item_name: str):
         self.item_id = item_id
         self.item_code = item_code
         self.item_name = item_name
 
     @classmethod
-    def from_dto(cls,dto:ChapterDto):
+    def from_dto(cls, dto: ChapterDto):
         return cls(
-            item_id=dto.item_id,
-            item_code=dto.item_code,
-            item_name=dto.project_name
+            item_id=dto.item_id, item_code=dto.item_code, item_name=dto.project_name
         )
+
     def to_dict(self):
         return {
-            "item_id":self.item_id,
-            "item_code":self.item_code,
-            "item_name":self.item_name
+            "item_id": self.item_id,
+            "item_code": self.item_code,
+            "item_name": self.item_name,
         }
 
+
 class ExcelParseFileDto:
-    def __init__(self,
-                 file_id:str,
-                 content:str
-                 ):
+    def __init__(self, file_id: str, content: str):
         self.file_id = file_id
         # 从file_id路径中获取文件类型
-        self.file_type = file_id.split('.')[-1]
+        self.file_type = file_id.split(".")[-1]
         self.content = content
 
     def to_dict(self):
         return {
             "file_id": base64.b64encode(self.file_id.encode()).decode(),
             "file_type": self.file_type,
-            "content": self.content
+            "content": self.content,
         }
 
+
 class ExcelParseDto:
-    def __init__(self,
-                 task_id:int,
-                 version:str,
-                 project_id:str,
-                 project_name:str,
-                 project_stage:str,
-                 selected_zgs_id:int,
-                 zgs_list:list[ExcelParseZgsDto],
-                 hierarchy:list[ExcelParseItemDto],
-                 components:list[ExcelParseItemDto],
-                 files:list[ExcelParseFileDto]):
+    def __init__(
+            self,
+            task_id: int,
+            version: str,
+            project_id: str,
+            project_name: str,
+            project_stage: str,
+            selected_zgs_id: int,
+            zgs_list: list[ExcelParseZgsDto],
+            hierarchy: list[ExcelParseItemDto],
+            components: list[ExcelParseItemDto],
+            files: list[ExcelParseFileDto],
+    ):
         self.task_id = task_id
         self.version = version
         self.project_id = project_id
@@ -87,18 +77,19 @@ class ExcelParseDto:
 
     def to_dict(self):
         return {
-            "task_id":self.task_id,
-            "version":self.version,
-            "project_id":self.project_id,
-            "project_name":self.project_name,
-            "project_stage":self.project_stage,
-            "selected_zgs_id":self.selected_zgs_id,
-            "files":[file.to_dict() for file in self.files],
-            "zgs_list":[zgs.to_dict() for zgs in self.zgs_list],
-            "hierarchy":[item.to_dict() for item in self.hierarchy],
-            "components":[item.to_dict() for item in self.components],
+            "task_id": self.task_id,
+            "version": self.version,
+            "project_id": self.project_id,
+            "project_name": self.project_name,
+            "project_stage": self.project_stage,
+            "selected_zgs_id": self.selected_zgs_id,
+            "files": [file.to_dict() for file in self.files],
+            "zgs_list": [zgs.to_dict() for zgs in self.zgs_list],
+            "hierarchy": [item.to_dict() for item in self.hierarchy],
+            "components": [item.to_dict() for item in self.components],
         }
 
+
 class ExcelParseResultDataDto:
     # {
     #     "zgs_id": 总概算id, // int
@@ -116,22 +107,23 @@ class ExcelParseResultDataDto:
     #     "ex_unit": excel中给出的单位,
     #     "ex_amount": excel中给出的数量, // number
     # }
-    def __init__(self,
-                 zgs_id:int, # 总概算id
-                 zgs_code:str, # 总概算编号
-                 item_id:int, # 条⽬序号
-                 item_code:str, # 条⽬编码
-                 entry_name:str, # ⼯程或费⽤项⽬名称,来⾃于定额表,
-                 dinge_code:str, # 定额编号,
-                 units:str, # 单位,
-                 amount:float, # 数量,
-                 target_id:int, # ⽤户数据库中条⽬的id,-1表示没有,
-                 ex_file_id:str, # excel⽂件id,
-                 ex_cell:str, # 数量单元格位置,例如 "C17",
-                 ex_row:str, # 该⾏内容,由逗号连接多个单元格得到,
-                 ex_unit:str, # excel中给出的单位,
-                 ex_amount:float # excel中给出的数量,
-                 ):
+    def __init__(
+            self,
+            zgs_id: int,  # 总概算id
+            zgs_code: str,  # 总概算编号
+            item_id: int,  # 条⽬序号
+            item_code: str,  # 条⽬编码
+            entry_name: str,  # ⼯程或费⽤项⽬名称,来⾃于定额表,
+            dinge_code: str,  # 定额编号,
+            units: str,  # 单位,
+            amount: float,  # 数量,
+            target_id: int,  # ⽤户数据库中条⽬的id,-1表示没有,
+            ex_file_id: str,  # excel⽂件id,
+            ex_cell: str,  # 数量单元格位置,例如 "C17",
+            ex_row: str,  # 该⾏内容,由逗号连接多个单元格得到,
+            ex_unit: str,  # excel中给出的单位,
+            ex_amount: float,  # excel中给出的数量,
+    ):
         self.zgs_id = zgs_id
         self.zgs_code = zgs_code
         self.item_id = item_id
@@ -148,24 +140,29 @@ class ExcelParseResultDataDto:
         self.ex_unit = ex_unit
         self.ex_amount = ex_amount
 
-
     @classmethod
     def from_dict(cls, data: dict):
         return cls(
-            zgs_id=data.get('zgs_id', 0),
-            zgs_code=data.get('zgs_code', ''),
-            item_id=data.get('item_id', 0),
-            item_code=data.get('item_code', ''),
-            entry_name=data.get('entry_name', ''),
-            dinge_code=data.get('dinge_code', ''),
-            units=data.get('units', ''),
-            amount=data.get('amount', 0.0),
-            target_id=data.get('target_id', -1),
-            ex_file_id= base64.b64decode(data.get('ex_file_id', '').encode('utf-8')).decode('utf-8') if data.get('ex_file_id', '') else '',
-            ex_cell=data.get('ex_cell', ''),
-            ex_row=data.get('ex_row', ''),
-            ex_unit=data.get('ex_unit', ''),
-            ex_amount=data.get('ex_amount', 0.0)
+            zgs_id=data.get("zgs_id", 0),
+            zgs_code=data.get("zgs_code", ""),
+            item_id=data.get("item_id", 0),
+            item_code=data.get("item_code", ""),
+            entry_name=data.get("entry_name", ""),
+            dinge_code=data.get("dinge_code", ""),
+            units=data.get("units", ""),
+            amount=data.get("amount", 0.0),
+            target_id=data.get("target_id", -1),
+            ex_file_id=(
+                base64.b64decode(data.get("ex_file_id", "").encode("utf-8")).decode(
+                    "utf-8"
+                )
+                if data.get("ex_file_id", "")
+                else ""
+            ),
+            ex_cell=data.get("ex_cell", ""),
+            ex_row=data.get("ex_row", ""),
+            ex_unit=data.get("ex_unit", ""),
+            ex_amount=data.get("ex_amount", 0.0),
         )
 
     def to_dict(self):
@@ -176,38 +173,42 @@ class ExcelParseResultDataDto:
             "item_code": self.item_code,
             "entry_name": self.entry_name,
             "dinge_code": self.dinge_code,
+            "target_id": self.target_id,
             "units": self.units,
             "amount": self.amount,
             "ex_file": self.ex_file_id,
-            "target_id": self.target_id,
             # "ex_file_id": base64.b64encode(self.ex_file_id.encode('utf-8')).decode('utf-8') if self.ex_file_id else self.ex_file_id,
             "ex_file_id": self.ex_file_id,
             "ex_cell": self.ex_cell,
             "ex_row": self.ex_row,
             "ex_unit": self.ex_unit,
-            "ex_amount": self.ex_amount
+            "ex_amount": self.ex_amount,
         }
 
+
 class ExcelParseResultDto:
-    def __init__(self,
-                 task_id:int,
-                 result:int=-1,
-                 reason:str="",
-                 data:list[ExcelParseResultDataDto]=None,
+    def __init__(
+            self,
+            task_id: int,
+            result: int = -1,
+            reason: str = "",
+            data: list[ExcelParseResultDataDto] = None,
     ):
         self.task_id = task_id
-        self.result = result  #-1-失败;0-运行中;1-成功
+        self.result = result  # -1-失败;0-运行中;1-成功
         self.data = data
         self.reason = reason
 
     @classmethod
     def from_dict(cls, response: dict):
-        data = [ExcelParseResultDataDto.from_dict(item) for item in response.get('data', [])]
+        data = [
+            ExcelParseResultDataDto.from_dict(item) for item in response.get("data", [])
+        ]
         return cls(
-            task_id=response.get('task_id', 0),
-            result=response.get('result', 0),
-            reason=response.get('reason', ''),
-            data = data,
+            task_id=response.get("task_id", 0),
+            result=response.get("result", 0),
+            reason=response.get("reason", ""),
+            data=data,
         )
 
     def to_dict(self):
@@ -215,5 +216,5 @@ class ExcelParseResultDto:
             "task_id": self.task_id,
             "result": self.result,
             "reason": self.reason,
-            "data": [item.to_dict() for item in self.data] if self.data else []
-        }
+            "data": [item.to_dict() for item in self.data] if self.data else [],
+        }

+ 9 - 8
SourceCode/IntelligentRailwayCosting/app/core/enum/task.py

@@ -1,5 +1,6 @@
 from enum import Enum
 
+
 class TaskStatusEnum(Enum):
     NEW = 0
     WAIT = 1
@@ -9,7 +10,6 @@ class TaskStatusEnum(Enum):
     CANCELED = 5
     CHANGE = 6
 
-
     @classmethod
     def get_name(cls, status: int):
         for k, v in cls.get_dict().items():
@@ -26,9 +26,10 @@ class TaskStatusEnum(Enum):
             "运行成功": cls.SUCCESS,
             "运行失败": cls.FAILURE,
             "取消运行": cls.CANCELED,
-            "已修改": cls.CHANGE
+            "已修改": cls.CHANGE,
         }
 
+
 class SendStatusEnum(Enum):
     NEW = 0
     PROCESSING = 1
@@ -46,9 +47,9 @@ class SendStatusEnum(Enum):
     @classmethod
     def get_dict(cls):
         return {
-            "未送": cls.NEW,
-            "送中": cls.PROCESSING,
-            "送成功": cls.SUCCESS,
-            "送失败": cls.FAILURE,
-            "已修改": cls.CHANGE
-        }
+            "未送": cls.NEW,
+            "送中": cls.PROCESSING,
+            "送成功": cls.SUCCESS,
+            "送失败": cls.FAILURE,
+            "已修改": cls.CHANGE,
+        }

+ 2 - 1
SourceCode/IntelligentRailwayCosting/app/stores/__init__.py

@@ -1,4 +1,5 @@
-# from stores.railway_costing_mysql import LogStore,ProjectQuotaStore,ProjectTaskStore
+# from stores.railway_costing_mysql import LogStore, ProjectQuotaStore, ProjectTaskStore
+
 from stores.railway_costing_sqlserver import (
     LogStore,
     ProjectQuotaStore,

+ 1 - 2
SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_mysql/log.py

@@ -9,7 +9,7 @@ from core.models import LogModel
 class LogStore:
     def __init__(self):
         # self._database= None
-        self._database = "Iwb_RailwayCosting"
+        self._database = "iwb_railway_costing_v1"
 
     def query_logs_paginated(
             self,
@@ -36,7 +36,6 @@ class LogStore:
         """
         with db_helper.mysql_query_session(self._database) as db_session:
             query = db_session.query(LogModel)
-
             # 构建查询条件
             conditions = []
             if username:

+ 3 - 2
SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_mysql/project_quota.py

@@ -12,7 +12,7 @@ from core.user_session import UserSession
 class ProjectQuotaStore:
     def __init__(self):
         # self._database= None
-        self._database = "Iwb_RailwayCosting"
+        self._database = "iwb_railway_costing_v1"
         self._current_user = None
 
     @property
@@ -115,7 +115,7 @@ class ProjectQuotaStore:
 
             # 分页
             query = (
-                query.order_by(ProjectQuotaModel.created_at.desc())
+                query.order_by(ProjectQuotaModel.id.desc())
                 .offset((page - 1) * page_size)
                 .limit(page_size)
             )
@@ -209,6 +209,7 @@ class ProjectQuotaStore:
                 task_id=quota_dto.task_id,
                 item_id=quota_dto.item_id,
                 item_code=quota_dto.item_code,
+                quota_id=quota_dto.quota_id,
                 quota_code=quota_dto.quota_code,
                 entry_name=quota_dto.entry_name,
                 units=quota_dto.units,

+ 1 - 1
SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_mysql/project_task.py

@@ -12,7 +12,7 @@ from core.user_session import UserSession
 class ProjectTaskStore:
     def __init__(self):
         # self._database= None
-        self._database = "Iwb_RailwayCosting"
+        self._database = "iwb_railway_costing_v1"
         self._current_user = None
 
     @property

+ 1 - 1
SourceCode/IntelligentRailwayCosting/app/stores/railway_costing_sqlserver/project_quota.py

@@ -71,7 +71,7 @@ class ProjectQuotaStore:
 
             # 分页
             query = (
-                query.order_by(ProjectQuotaModel.created_at.desc())
+                query.order_by(ProjectQuotaModel.id.desc())
                 .offset((page - 1) * page_size)
                 .limit(page_size)
             )

+ 2 - 1
SourceCode/IntelligentRailwayCosting/requirements.txt

@@ -10,4 +10,5 @@ openai~=1.66.3
 pandas~=2.2.3
 requests~=2.32.3
 PyYAML~=6.0.2
-pyodbc~=5.2.0
+pyodbc~=5.2.0
+cryptography==41.0.4