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虚拟化三种模式 客…...

C++初阶-list的底层
目录 1.std::list实现的所有代码 2.list的简单介绍 2.1实现list的类 2.2_list_iterator的实现 2.2.1_list_iterator实现的原因和好处 2.2.2_list_iterator实现 2.3_list_node的实现 2.3.1. 避免递归的模板依赖 2.3.2. 内存布局一致性 2.3.3. 类型安全的替代方案 2.3.…...

通过Wrangler CLI在worker中创建数据库和表
官方使用文档:Getting started Cloudflare D1 docs 创建数据库 在命令行中执行完成之后,会在本地和远程创建数据库: npx wranglerlatest d1 create prod-d1-tutorial 在cf中就可以看到数据库: 现在,您的Cloudfla…...

MFC内存泄露
1、泄露代码示例 void X::SetApplicationBtn() {CMFCRibbonApplicationButton* pBtn GetApplicationButton();// 获取 Ribbon Bar 指针// 创建自定义按钮CCustomRibbonAppButton* pCustomButton new CCustomRibbonAppButton();pCustomButton->SetImage(IDB_BITMAP_Jdp26)…...
【AI学习】三、AI算法中的向量
在人工智能(AI)算法中,向量(Vector)是一种将现实世界中的数据(如图像、文本、音频等)转化为计算机可处理的数值型特征表示的工具。它是连接人类认知(如语义、视觉特征)与…...

微服务商城-商品微服务
数据表 CREATE TABLE product (id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 商品id,cateid smallint(6) UNSIGNED NOT NULL DEFAULT 0 COMMENT 类别Id,name varchar(100) NOT NULL DEFAULT COMMENT 商品名称,subtitle varchar(200) NOT NULL DEFAULT COMMENT 商…...

令牌桶 滑动窗口->限流 分布式信号量->限并发的原理 lua脚本分析介绍
文章目录 前言限流限制并发的实际理解限流令牌桶代码实现结果分析令牌桶lua的模拟实现原理总结: 滑动窗口代码实现结果分析lua脚本原理解析 限并发分布式信号量代码实现结果分析lua脚本实现原理 双注解去实现限流 并发结果分析: 实际业务去理解体会统一注…...
【C++从零实现Json-Rpc框架】第六弹 —— 服务端模块划分
一、项目背景回顾 前五弹完成了Json-Rpc协议解析、请求处理、客户端调用等基础模块搭建。 本弹重点聚焦于服务端的模块划分与架构设计,提升代码结构的可维护性与扩展性。 二、服务端模块设计目标 高内聚低耦合:各模块职责清晰,便于独立开发…...
是否存在路径(FIFOBB算法)
题目描述 一个具有 n 个顶点e条边的无向图,该图顶点的编号依次为0到n-1且不存在顶点与自身相连的边。请使用FIFOBB算法编写程序,确定是否存在从顶点 source到顶点 destination的路径。 输入 第一行两个整数,分别表示n 和 e 的值(1…...

云原生玩法三问:构建自定义开发环境
云原生玩法三问:构建自定义开发环境 引言 临时运维一个古董项目,无文档,无环境,无交接人,俗称三无。 运行设备的环境老,本地环境版本高,ssh不过去。正好最近对 腾讯出品的云原生 cnb 感兴趣&…...
【Go语言基础【13】】函数、闭包、方法
文章目录 零、概述一、函数基础1、函数基础概念2、参数传递机制3、返回值特性3.1. 多返回值3.2. 命名返回值3.3. 错误处理 二、函数类型与高阶函数1. 函数类型定义2. 高阶函数(函数作为参数、返回值) 三、匿名函数与闭包1. 匿名函数(Lambda函…...