From 8d72e8bca0888276a10ef5f0445a50660fedcd44 Mon Sep 17 00:00:00 2001 From: sichan Date: Wed, 27 Mar 2024 14:50:00 +0800 Subject: [PATCH] first commit --- .gitignore | 162 ++++++++++++++++++ .idea/.gitignore | 8 + .idea/TimberTrust.iml | 10 ++ .idea/inspectionProfiles/Project_Default.xml | 21 +++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 4 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + TimberTrust/__init__.py | 0 TimberTrust/asgi.py | 16 ++ TimberTrust/settings.py | 124 ++++++++++++++ TimberTrust/urls.py | 22 +++ TimberTrust/wsgi.py | 16 ++ business_information/__init__.py | 0 business_information/admin.py | 3 + business_information/apps.py | 6 + business_information/migrations/__init__.py | 0 business_information/models.py | 39 +++++ .../business_information/company_detail.html | 108 ++++++++++++ business_information/tests.py | 3 + business_information/views.py | 7 + manage.py | 22 +++ requirements.txt | 1 + 23 files changed, 592 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/TimberTrust.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 TimberTrust/__init__.py create mode 100644 TimberTrust/asgi.py create mode 100644 TimberTrust/settings.py create mode 100644 TimberTrust/urls.py create mode 100644 TimberTrust/wsgi.py create mode 100644 business_information/__init__.py create mode 100644 business_information/admin.py create mode 100644 business_information/apps.py create mode 100644 business_information/migrations/__init__.py create mode 100644 business_information/models.py create mode 100644 business_information/templates/business_information/company_detail.html create mode 100644 business_information/tests.py create mode 100644 business_information/views.py create mode 100644 manage.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..287a2f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,162 @@ +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/TimberTrust.iml b/.idea/TimberTrust.iml new file mode 100644 index 0000000..2c80e12 --- /dev/null +++ b/.idea/TimberTrust.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9f44ea3 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,21 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..86b4684 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..84160e2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TimberTrust/__init__.py b/TimberTrust/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/TimberTrust/asgi.py b/TimberTrust/asgi.py new file mode 100644 index 0000000..1a74746 --- /dev/null +++ b/TimberTrust/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for TimberTrust project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TimberTrust.settings") + +application = get_asgi_application() diff --git a/TimberTrust/settings.py b/TimberTrust/settings.py new file mode 100644 index 0000000..75a2517 --- /dev/null +++ b/TimberTrust/settings.py @@ -0,0 +1,124 @@ +""" +Django settings for TimberTrust project. + +Generated by 'django-admin startproject' using Django 5.0.3. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.0/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = "django-insecure-ne(nulf(&djg-&6xa(^fruf)kpj05!50$w)s(ss09^=7ob&_g8" + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", +] + +MIDDLEWARE = [ + "django.middleware.security.SecurityMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", +] + +ROOT_URLCONF = "TimberTrust.urls" + +TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [BASE_DIR / 'templates'] + , + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", + ], + }, + }, +] + +WSGI_APPLICATION = "TimberTrust.wsgi.application" + + +# Database +# https://docs.djangoproject.com/en/5.0/ref/settings/#databases + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": BASE_DIR / "db.sqlite3", + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/5.0/topics/i18n/ + +LANGUAGE_CODE = "zh-hans" + +TIME_ZONE = "Asia/Shanghai" + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.0/howto/static-files/ + +STATIC_URL = "static/" + +# Default primary key field type +# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" diff --git a/TimberTrust/urls.py b/TimberTrust/urls.py new file mode 100644 index 0000000..126f0d8 --- /dev/null +++ b/TimberTrust/urls.py @@ -0,0 +1,22 @@ +""" +URL configuration for TimberTrust project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/5.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +urlpatterns = [ + path("admin/", admin.site.urls), +] diff --git a/TimberTrust/wsgi.py b/TimberTrust/wsgi.py new file mode 100644 index 0000000..c1e9b3d --- /dev/null +++ b/TimberTrust/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for TimberTrust project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TimberTrust.settings") + +application = get_wsgi_application() diff --git a/business_information/__init__.py b/business_information/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/business_information/admin.py b/business_information/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/business_information/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/business_information/apps.py b/business_information/apps.py new file mode 100644 index 0000000..605621a --- /dev/null +++ b/business_information/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class BusinessInformationConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "business_information" diff --git a/business_information/migrations/__init__.py b/business_information/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/business_information/models.py b/business_information/models.py new file mode 100644 index 0000000..27ef77f --- /dev/null +++ b/business_information/models.py @@ -0,0 +1,39 @@ +from django.db import models + + +class Company(models.Model): + enterprise_id = models.CharField(max_length=15, unique=True, verbose_name="企业ID") + name = models.CharField(max_length=255, verbose_name="企业名称") + operation_status = models.CharField(max_length=100, verbose_name="经营状态") + legal_representative = models.CharField(max_length=100, verbose_name="法定代表人") + registered_capital = models.DecimalField(max_digits=19, decimal_places=2, verbose_name="注册资本") + paid_in_capital = models.DecimalField(max_digits=19, decimal_places=2, verbose_name="实缴资本") + establishment_date = models.DateField(verbose_name="成立日期") + approval_date = models.DateField(verbose_name="核准日期") + operation_period = models.CharField(max_length=100, verbose_name="营业期限") + province = models.CharField(max_length=100, verbose_name="所属省份") + city = models.CharField(max_length=100, verbose_name="所属城市") + district = models.CharField(max_length=100, verbose_name="所属区县") + unified_social_credit_code = models.CharField(max_length=18, verbose_name="统一社会信用代码") + taxpayer_identification_number = models.CharField(max_length=20, verbose_name="纳税人识别号") + registration_number = models.CharField(max_length=15, verbose_name="注册号") + organization_code = models.CharField(max_length=10, verbose_name="组织机构代码") + insured_persons_number = models.IntegerField(verbose_name="参保人数") + company_type = models.CharField(max_length=100, verbose_name="公司类型") + industry = models.CharField(max_length=100, verbose_name="所属行业") + used_name = models.CharField(max_length=255, blank=True, null=True, verbose_name="曾用名") + registered_address = models.TextField(verbose_name="注册地址") + latest_annual_report_address = models.TextField(verbose_name="最新年报地址") + website = models.URLField(blank=True, null=True, verbose_name="网址") + phone = models.CharField(max_length=20, verbose_name="电话") + other_phone = models.CharField(max_length=20, blank=True, null=True, verbose_name="其他电话") + email = models.EmailField(verbose_name="邮箱") + other_email = models.EmailField(blank=True, null=True, verbose_name="其他邮箱") + business_scope = models.TextField(verbose_name="经营范围") + + def __str__(self): + return self.name + + class Meta: + verbose_name = "工商信息" + verbose_name_plural = "工商信息" diff --git a/business_information/templates/business_information/company_detail.html b/business_information/templates/business_information/company_detail.html new file mode 100644 index 0000000..5017b4e --- /dev/null +++ b/business_information/templates/business_information/company_detail.html @@ -0,0 +1,108 @@ + + + + + {{ company.name }} - 企业工商信息详情 + + + +
+
+
+
+ 公司LOGO占位图 +
+
+

{{ company.name }}

+

注册资本: {{ company.registered_capital }}元

+
+
+ + +
+
+

企业名称:{{ company.name }}

+
+
+

经营状态:{{ company.operation_status }}

+
+
+

法定代表人:{{ company.legal_representative }}

+
+
+

注册资本:{{ company.registered_capital }}

+
+
+

实缴资本:{{ company.paid_in_capital }}

+
+
+

成立日期:{{ company.establishment_date }}

+
+
+

核准日期:{{ company.approval_date }}

+
+
+

营业期限:{{ company.operation_period }}

+
+
+

所属省份:{{ company.province }}

+
+
+

所属城市:{{ company.city }}

+
+
+

所属区县:{{ company.district }}

+
+
+

统一社会信用代码:{{ company.unified_social_credit_code }}

+
+
+

纳税人识别号:{{ company.taxpayer_identification_number }}

+
+
+

注册号:{{ company.registration_number }}

+
+
+

组织机构代码:{{ company.organization_code }}

+
+
+

参保人数:{{ company.insured_persons_number }}

+
+
+

公司类型:{{ company.company_type }}

+
+
+

所属行业:{{ company.industry }}

+
+
+

曾用名:{{ company.used_name }}

+
+
+

注册地址:{{ company.registered_address }}

+
+
+

最新年报地址:{{ company.latest_annual_report_address }}

+
+
+

网址:{{ company.website }}

+
+
+

电话:{{ company.phone }}

+
+
+

其他电话:{{ company.other_phone }}

+
+
+

邮箱:{{ company.email }}

+
+
+

其他邮箱:{{ company.other_email }}

+
+
+

经营范围:{{ company.business_scope }}

+
+
+
+
+ + \ No newline at end of file diff --git a/business_information/tests.py b/business_information/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/business_information/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/business_information/views.py b/business_information/views.py new file mode 100644 index 0000000..f2d18ae --- /dev/null +++ b/business_information/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render, get_object_or_404 +from .models import Company + + +def company_detail(request, enterprise_id): + company = get_object_or_404(Company, enterprise_id=enterprise_id) + return render(request, 'business_information/company_detail.html', {'company': company}) \ No newline at end of file diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..4e4246d --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TimberTrust.settings") + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ad7349a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Django==5.0.3 \ No newline at end of file