From b885824ae58ae567cd637d6a5fd5d5b178e49d2f Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期四, 14 八月 2025 19:21:41 +0800 Subject: [PATCH] 修改积分评价设置接口 --- src/main/java/com/webmanage/entity/PointsRule.java | 45 sql/public.sql | 1429 ++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java | 6 src/main/java/com/webmanage/service/impl/PointsRuleServiceImpl.java | 64 + src/main/java/com/webmanage/service/PointsRuleService.java | 4 src/main/java/com/webmanage/emun/RuleTypeEnum.java | 28 src/main/java/com/webmanage/controller/PointsController.java | 17 src/main/resources/application-dev.yml | 59 - src/main/resources/application-test.yml | 69 ++ src/main/resources/application.yml | 70 -- src/main/java/com/webmanage/vo/PointsRuleResultVO.java | 19 11 files changed, 1,619 insertions(+), 191 deletions(-) diff --git a/sql/public.sql b/sql/public.sql new file mode 100644 index 0000000..e92529d --- /dev/null +++ b/sql/public.sql @@ -0,0 +1,1429 @@ +/* + Navicat Premium Data Transfer + + Source Server : local + Source Server Type : PostgreSQL + Source Server Version : 110005 + Source Host : localhost:5432 + Source Catalog : web_manage + Source Schema : public + + Target Server Type : PostgreSQL + Target Server Version : 110005 + File Encoding : 65001 + + Date: 14/08/2025 19:19:38 +*/ + + +-- ---------------------------- +-- Sequence structure for cart_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."cart_id_seq"; +CREATE SEQUENCE "public"."cart_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for order_approval_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."order_approval_id_seq"; +CREATE SEQUENCE "public"."order_approval_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for order_attachment_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."order_attachment_id_seq"; +CREATE SEQUENCE "public"."order_attachment_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for order_detail_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."order_detail_id_seq"; +CREATE SEQUENCE "public"."order_detail_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for order_evaluation_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."order_evaluation_id_seq"; +CREATE SEQUENCE "public"."order_evaluation_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for points_account_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."points_account_id_seq"; +CREATE SEQUENCE "public"."points_account_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for points_flow_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."points_flow_id_seq"; +CREATE SEQUENCE "public"."points_flow_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for points_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."points_id_seq"; +CREATE SEQUENCE "public"."points_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for points_rule_detail_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."points_rule_detail_id_seq"; +CREATE SEQUENCE "public"."points_rule_detail_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for points_rule_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."points_rule_id_seq"; +CREATE SEQUENCE "public"."points_rule_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for points_transaction_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."points_transaction_id_seq"; +CREATE SEQUENCE "public"."points_transaction_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for product_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."product_id_seq"; +CREATE SEQUENCE "public"."product_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for product_pricing_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."product_pricing_id_seq"; +CREATE SEQUENCE "public"."product_pricing_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for unit_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."unit_id_seq"; +CREATE SEQUENCE "public"."unit_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for user_points_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."user_points_id_seq"; +CREATE SEQUENCE "public"."user_points_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Sequence structure for users_id_seq +-- ---------------------------- +DROP SEQUENCE IF EXISTS "public"."users_id_seq"; +CREATE SEQUENCE "public"."users_id_seq" +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +CACHE 1; + +-- ---------------------------- +-- Table structure for cart +-- ---------------------------- +DROP TABLE IF EXISTS "public"."cart"; +CREATE TABLE "public"."cart" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "user_id" int8 NOT NULL, + "unit_id" int8 NOT NULL, + "pricing_id" int8 NOT NULL, + "product_id" int8 NOT NULL, + "product_name" text COLLATE "pg_catalog"."default", + "suite_name" text COLLATE "pg_catalog"."default", + "sales_form" text COLLATE "pg_catalog"."default", + "customer_type" text COLLATE "pg_catalog"."default", + "account_limit" text COLLATE "pg_catalog"."default", + "concurrent_nodes" text COLLATE "pg_catalog"."default", + "price_type" text COLLATE "pg_catalog"."default", + "price_unit" text COLLATE "pg_catalog"."default", + "unit_price" numeric(15,2) NOT NULL, + "quantity" int4 NOT NULL DEFAULT 1, + "duration" int4, + "total_price" numeric(15,2), + "provider_id" int8, + "provider_name" text COLLATE "pg_catalog"."default", + "remarks" text COLLATE "pg_catalog"."default", + "add_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."cart" IS '璐墿杞﹁〃'; + +-- ---------------------------- +-- Records of cart +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_approval +-- ---------------------------- +DROP TABLE IF EXISTS "public"."order_approval"; +CREATE TABLE "public"."order_approval" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "order_id" text COLLATE "pg_catalog"."default" NOT NULL, + "approval_step" text COLLATE "pg_catalog"."default" NOT NULL, + "approval_type" text COLLATE "pg_catalog"."default" NOT NULL, + "approval_opinion" text COLLATE "pg_catalog"."default", + "approval_result" text COLLATE "pg_catalog"."default" NOT NULL, + "approver_id" int8 NOT NULL, + "approver_name" text COLLATE "pg_catalog"."default" NOT NULL, + "approver_role" text COLLATE "pg_catalog"."default", + "approval_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "next_approver_id" int8, + "next_approver_name" text COLLATE "pg_catalog"."default", + "workflow_status" text COLLATE "pg_catalog"."default", + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."order_approval" IS '璁㈠崟瀹℃牳琛�'; + +-- ---------------------------- +-- Records of order_approval +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_attachment +-- ---------------------------- +DROP TABLE IF EXISTS "public"."order_attachment"; +CREATE TABLE "public"."order_attachment" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "order_id" text COLLATE "pg_catalog"."default" NOT NULL, + "file_name" text COLLATE "pg_catalog"."default" NOT NULL, + "original_name" text COLLATE "pg_catalog"."default", + "file_type" text COLLATE "pg_catalog"."default" NOT NULL, + "file_size" int8 NOT NULL, + "file_url" text COLLATE "pg_catalog"."default" NOT NULL, + "file_path" text COLLATE "pg_catalog"."default", + "bucket_name" text COLLATE "pg_catalog"."default", + "object_name" text COLLATE "pg_catalog"."default", + "upload_user_id" int8, + "upload_user_name" text COLLATE "pg_catalog"."default", + "attachment_type" text COLLATE "pg_catalog"."default", + "description" text COLLATE "pg_catalog"."default", + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."order_attachment" IS '璁㈠崟闄勪欢琛�'; + +-- ---------------------------- +-- Records of order_attachment +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_detail +-- ---------------------------- +DROP TABLE IF EXISTS "public"."order_detail"; +CREATE TABLE "public"."order_detail" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "order_id" text COLLATE "pg_catalog"."default" NOT NULL, + "pricing_id" int8 NOT NULL, + "product_id" int8 NOT NULL, + "suite_name" text COLLATE "pg_catalog"."default" NOT NULL, + "sales_form" text COLLATE "pg_catalog"."default" NOT NULL, + "customer_type" text COLLATE "pg_catalog"."default" NOT NULL, + "account_limit" text COLLATE "pg_catalog"."default", + "concurrent_nodes" text COLLATE "pg_catalog"."default", + "price_type" text COLLATE "pg_catalog"."default" NOT NULL, + "price_unit" text COLLATE "pg_catalog"."default" NOT NULL, + "unit_price" numeric(15,2) NOT NULL, + "quantity" int4 NOT NULL, + "duration" int4, + "total_price" numeric(15,2) NOT NULL, + "provider_id" int8 NOT NULL, + "provider_name" text COLLATE "pg_catalog"."default", + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "remarks" text COLLATE "pg_catalog"."default", + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."order_detail" IS '璁㈠崟璇︽儏琛�'; + +-- ---------------------------- +-- Records of order_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_evaluation +-- ---------------------------- +DROP TABLE IF EXISTS "public"."order_evaluation"; +CREATE TABLE "public"."order_evaluation" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "order_id" text COLLATE "pg_catalog"."default" NOT NULL, + "evaluator_id" int8 NOT NULL, + "evaluator_name" text COLLATE "pg_catalog"."default" NOT NULL, + "evaluator_type" text COLLATE "pg_catalog"."default" NOT NULL, + "content" text COLLATE "pg_catalog"."default" NOT NULL, + "rating" int4 NOT NULL, + "service_rating" int4, + "quality_rating" int4, + "delivery_rating" int4, + "is_anonymous" bool DEFAULT false, + "reply_content" text COLLATE "pg_catalog"."default", + "reply_user_id" int8, + "reply_time" timestamp(6), + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."order_evaluation" IS '璁㈠崟璇勪环琛�'; + +-- ---------------------------- +-- Records of order_evaluation +-- ---------------------------- + +-- ---------------------------- +-- Table structure for order_info +-- ---------------------------- +DROP TABLE IF EXISTS "public"."order_info"; +CREATE TABLE "public"."order_info" ( + "order_id" text COLLATE "pg_catalog"."default" NOT NULL, + "product_id" int8 NOT NULL, + "user_id" int8 NOT NULL, + "unit_id" int8, + "product_name" text COLLATE "pg_catalog"."default" NOT NULL, + "provider_name" text COLLATE "pg_catalog"."default" NOT NULL, + "provider_id" int8 NOT NULL, + "apply_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "order_status" text COLLATE "pg_catalog"."default" NOT NULL DEFAULT '寰呭鎵�'::text, + "total_amount" numeric(15,2) NOT NULL, + "payment_type" text COLLATE "pg_catalog"."default", + "payment_status" text COLLATE "pg_catalog"."default" DEFAULT '鏈敮浠�'::text, + "workflow_id" text COLLATE "pg_catalog"."default", + "current_step" text COLLATE "pg_catalog"."default", + "approval_flow" text COLLATE "pg_catalog"."default", + "buyer_remarks" text COLLATE "pg_catalog"."default", + "seller_remarks" text COLLATE "pg_catalog"."default", + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."order_info" IS '璁㈠崟琛�'; + +-- ---------------------------- +-- Records of order_info +-- ---------------------------- + +-- ---------------------------- +-- Table structure for points +-- ---------------------------- +DROP TABLE IF EXISTS "public"."points"; +CREATE TABLE "public"."points" ( + "id" int8 NOT NULL DEFAULT nextval('points_id_seq'::regclass), + "points_name" varchar COLLATE "pg_catalog"."default" NOT NULL, + "effective_start" timestamp(0) NOT NULL, + "modifier_id" int8 NOT NULL, + "modifier_name" varchar COLLATE "pg_catalog"."default" NOT NULL, + "version" numeric(2,1) NOT NULL, + "description" text COLLATE "pg_catalog"."default", + "status" int2, + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int2 DEFAULT 0 +) +; +COMMENT ON COLUMN "public"."points"."points_name" IS '绉垎鍚嶇О'; +COMMENT ON COLUMN "public"."points"."effective_start" IS '鐢熸晥寮�濮嬫椂闂�'; +COMMENT ON COLUMN "public"."points"."modifier_id" IS '淇敼浜篒D'; +COMMENT ON COLUMN "public"."points"."modifier_name" IS '淇敼浜哄鍚�'; +COMMENT ON COLUMN "public"."points"."version" IS '鐗堟湰鍙�'; +COMMENT ON COLUMN "public"."points"."description" IS '绉垎鎻忚堪'; +COMMENT ON COLUMN "public"."points"."status" IS '鐘舵��(0鍚敤1绂佺敤)'; +COMMENT ON COLUMN "public"."points"."created_at" IS '鍒涘缓鏃堕棿'; +COMMENT ON COLUMN "public"."points"."updated_at" IS '鏇存柊鏃堕棿'; +COMMENT ON COLUMN "public"."points"."deleted" IS '閫昏緫鍒犻櫎(1鍒犻櫎)'; +COMMENT ON TABLE "public"."points" IS '绉垎涓昏〃'; + +-- ---------------------------- +-- Records of points +-- ---------------------------- +INSERT INTO "public"."points" VALUES (1, '绉垎杩愯瑙勫垯', '2025-08-14 00:00:00', 1, '绠$悊鍛�', 1.0, NULL, 0, '2025-08-14 11:01:32.086436', '2025-08-14 11:01:32.086436', 0); + +-- ---------------------------- +-- Table structure for points_account +-- ---------------------------- +DROP TABLE IF EXISTS "public"."points_account"; +CREATE TABLE "public"."points_account" ( + "id" int8 NOT NULL DEFAULT nextval('points_account_id_seq'::regclass), + "user_id" int8 NOT NULL, + "points_balance" int4 NOT NULL DEFAULT 0, + "total_earned" int4 NOT NULL DEFAULT 0, + "total_consumed" int4 NOT NULL DEFAULT 0, + "account_type" text COLLATE "pg_catalog"."default" NOT NULL, + "account_status" text COLLATE "pg_catalog"."default" DEFAULT '姝e父'::text, + "last_transaction_time" timestamptz(6), + "created_at" timestamptz(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamptz(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int2 DEFAULT 0 +) +; +COMMENT ON COLUMN "public"."points_account"."user_id" IS '鐢ㄦ埛ID'; +COMMENT ON COLUMN "public"."points_account"."points_balance" IS '绉垎浣欓'; +COMMENT ON COLUMN "public"."points_account"."total_earned" IS '绱鑾峰彇绉垎'; +COMMENT ON COLUMN "public"."points_account"."total_consumed" IS '绱娑堣�楃Н鍒�'; +COMMENT ON COLUMN "public"."points_account"."account_type" IS '璐︽埛绫诲瀷'; +COMMENT ON COLUMN "public"."points_account"."account_status" IS '璐︽埛鐘舵��'; +COMMENT ON COLUMN "public"."points_account"."last_transaction_time" IS '鏈�鍚庝氦鏄撴椂闂�'; +COMMENT ON COLUMN "public"."points_account"."created_at" IS '鍒涘缓鏃堕棿'; +COMMENT ON COLUMN "public"."points_account"."updated_at" IS '鏇存柊鏃堕棿'; +COMMENT ON COLUMN "public"."points_account"."deleted" IS '閫昏緫鍒犻櫎'; +COMMENT ON TABLE "public"."points_account" IS '绉垎璐︽埛琛�'; + +-- ---------------------------- +-- Records of points_account +-- ---------------------------- + +-- ---------------------------- +-- Table structure for points_flow +-- ---------------------------- +DROP TABLE IF EXISTS "public"."points_flow"; +CREATE TABLE "public"."points_flow" ( + "id" int8 NOT NULL DEFAULT nextval('points_flow_id_seq'::regclass), + "user_id" int8, + "unit_id" int8, + "data_category" varchar(100) COLLATE "pg_catalog"."default" NOT NULL, + "data_type" varchar(50) COLLATE "pg_catalog"."default" NOT NULL, + "name" text COLLATE "pg_catalog"."default" NOT NULL, + "points" int4 NOT NULL, + "flow_time" timestamp(6) NOT NULL, + "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON COLUMN "public"."points_flow"."user_id" IS '鐢ㄦ埛ID'; +COMMENT ON COLUMN "public"."points_flow"."unit_id" IS '鍗曚綅ID'; +COMMENT ON COLUMN "public"."points_flow"."data_category" IS '鏁版嵁绫荤洰'; +COMMENT ON COLUMN "public"."points_flow"."data_type" IS '鏁版嵁绫诲瀷'; +COMMENT ON COLUMN "public"."points_flow"."name" IS '鍚嶇О/鎻忚堪'; +COMMENT ON COLUMN "public"."points_flow"."points" IS '绉垎鍊�'; +COMMENT ON COLUMN "public"."points_flow"."flow_time" IS '娴佹按鏃堕棿'; +COMMENT ON COLUMN "public"."points_flow"."create_time" IS '鍒涘缓鏃堕棿'; +COMMENT ON COLUMN "public"."points_flow"."update_time" IS '鏇存柊鏃堕棿'; +COMMENT ON COLUMN "public"."points_flow"."deleted" IS '閫昏緫鍒犻櫎锛�1-宸插垹闄わ紝0-鏈垹闄�'; +COMMENT ON TABLE "public"."points_flow" IS '绉垎娴佹按琛�'; + +-- ---------------------------- +-- Records of points_flow +-- ---------------------------- +INSERT INTO "public"."points_flow" VALUES (1, 1, 1, 'user_participation', 'earned', '鐢ㄦ埛姣忔棩棣栨鐧诲綍', 1, '2025-05-18 16:00:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (2, 1, 1, 'user_participation', 'earned', '浜ゆ祦绀惧尯鍙戝竷璇勮"鍩哄缓琛屼笟濡備綍鍒╃敤AI鎶�鏈彁楂樻晥鐜�"', 1, '2025-05-17 15:00:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (3, 1, 1, 'user_participation', 'earned', '鐢ㄦ埛姣忔棩棣栨鐧诲綍', 1, '2025-05-16 14:00:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (4, 1, 1, 'user_participation', 'consumed', '浜ゆ祦绀惧尯鍒犻櫎鎻愰棶"鍩哄缓椤圭洰濡備綍搴旂敤鏁板瓧瀛敓鎶�鏈�?"', -1, '2025-05-15 13:00:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (5, 1, 1, 'points_conversion', 'earned', '鍗曚綅绉垎杞叆', 1000, '2025-05-06 12:00:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (6, 1, 1, 'user_participation', 'earned', '鐢ㄦ埛姣忔棩棣栨鐧诲綍', 1, '2025-05-05 11:00:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (7, 1, 1, 'other', 'earned', '绉垎濂栧姳', 100, '2025-05-04 10:00:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (8, 1, 1, 'user_participation', 'earned', '浜ゆ祦绀惧尯鍙戝竷鎻愰棶"鍩哄缓椤圭洰濡備綍搴旂敤鏁板瓧瀛敓鎶�鏈�?"', 1, '2025-05-02 09:10:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (9, 1, 1, 'user_participation', 'earned', '鐢ㄦ埛姣忔棩棣栨鐧诲綍', 1, '2025-05-02 09:02:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (10, 1, 1, 'other', 'earned', '鍒濆鍖栫Н鍒�', 100, '2025-05-01 09:01:00', '2025-08-07 11:48:21.579058', '2025-08-07 11:48:21.579058', 0); +INSERT INTO "public"."points_flow" VALUES (17, 1, 1, 'other', 'earned', '绉垎濂栧姳', 100, '2025-08-08 18:34:36', '2025-08-08 18:34:39', '2025-08-08 18:34:41', 0); + +-- ---------------------------- +-- Table structure for points_rule +-- ---------------------------- +DROP TABLE IF EXISTS "public"."points_rule"; +CREATE TABLE "public"."points_rule" ( + "id" int8 NOT NULL DEFAULT nextval('points_rule_id_seq'::regclass), + "points_id" int8 NOT NULL, + "rule_type" int2 NOT NULL, + "category" varchar COLLATE "pg_catalog"."default" NOT NULL, + "rule_name" varchar COLLATE "pg_catalog"."default" NOT NULL, + "rule_description" varchar COLLATE "pg_catalog"."default", + "is_enabled" int2 DEFAULT 0, + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int2 DEFAULT 0, + "points_winner" int2, + "is_limit" int2, + "rule_order" int2 +) +; +COMMENT ON COLUMN "public"."points_rule"."points_id" IS '鍏宠仈绉垎ID'; +COMMENT ON COLUMN "public"."points_rule"."rule_type" IS '绉垎瑙勫垯绫诲瀷(0鑾峰彇1娑堣��)'; +COMMENT ON COLUMN "public"."points_rule"."category" IS '绉垎绫诲埆'; +COMMENT ON COLUMN "public"."points_rule"."rule_name" IS '瑙勫垯鍚嶇О'; +COMMENT ON COLUMN "public"."points_rule"."rule_description" IS '瑙勫垯鎻忚堪'; +COMMENT ON COLUMN "public"."points_rule"."is_enabled" IS '瑙勫垯鐘舵��(0鍚姩1绂佺敤)'; +COMMENT ON COLUMN "public"."points_rule"."created_at" IS '鍒涘缓鏃堕棿'; +COMMENT ON COLUMN "public"."points_rule"."updated_at" IS '鏇存柊鏃堕棿'; +COMMENT ON COLUMN "public"."points_rule"."deleted" IS '閫昏緫鍒犻櫎'; +COMMENT ON COLUMN "public"."points_rule"."points_winner" IS '绉垎鑾峰緱鑰咃紙0璐$尞鑰�1鐢ㄦ埛锛�'; +COMMENT ON COLUMN "public"."points_rule"."is_limit" IS '绉垎鏄惁鏈変笂闄�(0娌℃湁1鏈�)'; +COMMENT ON COLUMN "public"."points_rule"."rule_order" IS '鎺掑簭瑙勫垯'; +COMMENT ON TABLE "public"."points_rule" IS '绉垎瑙勫垯琛�'; + +-- ---------------------------- +-- Records of points_rule +-- ---------------------------- +INSERT INTO "public"."points_rule" VALUES (2, 1, 0, '璧勬簮璐$尞', '鏂板鏁板瓧鍖栨爣鏉�', '姣忔垚鍔熶笂鏋�1涓爣鏉嗭紝璐$尞鑰� 鑾�', 0, '2025-08-14 14:24:00.753678', '2025-08-14 14:24:00.753678', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (4, 1, 0, '璧勬簮璐$尞', '鏂板鏁板瓧鍖栦骇鍝�', '姣忔垚鍔熶笂鏋�1涓骇鍝侊紝璐$尞鑰� 鑾�', 0, '2025-08-14 14:44:37.128422', '2025-08-14 14:44:37.128422', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (34, 1, 0, '浜ゆ祦绀惧尯浜掑姩', '鍥炲甯栧瓙', '姣忓洖澶�1娆″笘瀛愶紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:08:19.324645', '2025-08-14 15:08:19.324645', 0, 0, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (35, 1, 0, '浜ゆ祦绀惧尯浜掑姩', '甯栧瓙鐐硅禐', '鍙戝竷鐨勫笘瀛愭垨鍋氬嚭鐨勫洖绛旀瘡琚偣璧炰竴娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:08:19.325826', '2025-08-14 15:08:19.325826', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (3, 1, 0, '璧勬簮璐$尞', '鏂板鏁板瓧鍖栫煡璇�', '姣忔垚鍔熶笂鏋�1涓煡璇嗭紝璐$尞鑰� 鑾�', 0, '2025-08-14 14:44:37.124901', '2025-08-14 14:44:37.124901', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (36, 1, 0, '浜ゆ祦绀惧尯浜掑姩', '甯栧瓙鏀惰棌', '鍙戝竷鐨勫笘瀛愭瘡琚敹钘忎竴娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:08:19.326955', '2025-08-14 15:08:19.326955', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (52, 1, 1, '浜ゆ祦绀惧尯浜掑姩', '鍙栨秷鏀惰棌', '鍙戝竷鐨勫笘瀛愯鏀惰棌锛屽悗鍙堝彇娑堟敹钘忥紝璐$尞鑰� 鎵i櫎', 0, '2025-08-14 15:15:13.333528', '2025-08-14 15:15:13.333528', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (49, 1, 1, '浜ゆ祦绀惧尯浜掑姩', '鍒犻櫎甯栧瓙', '鑷繁鍙戝竷鐨勫笘瀛愯鍒犻櫎锛岃础鐚�� 鎵i櫎', 0, '2025-08-14 15:15:13.330326', '2025-08-14 15:15:13.330326', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (50, 1, 1, '浜ゆ祦绀惧尯浜掑姩', '鍒犻櫎鍥炲', '鑷繁鐨勫洖澶嶈鍒犻櫎锛岃础鐚�� 鎵i櫎', 0, '2025-08-14 15:15:13.331467', '2025-08-14 15:15:13.331467', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (11, 1, 0, '璧勬簮浼犳挱', '璇勪环鏁板瓧鍖栬祫婧�', '姣忚璇勪环1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:07:54.732016', '2025-08-14 15:07:54.732016', 0, 0, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (12, 1, 0, '璧勬簮浼犳挱', '璇勪环鏁板瓧鍖栬祫婧�', '璇勪环鑰� 鑾�', 0, '2025-08-14 15:07:54.733588', '2025-08-14 15:07:54.733588', 0, 1, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (51, 1, 1, '浜ゆ祦绀惧尯浜掑姩', '鍙栨秷鐐硅禐', '鍙戝竷鐨勫笘瀛愭垨鍋氬嚭鐨勫洖绛旇鐐硅禐鍚庡張鍙栨秷鐐硅禐锛岃础鐚�� 鎵i櫎', 0, '2025-08-14 15:15:13.332602', '2025-08-14 15:15:13.332602', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (15, 1, 0, '璧勬簮浼犳挱', '璁㈤槄鏁板瓧鍖栬祫婧�', '姣忚璁㈤槄1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:07:54.736641', '2025-08-14 15:07:54.736641', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (16, 1, 0, '璧勬簮浼犳挱', '璁㈤槄鏁板瓧鍖栬祫婧�', '璁㈤槄鑰� 鑾�', 0, '2025-08-14 15:07:54.737529', '2025-08-14 15:07:54.737529', 0, 1, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (17, 1, 0, '璧勬簮浜ゆ槗', '鏁板瓧鍖栦骇鍝佹帴鍏�', '姣忔垚鍔熸帴鍏�1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:07:54.738396', '2025-08-14 15:07:54.738396', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (18, 1, 0, '璧勬簮浜ゆ槗', '鏁板瓧鍖栦骇鍝佷氦鏄�', '姣忔垚鍔熶氦鏄�1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:07:54.739469', '2025-08-14 15:07:54.739469', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (20, 1, 0, '璧勬簮浼犳挱', '娴忚鏁板瓧鍖栬祫婧�', '娴忚鑰�', 0, '2025-08-14 15:08:19.309681', '2025-08-14 15:08:19.309681', 0, 1, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (21, 1, 0, '璧勬簮浼犳挱', '鏀惰棌鏁板瓧鍖栬祫婧�', '姣忚鏀惰棌1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:08:19.311096', '2025-08-14 15:08:19.311096', 0, 0, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (33, 1, 0, '浜ゆ祦绀惧尯浜掑姩', '鍙戝竷甯栧瓙', '姣忔垚鍔熷彂甯�1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:08:19.323293', '2025-08-14 15:08:19.323293', 0, 0, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (42, 1, 1, '璧勬簮浼犳挱', '鍙栨秷璁㈤槄', '鎿嶄綔鑰� 鎵i櫎', 0, '2025-08-14 15:12:29.49397', '2025-08-14 15:12:29.49397', 0, 1, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (43, 1, 1, '璧勬簮浼犳挱', '鍙栨秷鏀惰棌', '鏁板瓧鍖栬祫婧愯鍙栨秷鏀惰棌锛岃础鐚�� 鎵i櫎', 0, '2025-08-14 15:15:13.324114', '2025-08-14 15:15:13.324114', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (44, 1, 1, '璧勬簮浼犳挱', '鍙栨秷鏀惰棌', '鎿嶄綔鑰� 鎵i櫎', 0, '2025-08-14 15:15:13.325517', '2025-08-14 15:15:13.325517', 0, 1, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (22, 1, 0, '璧勬簮浼犳挱', '鏀惰棌鏁板瓧鍖栬祫婧�', '鏀惰棌鑰� 鑾�', 0, '2025-08-14 15:08:19.312482', '2025-08-14 15:08:19.312482', 0, 1, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (23, 1, 0, '璧勬簮浼犳挱', '鐐硅禐鏁板瓧鍖栬祫婧�', '姣忚鐐硅禐1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:08:19.313654', '2025-08-14 15:08:19.313654', 0, 0, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (24, 1, 0, '璧勬簮浼犳挱', '鐐硅禐鏁板瓧鍖栬祫婧�', '鐐硅禐鑰� 鑾�', 0, '2025-08-14 15:08:19.314647', '2025-08-14 15:08:19.314647', 0, 1, 1, NULL); +INSERT INTO "public"."points_rule" VALUES (28, 1, 0, '璧勬簮浼犳挱', '璇曠敤鏁板瓧鍖栬祫婧�', '璇曠敤鑰� 鑾�', 0, '2025-08-14 15:08:19.318477', '2025-08-14 15:08:19.318477', 0, 1, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (39, 1, 1, '璧勬簮浼犳挱', '鍙栨秷鐐硅禐', '鏁板瓧鍖栬祫婧愯鍙栨秷鐐硅禐锛岃础鐚�� 鎵i櫎', 0, '2025-08-14 15:12:29.490075', '2025-08-14 15:12:29.490075', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (40, 1, 1, '璧勬簮浼犳挱', '鍙栨秷鐐硅禐', '鎿嶄綔鑰� 鎵i櫎', 0, '2025-08-14 15:12:29.49113', '2025-08-14 15:12:29.49113', 0, 1, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (41, 1, 1, '璧勬簮浼犳挱', '鍙栨秷璁㈤槄', '鏁板瓧鍖栦骇鍝佽鍙栨秷璁㈤槄锛岃础鐚�� 鎵i櫎', 0, '2025-08-14 15:12:29.492296', '2025-08-14 15:12:29.492296', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (13, 1, 0, '璧勬簮浼犳挱', '璇曠敤鏁板瓧鍖栬祫婧�', '姣忚璇曠敤1娆★紝璐$尞鑰� 鑾�', 0, '2025-08-14 15:07:54.734444', '2025-08-14 15:07:54.734444', 0, 0, 0, NULL); +INSERT INTO "public"."points_rule" VALUES (19, 1, 0, '璧勬簮浼犳挱', '娴忚鏁板瓧鍖栬祫婧�', '姣忚娴忚1娆★紝璐$尞鑰�', 0, '2025-08-14 15:08:19.308203', '2025-08-14 15:08:19.308203', 0, 0, 1, NULL); + +-- ---------------------------- +-- Table structure for points_rule_detail +-- ---------------------------- +DROP TABLE IF EXISTS "public"."points_rule_detail"; +CREATE TABLE "public"."points_rule_detail" ( + "id" int8 NOT NULL DEFAULT nextval('points_rule_detail_id_seq'::regclass), + "rule_id" int8 NOT NULL, + "points_id" int8 NOT NULL, + "points_value" int4 NOT NULL, + "daily_limit" int4, + "monthly_limit" int4, + "yearly_limit" int4, + "min_value" int4 DEFAULT 0, + "max_value" int4, + "conversion_rate" numeric(10,4) DEFAULT 1.0, + "created_at" timestamptz(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamptz(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int2 DEFAULT 0 +) +; +COMMENT ON COLUMN "public"."points_rule_detail"."rule_id" IS '鍏宠仈绉垎瑙勫垯ID'; +COMMENT ON COLUMN "public"."points_rule_detail"."points_id" IS '鍏宠仈绉垎ID'; +COMMENT ON COLUMN "public"."points_rule_detail"."points_value" IS '绉垎鍊�'; +COMMENT ON COLUMN "public"."points_rule_detail"."daily_limit" IS '姣忔棩绉垎涓婇檺鍊�'; +COMMENT ON COLUMN "public"."points_rule_detail"."monthly_limit" IS '姣忔湀绉垎涓婇檺鍊�'; +COMMENT ON COLUMN "public"."points_rule_detail"."yearly_limit" IS '姣忓勾绉垎涓婇檺鍊�'; +COMMENT ON COLUMN "public"."points_rule_detail"."min_value" IS '鏈�灏忓��'; +COMMENT ON COLUMN "public"."points_rule_detail"."max_value" IS '鏈�澶у��'; +COMMENT ON COLUMN "public"."points_rule_detail"."conversion_rate" IS '杞崲姣旂巼'; +COMMENT ON COLUMN "public"."points_rule_detail"."created_at" IS '鍒涘缓鏃堕棿'; +COMMENT ON COLUMN "public"."points_rule_detail"."updated_at" IS '鏇存柊鏃堕棿'; +COMMENT ON COLUMN "public"."points_rule_detail"."deleted" IS '閫昏緫鍒犻櫎'; +COMMENT ON TABLE "public"."points_rule_detail" IS '绉垎瑙勫垯璇︽儏琛�'; + +-- ---------------------------- +-- Records of points_rule_detail +-- ---------------------------- + +-- ---------------------------- +-- Table structure for points_transaction +-- ---------------------------- +DROP TABLE IF EXISTS "public"."points_transaction"; +CREATE TABLE "public"."points_transaction" ( + "id" int8 NOT NULL DEFAULT nextval('points_transaction_id_seq'::regclass), + "data_category" text COLLATE "pg_catalog"."default" NOT NULL, + "transaction_name" text COLLATE "pg_catalog"."default" NOT NULL, + "transaction_time" timestamptz(6) DEFAULT CURRENT_TIMESTAMP, + "points_change" int4 NOT NULL, + "rule_type" text COLLATE "pg_catalog"."default" NOT NULL, + "user_id" int8, + "unit_id" int8, + "user_type" text COLLATE "pg_catalog"."default" NOT NULL, + "rule_id" int8, + "detail_id" int8, + "created_at" timestamptz(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int2 DEFAULT 0 +) +; +COMMENT ON COLUMN "public"."points_transaction"."data_category" IS '鏁版嵁绫荤洰'; +COMMENT ON COLUMN "public"."points_transaction"."transaction_name" IS '鍚嶇О'; +COMMENT ON COLUMN "public"."points_transaction"."transaction_time" IS '鏃堕棿'; +COMMENT ON COLUMN "public"."points_transaction"."points_change" IS '绉垎鍙樺姩鍊�'; +COMMENT ON COLUMN "public"."points_transaction"."rule_type" IS '绉垎瑙勫垯绫诲瀷'; +COMMENT ON COLUMN "public"."points_transaction"."user_id" IS '鐢ㄦ埛ID'; +COMMENT ON COLUMN "public"."points_transaction"."unit_id" IS '浼佷笟ID'; +COMMENT ON COLUMN "public"."points_transaction"."user_type" IS '鐢ㄦ埛绫诲瀷'; +COMMENT ON COLUMN "public"."points_transaction"."rule_id" IS '鍏宠仈瑙勫垯ID'; +COMMENT ON COLUMN "public"."points_transaction"."detail_id" IS '鍏宠仈瑙勫垯璇︽儏ID'; +COMMENT ON COLUMN "public"."points_transaction"."created_at" IS '鍒涘缓鏃堕棿'; +COMMENT ON COLUMN "public"."points_transaction"."deleted" IS '閫昏緫鍒犻櫎'; +COMMENT ON TABLE "public"."points_transaction" IS '绉垎娴佹按琛�'; + +-- ---------------------------- +-- Records of points_transaction +-- ---------------------------- + +-- ---------------------------- +-- Table structure for product +-- ---------------------------- +DROP TABLE IF EXISTS "public"."product"; +CREATE TABLE "public"."product" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "product_name" text COLLATE "pg_catalog"."default" NOT NULL, + "product_code" text COLLATE "pg_catalog"."default" NOT NULL, + "product_type" text COLLATE "pg_catalog"."default", + "category" text COLLATE "pg_catalog"."default", + "description" text COLLATE "pg_catalog"."default", + "provider_id" int8 NOT NULL, + "provider_name" text COLLATE "pg_catalog"."default" NOT NULL, + "provider_type" text COLLATE "pg_catalog"."default", + "status" text COLLATE "pg_catalog"."default" DEFAULT '涓婃灦'::text, + "audit_status" text COLLATE "pg_catalog"."default" DEFAULT '寰呭鏍�'::text, + "tags" text COLLATE "pg_catalog"."default", + "cover_image" text COLLATE "pg_catalog"."default", + "demo_url" text COLLATE "pg_catalog"."default", + "doc_url" text COLLATE "pg_catalog"."default", + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "created_by" int8, + "updated_by" int8, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."product" IS '浜у搧琛�'; + +-- ---------------------------- +-- Records of product +-- ---------------------------- +INSERT INTO "public"."product" OVERRIDING SYSTEM VALUE VALUES (1, '娴嬭瘯浜у搧1', 'TEST_PRODUCT_001', '杞欢浜у搧', '浼佷笟绠$悊', '杩欐槸涓�涓祴璇曚骇鍝�', 3, '娴嬭瘯鎻愪緵鑰�', NULL, '涓婃灦', '瀹℃牳閫氳繃', NULL, NULL, NULL, NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', NULL, NULL, 0); +INSERT INTO "public"."product" OVERRIDING SYSTEM VALUE VALUES (2, '娴嬭瘯浜у搧2', 'TEST_PRODUCT_002', '鏈嶅姟浜у搧', '鎶�鏈湇鍔�', '杩欐槸鍙︿竴涓祴璇曚骇鍝�', 3, '娴嬭瘯鎻愪緵鑰�', NULL, '涓婃灦', '瀹℃牳閫氳繃', NULL, NULL, NULL, NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', NULL, NULL, 0); + +-- ---------------------------- +-- Table structure for product_pricing +-- ---------------------------- +DROP TABLE IF EXISTS "public"."product_pricing"; +CREATE TABLE "public"."product_pricing" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "suite_name" text COLLATE "pg_catalog"."default" NOT NULL, + "sales_form" text COLLATE "pg_catalog"."default" NOT NULL, + "customer_type" text COLLATE "pg_catalog"."default" NOT NULL, + "account_limit" text COLLATE "pg_catalog"."default" DEFAULT '涓嶉檺'::text, + "concurrent_nodes" text COLLATE "pg_catalog"."default" DEFAULT '涓嶉檺'::text, + "price_type" text COLLATE "pg_catalog"."default" NOT NULL, + "price_unit" text COLLATE "pg_catalog"."default" NOT NULL, + "price" numeric(15,2) NOT NULL, + "is_active" bool DEFAULT true, + "product_id" int8 NOT NULL, + "product_name" text COLLATE "pg_catalog"."default", + "provider_id" int8, + "provider_name" text COLLATE "pg_catalog"."default", + "description" text COLLATE "pg_catalog"."default", + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "created_by" int8, + "updated_by" int8, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON COLUMN "public"."product_pricing"."suite_name" IS '浜у搧濂椾欢鍚嶇О'; +COMMENT ON COLUMN "public"."product_pricing"."sales_form" IS '閿�鍞舰寮�'; +COMMENT ON TABLE "public"."product_pricing" IS '浜у搧瀹氫环琛�'; + +-- ---------------------------- +-- Records of product_pricing +-- ---------------------------- +INSERT INTO "public"."product_pricing" OVERRIDING SYSTEM VALUE VALUES (1, '鍩虹鐗�', '涔版柇', '浼佷笟', '涓嶉檺', '涓嶉檺', '绉垎', '濂�', 1000.00, 't', 1, '娴嬭瘯浜у搧1', 3, '娴嬭瘯鎻愪緵鑰�', NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', NULL, NULL, 0); +INSERT INTO "public"."product_pricing" OVERRIDING SYSTEM VALUE VALUES (2, '涓撲笟鐗�', '绉熻祦', '浼佷笟', '涓嶉檺', '涓嶉檺', '绉垎', '濂�/骞�', 500.00, 't', 1, '娴嬭瘯浜у搧1', 3, '娴嬭瘯鎻愪緵鑰�', NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', NULL, NULL, 0); +INSERT INTO "public"."product_pricing" OVERRIDING SYSTEM VALUE VALUES (3, '浼佷笟鐗�', '涔版柇', '浼佷笟', '涓嶉檺', '涓嶉檺', '璐у竵', '濂�', 10000.00, 't', 2, '娴嬭瘯浜у搧2', 3, '娴嬭瘯鎻愪緵鑰�', NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', NULL, NULL, 0); + +-- ---------------------------- +-- Table structure for unit +-- ---------------------------- +DROP TABLE IF EXISTS "public"."unit"; +CREATE TABLE "public"."unit" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "unit_name" text COLLATE "pg_catalog"."default" NOT NULL, + "unit_code" text COLLATE "pg_catalog"."default", + "unit_type" text COLLATE "pg_catalog"."default", + "industry" text COLLATE "pg_catalog"."default", + "address" text COLLATE "pg_catalog"."default", + "contact_person" text COLLATE "pg_catalog"."default", + "contact_phone" text COLLATE "pg_catalog"."default", + "contact_email" text COLLATE "pg_catalog"."default", + "business_license" text COLLATE "pg_catalog"."default", + "legal_person" text COLLATE "pg_catalog"."default", + "registered_capital" numeric(15,2), + "establishment_date" date, + "status" text COLLATE "pg_catalog"."default" DEFAULT '姝e父'::text, + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."unit" IS '鍗曚綅琛�'; + +-- ---------------------------- +-- Records of unit +-- ---------------------------- +INSERT INTO "public"."unit" OVERRIDING SYSTEM VALUE VALUES (1, '娴嬭瘯浼佷笟', 'TEST_ENTERPRISE', '浼佷笟', '淇℃伅鎶�鏈�', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '姝e父', '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', 0); +INSERT INTO "public"."unit" OVERRIDING SYSTEM VALUE VALUES (2, '娴嬭瘯鍗曚綅', 'TEST_UNIT', '浜嬩笟鍗曚綅', '鏁欒偛', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '姝e父', '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', 0); + +-- ---------------------------- +-- Table structure for user_points +-- ---------------------------- +DROP TABLE IF EXISTS "public"."user_points"; +CREATE TABLE "public"."user_points" ( + "id" int8 NOT NULL DEFAULT nextval('user_points_id_seq'::regclass), + "user_id" int8 NOT NULL, + "unit_id" int8, + "balance" int4 NOT NULL DEFAULT 0, + "total_earned" int4 NOT NULL DEFAULT 0, + "total_consumed" int4 NOT NULL DEFAULT 0, + "total_converted" int4 NOT NULL DEFAULT 0, + "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON COLUMN "public"."user_points"."user_id" IS '鐢ㄦ埛ID'; +COMMENT ON COLUMN "public"."user_points"."unit_id" IS '鍗曚綅ID'; +COMMENT ON COLUMN "public"."user_points"."balance" IS '绉垎浣欓'; +COMMENT ON COLUMN "public"."user_points"."total_earned" IS '绱鑾峰彇绉垎'; +COMMENT ON COLUMN "public"."user_points"."total_consumed" IS '绱娑堣�楃Н鍒�'; +COMMENT ON COLUMN "public"."user_points"."total_converted" IS '绱杞崲绉垎'; +COMMENT ON COLUMN "public"."user_points"."create_time" IS '鍒涘缓鏃堕棿'; +COMMENT ON COLUMN "public"."user_points"."update_time" IS '鏇存柊鏃堕棿'; +COMMENT ON COLUMN "public"."user_points"."deleted" IS '閫昏緫鍒犻櫎锛�1-宸插垹闄わ紝0-鏈垹闄�'; +COMMENT ON TABLE "public"."user_points" IS '鐢ㄦ埛绉垎琛�'; + +-- ---------------------------- +-- Records of user_points +-- ---------------------------- +INSERT INTO "public"."user_points" VALUES (1, 1, 1, 20000, 10000, 200, 0, '2025-08-07 11:48:21.574933', '2025-08-07 11:48:21.574933', 0); + +-- ---------------------------- +-- Table structure for users +-- ---------------------------- +DROP TABLE IF EXISTS "public"."users"; +CREATE TABLE "public"."users" ( + "id" int8 NOT NULL GENERATED ALWAYS AS IDENTITY ( +INCREMENT 1 +MINVALUE 1 +MAXVALUE 9223372036854775807 +START 1 +), + "username" text COLLATE "pg_catalog"."default" NOT NULL, + "real_name" text COLLATE "pg_catalog"."default", + "email" text COLLATE "pg_catalog"."default", + "phone" text COLLATE "pg_catalog"."default", + "avatar" text COLLATE "pg_catalog"."default", + "user_type" text COLLATE "pg_catalog"."default" DEFAULT '涓汉鐢ㄦ埛'::text, + "unit_id" int8, + "unit_name" text COLLATE "pg_catalog"."default", + "status" text COLLATE "pg_catalog"."default" DEFAULT '姝e父'::text, + "last_login_time" timestamp(6), + "created_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "updated_at" timestamp(6) DEFAULT CURRENT_TIMESTAMP, + "deleted" int4 DEFAULT 0 +) +; +COMMENT ON TABLE "public"."users" IS '鐢ㄦ埛琛�'; + +-- ---------------------------- +-- Records of users +-- ---------------------------- +INSERT INTO "public"."users" OVERRIDING SYSTEM VALUE VALUES (1, 'admin', '绯荤粺绠$悊鍛�', NULL, NULL, NULL, '涓汉鐢ㄦ埛', NULL, NULL, '姝e父', NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', 0); +INSERT INTO "public"."users" OVERRIDING SYSTEM VALUE VALUES (2, 'test_user', '娴嬭瘯鐢ㄦ埛', NULL, NULL, NULL, '涓汉鐢ㄦ埛', 1, NULL, '姝e父', NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', 0); +INSERT INTO "public"."users" OVERRIDING SYSTEM VALUE VALUES (3, 'test_provider', '娴嬭瘯鎻愪緵鑰�', NULL, NULL, NULL, '鍗曚綅鐢ㄦ埛', 1, NULL, '姝e父', NULL, '2025-08-13 14:50:16.574223', '2025-08-13 14:50:16.574223', 0); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."cart_id_seq" +OWNED BY "public"."cart"."id"; +SELECT setval('"public"."cart_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."order_approval_id_seq" +OWNED BY "public"."order_approval"."id"; +SELECT setval('"public"."order_approval_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."order_attachment_id_seq" +OWNED BY "public"."order_attachment"."id"; +SELECT setval('"public"."order_attachment_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."order_detail_id_seq" +OWNED BY "public"."order_detail"."id"; +SELECT setval('"public"."order_detail_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."order_evaluation_id_seq" +OWNED BY "public"."order_evaluation"."id"; +SELECT setval('"public"."order_evaluation_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."points_account_id_seq" +OWNED BY "public"."points_account"."id"; +SELECT setval('"public"."points_account_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."points_flow_id_seq" +OWNED BY "public"."points_flow"."id"; +SELECT setval('"public"."points_flow_id_seq"', 18, true); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."points_id_seq" +OWNED BY "public"."points"."id"; +SELECT setval('"public"."points_id_seq"', 2, true); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."points_rule_detail_id_seq" +OWNED BY "public"."points_rule_detail"."id"; +SELECT setval('"public"."points_rule_detail_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."points_rule_id_seq" +OWNED BY "public"."points_rule"."id"; +SELECT setval('"public"."points_rule_id_seq"', 53, true); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."points_transaction_id_seq" +OWNED BY "public"."points_transaction"."id"; +SELECT setval('"public"."points_transaction_id_seq"', 2, false); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."product_id_seq" +OWNED BY "public"."product"."id"; +SELECT setval('"public"."product_id_seq"', 3, true); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."product_pricing_id_seq" +OWNED BY "public"."product_pricing"."id"; +SELECT setval('"public"."product_pricing_id_seq"', 4, true); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."unit_id_seq" +OWNED BY "public"."unit"."id"; +SELECT setval('"public"."unit_id_seq"', 3, true); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."user_points_id_seq" +OWNED BY "public"."user_points"."id"; +SELECT setval('"public"."user_points_id_seq"', 2, true); + +-- ---------------------------- +-- Alter sequences owned by +-- ---------------------------- +ALTER SEQUENCE "public"."users_id_seq" +OWNED BY "public"."users"."id"; +SELECT setval('"public"."users_id_seq"', 4, true); + +-- ---------------------------- +-- Indexes structure for table cart +-- ---------------------------- +CREATE INDEX "idx_cart_add_time" ON "public"."cart" USING btree ( + "add_time" "pg_catalog"."timestamp_ops" ASC NULLS LAST, + "deleted" "pg_catalog"."int4_ops" ASC NULLS LAST +); +CREATE INDEX "idx_cart_pricing" ON "public"."cart" USING btree ( + "pricing_id" "pg_catalog"."int8_ops" ASC NULLS LAST, + "deleted" "pg_catalog"."int4_ops" ASC NULLS LAST +); +CREATE INDEX "idx_cart_product" ON "public"."cart" USING btree ( + "product_id" "pg_catalog"."int8_ops" ASC NULLS LAST, + "deleted" "pg_catalog"."int4_ops" ASC NULLS LAST +); +CREATE INDEX "idx_cart_provider" ON "public"."cart" USING btree ( + "provider_id" "pg_catalog"."int8_ops" ASC NULLS LAST, + "deleted" "pg_catalog"."int4_ops" ASC NULLS LAST +); +CREATE INDEX "idx_cart_user_unit" ON "public"."cart" USING btree ( + "user_id" "pg_catalog"."int8_ops" ASC NULLS LAST, + "unit_id" "pg_catalog"."int8_ops" ASC NULLS LAST, + "deleted" "pg_catalog"."int4_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Uniques structure for table cart +-- ---------------------------- +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_user_id_unit_id_pricing_id_deleted_key" UNIQUE ("user_id", "unit_id", "pricing_id", "deleted"); + +-- ---------------------------- +-- Checks structure for table cart +-- ---------------------------- +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table cart +-- ---------------------------- +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table order_approval +-- ---------------------------- +CREATE INDEX "idx_order_approval_approver_id" ON "public"."order_approval" USING btree ( + "approver_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_order_approval_order_id" ON "public"."order_approval" USING btree ( + "order_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table order_approval +-- ---------------------------- +ALTER TABLE "public"."order_approval" ADD CONSTRAINT "order_approval_approval_result_check" CHECK ((approval_result = ANY (ARRAY['閫氳繃'::text, '椹冲洖'::text, '寰呭鐞�'::text]))); +ALTER TABLE "public"."order_approval" ADD CONSTRAINT "order_approval_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); +ALTER TABLE "public"."order_approval" ADD CONSTRAINT "order_approval_approval_type_check" CHECK ((approval_type = ANY (ARRAY['瀹℃壒'::text, '鎺堟潈'::text]))); + +-- ---------------------------- +-- Primary Key structure for table order_approval +-- ---------------------------- +ALTER TABLE "public"."order_approval" ADD CONSTRAINT "order_approval_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table order_attachment +-- ---------------------------- +CREATE INDEX "idx_order_attachment_order_id" ON "public"."order_attachment" USING btree ( + "order_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table order_attachment +-- ---------------------------- +ALTER TABLE "public"."order_attachment" ADD CONSTRAINT "order_attachment_attachment_type_check" CHECK ((attachment_type = ANY (ARRAY['鍚堝悓'::text, '鍙戠エ'::text, '鍏朵粬'::text]))); +ALTER TABLE "public"."order_attachment" ADD CONSTRAINT "order_attachment_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table order_attachment +-- ---------------------------- +ALTER TABLE "public"."order_attachment" ADD CONSTRAINT "order_attachment_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table order_detail +-- ---------------------------- +CREATE INDEX "idx_order_detail_order_id" ON "public"."order_detail" USING btree ( + "order_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table order_detail +-- ---------------------------- +ALTER TABLE "public"."order_detail" ADD CONSTRAINT "order_detail_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table order_detail +-- ---------------------------- +ALTER TABLE "public"."order_detail" ADD CONSTRAINT "order_detail_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table order_evaluation +-- ---------------------------- +CREATE INDEX "idx_order_evaluation_evaluator_id" ON "public"."order_evaluation" USING btree ( + "evaluator_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_order_evaluation_order_id" ON "public"."order_evaluation" USING btree ( + "order_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table order_evaluation +-- ---------------------------- +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_rating_check" CHECK (((rating >= 1) AND (rating <= 5))); +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_service_rating_check" CHECK (((service_rating >= 1) AND (service_rating <= 5))); +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_quality_rating_check" CHECK (((quality_rating >= 1) AND (quality_rating <= 5))); +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_delivery_rating_check" CHECK (((delivery_rating >= 1) AND (delivery_rating <= 5))); +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_evaluator_type_check" CHECK ((evaluator_type = ANY (ARRAY['涔板'::text, '鍗栧'::text]))); + +-- ---------------------------- +-- Primary Key structure for table order_evaluation +-- ---------------------------- +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table order_info +-- ---------------------------- +CREATE INDEX "idx_order_info_apply_time" ON "public"."order_info" USING btree ( + "apply_time" "pg_catalog"."timestamp_ops" ASC NULLS LAST +); +CREATE INDEX "idx_order_info_provider_id" ON "public"."order_info" USING btree ( + "provider_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_order_info_status" ON "public"."order_info" USING btree ( + "order_status" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); +CREATE INDEX "idx_order_info_user_id" ON "public"."order_info" USING btree ( + "user_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table order_info +-- ---------------------------- +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_payment_type_check" CHECK ((payment_type = ANY (ARRAY['绉垎'::text, '璐у竵'::text, '鍗忚'::text]))); +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_payment_status_check" CHECK ((payment_status = ANY (ARRAY['鏈敮浠�'::text, '宸叉敮浠�'::text, '鏀粯澶辫触'::text, '宸查��娆�'::text]))); +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_order_status_check" CHECK ((order_status = ANY (ARRAY['寰呭鎵�'::text, '寰呭鎵规巿鏉�'::text, '寰呮巿鏉�'::text, '寰呬笂浼犳枃浠�'::text, '寰呬氦鏄撶‘璁�'::text, '宸插畬鎴�'::text, '宸插彇娑�'::text, '宸查┏鍥�'::text]))); + +-- ---------------------------- +-- Primary Key structure for table order_info +-- ---------------------------- +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_pkey" PRIMARY KEY ("order_id"); + +-- ---------------------------- +-- Checks structure for table points +-- ---------------------------- +ALTER TABLE "public"."points" ADD CONSTRAINT "chk_deleted" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table points +-- ---------------------------- +ALTER TABLE "public"."points" ADD CONSTRAINT "points_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table points_account +-- ---------------------------- +CREATE INDEX "idx_account_user" ON "public"."points_account" USING btree ( + "user_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table points_account +-- ---------------------------- +ALTER TABLE "public"."points_account" ADD CONSTRAINT "chk_account_type" CHECK ((account_type = ANY (ARRAY['涓汉绉垎'::text, '鍗曚綅绉垎'::text]))); +ALTER TABLE "public"."points_account" ADD CONSTRAINT "chk_account_status" CHECK ((account_status = ANY (ARRAY['姝e父'::text, '鍐荤粨'::text, '娉ㄩ攢'::text]))); +ALTER TABLE "public"."points_account" ADD CONSTRAINT "chk_account_deleted" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table points_account +-- ---------------------------- +ALTER TABLE "public"."points_account" ADD CONSTRAINT "points_account_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table points_flow +-- ---------------------------- +CREATE INDEX "idx_points_flow_data_category" ON "public"."points_flow" USING btree ( + "data_category" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); +CREATE INDEX "idx_points_flow_flow_time" ON "public"."points_flow" USING btree ( + "flow_time" "pg_catalog"."timestamp_ops" ASC NULLS LAST +); +CREATE INDEX "idx_points_flow_unit_id" ON "public"."points_flow" USING btree ( + "unit_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_points_flow_user_id" ON "public"."points_flow" USING btree ( + "user_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Primary Key structure for table points_flow +-- ---------------------------- +ALTER TABLE "public"."points_flow" ADD CONSTRAINT "points_flow_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table points_rule +-- ---------------------------- +CREATE INDEX "idx_points_rule_points" ON "public"."points_rule" USING btree ( + "points_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_points_rule_points_id" ON "public"."points_rule" USING btree ( + "points_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_points_rule_type" ON "public"."points_rule" USING btree ( + "rule_type" "pg_catalog"."int2_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table points_rule +-- ---------------------------- +ALTER TABLE "public"."points_rule" ADD CONSTRAINT "chk_rule_deleted" CHECK ((deleted = ANY (ARRAY[0, 1]))); +ALTER TABLE "public"."points_rule" ADD CONSTRAINT "chk_category" CHECK (((category)::text = ANY (ARRAY['璧勬簮璐$尞'::text, '璧勬簮浼犳挱'::text, '璧勬簮浜ゆ槗'::text, '浜ゆ祦绀惧尯浜掑姩'::text]))); + +-- ---------------------------- +-- Primary Key structure for table points_rule +-- ---------------------------- +ALTER TABLE "public"."points_rule" ADD CONSTRAINT "points_rule_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table points_rule_detail +-- ---------------------------- +CREATE INDEX "idx_points_detail_rule" ON "public"."points_rule_detail" USING btree ( + "rule_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_points_rule_detail_rule_id" ON "public"."points_rule_detail" USING btree ( + "rule_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table points_rule_detail +-- ---------------------------- +ALTER TABLE "public"."points_rule_detail" ADD CONSTRAINT "chk_detail_deleted" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table points_rule_detail +-- ---------------------------- +ALTER TABLE "public"."points_rule_detail" ADD CONSTRAINT "points_rule_detail_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table points_transaction +-- ---------------------------- +CREATE INDEX "idx_transaction_time" ON "public"."points_transaction" USING btree ( + "transaction_time" "pg_catalog"."timestamptz_ops" ASC NULLS LAST +); +CREATE INDEX "idx_transaction_user" ON "public"."points_transaction" USING btree ( + "user_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table points_transaction +-- ---------------------------- +ALTER TABLE "public"."points_transaction" ADD CONSTRAINT "chk_data_category" CHECK ((data_category = ANY (ARRAY['鐢ㄦ埛鍙備笌'::text, '鍏朵粬'::text]))); +ALTER TABLE "public"."points_transaction" ADD CONSTRAINT "chk_trans_rule_type" CHECK ((rule_type = ANY (ARRAY['鑾峰彇'::text, '娑堣��'::text]))); +ALTER TABLE "public"."points_transaction" ADD CONSTRAINT "chk_user_type" CHECK ((user_type = ANY (ARRAY['鍗曚綅鐢ㄦ埛'::text, '涓汉鐢ㄦ埛'::text]))); +ALTER TABLE "public"."points_transaction" ADD CONSTRAINT "chk_trans_deleted" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table points_transaction +-- ---------------------------- +ALTER TABLE "public"."points_transaction" ADD CONSTRAINT "points_transaction_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table product +-- ---------------------------- +CREATE INDEX "idx_product_provider_id" ON "public"."product" USING btree ( + "provider_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_product_status" ON "public"."product" USING btree ( + "status" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Uniques structure for table product +-- ---------------------------- +ALTER TABLE "public"."product" ADD CONSTRAINT "product_product_code_key" UNIQUE ("product_code"); + +-- ---------------------------- +-- Checks structure for table product +-- ---------------------------- +ALTER TABLE "public"."product" ADD CONSTRAINT "product_provider_type_check" CHECK ((provider_type = ANY (ARRAY['浼佷笟'::text, '涓汉'::text]))); +ALTER TABLE "public"."product" ADD CONSTRAINT "product_status_check" CHECK ((status = ANY (ARRAY['涓婃灦'::text, '涓嬫灦'::text, '瀹℃牳涓�'::text, '宸蹭笅鏋�'::text]))); +ALTER TABLE "public"."product" ADD CONSTRAINT "product_audit_status_check" CHECK ((audit_status = ANY (ARRAY['寰呭鏍�'::text, '瀹℃牳閫氳繃'::text, '瀹℃牳椹冲洖'::text]))); +ALTER TABLE "public"."product" ADD CONSTRAINT "product_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table product +-- ---------------------------- +ALTER TABLE "public"."product" ADD CONSTRAINT "product_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table product_pricing +-- ---------------------------- +CREATE INDEX "idx_product_pricing_product_id" ON "public"."product_pricing" USING btree ( + "product_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_product_pricing_status" ON "public"."product_pricing" USING btree ( + "is_active" "pg_catalog"."bool_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Checks structure for table product_pricing +-- ---------------------------- +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_customer_type_check" CHECK ((customer_type = ANY (ARRAY['浼佷笟'::text, '涓汉'::text, '椤圭洰閮�'::text]))); +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_price_type_check" CHECK ((price_type = ANY (ARRAY['绉垎'::text, '鍗忚'::text, '璐у竵'::text, '鍏嶈垂'::text]))); +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_price_unit_check" CHECK ((price_unit = ANY (ARRAY['濂�'::text, '濂�/骞�'::text, '骞�'::text, '涓�'::text, '娆�'::text]))); +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_sales_form_check" CHECK ((sales_form = ANY (ARRAY['涔版柇'::text, '绉熻祦'::text, '绉佹湁澧炲寘閲�'::text, '鍏湁澧炲寘閲�'::text, 'OTA鏈嶅姟'::text, '璧勬簮鍖�'::text, '涓汉'::text]))); + +-- ---------------------------- +-- Primary Key structure for table product_pricing +-- ---------------------------- +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Uniques structure for table unit +-- ---------------------------- +ALTER TABLE "public"."unit" ADD CONSTRAINT "unit_unit_code_key" UNIQUE ("unit_code"); + +-- ---------------------------- +-- Checks structure for table unit +-- ---------------------------- +ALTER TABLE "public"."unit" ADD CONSTRAINT "unit_status_check" CHECK ((status = ANY (ARRAY['姝e父'::text, '鍐荤粨'::text, '娉ㄩ攢'::text]))); +ALTER TABLE "public"."unit" ADD CONSTRAINT "unit_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table unit +-- ---------------------------- +ALTER TABLE "public"."unit" ADD CONSTRAINT "unit_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table user_points +-- ---------------------------- +CREATE INDEX "idx_user_points_unit_id" ON "public"."user_points" USING btree ( + "unit_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); +CREATE INDEX "idx_user_points_user_id" ON "public"."user_points" USING btree ( + "user_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Primary Key structure for table user_points +-- ---------------------------- +ALTER TABLE "public"."user_points" ADD CONSTRAINT "user_points_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Indexes structure for table users +-- ---------------------------- +CREATE INDEX "idx_users_status" ON "public"."users" USING btree ( + "status" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST +); +CREATE INDEX "idx_users_unit_id" ON "public"."users" USING btree ( + "unit_id" "pg_catalog"."int8_ops" ASC NULLS LAST +); + +-- ---------------------------- +-- Uniques structure for table users +-- ---------------------------- +ALTER TABLE "public"."users" ADD CONSTRAINT "users_username_key" UNIQUE ("username"); + +-- ---------------------------- +-- Checks structure for table users +-- ---------------------------- +ALTER TABLE "public"."users" ADD CONSTRAINT "users_user_type_check" CHECK ((user_type = ANY (ARRAY['涓汉鐢ㄦ埛'::text, '鍗曚綅鐢ㄦ埛'::text]))); +ALTER TABLE "public"."users" ADD CONSTRAINT "users_status_check" CHECK ((status = ANY (ARRAY['姝e父'::text, '鍐荤粨'::text, '娉ㄩ攢'::text]))); +ALTER TABLE "public"."users" ADD CONSTRAINT "users_deleted_check" CHECK ((deleted = ANY (ARRAY[0, 1]))); + +-- ---------------------------- +-- Primary Key structure for table users +-- ---------------------------- +ALTER TABLE "public"."users" ADD CONSTRAINT "users_pkey" PRIMARY KEY ("id"); + +-- ---------------------------- +-- Foreign Keys structure for table cart +-- ---------------------------- +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_pricing_id_fkey" FOREIGN KEY ("pricing_id") REFERENCES "public"."product_pricing" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "public"."product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_provider_id_fkey" FOREIGN KEY ("provider_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_unit_id_fkey" FOREIGN KEY ("unit_id") REFERENCES "public"."unit" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."cart" ADD CONSTRAINT "cart_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table order_approval +-- ---------------------------- +ALTER TABLE "public"."order_approval" ADD CONSTRAINT "order_approval_approver_id_fkey" FOREIGN KEY ("approver_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_approval" ADD CONSTRAINT "order_approval_next_approver_id_fkey" FOREIGN KEY ("next_approver_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_approval" ADD CONSTRAINT "order_approval_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "public"."order_info" ("order_id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table order_attachment +-- ---------------------------- +ALTER TABLE "public"."order_attachment" ADD CONSTRAINT "order_attachment_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "public"."order_info" ("order_id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_attachment" ADD CONSTRAINT "order_attachment_upload_user_id_fkey" FOREIGN KEY ("upload_user_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table order_detail +-- ---------------------------- +ALTER TABLE "public"."order_detail" ADD CONSTRAINT "order_detail_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "public"."order_info" ("order_id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_detail" ADD CONSTRAINT "order_detail_pricing_id_fkey" FOREIGN KEY ("pricing_id") REFERENCES "public"."product_pricing" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_detail" ADD CONSTRAINT "order_detail_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "public"."product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_detail" ADD CONSTRAINT "order_detail_provider_id_fkey" FOREIGN KEY ("provider_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table order_evaluation +-- ---------------------------- +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_evaluator_id_fkey" FOREIGN KEY ("evaluator_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_order_id_fkey" FOREIGN KEY ("order_id") REFERENCES "public"."order_info" ("order_id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_evaluation" ADD CONSTRAINT "order_evaluation_reply_user_id_fkey" FOREIGN KEY ("reply_user_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table order_info +-- ---------------------------- +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "public"."product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_provider_id_fkey" FOREIGN KEY ("provider_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_unit_id_fkey" FOREIGN KEY ("unit_id") REFERENCES "public"."unit" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."order_info" ADD CONSTRAINT "order_info_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table points_rule +-- ---------------------------- +ALTER TABLE "public"."points_rule" ADD CONSTRAINT "fk_points" FOREIGN KEY ("points_id") REFERENCES "public"."points" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table points_rule_detail +-- ---------------------------- +ALTER TABLE "public"."points_rule_detail" ADD CONSTRAINT "fk_detail_points" FOREIGN KEY ("points_id") REFERENCES "public"."points" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."points_rule_detail" ADD CONSTRAINT "fk_rule" FOREIGN KEY ("rule_id") REFERENCES "public"."points_rule" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table points_transaction +-- ---------------------------- +ALTER TABLE "public"."points_transaction" ADD CONSTRAINT "fk_detail_id" FOREIGN KEY ("detail_id") REFERENCES "public"."points_rule_detail" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."points_transaction" ADD CONSTRAINT "fk_rule_id" FOREIGN KEY ("rule_id") REFERENCES "public"."points_rule" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table product +-- ---------------------------- +ALTER TABLE "public"."product" ADD CONSTRAINT "product_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."product" ADD CONSTRAINT "product_provider_id_fkey" FOREIGN KEY ("provider_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."product" ADD CONSTRAINT "product_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table product_pricing +-- ---------------------------- +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_product_id_fkey" FOREIGN KEY ("product_id") REFERENCES "public"."product" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_provider_id_fkey" FOREIGN KEY ("provider_id") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE "public"."product_pricing" ADD CONSTRAINT "product_pricing_updated_by_fkey" FOREIGN KEY ("updated_by") REFERENCES "public"."users" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; + +-- ---------------------------- +-- Foreign Keys structure for table users +-- ---------------------------- +ALTER TABLE "public"."users" ADD CONSTRAINT "users_unit_id_fkey" FOREIGN KEY ("unit_id") REFERENCES "public"."unit" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION; diff --git a/src/main/java/com/webmanage/controller/PointsController.java b/src/main/java/com/webmanage/controller/PointsController.java index b4e0ba5..942a46d 100644 --- a/src/main/java/com/webmanage/controller/PointsController.java +++ b/src/main/java/com/webmanage/controller/PointsController.java @@ -1,5 +1,6 @@ package com.webmanage.controller; +import com.webmanage.common.PageResult; import com.webmanage.common.Result; import com.webmanage.dto.AddPointsFlowDTO; import com.webmanage.dto.PointsFlowQueryDTO; @@ -10,6 +11,8 @@ import com.webmanage.service.PointsFlowService; import com.webmanage.service.PointsRuleService; import com.webmanage.service.PointsService; +import com.webmanage.vo.PointsRuleResultVO; +import com.webmanage.vo.PointsRuleVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -46,7 +49,7 @@ @PostMapping("/main/page") @ApiOperation("鍒嗛〉鏌ヨ绉垎涓昏〃") - public Result<Object> getPointsMainPage(@Valid @RequestBody PointsMainQueryDTO queryDTO) { + public Result<PageResult<Points>> getPointsMainPage(@Valid @RequestBody PointsMainQueryDTO queryDTO) { try { return Result.success(pointsService.getPointsMainPage(queryDTO)); } catch (Exception e) { @@ -58,14 +61,12 @@ // ==================== 绉垎瑙勫垯绠$悊 ==================== - @PostMapping("/rule/page") - @ApiOperation("鍒嗛〉鏌ヨ绉垎瑙勫垯") - public Result<Object> getPointsRulePage(@RequestParam(defaultValue = "1") Integer pageNum, - @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(required = false) String ruleName, - @RequestParam(required = false) String ruleType) { + @PostMapping("/rule/list") + @ApiOperation("鏍规嵁瑙勫垯涓昏〃ID鏌ヨ绉垎瑙勫垯") + public Result<PointsRuleResultVO> getPointsRuleListById( + @RequestParam(required = true) @NotNull Long ruleId) { try { - return Result.success(pointsRuleService.getPointsRulePage(pageNum, pageSize, ruleName, ruleType)); + return Result.success(pointsRuleService.getPointsRuleList(ruleId)); } catch (Exception e) { log.error("鏌ヨ绉垎瑙勫垯澶辫触", e); return Result.error("鏌ヨ绉垎瑙勫垯澶辫触锛�" + e.getMessage()); diff --git a/src/main/java/com/webmanage/emun/RuleTypeEnum.java b/src/main/java/com/webmanage/emun/RuleTypeEnum.java new file mode 100644 index 0000000..284c77e --- /dev/null +++ b/src/main/java/com/webmanage/emun/RuleTypeEnum.java @@ -0,0 +1,28 @@ +package com.webmanage.emun; + +/** + * @author c.y.b + * @Title: + * @Package + * @Description: + * @date 2025/8/1416:27 + */ +public enum RuleTypeEnum { + + GET(0L,"鑾峰彇"),CONSUME(1L,"娑堣垂"); + private Long code; + private String name; + + RuleTypeEnum(Long code, String name) { + this.code = code; + this.name = name; + } + + public Long getCode() { + return code; + } + + public String getName() { + return name; + } +} diff --git a/src/main/java/com/webmanage/entity/PointsRule.java b/src/main/java/com/webmanage/entity/PointsRule.java index 0a9a8a1..11bfdf7 100644 --- a/src/main/java/com/webmanage/entity/PointsRule.java +++ b/src/main/java/com/webmanage/entity/PointsRule.java @@ -28,25 +28,17 @@ @TableId(value = "id", type = IdType.AUTO) private Long id; + @ApiModelProperty("瑙勫垯绫诲瀷(0鑾峰緱/1娑堣垂)") + @TableField("rule_type") + private Long ruleType; + + @ApiModelProperty("瑙勫垯绫诲埆") + @TableField("category") + private String category; + @ApiModelProperty("瑙勫垯鍚嶇О") @TableField("rule_name") private String ruleName; - - @ApiModelProperty("瑙勫垯绫诲瀷(鑾峰緱/娑堣垂)") - @TableField("rule_type") - private String ruleType; - - @ApiModelProperty("绉垎鍊�") - @TableField("points_value") - private Integer pointsValue; - - @ApiModelProperty("瑙﹀彂鏉′欢") - @TableField("trigger_condition") - private String triggerCondition; - - @ApiModelProperty("瑙﹀彂閲戦") - @TableField("trigger_amount") - private BigDecimal triggerAmount; @ApiModelProperty("瑙勫垯鎻忚堪") @TableField("rule_description") @@ -55,18 +47,6 @@ @ApiModelProperty("鏄惁鍚敤") @TableField("is_enabled") private Boolean isEnabled; - - @ApiModelProperty("浼樺厛绾�") - @TableField("priority") - private Integer priority; - - @ApiModelProperty("鏈夋晥鏈熷紑濮嬫椂闂�") - @TableField("valid_start_time") - private LocalDateTime validStartTime; - - @ApiModelProperty("鏈夋晥鏈熺粨鏉熸椂闂�") - @TableField("valid_end_time") - private LocalDateTime validEndTime; @ApiModelProperty("鍒涘缓鏃堕棿") @TableField(value = "created_at", fill = FieldFill.INSERT) @@ -80,4 +60,13 @@ @TableLogic @TableField("deleted") private Integer deleted; + + + @ApiModelProperty("绉垎鎷ユ湁鑰�(0璐$尞鍊�1鐢ㄦ埛)") + @TableField("points_winner") + private Integer pointsWinner; + + @ApiModelProperty("绉垎鏄惁鏈変笂闄�(0鏈�1娌℃湁)") + @TableField("is_limit") + private Integer isLimit; } diff --git a/src/main/java/com/webmanage/service/PointsRuleService.java b/src/main/java/com/webmanage/service/PointsRuleService.java index da6de60..ab3455c 100644 --- a/src/main/java/com/webmanage/service/PointsRuleService.java +++ b/src/main/java/com/webmanage/service/PointsRuleService.java @@ -4,6 +4,8 @@ import com.webmanage.common.PageResult; import com.webmanage.dto.PointsRuleDTO; import com.webmanage.entity.PointsRule; +import com.webmanage.vo.PointsRuleResultVO; +import com.webmanage.vo.PointsRuleVO; import java.util.List; @@ -15,7 +17,7 @@ /** * 鍒嗛〉鏌ヨ绉垎瑙勫垯 */ - PageResult<PointsRule> getPointsRulePage(Integer pageNum, Integer pageSize, String ruleName, String ruleType); + PointsRuleResultVO getPointsRuleList(Long ruleId); /** * 鏂板绉垎瑙勫垯 diff --git a/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java b/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java index ac0d99d..9188feb 100644 --- a/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java +++ b/src/main/java/com/webmanage/service/impl/PointsFlowServiceImpl.java @@ -171,7 +171,7 @@ } // 璁$畻绉垎鍊� - Integer basePoints = pointsRule.getPointsValue() != null ? pointsRule.getPointsValue() : 0; + Integer basePoints = 0; //pointsRule.getPointsValue() != null ? pointsRule.getPointsValue() : 0; Integer totalPoints = basePoints * count; // 濡傛灉鏄秷璐圭被鍨嬶紝绉垎涓鸿礋鏁� @@ -180,8 +180,8 @@ } // 妫�鏌ユ瘡鏃ョН鍒嗕笂闄� - if (basePoints > 0 && pointsRule.getPriority() != null && pointsRule.getPriority() > 0) { - checkDailyLimit(userId, unitId, ruleName, totalPoints, pointsRule.getPriority()); + if (basePoints > 0) { + checkDailyLimit(userId, unitId, ruleName, totalPoints, 0); } // 鍒涘缓绉垎娴佹按璁板綍 diff --git a/src/main/java/com/webmanage/service/impl/PointsRuleServiceImpl.java b/src/main/java/com/webmanage/service/impl/PointsRuleServiceImpl.java index f61054e..05d9e37 100644 --- a/src/main/java/com/webmanage/service/impl/PointsRuleServiceImpl.java +++ b/src/main/java/com/webmanage/service/impl/PointsRuleServiceImpl.java @@ -1,12 +1,11 @@ package com.webmanage.service.impl; +import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.webmanage.common.BusinessException; -import com.webmanage.common.PageResult; import com.webmanage.dto.PointsRuleDTO; +import com.webmanage.emun.RuleTypeEnum; import com.webmanage.entity.Points; import com.webmanage.entity.PointsRule; import com.webmanage.entity.PointsRuleDetail; @@ -14,6 +13,8 @@ import com.webmanage.service.PointsRuleService; import com.webmanage.service.PointsService; import com.webmanage.service.PointsRuleDetailService; +import com.webmanage.vo.PointsRuleResultVO; +import com.webmanage.vo.PointsRuleVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +22,10 @@ import org.springframework.util.StringUtils; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * 绉垎瑙勫垯Service瀹炵幇绫� @@ -37,30 +41,44 @@ private PointsRuleDetailService pointsRuleDetailService; @Override - public PageResult<PointsRule> getPointsRulePage(Integer pageNum, Integer pageSize, String ruleName, String ruleType) { - Page<PointsRule> page = new Page<>(pageNum, pageSize); - + public PointsRuleResultVO getPointsRuleList(Long ruleId) { + QueryWrapper<PointsRule> wrapper = new QueryWrapper<>(); - wrapper.eq("deleted", 0); + + wrapper.eq("deleted", 0).eq("is_enabled",0); - if (StringUtils.hasText(ruleName)) { - wrapper.like("rule_name", ruleName); + if(ruleId != null){ + wrapper.eq("points_id", ruleId); } - if (StringUtils.hasText(ruleType)) { - wrapper.eq("rule_type", ruleType); + + List<PointsRule> list = list(wrapper); + PointsRuleResultVO pointsRuleResultVO = new PointsRuleResultVO(); + if (!CollectionUtil.isEmpty(list)) { + Map<Long, List<PointsRule>> collect = list.stream().collect(Collectors.groupingBy(PointsRule::getRuleType)); + + Map<String, List<PointsRule>> getRules = collect.get(RuleTypeEnum.GET.getCode()).stream().collect(Collectors.groupingBy(PointsRule::getCategory)); + Map<String, List<PointsRule>> consumeRules = collect.get(RuleTypeEnum.CONSUME.getCode()).stream().collect(Collectors.groupingBy(PointsRule::getCategory)); + List<PointsRuleVO> getPointsRuleVOList = new ArrayList<>(); + List<PointsRuleVO> consumePointsRuleVOList = new ArrayList<>(); + getRules.forEach((k,v)->{ + PointsRuleVO pointsRuleVO = new PointsRuleVO(); + pointsRuleVO.setCategory(k); + pointsRuleVO.setPointsRules(v); + getPointsRuleVOList.add(pointsRuleVO); + + }); + consumeRules.forEach((k,v)->{ + PointsRuleVO pointsRuleVO = new PointsRuleVO(); + pointsRuleVO.setCategory(k); + pointsRuleVO.setPointsRules(v); + consumePointsRuleVOList.add(pointsRuleVO); + + }); + pointsRuleResultVO.setGetPointsRuleList(getPointsRuleVOList); + pointsRuleResultVO.setConsumePointsRuleList(consumePointsRuleVOList); } - - wrapper.orderByDesc("priority", "created_at"); - - IPage<PointsRule> result = page(page, wrapper); - - return new PageResult<PointsRule>( - result.getRecords(), - result.getTotal(), - pageNum.longValue(), - pageSize.longValue(), - result.getPages() - ); + + return pointsRuleResultVO; } @Override diff --git a/src/main/java/com/webmanage/vo/PointsRuleResultVO.java b/src/main/java/com/webmanage/vo/PointsRuleResultVO.java new file mode 100644 index 0000000..e6da71f --- /dev/null +++ b/src/main/java/com/webmanage/vo/PointsRuleResultVO.java @@ -0,0 +1,19 @@ +package com.webmanage.vo; + +import com.webmanage.entity.PointsRule; +import lombok.Data; + +import java.util.List; + +/** + * @author c.y.b + * @Title: + * @Package + * @Description: + * @date 2025/8/1416:47 + */ +@Data +public class PointsRuleResultVO { + private List<PointsRuleVO> getPointsRuleList; + private List<PointsRuleVO> consumePointsRuleList; +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index f12c5d6..235bb55 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,17 +1,4 @@ -server: - port: 8080 - servlet: - context-path: /admin - spring: - application: - name: web-manage-back - - #mcv閰嶇疆 - mvc: - pathmatch: - matching-strategy: ant_path_matcher - # 鏁版嵁婧愰厤缃� datasource: type: com.alibaba.druid.pool.DruidDataSource @@ -80,49 +67,3 @@ secret-key: minioadmin bucket-name: web-manage -# MyBatis Plus閰嶇疆 -mybatis-plus: - configuration: - # 寮�鍚┘宄板懡鍚� - map-underscore-to-camel-case: true - # 寮�鍚痵ql鏃ュ織 - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - global-config: - db-config: - # 涓婚敭绫诲瀷 - id-type: auto - # 閫昏緫鍒犻櫎閰嶇疆 - logic-delete-field: deleted - logic-delete-value: 1 - logic-not-delete-value: 0 - mapper-locations: classpath*:/mapper/**/*.xml - -# 鏃ュ織閰嶇疆 -logging: - level: - com.webmanage: debug - org.springframework.web: debug - pattern: - console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n" - -# Knife4j閰嶇疆 -knife4j: - enable: true - setting: - language: zh-CN - enable-swagger-models: true - enable-document-manage: true - swagger-model-name: 瀹炰綋绫诲垪琛� - basic: - enable: false - -# 璐墿杞﹂厤缃� -cart: - # Redis缂撳瓨杩囨湡鏃堕棿锛堝ぉ锛� - expire-days: 30 - # 鏄惁鍚敤鏁版嵁搴撴寔涔呭寲 - enable-persistence: true - # 鏄惁鍚敤鏁版嵁涓�鑷存�ф鏌� - enable-consistency-check: true - # 鍚屾绛栫暐锛歳ealtime锛堝疄鏃跺悓姝ワ級銆乥atch锛堟壒閲忓悓姝ワ級銆乵anual锛堟墜鍔ㄥ悓姝ワ級 - sync-strategy: realtime diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 0000000..58c3ec5 --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,69 @@ + # 鏁版嵁婧愰厤缃� +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://localhost:5432/web_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: postgres + password: zkyxpostgres + druid: + # 鍒濆杩炴帴鏁� + initial-size: 5 + # 鏈�灏忚繛鎺ユ睜鏁伴噺 + min-idle: 10 + # 鏈�澶ц繛鎺ユ睜鏁伴噺 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + min-evictable-idle-time-millis: 300000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 + max-evictable-idle-time-millis: 900000 + # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁� + validation-query: SELECT 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + # 鎵撳紑PSCache锛屽苟涓旀寚瀹氭瘡涓繛鎺ヤ笂PSCache鐨勫ぇ灏� + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + # 閰嶇疆鐩戞帶缁熻鎷︽埅鐨刦ilters锛屽幓鎺夊悗鐩戞帶鐣岄潰sql鏃犳硶缁熻锛�'wall'鐢ㄤ簬闃茬伀澧� + filters: stat,wall,slf4j + # 閫氳繃connectProperties灞炴�ф潵鎵撳紑mergeSql鍔熻兘锛涙參SQL璁板綍 + connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 + # 閰嶇疆DruidStatFilter + web-stat-filter: + enabled: true + url-pattern: /* + exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" + # 閰嶇疆DruidStatViewServlet + stat-view-servlet: + enabled: true + url-pattern: /druid/* + reset-enable: false + login-username: admin + login-password: 123456 + + # Redis閰嶇疆 + redis: + host: 192.168.110.129 + port: 6379 + password: + database: 0 + timeout: 10000ms + lettuce: + pool: + max-active: 8 + max-wait: -1ms + max-idle: 8 + min-idle: 0 +# MinIO閰嶇疆 +minio: + endpoint: http://192.168.110.129:9000 + access-key: minioadmin + secret-key: minioadmin + bucket-name: web-manage + + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 88eaa3e..3e402c4 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,7 +7,7 @@ application: name: web-manage-back profiles: - active: dev + active: test jackson: date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 @@ -16,74 +16,6 @@ mvc: pathmatch: matching-strategy: ant_path_matcher - - # 鏁版嵁婧愰厤缃� - datasource: - type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://localhost:5432/web_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: postgres - password: zkyxpostgres - druid: - # 鍒濆杩炴帴鏁� - initial-size: 5 - # 鏈�灏忚繛鎺ユ睜鏁伴噺 - min-idle: 10 - # 鏈�澶ц繛鎺ユ睜鏁伴噺 - max-active: 20 - # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� - max-wait: 60000 - # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 - time-between-eviction-runs-millis: 60000 - # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 - min-evictable-idle-time-millis: 300000 - # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 - max-evictable-idle-time-millis: 900000 - # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁� - validation-query: SELECT 1 - test-while-idle: true - test-on-borrow: false - test-on-return: false - # 鎵撳紑PSCache锛屽苟涓旀寚瀹氭瘡涓繛鎺ヤ笂PSCache鐨勫ぇ灏� - pool-prepared-statements: true - max-pool-prepared-statement-per-connection-size: 20 - # 閰嶇疆鐩戞帶缁熻鎷︽埅鐨刦ilters锛屽幓鎺夊悗鐩戞帶鐣岄潰sql鏃犳硶缁熻锛�'wall'鐢ㄤ簬闃茬伀澧� - filters: stat,wall,slf4j - # 閫氳繃connectProperties灞炴�ф潵鎵撳紑mergeSql鍔熻兘锛涙參SQL璁板綍 - connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 - # 閰嶇疆DruidStatFilter - web-stat-filter: - enabled: true - url-pattern: /* - exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" - # 閰嶇疆DruidStatViewServlet - stat-view-servlet: - enabled: true - url-pattern: /druid/* - reset-enable: false - login-username: admin - login-password: 123456 - - # Redis閰嶇疆 - redis: - host: 192.168.110.129 - port: 6379 - password: - database: 0 - timeout: 10000ms - lettuce: - pool: - max-active: 8 - max-wait: -1ms - max-idle: 8 - min-idle: 0 - -# MinIO閰嶇疆 -minio: - endpoint: http://192.168.110.129:9000 - access-key: minioadmin - secret-key: minioadmin - bucket-name: web-manage # MyBatis Plus閰嶇疆 mybatis-plus: -- Gitblit v1.8.0