pdcj设计
为了实现这些功能需求,我们需要设计多个数据库表来存储相关的数据,并编写相应的Java代码来处理业务逻辑。下面是各个功能需求对应的MySQL表结构以及部分Java代码示例。
商品设置管理
商品分类管理
- 商品分类表 (product_categories)
CREATE TABLE product_categories (id INT AUTO_INCREMENT PRIMARY KEY,category_name VARCHAR(255) NOT NULL,category_code VARCHAR(50) NOT NULL,parent_id INT DEFAULT NULL,FOREIGN KEY (parent_id) REFERENCES product_categories(id) );
单位维护
- 单位表 (units)
CREATE TABLE units (id INT AUTO_INCREMENT PRIMARY KEY,unit_name VARCHAR(50) NOT NULL );
未上架商品
- 商品表 (products)
CREATE TABLE products (id INT AUTO_INCREMENT PRIMARY KEY,category_id INT NOT NULL,product_code VARCHAR(50) NOT NULL,product_name VARCHAR(255) NOT NULL,market_price DECIMAL(10, 2),unit_id INT NOT NULL,main_image VARCHAR(255),carousel_images TEXT,details TEXT,status ENUM('NOT_LISTED', 'LISTED') DEFAULT 'NOT_LISTED',created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,FOREIGN KEY (category_id) REFERENCES product_categories(id),FOREIGN KEY (unit_id) REFERENCES units(id) );
已上架商品
- 商品状态表 (product_status)
CREATE TABLE product_status (id INT AUTO_INCREMENT PRIMARY KEY,product_id INT NOT NULL,listed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,status ENUM('LISTED', 'DELISTED') DEFAULT 'LISTED',FOREIGN KEY (product_id) REFERENCES products(id) );
交易设置管理
交易日程设置
-
交易日历表 (trading_calendar)
CREATE TABLE trading_calendar (id INT AUTO_INCREMENT PRIMARY KEY,date DATE NOT NULL,status ENUM('OPEN', 'CLOSED') NOT NULL,preparation_time TIME,opening_time TIME,closing_time TIME,settlement_time TIME,settlement_completion_time TIME ); -
暂停节表 (pause_periods)
CREATE TABLE pause_periods (id INT AUTO_INCREMENT PRIMARY KEY,name VARCHAR(255) NOT NULL,start_time TIME,end_time TIME );
市场开休市管理
- 市场表 (markets)
CREATE TABLE markets (id INT AUTO_INCREMENT PRIMARY KEY,name VARCHAR(255) NOT NULL,trading_days VARCHAR(255) NOT NULL,status ENUM('OPEN', 'CLOSED') NOT NULL,next_trading_day DATE );
市场参数设置
- 市场参数表 (market_parameters)
CREATE TABLE market_parameters (id INT AUTO_INCREMENT PRIMARY KEY,group_deposit_algorithm ENUM('FIXED', 'RATIO') NOT NULL,purchase_deposit_value DECIMAL(10, 2),purchase_fee_algorithm ENUM('FIXED', 'RATIO') NOT NULL,purchase_fee_value DECIMAL(10, 2),sale_fee_algorithm ENUM('FIXED', 'RATIO') NOT NULL,sale_fee_value DECIMAL(10, 2),interest_rate DECIMAL(10, 8) );
拼单团购管理
团购设置
- 团购设置表 (group_buying_settings)
CREATE TABLE group_buying_settings (id INT AUTO_INCREMENT PRIMARY KEY,code VARCHAR(50) NOT NULL,name VARCHAR(255) NOT NULL,product_category_id INT NOT NULL,product_id INT NOT NULL,minimum_quantity DECIMAL(10, 2),formation_condition DECIMAL(10, 2),start_time DATETIME,end_time DATETIME,display_end_time DATETIME,status ENUM('UNSTARTED', 'ONGOING', 'COMPLETED') NOT NULL,description TEXT,FOREIGN KEY (product_category_id) REFERENCES product_categories(id),FOREIGN KEY (product_id) REFERENCES products(id) );
团购参与详情
- 团购参与表 (group_buying_participants)
CREATE TABLE group_buying_participants (id INT AUTO_INCREMENT PRIMARY KEY,group_buying_setting_id INT NOT NULL,user_code VARCHAR(50) NOT NULL,user_name VARCHAR(255) NOT NULL,order_quantity DECIMAL(10, 2),status ENUM('PENDING_FORMATION', 'FORMED', 'EXPIRED') NOT NULL,deposit_amount DECIMAL(10, 2),formation_amount DECIMAL(10, 2),order_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,FOREIGN KEY (group_buying_setting_id) REFERENCES group_buying_settings(id) );
集采订单管理
采购管理
- 采购订单表 (purchase_orders)
CREATE TABLE purchase_orders (id INT AUTO_INCREMENT PRIMARY KEY,product_category_id INT NOT NULL,product_id INT NOT NULL,unit_price DECIMAL(10, 2),total_quantity DECIMAL(10, 2),total_amount DECIMAL(10, 2),total_deposit DECIMAL(10, 2),status ENUM('PENDING_PURCHASE', 'PURCHASED') NOT NULL,FOREIGN KEY (product_category_id) REFERENCES product_categories(id),FOREIGN KEY (product_id) REFERENCES products(id) );
发货订单管理
- 发货订单表 (shipping_orders)
CREATE TABLE shipping_orders (id INT AUTO_INCREMENT PRIMARY KEY,order_number VARCHAR(50) NOT NULL,product_category_id INT NOT NULL,product_id INT NOT NULL,buyer_code VARCHAR(50) NOT NULL,buyer_name VARCHAR(255) NOT NULL,seller_code VARCHAR(50) NOT NULL,seller_name VARCHAR(255) NOT NULL,unit_price DECIMAL(10, 2),quantity DECIMAL(10, 2),deposit_amount DECIMAL(10, 2),status ENUM('WAITING_PAYMENT', 'WAITING_SHIPPING', 'WAITING_RECEIPT', 'COMPLETED') NOT NULL,FOREIGN KEY (product_category_id) REFERENCES product_categories(id),FOREIGN KEY (product_id) REFERENCES products(id) );
供求信息管理
集采预购信息
- 集采预购信息表 (pre_purchase_info)
CREATE TABLE pre_purchase_info (id INT AUTO_INCREMENT PRIMARY KEY,product_category_id INT NOT NULL,product_id INT NOT NULL,pre_purchase_date DATE,pre_purchase_unit_price DECIMAL(10, 2),pre_purchase_quantity DECIMAL(10, 2),total_price DECIMAL(10, 2),contact_person VARCHAR(255),contact_phone VARCHAR(50),other_info TEXT,publish_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,status ENUM('PENDING_ACCEPTANCE', 'ACCEPTED') NOT NULL,FOREIGN KEY (product_category_id) REFERENCES product_categories(id),FOREIGN KEY (product_id) REFERENCES products(id) );
销售报价信息
- 销售报价信息表 (sales_quotes)
CREATE TABLE sales_quotes (id INT AUTO_INCREMENT PRIMARY KEY,product_category_id INT NOT NULL,product_id INT NOT NULL,pre_sale_date DATE,pre_sale_unit_price DECIMAL(10, 2),pre_sale_quantity DECIMAL(10, 2),total_price DECIMAL(10, 2),contact_person VARCHAR(255),contact_phone VARCHAR(50),other_info TEXT,publish_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,status ENUM('PENDING_ACCEPTANCE', 'ACCEPTED') NOT NULL,FOREIGN KEY (product_category_id) REFERENCES product_categories(id),FOREIGN KEY (product_id) REFERENCES products(id) );
Java示例代码
商品分类管理 - 新增分类
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;@Service
public class ProductCategoryService {@PersistenceContextprivate EntityManager entityManager;@Autowiredprivate ProductCategoryRepository productCategoryRepository;public void addProductCategory(String categoryName, String categoryCode) {ProductCategory category = new ProductCategory();category.setCategoryName(categoryName);category.setCategoryCode(categoryCode);productCategoryRepository.save(category);}
}import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;@Entity
public class ProductCategory {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;private String categoryName;private String categoryCode;private Integer parentId;// Getters and setters
}
商品管理 - 新增商品
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;@Service
public class ProductService {@PersistenceContextprivate EntityManager entityManager;@Autowiredprivate ProductRepository productRepository;@Autowiredprivate UnitRepository unitRepository;public void addProduct(int categoryId, String productCode, String productName, double marketPrice, int unitId, String mainImage, String carouselImages, String details) {Product product = new Product();product.setCategoryId(categoryId);product.setProductCode(productCode);product.setProductName(productName);product.setMarketPrice(marketPrice);product.setUnitId(unitId);product.setMainImage(mainImage);product.setCarouselImages(carouselImages);product.setDetails(details);product.setStatus("NOT_LISTED");productRepository.save(product);}
}import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;@Entity
public class Product {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;private int categoryId;private String productCode;private String productName;private double marketPrice;private int unitId;private String mainImage;private String carouselImages;private String details;private String status;// Getters and setters
}
商品管理 - 上架商品
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;@Service
public class ProductService {@PersistenceContextprivate EntityManager entityManager;@Autowiredprivate ProductRepository productRepository;public void listProduct(int productId) {Product product = productRepository.findById(productId).orElse(null);if (product != null) {product.setStatus("LISTED");productRepository.save(product);}}
}
市场参数设置 - 修改参数
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;@Service
public class MarketParameterService {@PersistenceContextprivate EntityManager entityManager;@Autowiredprivate MarketParameterRepository marketParameterRepository;public void updateMarketParameters(String groupDepositAlgorithm, Double purchaseDepositValue, String purchaseFeeAlgorithm, Double purchaseFeeValue, String saleFeeAlgorithm, Double saleFeeValue, Double interestRate) {MarketParameters parameters = marketParameterRepository.findById(1L).orElse(null);if (parameters != null) {parameters.setGroupDepositAlgorithm(groupDepositAlgorithm);parameters.setPurchaseDepositValue(purchaseDepositValue);parameters.setPurchaseFeeAlgorithm(purchaseFeeAlgorithm);parameters.setPurchaseFeeValue(purchaseFeeValue);parameters.setSaleFeeAlgorithm(saleFeeAlgorithm);parameters.setSaleFeeValue(saleFeeValue);parameters.setInterestRate(interestRate);marketParameterRepository.save(parameters);}}
}import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;@Entity
public class MarketParameters {@Id@GeneratedValue(strategy = GenerationType.IDENTITY)private Long id;private String groupDepositAlgorithm;private Double purchaseDepositValue;private String purchaseFeeAlgorithm;private Double purchaseFeeValue;private String saleFeeAlgorithm;private Double saleFeeValue;private Double interestRate;// Getters and setters
}
这些示例代码仅覆盖了一小部分功能,您还需要根据实际需求扩展和完善其他的业务逻辑。如果您需要更详细的实现,请告知我。
相关文章:
pdcj设计
为了实现这些功能需求,我们需要设计多个数据库表来存储相关的数据,并编写相应的Java代码来处理业务逻辑。下面是各个功能需求对应的MySQL表结构以及部分Java代码示例。 商品设置管理 商品分类管理 商品分类表 (product_categories)CREATE TABLE produ…...
【数据结构】哈希表的模拟实现
文章目录 1. 哈希的概念2. 哈希表与哈希函数2.1 哈希冲突2.2 哈希函数2.3 哈希冲突的解决2.3.1 闭散列(线性探测)2.3.2 闭散列的实现2.3.3 开散列(哈希桶)2.3.4 开散列的实现 2.4 开散列与闭散列比较 1. 哈希的概念 在我们之前所接触到的所有的数据结构…...
面试经典算法150题系列-数组/字符串操作之多数元素
序言:今天是第五题啦,前面四题的解法还清楚吗?可以到面试算法题系列150题专栏 进行复习呀。 温故而知新,可以为师矣!加油,未来的技术大牛们。 多数元素 给定一个大小为 n 的数组 nums ,返回其…...
海南云亿商务咨询有限公司领航抖音电商服务
在当下这个瞬息万变的互联网时代,短视频平台尤其是抖音,正以惊人的速度重塑着消费者的购物习惯与商家的营销版图。在这场电商盛宴中,海南云亿商务咨询有限公司凭借其在抖音电商领域的深厚积累与前瞻视野,正逐步成为众多商家转型升…...
C#初级——继承
继承 继承是面向对象程序设计中最重要的概念之一。继承允许我们根据一个类来定义另一个类,不需要完全重新编写新的数据成员和成员函数,只需要设计一个新的类,继承了已有的类的成员即可。这个已有的类被称为的基类(父类࿰…...
Github 2024-07-29 开源项目日报 Top10
根据Github Trendings的统计,今日(2024-07-29统计)共有10个项目上榜。根据开发语言中项目的数量,汇总情况如下: 开发语言项目数量JavaScript项目3非开发语言项目3Python项目1TypeScript项目1C++项目1Lean项目1HTML项目1免费编程学习平台:freeCodeCamp.org 创建周期:3302 天…...
nginx反向代理和负载均衡+安装jdk-22.0.2
ps -aux|grep nginx //查看进程 nginx 代理 nginx代理是负载均衡的基础 主机:192.168.118.60 这台主机只发布了web服务,没有做代理的任何操作 修改一下index.html中的内容 echo "this is java web server" > /usr/local/nginx/htm…...
软考高级科目怎么选?软考高级含金量排序
软考既是国家职业资格考试,又是职称资格考试,含金量很高。软考的报考不设置任何条件,可以跨级考试,也就是非相关专业的人,也可以直接考高级。因此近些年报考软考、尤其是软考高级的人越来越多。 软考高级证书…...
【机器学习西瓜书学习笔记——模型评估与选择】
机器学习西瓜书学习笔记【第二章】 第二章 模型评估与选择2.1训练误差和测试误差错误率误差 欠拟合和过拟合2.2评估方法留出法交叉验证法自助法 2.3性能度量查准率、查全率与F1查准率查全率F1 P-R曲线ROC与AUCROCAUC 代价敏感错误率与代价曲线代价曲线 2.4比较检验假设检验&…...
vue3+cesium创建地图
1.我这边使用的是cdn引入形式 比较简单的方式 不需要下载依赖 在项目文件的index.html引入 这样cesium就会挂载到window对象上面去了 <!-- 引入cesium-js文件 --><script src"https://cesium.com/downloads/cesiumjs/releases/1.111/Build/Cesium/Cesium.js"…...
Zookeeper客户端和服务端NIO网络通信源码剖析
文章目录 服务端的ServerCnxFactory到底是个什么东西?ServerCnxFactory 的作用ServerCnxFactory 的实现使用 ServerCnxFactory 的示例注意事项ServerCnxFactory是什么时候完成初始化的?初始化流程代码示例详细步骤1. 创建实例2. 配置3. 启动初始化时机总结服务端基于NIO的Ser…...
从DevOps到DevSecOps是怎样之中转变?
DevSecOps是DevOps实践的自然演进,其重点是将安全集成到软件开发和部署流程中。在DevOps和DevSecOps发展之前,企业通常在在软件部署前进行集中的安全测试,导致安全介入严重滞后,漏洞分风险无法及时修复,影响上线交付。…...
ORM与第三方数据库对接的探讨及不同版本数据库的影响
对象关系映射(Object-Relational Mapping,ORM)是一种将程序中的对象与数据库中的数据进行映射的技术,使开发者可以通过操作对象来间接操作数据库。然而,在实际应用中,ORM并不是总能完美地对接陌生的第三方数…...
Windows远程桌面无法拷贝文件问题
场景说明 Winwdows远程桌面,相比Linux方便一点就是,同是windows连接,其中复制粘贴功能,可以在两个windows无缝切换。 但最近笔者远程一台测试windows服务器时,发现无法在服务器上复制内容到本地,也无法从…...
优化数据处理效率,解读 EasyMR 大数据组件升级
EasyMR 作为袋鼠云基于云原生技术和 Hadoop、Hive、Spark、Flink、Hbase、Presto 等开源大数据组件构建的弹性计算引擎。此前,我们已就其展开了多方位、多角度的详尽介绍。而此次,我们成功接入了大数据组件的升级和回滚功能,能够借助 EasyMR …...
并发编程AtomicInteger详解
AtomicInteger 是 Java 并发包 (java.util.concurrent.atomic) 中的一个原子变量类,用于对 int 类型的变量进行原子操作。它利用底层的 CAS(Compare-And-Swap)机制,实现了无锁的线程安全。AtomicInteger 常用于需要高效、线程安全…...
ctfshow 权限维持 web670--web679
web670 <?php// 题目说明: // 想办法维持权限,确定无误后提交check,通过check后,才会生成flag,此前flag不存在error_reporting(0); highlight_file(__FILE__);$a$_GET[action];switch($a){case cmd:eval($_POST[c…...
职场生存指南
求职篇 面试潜台词分析 (1)介绍: “请做一下自我介绍?” ❌:慢吞吞的介绍:叫什么,来自学校,专业,工作了那几家公司。 问题目的:个人优势+岗位匹配度+个人身上技能标签 (2)反问: “你还有什么想问的吗?” 问题目的:对工作的好奇心+个人积极性<——岗位…...
Spring源码(八)--Spring实例化的策略
Spring实例化的策略有几种 ,可以看一下 InstantiationStrategy 相关的类。 UML 结构图 InstantiationStrategy的实现类有 SimpleInstantiationStrategy。 CglibSubclassingInstantiationStrategy 又继承了SimpleInstantiationStrategy。 InstantiationStrategy I…...
部署KVM虚拟化平台
文章目录 KVM虚拟化架构KVM组成KVM虚拟化三种模式 KVM虚拟化架构 KVM模块直接整合在Linux内核中 KVM组成 e KVM Driver虚拟机创建虚拟机内存分配虚拟CPU寄存器读写虚拟CPU运行 QEMU(快速仿真器) 模拟PC硬件的用户控件组件提供I/O设备模型及访问外设的途径 KVM虚拟化三种模式 客…...
Python|GIF 解析与构建(5):手搓截屏和帧率控制
目录 Python|GIF 解析与构建(5):手搓截屏和帧率控制 一、引言 二、技术实现:手搓截屏模块 2.1 核心原理 2.2 代码解析:ScreenshotData类 2.2.1 截图函数:capture_screen 三、技术实现&…...
变量 varablie 声明- Rust 变量 let mut 声明与 C/C++ 变量声明对比分析
一、变量声明设计:let 与 mut 的哲学解析 Rust 采用 let 声明变量并通过 mut 显式标记可变性,这种设计体现了语言的核心哲学。以下是深度解析: 1.1 设计理念剖析 安全优先原则:默认不可变强制开发者明确声明意图 let x 5; …...
深入浅出Asp.Net Core MVC应用开发系列-AspNetCore中的日志记录
ASP.NET Core 是一个跨平台的开源框架,用于在 Windows、macOS 或 Linux 上生成基于云的新式 Web 应用。 ASP.NET Core 中的日志记录 .NET 通过 ILogger API 支持高性能结构化日志记录,以帮助监视应用程序行为和诊断问题。 可以通过配置不同的记录提供程…...
376. Wiggle Subsequence
376. Wiggle Subsequence 代码 class Solution { public:int wiggleMaxLength(vector<int>& nums) {int n nums.size();int res 1;int prediff 0;int curdiff 0;for(int i 0;i < n-1;i){curdiff nums[i1] - nums[i];if( (prediff > 0 && curdif…...
[10-3]软件I2C读写MPU6050 江协科技学习笔记(16个知识点)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16...
python爬虫:Newspaper3k 的详细使用(好用的新闻网站文章抓取和解析的Python库)
更多内容请见: 爬虫和逆向教程-专栏介绍和目录 文章目录 一、Newspaper3k 概述1.1 Newspaper3k 介绍1.2 主要功能1.3 典型应用场景1.4 安装二、基本用法2.2 提取单篇文章的内容2.2 处理多篇文档三、高级选项3.1 自定义配置3.2 分析文章情感四、实战案例4.1 构建新闻摘要聚合器…...
3-11单元格区域边界定位(End属性)学习笔记
返回一个Range 对象,只读。该对象代表包含源区域的区域上端下端左端右端的最后一个单元格。等同于按键 End 向上键(End(xlUp))、End向下键(End(xlDown))、End向左键(End(xlToLeft)End向右键(End(xlToRight)) 注意:它移动的位置必须是相连的有内容的单元格…...
ip子接口配置及删除
配置永久生效的子接口,2个IP 都可以登录你这一台服务器。重启不失效。 永久的 [应用] vi /etc/sysconfig/network-scripts/ifcfg-eth0修改文件内内容 TYPE"Ethernet" BOOTPROTO"none" NAME"eth0" DEVICE"eth0" ONBOOT&q…...
安宝特案例丨Vuzix AR智能眼镜集成专业软件,助力卢森堡医院药房转型,赢得辉瑞创新奖
在Vuzix M400 AR智能眼镜的助力下,卢森堡罗伯特舒曼医院(the Robert Schuman Hospitals, HRS)凭借在无菌制剂生产流程中引入增强现实技术(AR)创新项目,荣获了2024年6月7日由卢森堡医院药剂师协会࿰…...
20个超级好用的 CSS 动画库
分享 20 个最佳 CSS 动画库。 它们中的大多数将生成纯 CSS 代码,而不需要任何外部库。 1.Animate.css 一个开箱即用型的跨浏览器动画库,可供你在项目中使用。 2.Magic Animations CSS3 一组简单的动画,可以包含在你的网页或应用项目中。 3.An…...
