first commit

This commit is contained in:
王思川 2024-03-27 14:50:00 +08:00
commit 8d72e8bca0
23 changed files with 592 additions and 0 deletions

162
.gitignore vendored Normal file
View File

@ -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/

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

10
.idea/TimberTrust.iml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,21 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="h1" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (TimberTrust)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/TimberTrust.iml" filepath="$PROJECT_DIR$/.idea/TimberTrust.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

0
TimberTrust/__init__.py Normal file
View File

16
TimberTrust/asgi.py Normal file
View File

@ -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()

124
TimberTrust/settings.py Normal file
View File

@ -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"

22
TimberTrust/urls.py Normal file
View File

@ -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),
]

16
TimberTrust/wsgi.py Normal file
View File

@ -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()

View File

View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class BusinessInformationConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "business_information"

View File

@ -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 = "工商信息"

View File

@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>{{ company.name }} - 企业工商信息详情</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css">
</head>
<body class="bg-gray-100">
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="bg-white p-5 shadow-lg rounded-lg">
<div class="flex items-center space-x-3 mb-4">
<div class="flex-shrink-0">
<img class="h-12 w-12 rounded-full" src="https://placehold.co/100x100" alt="公司LOGO占位图">
</div>
<div class="flex-1 min-w-0">
<p class="text-lg font-medium text-gray-900 truncate">{{ company.name }}</p>
<p class="text-sm text-gray-500 truncate">注册资本: {{ company.registered_capital }}元</p>
</div>
</div>
<!-- 企业详细信息 -->
<div class="grid grid-cols-2 gap-4">
<div class="col-span-2 sm:col-span-1">
<p><strong>企业名称:</strong>{{ company.name }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>经营状态:</strong>{{ company.operation_status }}</p>
</div>
<div class="col-span-2">
<p><strong>法定代表人:</strong>{{ company.legal_representative }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>注册资本:</strong>{{ company.registered_capital }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>实缴资本:</strong>{{ company.paid_in_capital }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>成立日期:</strong>{{ company.establishment_date }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>核准日期:</strong>{{ company.approval_date }}</p>
</div>
<div class="col-span-2">
<p><strong>营业期限:</strong>{{ company.operation_period }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>所属省份:</strong>{{ company.province }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>所属城市:</strong>{{ company.city }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>所属区县:</strong>{{ company.district }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>统一社会信用代码:</strong>{{ company.unified_social_credit_code }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>纳税人识别号:</strong>{{ company.taxpayer_identification_number }}</p>
</div>
<div class="col-span-2">
<p><strong>注册号:</strong>{{ company.registration_number }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>组织机构代码:</strong>{{ company.organization_code }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>参保人数:</strong>{{ company.insured_persons_number }}</p>
</div>
<div class="col-span-2">
<p><strong>公司类型:</strong>{{ company.company_type }}</p>
</div>
<div class="col-span-2">
<p><strong>所属行业:</strong>{{ company.industry }}</p>
</div>
<div class="col-span-2">
<p><strong>曾用名:</strong>{{ company.used_name }}</p>
</div>
<div class="col-span-2">
<p><strong>注册地址:</strong>{{ company.registered_address }}</p>
</div>
<div class="col-span-2">
<p><strong>最新年报地址:</strong>{{ company.latest_annual_report_address }}</p>
</div>
<div class="col-span-2">
<p><strong>网址:</strong><a href="{{ company.website }}" target="_blank">{{ company.website }}</a></p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>电话:</strong>{{ company.phone }}</p>
</div>
<div class="col-span-2 sm:col-span-1">
<p><strong>其他电话:</strong>{{ company.other_phone }}</p>
</div>
<div class="col-span-2">
<p><strong>邮箱:</strong>{{ company.email }}</p>
</div>
<div class="col-span-2">
<p><strong>其他邮箱:</strong>{{ company.other_email }}</p>
</div>
<div class="col-span-2">
<p><strong>经营范围:</strong>{{ company.business_scope }}</p>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -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})

22
manage.py Normal file
View File

@ -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()

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Django==5.0.3