Merge branch 'master' into message-board
This commit is contained in:
commit
ca7c565883
350
sql/v2.1.sql
350
sql/v2.1.sql
@ -1,113 +1,263 @@
|
||||
CREATE TABLE `xhpc_tradebill_internet_check_record`
|
||||
(
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` DATETIME(6) NOT NULL COMMENT '创建时间',
|
||||
`create_by` VARCHAR(30) NULL DEFAULT NULL COMMENT '创建人' COLLATE 'utf8mb4_unicode_ci',
|
||||
`update_time` DATETIME(6) NOT NULL COMMENT '更新时间',
|
||||
`update_by` VARCHAR(30) NULL DEFAULT NULL COMMENT '更新人' COLLATE 'utf8mb4_unicode_ci',
|
||||
`upload_id` INT(11) NOT NULL COMMENT '文件上传ID',
|
||||
`history_order_no` BIGINT(20) NULL DEFAULT NULL COMMENT '历史订单ID',
|
||||
`user_id` VARCHAR(64) NULL DEFAULT NULL COMMENT '用户ID' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_name` VARCHAR(64) NULL DEFAULT NULL COMMENT '流量方' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_internet_serial_number` VARCHAR(32) NULL DEFAULT NULL COMMENT '平台-第三方订单号' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_serial_number` VARCHAR(32) NULL DEFAULT NULL COMMENT '平台-订单号' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_charge_station` VARCHAR(32) NULL DEFAULT NULL COMMENT '平台-场站名称' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_start_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '平台-开始SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_end_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '平台-结束SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` DATETIME(6) NOT NULL COMMENT '创建时间',
|
||||
`create_by` VARCHAR(30) NULL DEFAULT NULL COMMENT '创建人' COLLATE 'utf8mb4_unicode_ci',
|
||||
`update_time` DATETIME(6) NOT NULL COMMENT '更新时间',
|
||||
`update_by` VARCHAR(30) NULL DEFAULT NULL COMMENT '更新人' COLLATE 'utf8mb4_unicode_ci',
|
||||
`upload_id` INT(11) NOT NULL COMMENT '文件上传ID',
|
||||
`history_order_no` BIGINT(20) NULL DEFAULT NULL COMMENT '历史订单ID',
|
||||
`user_id` VARCHAR(64) NULL DEFAULT NULL COMMENT '用户ID' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_name` VARCHAR(64) NULL DEFAULT NULL COMMENT '流量方' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_internet_serial_number` VARCHAR(32) NULL DEFAULT NULL COMMENT '平台-第三方订单号' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_serial_number` VARCHAR(32) NULL DEFAULT NULL COMMENT '平台-订单号' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_charge_station` VARCHAR(32) NULL DEFAULT NULL COMMENT '平台-场站名称' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_start_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '平台-开始SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_end_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '平台-结束SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_charging_degree` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '平台-充电电量',
|
||||
`platform_charging_time` VARCHAR(20) NULL DEFAULT NULL COMMENT '平台-充电时长' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_start_time` DATETIME(6) NULL DEFAULT NULL COMMENT '平台-开始充电时间',
|
||||
`platform_end_time` DATETIME(6) NULL DEFAULT NULL COMMENT '平台-结束充电时间',
|
||||
`platform_charging_time` VARCHAR(20) NULL DEFAULT NULL COMMENT '平台-充电时长' COLLATE 'utf8mb4_unicode_ci',
|
||||
`platform_start_time` DATETIME(6) NULL DEFAULT NULL COMMENT '平台-开始充电时间',
|
||||
`platform_end_time` DATETIME(6) NULL DEFAULT NULL COMMENT '平台-结束充电时间',
|
||||
`platform_order_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '平台-订单总金额',
|
||||
`platform_power_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '平台-电费',
|
||||
`platform_server_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '平台-服务费',
|
||||
`platform_discount_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '平台-折扣金额',
|
||||
`platform_pay_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '平台-支付金额',
|
||||
`internet_serial_number` VARCHAR(32) NULL DEFAULT NULL COMMENT '流量方-订单号' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_charge_station` VARCHAR(32) NULL DEFAULT NULL COMMENT '流量方-场站名称' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_start_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '流量方-开始SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_end_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '流量方-结束SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_serial_number` VARCHAR(32) NULL DEFAULT NULL COMMENT '流量方-订单号' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_charge_station` VARCHAR(32) NULL DEFAULT NULL COMMENT '流量方-场站名称' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_start_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '流量方-开始SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_end_soc` VARCHAR(10) NULL DEFAULT NULL COMMENT '流量方-结束SOC' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_charging_degree` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '流量方-充电电量',
|
||||
`internet_charging_time` VARCHAR(20) NULL DEFAULT NULL COMMENT '流量方-充电时长(单位:分钟)' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_start_time` DATETIME(6) NULL DEFAULT NULL COMMENT '流量方-开始充电时间',
|
||||
`internet_end_time` DATETIME(6) NULL DEFAULT NULL COMMENT '流量方-结束充电时间',
|
||||
`internet_charging_time` VARCHAR(20) NULL DEFAULT NULL COMMENT '流量方-充电时长(单位:分钟)' COLLATE 'utf8mb4_unicode_ci',
|
||||
`internet_start_time` DATETIME(6) NULL DEFAULT NULL COMMENT '流量方-开始充电时间',
|
||||
`internet_end_time` DATETIME(6) NULL DEFAULT NULL COMMENT '流量方-结束充电时间',
|
||||
`internet_order_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '流量方-订单总金额',
|
||||
`internet_power_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '流量方-电费',
|
||||
`internet_server_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '流量方-服务费',
|
||||
`internet_discount_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '流量方-折扣费',
|
||||
`internet_pay_amount` DECIMAL(10, 2) NULL DEFAULT NULL COMMENT '流量方-支付金额',
|
||||
`remark` VARCHAR(200) NULL DEFAULT NULL COMMENT '备注' COLLATE 'utf8mb4_unicode_ci',
|
||||
`status` SMALLINT(6) NOT NULL COMMENT '状态(0-待对账,1-对账异常,2-对账正常)',
|
||||
`remark` VARCHAR(200) NULL DEFAULT NULL COMMENT '备注' COLLATE 'utf8mb4_unicode_ci',
|
||||
`status` SMALLINT(6) NOT NULL COMMENT '状态(0-待对账,1-对账异常,2-对账正常)',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
)
|
||||
COLLATE = 'utf8mb4_unicode_ci'
|
||||
) COLLATE = 'utf8mb4_unicode_ci'
|
||||
ENGINE = InnoDB
|
||||
ROW_FORMAT = DYNAMIC
|
||||
AUTO_INCREMENT = 34670
|
||||
;
|
||||
|
||||
ALTER TABLE `xhpc_app_user` ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `is_refund_application` int(10) NULL DEFAULT 0 COMMENT '是否有退款订单审核(0无 1有)' AFTER `is_refund`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `soc` int(10) NULL DEFAULT NULL COMMENT '用户设置的SOC' AFTER `is_refund_application`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `weixin_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `avatar`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `alipay_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `weixin_open_id`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `weixin_login` int(10) NULL DEFAULT 0 COMMENT '微信是否登录(0未登录 1已登录)' AFTER `alipay_open_id`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `alipay_login` int(10) NULL DEFAULT 0 COMMENT '支付宝是否登录(0未登录 1已登录)' AFTER `weixin_login`;
|
||||
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `is_refund_application` int(10) NULL DEFAULT 0 COMMENT '是否有退款订单审核(0无 1有)' AFTER `remark`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `soc` int(10) NULL DEFAULT NULL COMMENT '用户设置的SOC' AFTER `is_refund_application`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `weixin_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `avatar`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `alipay_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `weixin_open_id`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `weixin_login` int(10) NULL DEFAULT 0 COMMENT '微信是否登录(0未登录 1已登录)' AFTER `alipay_open_id`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `alipay_login` int(10) NULL DEFAULT 0 COMMENT '支付宝是否登录(0未登录 1已登录)' AFTER `weixin_login`;
|
||||
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_app_user`
|
||||
ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `is_refund_application` int(10) NULL DEFAULT 0 COMMENT '是否有退款订单审核(0无 1有)' AFTER `is_refund`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `soc` int(10) NULL DEFAULT NULL COMMENT '用户设置的SOC' AFTER `is_refund_application`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `weixin_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `avatar`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `alipay_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `weixin_open_id`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `weixin_login` int(10) NULL DEFAULT 0 COMMENT '微信是否登录(0未登录 1已登录)' AFTER `alipay_open_id`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `alipay_login` int(10) NULL DEFAULT 0 COMMENT '支付宝是否登录(0未登录 1已登录)' AFTER `weixin_login`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `is_refund_application` int(10) NULL DEFAULT 0 COMMENT '是否有退款订单审核(0无 1有)' AFTER `remark`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `soc` int(10) NULL DEFAULT NULL COMMENT '用户设置的SOC' AFTER `is_refund_application`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址' AFTER `soc`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `weixin_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `avatar`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `alipay_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `weixin_open_id`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `weixin_login` int(10) NULL DEFAULT 0 COMMENT '微信是否登录(0未登录 1已登录)' AFTER `alipay_open_id`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `alipay_login` int(10) NULL DEFAULT 0 COMMENT '支付宝是否登录(0未登录 1已登录)' AFTER `weixin_login`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||
|
||||
CREATE TABLE `xhpc_user_login` (
|
||||
`user_login_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`app_user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
|
||||
`account` varchar(50) DEFAULT NULL COMMENT '账号',
|
||||
`user_type` int(4) NOT NULL COMMENT '用户类型 0 C端用户 1 流量方用户 2社区用户 3B端用户)',
|
||||
`open_id` varchar(50) DEFAULT NULL COMMENT 'openid',
|
||||
`type` int(4) DEFAULT '0' COMMENT '1 微信 2支付宝',
|
||||
`status` int(4) DEFAULT '1' COMMENT '0退出 1登录',
|
||||
`del_flag` int(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
PRIMARY KEY (`user_login_id`)
|
||||
CREATE TABLE `xhpc_user_login`
|
||||
(
|
||||
`user_login_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`app_user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
|
||||
`account` varchar(50) DEFAULT NULL COMMENT '账号',
|
||||
`user_type` int(4) NOT NULL COMMENT '用户类型 0 C端用户 1 流量方用户 2社区用户 3B端用户)',
|
||||
`open_id` varchar(50) DEFAULT NULL COMMENT 'openid',
|
||||
`type` int(4) DEFAULT '0' COMMENT '1 微信 2支付宝',
|
||||
`status` int(4) DEFAULT '1' COMMENT '0退出 1登录',
|
||||
`del_flag` int(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
PRIMARY KEY (`user_login_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='小程序用户最后一次登录记录';
|
||||
|
||||
CREATE TABLE `xhpc_tenant`
|
||||
(
|
||||
`tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户ID',
|
||||
`tenant_name` VARCHAR(50) NOT NULL COMMENT '租户名称',
|
||||
`domain` VARCHAR(255) NULL DEFAULT NULL COMMENT '域名地址',
|
||||
`tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户ID',
|
||||
`tenant_name` VARCHAR(50) NOT NULL COMMENT '租户名称',
|
||||
`domain` VARCHAR(255) NULL DEFAULT NULL COMMENT '域名地址',
|
||||
`background_url` VARCHAR(1000) NULL DEFAULT NULL COMMENT '系统背景',
|
||||
`linkman` VARCHAR(20) NULL DEFAULT NULL COMMENT '联系人',
|
||||
`contact_number` VARCHAR(20) NULL DEFAULT NULL COMMENT '联系电话',
|
||||
`address` VARCHAR(255) NULL DEFAULT NULL COMMENT '联系地址',
|
||||
`station_quote` INT(11) NULL DEFAULT '-1' COMMENT '场站限额',
|
||||
`station_pile_quote` INT(11) NULL DEFAULT '-1' COMMENT '每站桩限额',
|
||||
`expire_time` DATETIME NULL DEFAULT NULL COMMENT '过期时间',
|
||||
`create_user` BIGINT(64) NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_dept` BIGINT(64) NULL DEFAULT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_user` BIGINT(64) NULL DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
|
||||
`status` INT(2) NULL DEFAULT NULL COMMENT '状态',
|
||||
`is_deleted` INT(2) NULL DEFAULT '0' COMMENT '是否已删除',
|
||||
`linkman` VARCHAR(20) NULL DEFAULT NULL COMMENT '联系人',
|
||||
`contact_number` VARCHAR(20) NULL DEFAULT NULL COMMENT '联系电话',
|
||||
`address` VARCHAR(255) NULL DEFAULT NULL COMMENT '联系地址',
|
||||
`station_quote` INT(11) NULL DEFAULT '-1' COMMENT '场站限额',
|
||||
`station_pile_quote` INT(11) NULL DEFAULT '-1' COMMENT '每站桩限额',
|
||||
`expire_time` DATETIME NULL DEFAULT NULL COMMENT '过期时间',
|
||||
`create_user` BIGINT(64) NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_dept` BIGINT(64) NULL DEFAULT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_user` BIGINT(64) NULL DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
|
||||
`status` INT(2) NULL DEFAULT NULL COMMENT '状态',
|
||||
`is_deleted` INT(2) NULL DEFAULT '0' COMMENT '是否已删除',
|
||||
PRIMARY KEY (`tenant_id`) USING BTREE
|
||||
)
|
||||
COMMENT ='租户表'
|
||||
) COMMENT ='租户表'
|
||||
COLLATE = 'utf8mb4_general_ci'
|
||||
ENGINE = InnoDB
|
||||
;
|
||||
|
||||
|
||||
CREATE TABLE `xhpc_tradebill_upload_record`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` datetime(6) NOT NULL COMMENT '创建时间',
|
||||
`create_by` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||||
`update_time` datetime(6) NOT NULL COMMENT '更新时间',
|
||||
`update_by` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||||
`source` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源',
|
||||
`file_name` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件名称',
|
||||
`url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件地址',
|
||||
`type` smallint(6) NOT NULL COMMENT '文件类型(1-微信充值,2-微信退款,3-支付宝充值,4-支付宝退款,5-恒大,6-小桔,7-新电途,8-特来电)',
|
||||
`status` smallint(6) NOT NULL COMMENT '状态(0-未对账,1-已对账)',
|
||||
`del_flag` smallint(6) NOT NULL COMMENT '删除标识(0-正常,2-已删除)',
|
||||
`success_count` int(11) NOT NULL COMMENT '对账成功记录数量',
|
||||
`fail_count` int(11) NOT NULL COMMENT '对账失败记录数量',
|
||||
`uncheck_count` int(11) NOT NULL COMMENT '未对账记录数量',
|
||||
`checked_count` int(11) NOT NULL COMMENT '已对账记录数量',
|
||||
`tenant_id` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = '对账单上传记录表'
|
||||
AUTO_INCREMENT=1
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
COLLATE='utf8mb4_general_ci'
|
||||
ROW_FORMAT=DYNAMIC;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `xhpc_tradebill_payment_check_record`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` datetime(6) NOT NULL COMMENT '创建时间',
|
||||
`create_by` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||||
`update_time` datetime(6) NOT NULL COMMENT '更新时间',
|
||||
`update_by` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||||
`upload_id` int(11) NOT NULL COMMENT '文件上传ID',
|
||||
`order_type` smallint(6) DEFAULT NULL COMMENT '订单类型(1-充值,2-退款)',
|
||||
`payment_channel` smallint(6) DEFAULT NULL COMMENT '充值渠道(1微信 2支付宝)',
|
||||
`platform_order_number` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-订单ID',
|
||||
`platform_pay_number` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-支付订单号',
|
||||
`platform_user_id` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-用户ID',
|
||||
`platform_amount` decimal(10, 2) DEFAULT NULL COMMENT '平台-金额',
|
||||
`platform_pay_time` datetime(6) DEFAULT NULL COMMENT '平台-支付时间',
|
||||
`payment_pay_number` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付方-订单号',
|
||||
`payment_user_id` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付方-用户ID',
|
||||
`payment_amount` decimal(10, 2) DEFAULT NULL COMMENT '支付方-支付金额',
|
||||
`payment_pay_time` datetime(6) DEFAULT NULL COMMENT '支付方-支付时间',
|
||||
`status` smallint(6) NOT NULL COMMENT '状态(0-待对账,1-对账异常,2-对账正常)',
|
||||
`remark` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||||
`tenant_id` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = '支付平台对账明细表'
|
||||
AUTO_INCREMENT=1
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
COLLATE='utf8mb4_general_ci'
|
||||
ROW_FORMAT=DYNAMIC;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `xhpc_tradebill_internet_check_record`
|
||||
(
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`create_time` datetime(6) NOT NULL COMMENT '创建时间',
|
||||
`create_by` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人',
|
||||
`update_time` datetime(6) NOT NULL COMMENT '更新时间',
|
||||
`update_by` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '更新人',
|
||||
`upload_id` int(11) NOT NULL COMMENT '文件上传ID',
|
||||
`history_order_no` bigint(20) DEFAULT NULL COMMENT '历史订单ID',
|
||||
`user_id` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户ID',
|
||||
`internet_name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '流量方',
|
||||
`platform_internet_serial_number` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-第三方订单号',
|
||||
`platform_serial_number` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-订单号',
|
||||
`platform_charge_station` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-场站名称',
|
||||
`platform_start_soc` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-开始SOC',
|
||||
`platform_end_soc` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-结束SOC',
|
||||
`platform_charging_degree` decimal(10, 2) DEFAULT NULL COMMENT '平台-充电电量',
|
||||
`platform_charging_time` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '平台-充电时长',
|
||||
`platform_start_time` datetime(6) DEFAULT NULL COMMENT '平台-开始充电时间',
|
||||
`platform_end_time` datetime(6) DEFAULT NULL COMMENT '平台-结束充电时间',
|
||||
`platform_order_amount` decimal(10, 2) DEFAULT NULL COMMENT '平台-订单总金额',
|
||||
`platform_power_amount` decimal(10, 2) DEFAULT NULL COMMENT '平台-电费',
|
||||
`platform_server_amount` decimal(10, 2) DEFAULT NULL COMMENT '平台-服务费',
|
||||
`platform_discount_amount` decimal(10, 2) DEFAULT NULL COMMENT '平台-折扣金额',
|
||||
`platform_pay_amount` decimal(10, 2) DEFAULT NULL COMMENT '平台-支付金额',
|
||||
`internet_serial_number` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '流量方-订单号',
|
||||
`internet_charge_station` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '流量方-场站名称',
|
||||
`internet_start_soc` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '流量方-开始SOC',
|
||||
`internet_end_soc` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '流量方-结束SOC',
|
||||
`internet_charging_degree` decimal(10, 2) DEFAULT NULL COMMENT '流量方-充电电量',
|
||||
`internet_charging_time` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '流量方-充电时长(单位:分钟)',
|
||||
`internet_start_time` datetime(6) DEFAULT NULL COMMENT '流量方-开始充电时间',
|
||||
`internet_end_time` datetime(6) DEFAULT NULL COMMENT '流量方-结束充电时间',
|
||||
`internet_order_amount` decimal(10, 2) DEFAULT NULL COMMENT '流量方-订单总金额',
|
||||
`internet_power_amount` decimal(10, 2) DEFAULT NULL COMMENT '流量方-电费',
|
||||
`internet_server_amount` decimal(10, 2) DEFAULT NULL COMMENT '流量方-服务费',
|
||||
`internet_discount_amount` decimal(10, 2) DEFAULT NULL COMMENT '流量方-折扣费',
|
||||
`internet_pay_amount` decimal(10, 2) DEFAULT NULL COMMENT '流量方-支付金额',
|
||||
`remark` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
|
||||
`status` smallint(6) NOT NULL COMMENT '状态(0-待对账,1-对账异常,2-对账正常)',
|
||||
`tenant_id` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT '000000' COMMENT '租户id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = '流量方对账明细表'
|
||||
AUTO_INCREMENT=1
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
COLLATE='utf8mb4_general_ci'
|
||||
ROW_FORMAT=DYNAMIC;
|
||||
|
||||
|
||||
CREATE TABLE `xhpc_device_message`
|
||||
(
|
||||
`device_message_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息id',
|
||||
`type` varchar(50) DEFAULT NULL COMMENT '设备类型(PILE-充电桩,TERMINAL-终端)',
|
||||
`serial_number` varchar(32) DEFAULT NULL COMMENT '设备流水号',
|
||||
`content` text CHARACTER SET utf8 COMMENT '报文16进制原文',
|
||||
`reply_content` text COMMENT '回复的报文',
|
||||
`status` int(10) DEFAULT '0' COMMENT '状态(0正常 1停用)',
|
||||
`create_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者',
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`update_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '更新者',
|
||||
`remark` text CHARACTER SET utf8 COMMENT '备注',
|
||||
`tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户id',
|
||||
PRIMARY KEY (`device_message_id`) USING BTREE
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = '设备运行信息表'
|
||||
AUTO_INCREMENT=1
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
COLLATE='utf8mb4_general_ci'
|
||||
ROW_FORMAT=DYNAMIC;
|
||||
|
||||
|
||||
ALTER TABLE `et_auth_sec_token`
|
||||
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||
ALTER TABLE `et_charge_order_info`
|
||||
@ -281,3 +431,47 @@ ALTER TABLE `xhpc_vin_blacklist`
|
||||
|
||||
ALTER TABLE `xhpc_user_account_statement`
|
||||
ADD COLUMN `source` INT(4) NULL DEFAULT '0' COMMENT '订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)' AFTER `tenant_id`;
|
||||
|
||||
ALTER TABLE `xhpc_app_user`
|
||||
ADD COLUMN `soc_protect` INT(4) NULL DEFAULT '0' COMMENT '是否开启电池保护 0 未开启 1开启' AFTER `tenant_id`;
|
||||
ALTER TABLE `xhpc_community_personnel`
|
||||
ADD COLUMN `soc_protect` INT(4) NULL DEFAULT '0' COMMENT '是否开启电池保护 0 未开启 1开启' AFTER `tenant_id`;
|
||||
ALTER TABLE `xhpc_customers_personnel`
|
||||
ADD COLUMN `soc_protect` INT(4) NULL DEFAULT '0' COMMENT '是否开启电池保护 0 未开启 1开启' AFTER `tenant_id`;
|
||||
|
||||
ALTER TABLE `xhpc_setting_config`
|
||||
CHANGE COLUMN `zhb_server_url` `zhb_server_url` VARCHAR(255) NULL DEFAULT NULL COMMENT '支付宝网管' COLLATE 'utf8mb4_general_ci' AFTER `zfb_alipay_root_cert`;
|
||||
|
||||
CREATE TABLE `xhpc_setting_config` (
|
||||
`setting_config_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
`wx_app_id` VARCHAR(50) NULL DEFAULT NULL COMMENT '微信小程序id' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_app_secret` VARCHAR(50) NULL DEFAULT NULL COMMENT '微信小程序密钥' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_mch_id` VARCHAR(20) NULL DEFAULT NULL COMMENT '微信商户id' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_mch_key` VARCHAR(50) NULL DEFAULT NULL COMMENT '微信商户平台Key' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_payment_url` VARCHAR(255) NULL DEFAULT NULL COMMENT '微信小程序支付地址' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_callback_url` VARCHAR(255) NULL DEFAULT NULL COMMENT '微信回调地址' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_transfers_url` VARCHAR(255) NULL DEFAULT NULL COMMENT '向微信用户个人付款地址' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_apiclient_cert_pem` VARCHAR(255) NULL DEFAULT NULL COMMENT '微信证书' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_apiclient_key_pem` VARCHAR(255) NULL DEFAULT NULL COMMENT '微信证书' COLLATE 'utf8mb4_general_ci',
|
||||
`wx_app_cert_public_key` VARCHAR(255) NULL DEFAULT NULL COMMENT '微信证书' COLLATE 'utf8mb4_general_ci',
|
||||
`zfb_app_id` VARCHAR(50) NULL DEFAULT NULL COMMENT '支付宝appid' COLLATE 'utf8mb4_general_ci',
|
||||
`zfb_private_key` VARCHAR(500) NULL DEFAULT NULL COMMENT '支付宝应用私钥' COLLATE 'utf8mb4_general_ci',
|
||||
`zfb_callback_url` VARCHAR(255) NULL DEFAULT NULL COMMENT '支付宝回调地址' COLLATE 'utf8mb4_general_ci',
|
||||
`zfb_app_cert_public_key` VARCHAR(255) NULL DEFAULT NULL COMMENT '支付宝应用公钥证书路径' COLLATE 'utf8mb4_general_ci',
|
||||
`zfb_alipay_cert_public_key_rsa` VARCHAR(255) NULL DEFAULT NULL COMMENT '支付宝公钥证书路径' COLLATE 'utf8mb4_general_ci',
|
||||
`zfb_alipay_root_cert` VARCHAR(255) NULL DEFAULT NULL COMMENT '支付宝根证书路径' COLLATE 'utf8mb4_general_ci',
|
||||
`zhb_server_url` VARCHAR(255) NULL DEFAULT NULL COMMENT '支付宝网管' COLLATE 'utf8mb4_general_ci',
|
||||
`status` INT(4) NULL DEFAULT '0' COMMENT '1微信 2支付宝',
|
||||
`del_flag` INT(1) NULL DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
|
||||
`create_by` VARCHAR(64) NULL DEFAULT '' COMMENT '创建者' COLLATE 'utf8mb4_general_ci',
|
||||
`create_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` VARCHAR(64) NULL DEFAULT '' COMMENT '更新者' COLLATE 'utf8mb4_general_ci',
|
||||
`update_time` DATETIME NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注' COLLATE 'utf8mb4_general_ci',
|
||||
`tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id' COLLATE 'utf8mb4_general_ci',
|
||||
PRIMARY KEY (`setting_config_id`) USING BTREE
|
||||
)
|
||||
COLLATE='utf8mb4_general_ci'
|
||||
ENGINE=InnoDB
|
||||
AUTO_INCREMENT=3
|
||||
;
|
||||
|
||||
@ -0,0 +1,160 @@
|
||||
package com.xhpc.charging.station;
|
||||
|
||||
|
||||
import com.xhpc.common.core.constant.CacheConstants;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* TODO AO切面,插入创建人,创建时间,修改人,修改时间
|
||||
* @author fjd
|
||||
* @date 2020-07-09 11:59
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@Configuration
|
||||
public class DaoAspect {
|
||||
|
||||
private static final String CREATE_USER = "createBy";
|
||||
private static final String CREATE_TIME = "createTime";
|
||||
private static final String UPDATE_USER = "updateBy";
|
||||
private static final String UPDATE_TIME = "updateTime";
|
||||
private static final String TENANT_ID = "tenantId";
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.update*(..))")
|
||||
public void daoUpdate() {
|
||||
|
||||
}
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.insert*(..))")
|
||||
public void daoCreate() {
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Around("daoUpdate()")
|
||||
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
|
||||
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes == null) {
|
||||
return point.proceed();
|
||||
}
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
try {
|
||||
String token = request.getHeader(CacheConstants.HEADER);
|
||||
token = token.substring(7);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
try {
|
||||
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String userName = "";
|
||||
try {
|
||||
userName = SecurityUtils.getUsername();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = loginUser.getUsername();
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = "admin";
|
||||
}
|
||||
if (userName != null) {
|
||||
Object[] objects = point.getArgs();
|
||||
if (objects != null && objects.length > 0) {
|
||||
for (Object arg : objects) {
|
||||
if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_USER, userName);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Object object = point.proceed();
|
||||
return object;
|
||||
|
||||
}
|
||||
|
||||
@Around("daoCreate()")
|
||||
public Object doAroundCreate(ProceedingJoinPoint point) throws Throwable {
|
||||
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes == null) {
|
||||
return point.proceed();
|
||||
}
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
try {
|
||||
Object[] objects = point.getArgs();
|
||||
if (objects != null && objects.length > 0) {
|
||||
for (Object arg : objects) {
|
||||
String token = request.getHeader(CacheConstants.HEADER);
|
||||
token = token.substring(7);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
try {
|
||||
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String userName = "";
|
||||
try {
|
||||
userName = SecurityUtils.getUsername();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = loginUser.getUsername();
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = "admin";
|
||||
}
|
||||
Date date = new Date();
|
||||
if (isProperty(arg, CREATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_USER))) {
|
||||
BeanUtils.setProperty(arg, CREATE_USER, userName);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_USER, userName);
|
||||
}
|
||||
|
||||
if (isProperty(arg, CREATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, CREATE_TIME, date);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, date);
|
||||
}
|
||||
|
||||
if (isProperty(arg, TENANT_ID) && StringUtils.isEmpty(BeanUtils.getProperty(arg, TENANT_ID))) {
|
||||
BeanUtils.setProperty(arg, TENANT_ID, loginUser.getTenantId());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Object object = point.proceed();
|
||||
return object;
|
||||
}
|
||||
|
||||
public static boolean isProperty(Object bean, String field) {
|
||||
|
||||
return StringUtils.isProperty(bean, field);
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,7 +19,7 @@ import com.xhpc.common.domain.XhpcChargingPile;
|
||||
import com.xhpc.common.domain.XhpcChargingStation;
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import com.xhpc.common.enums.ConnectorTypeEnum;
|
||||
import com.xhpc.common.enums.EquipmentTypeEnum;
|
||||
import com.xhpc.common.enums.PileEquipmentTypeEnum;
|
||||
import com.xhpc.common.enums.PowerTypeEnum;
|
||||
import com.xhpc.common.util.LogUserUtils;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
@ -371,7 +371,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
|
||||
|
||||
pile.setType(PowerTypeEnum.getCodeByName(pile.getTypeName()));
|
||||
pile.setConnectorType(ConnectorTypeEnum.getCodeByName(pile.getConnectorTypeName()));
|
||||
pile.setEquipmentType(EquipmentTypeEnum.getCodeByName(pile.getEquipmentTypeName()));
|
||||
pile.setEquipmentType(PileEquipmentTypeEnum.getCodeByName(pile.getEquipmentTypeName()));
|
||||
|
||||
XhpcChargingStation station = xhpcChargingStationService.selectXhpcChargingStationByName(pile.getChargingStationName());
|
||||
if(station == null){
|
||||
|
||||
@ -846,7 +846,8 @@
|
||||
|
||||
select IF(SUM(total_power) IS NULL, 0, SUM(total_power)) as chargingDegreeSum,
|
||||
COUNT(history_order_id) as realTimeOrderIdCount,
|
||||
COUNT(DISTINCT user_id) as userIdCount
|
||||
((SELECT count(user_id) from xhpc_history_order where charging_station_id =#{chargingStationId} and create_time >= #{createTime} and source=1 ) +
|
||||
(SELECT count(DISTINCT user_id) from xhpc_history_order where charging_station_id =#{chargingStationId} and create_time >= #{createTime} and source!=1 )) as userIdCount
|
||||
from xhpc_history_order
|
||||
where charging_station_id =#{chargingStationId} and create_time >= #{createTime}
|
||||
</select>
|
||||
|
||||
@ -7,6 +7,8 @@ import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/12/29 10:23
|
||||
@ -21,4 +23,21 @@ public interface UserTypeService {
|
||||
*/
|
||||
@GetMapping("/common/getUser")
|
||||
R getUser(@RequestParam(value = "phone")String phone,@RequestParam(value = "userId")Long userId,@RequestParam(value = "userType")Integer userType,@RequestParam(value = "serialNumber")String serialNumber,@RequestParam(value = "tenantId")String tenantId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户类型,用户id,充值记录,增加流水
|
||||
* @param money 充值金额
|
||||
* @param userId 充值用户
|
||||
* @param userType 用户类型
|
||||
* @param tenantId 租户id
|
||||
* @param type 充值渠道(1微信 2支付宝 3平台)
|
||||
* @param status 1 充值 2退款
|
||||
* @param remark 备注
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/common/insertUserBalance")
|
||||
R insertUserBalance(@RequestParam(value = "money")BigDecimal money, @RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId, @RequestParam(value = "type")Integer type, @RequestParam(value = "status")Integer status, @RequestParam(value = "remark")String remark,@RequestParam(value = "moneyOrderId")Long moneyOrderId);
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/12/29 10:27
|
||||
@ -23,6 +25,11 @@ public class UserTypeFallbackFactory implements FallbackFactory<UserTypeService>
|
||||
public R getUser(String phone, Long userId, Integer userType,String serialNumber,String tenantId) {
|
||||
return R.fail("用户信息获取失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R insertUserBalance(BigDecimal money,Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId) {
|
||||
return R.fail("添加用户金额信息失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.xhpc.payment.domain;
|
||||
package com.xhpc.common.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.xhpc.payment.domain;
|
||||
package com.xhpc.common.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
|
||||
@ -4,7 +4,7 @@ package com.xhpc.common.enums;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
public enum EquipmentTypeEnum {
|
||||
public enum PileEquipmentTypeEnum {
|
||||
|
||||
DC(1, "直流设备"),
|
||||
AC(2, "交流设备"),
|
||||
@ -16,14 +16,14 @@ public enum EquipmentTypeEnum {
|
||||
private final int code;
|
||||
private final String name;
|
||||
|
||||
EquipmentTypeEnum(int code, String name){
|
||||
PileEquipmentTypeEnum(int code, String name){
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//根据code获取name
|
||||
public static String getNameByCode(int code) {
|
||||
for (EquipmentTypeEnum typeEnum : EquipmentTypeEnum.values()) {
|
||||
for (PileEquipmentTypeEnum typeEnum : PileEquipmentTypeEnum.values()) {
|
||||
//移除交办
|
||||
if (typeEnum.code == code) {
|
||||
return typeEnum.name;
|
||||
@ -34,7 +34,7 @@ public enum EquipmentTypeEnum {
|
||||
|
||||
//根据code获取name
|
||||
public static Integer getCodeByName(String name) {
|
||||
for (EquipmentTypeEnum typeEnum : EquipmentTypeEnum.values()) {
|
||||
for (PileEquipmentTypeEnum typeEnum : PileEquipmentTypeEnum.values()) {
|
||||
//移除交办
|
||||
if (typeEnum.name.equals(name)) {
|
||||
return typeEnum.code;
|
||||
@ -0,0 +1,52 @@
|
||||
package com.xhpc.common.enums;
|
||||
|
||||
public enum StationDeviceEnum {
|
||||
|
||||
STATION("STATION", "充电站"),
|
||||
PILE("PILE", "充电桩"),
|
||||
TERMINAL("TERMINAL", "充电终端"),
|
||||
BARRIER("BARRIER", "道闸"),
|
||||
GROUND_LOCK("GROUND_LOCK", "地锁")
|
||||
;
|
||||
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
StationDeviceEnum(String code, String name){
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//根据code获取name
|
||||
public static String getNameByCode(String code) {
|
||||
for (StationDeviceEnum typeEnum : StationDeviceEnum.values()) {
|
||||
//移除交办
|
||||
if (typeEnum.code.equals(code)) {
|
||||
return typeEnum.name;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//根据name获取code
|
||||
public static String getCodeByName(String name) {
|
||||
for (StationDeviceEnum typeEnum : StationDeviceEnum.values()) {
|
||||
//移除交办
|
||||
if (typeEnum.name.equals(name)) {
|
||||
return typeEnum.code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@ -26,4 +26,51 @@ public class UserTypeUtil {
|
||||
//重新登录
|
||||
public static final Integer LOGIN_TYPE = 1999;
|
||||
|
||||
|
||||
/**
|
||||
* 微信操作渠道
|
||||
*/
|
||||
public static final Integer OPERATION_WX_TYPE = 1;
|
||||
|
||||
/**
|
||||
* 支付宝操作渠道
|
||||
*/
|
||||
public static final Integer OPERATION_ALI_PAY_TYPE = 2;
|
||||
|
||||
/**
|
||||
* 用户增加余额
|
||||
*/
|
||||
public static final Integer INSERT_BALANCE = 1;
|
||||
/**
|
||||
* 用户减少余额
|
||||
*/
|
||||
public static final Integer UPDATE_BALANCE = 2;
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
*/
|
||||
public static final Integer RECHARGE_WX = 1;
|
||||
/**
|
||||
* 支付宝支付
|
||||
*/
|
||||
public static final Integer RECHARGE_ZHB = 2;
|
||||
/**
|
||||
* 平台支付
|
||||
*/
|
||||
public static final Integer RECHARGE_PT = 3;
|
||||
|
||||
/**
|
||||
* 支付状态-待支付
|
||||
*/
|
||||
public static final Integer RECHARGE_STATUS_ZERO= 0;
|
||||
/**
|
||||
* 支付状态-充值成功
|
||||
*/
|
||||
public static final Integer RECHARGE_STATUS_ONE = 1;
|
||||
/**
|
||||
* 支付状态-充值失败
|
||||
*/
|
||||
public static final Integer RECHARGE_STATUS_TWO = 2;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,160 @@
|
||||
package com.xhpc.general;
|
||||
|
||||
|
||||
import com.xhpc.common.core.constant.CacheConstants;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* TODO AO切面,插入创建人,创建时间,修改人,修改时间
|
||||
* @author fjd
|
||||
* @date 2020-07-09 11:59
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@Configuration
|
||||
public class DaoAspect {
|
||||
|
||||
private static final String CREATE_USER = "createBy";
|
||||
private static final String CREATE_TIME = "createTime";
|
||||
private static final String UPDATE_USER = "updateBy";
|
||||
private static final String UPDATE_TIME = "updateTime";
|
||||
private static final String TENANT_ID = "tenantId";
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.update*(..))")
|
||||
public void daoUpdate() {
|
||||
|
||||
}
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.insert*(..))")
|
||||
public void daoCreate() {
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Around("daoUpdate()")
|
||||
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
|
||||
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes == null) {
|
||||
return point.proceed();
|
||||
}
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
try {
|
||||
String token = request.getHeader(CacheConstants.HEADER);
|
||||
token = token.substring(7);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
try {
|
||||
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String userName = "";
|
||||
try {
|
||||
userName = SecurityUtils.getUsername();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = loginUser.getUsername();
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = "admin";
|
||||
}
|
||||
if (userName != null) {
|
||||
Object[] objects = point.getArgs();
|
||||
if (objects != null && objects.length > 0) {
|
||||
for (Object arg : objects) {
|
||||
if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_USER, userName);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Object object = point.proceed();
|
||||
return object;
|
||||
|
||||
}
|
||||
|
||||
@Around("daoCreate()")
|
||||
public Object doAroundCreate(ProceedingJoinPoint point) throws Throwable {
|
||||
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes == null) {
|
||||
return point.proceed();
|
||||
}
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
try {
|
||||
Object[] objects = point.getArgs();
|
||||
if (objects != null && objects.length > 0) {
|
||||
for (Object arg : objects) {
|
||||
String token = request.getHeader(CacheConstants.HEADER);
|
||||
token = token.substring(7);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
try {
|
||||
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String userName = "";
|
||||
try {
|
||||
userName = SecurityUtils.getUsername();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = loginUser.getUsername();
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = "admin";
|
||||
}
|
||||
Date date = new Date();
|
||||
if (isProperty(arg, CREATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_USER))) {
|
||||
BeanUtils.setProperty(arg, CREATE_USER, userName);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_USER, userName);
|
||||
}
|
||||
|
||||
if (isProperty(arg, CREATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, CREATE_TIME, date);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, date);
|
||||
}
|
||||
|
||||
if (isProperty(arg, TENANT_ID) && StringUtils.isEmpty(BeanUtils.getProperty(arg, TENANT_ID))) {
|
||||
BeanUtils.setProperty(arg, TENANT_ID, loginUser.getTenantId());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Object object = point.proceed();
|
||||
return object;
|
||||
}
|
||||
|
||||
public static boolean isProperty(Object bean, String field) {
|
||||
|
||||
return StringUtils.isProperty(bean, field);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
package com.xhpc.invoice.aspect;
|
||||
|
||||
|
||||
import com.xhpc.common.core.constant.CacheConstants;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* TODO AO切面,插入创建人,创建时间,修改人,修改时间
|
||||
* @author fjd
|
||||
* @date 2020-07-09 11:59
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@Configuration
|
||||
public class DaoAspect {
|
||||
|
||||
private static final String CREATE_USER = "createBy";
|
||||
private static final String CREATE_TIME = "createTime";
|
||||
private static final String UPDATE_USER = "updateBy";
|
||||
private static final String UPDATE_TIME = "updateTime";
|
||||
private static final String TENANT_ID = "tenantId";
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.update*(..))")
|
||||
public void daoUpdate() {
|
||||
|
||||
}
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.insert*(..))")
|
||||
public void daoCreate() {
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Around("daoUpdate()")
|
||||
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
|
||||
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes == null) {
|
||||
return point.proceed();
|
||||
}
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
try {
|
||||
String token = request.getHeader(CacheConstants.HEADER);
|
||||
token = token.substring(7);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
try {
|
||||
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String userName = "";
|
||||
try {
|
||||
userName = SecurityUtils.getUsername();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = loginUser.getUsername();
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = "admin";
|
||||
}
|
||||
if (userName != null) {
|
||||
Object[] objects = point.getArgs();
|
||||
if (objects != null && objects.length > 0) {
|
||||
for (Object arg : objects) {
|
||||
if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_USER, userName);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Object object = point.proceed();
|
||||
return object;
|
||||
|
||||
}
|
||||
|
||||
@Around("daoCreate()")
|
||||
public Object doAroundCreate(ProceedingJoinPoint point) throws Throwable {
|
||||
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes == null) {
|
||||
return point.proceed();
|
||||
}
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
try {
|
||||
Object[] objects = point.getArgs();
|
||||
if (objects != null && objects.length > 0) {
|
||||
for (Object arg : objects) {
|
||||
String token = request.getHeader(CacheConstants.HEADER);
|
||||
token = token.substring(7);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
try {
|
||||
loginUser = redisService.getCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
String userName = "";
|
||||
try {
|
||||
userName = SecurityUtils.getUsername();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = loginUser.getUsername();
|
||||
}
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
userName = "admin";
|
||||
}
|
||||
Date date = new Date();
|
||||
if (isProperty(arg, CREATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_USER))) {
|
||||
BeanUtils.setProperty(arg, CREATE_USER, userName);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_USER) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_USER))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_USER, userName);
|
||||
}
|
||||
|
||||
if (isProperty(arg, CREATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, CREATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, CREATE_TIME, date);
|
||||
}
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, date);
|
||||
}
|
||||
|
||||
if (isProperty(arg, TENANT_ID) && StringUtils.isEmpty(BeanUtils.getProperty(arg, TENANT_ID))) {
|
||||
BeanUtils.setProperty(arg, TENANT_ID, loginUser.getTenantId());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Object object = point.proceed();
|
||||
return object;
|
||||
}
|
||||
|
||||
public static boolean isProperty(Object bean, String field) {
|
||||
|
||||
return StringUtils.isProperty(bean, field);
|
||||
}
|
||||
|
||||
}
|
||||
@ -159,6 +159,8 @@ public class XhpcInvoice implements Serializable {
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
private String tenantId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@
|
||||
creator_id, creator_type, creator,
|
||||
create_time, `status`, invoicing_time,
|
||||
drawer, finance_notes, electric_invoice_url,
|
||||
updator, update_time, del_flag)
|
||||
updator, update_time, del_flag, tenant_id)
|
||||
values (#{receiveEmail,jdbcType=VARCHAR}, #{titleType,jdbcType=INTEGER}, #{titleContent,jdbcType=VARCHAR},
|
||||
#{dutyNumber,jdbcType=VARCHAR}, #{invoiceContent,jdbcType=VARCHAR}, #{invoiceMoney,jdbcType=DECIMAL},
|
||||
#{invoiceOrderEletricTotalMoney,jdbcType=DECIMAL}, #{invoiceOrderServiceTotalMoney,jdbcType=DECIMAL},
|
||||
@ -270,7 +270,8 @@
|
||||
#{creatorId,jdbcType=BIGINT}, #{creatorType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{invoicingTime,jdbcType=TIMESTAMP},
|
||||
#{drawer,jdbcType=VARCHAR}, #{financeNotes,jdbcType=VARCHAR}, #{electricInvoiceUrl,jdbcType=VARCHAR},
|
||||
#{updator,jdbcType=BIGINT}, #{updateTime,jdbcType=DATE}, #{delFlag,jdbcType=INTEGER})
|
||||
#{updator,jdbcType=BIGINT}, #{updateTime,jdbcType=DATE}, #{delFlag,jdbcType=INTEGER},
|
||||
#{tenantId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="invoice_id" keyProperty="invoiceId"
|
||||
parameterType="com.xhpc.invoice.pojo.XhpcInvoice" useGeneratedKeys="true">
|
||||
@ -354,6 +355,9 @@
|
||||
<if test="delFlag != null">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="receiveEmail != null">
|
||||
@ -434,6 +438,9 @@
|
||||
<if test="delFlag != null">
|
||||
#{delFlag,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertSelectiveAndReturnId" parameterType="com.xhpc.invoice.pojo.XhpcInvoice"
|
||||
@ -518,6 +525,9 @@
|
||||
<if test="delFlag != null">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="receiveEmail != null">
|
||||
@ -598,6 +608,9 @@
|
||||
<if test="delFlag != null">
|
||||
#{delFlag,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.invoice.pojo.XhpcInvoice">
|
||||
@ -749,4 +762,4 @@
|
||||
WHERE invoice_id = #{invoiceId};
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
35
xhpc-modules/xhpc-log/.gitignore
vendored
Normal file
35
xhpc-modules/xhpc-log/.gitignore
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
HELP.md
|
||||
target/
|
||||
.mvn/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
132
xhpc-modules/xhpc-log/pom.xml
Normal file
132
xhpc-modules/xhpc-log/pom.xml
Normal file
@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>xhpc-modules</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xhpc-log</artifactId>
|
||||
|
||||
<description>
|
||||
日志服务
|
||||
</description>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common Core -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>xhpc-common</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.10.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.10.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xhpc.log;
|
||||
|
||||
import com.xhpc.common.security.annotation.EnableCustomConfig;
|
||||
import com.xhpc.common.security.annotation.EnableRyFeignClients;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
|
||||
@EnableCustomConfig
|
||||
@SpringBootApplication
|
||||
@EnableRyFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@MapperScan("com.xhpc.log.mapper")
|
||||
public class XhpcLogApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(XhpcLogApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.xhpc.log.controller;
|
||||
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.log.service.OrderLogService;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 订单报文日志
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/log/order/")
|
||||
public class OrderLogController extends BaseController {
|
||||
|
||||
@Resource
|
||||
OrderLogService orderLogService;
|
||||
|
||||
@GetMapping("/getPage")
|
||||
public TableDataInfo getOrderPage(@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) Integer number){
|
||||
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("operatorId", SecurityUtils.getUserId());
|
||||
params.put("number", number);
|
||||
params.put("tenantId", tenantId);
|
||||
return getDataTable(orderLogService.getOrderPage(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{orderId}")
|
||||
public TableDataInfo getOrderDetailPage(@PathVariable("orderId") String orderId){
|
||||
startPage();
|
||||
return getDataTable(orderLogService.getOrderDetailPage(orderId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export")
|
||||
public void export(HttpServletResponse response,
|
||||
@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) Integer number,
|
||||
@RequestParam(required = false) String serialNumber) throws Exception {
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("operatorId", SecurityUtils.getUserId());
|
||||
params.put("number", number);
|
||||
params.put("serialNumber", serialNumber);
|
||||
params.put("tenantId", tenantId);
|
||||
orderLogService.export(response, params);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.xhpc.log.controller;
|
||||
|
||||
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.log.service.PileLogService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 桩运行日志
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/log/pile")
|
||||
public class PileLogController extends BaseController {
|
||||
|
||||
@Resource
|
||||
PileLogService pileLogService;
|
||||
|
||||
|
||||
@GetMapping("/getPage")
|
||||
public TableDataInfo getPilePage(@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) Integer number) {
|
||||
startPage();
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("operatorId", SecurityUtils.getUserId());
|
||||
params.put("number", number);
|
||||
params.put("tenantId", tenantId);
|
||||
return getDataTable(pileLogService.getPilePage(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{pileId}")
|
||||
public TableDataInfo getPileDetailPage(@PathVariable("pileId") String pileId) {
|
||||
startPage();
|
||||
return getDataTable(pileLogService.getPileRunLogPage(pileId));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
public void export(HttpServletResponse response,
|
||||
@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) Integer number,
|
||||
@RequestParam(required = false) String serialNumber) throws Exception {
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("operatorId", SecurityUtils.getUserId());
|
||||
params.put("number", number);
|
||||
params.put("type", StationDeviceEnum.PILE.getCode());
|
||||
params.put("serialNumber", serialNumber);
|
||||
params.put("tenantId", tenantId);
|
||||
pileLogService.export(response, params);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.xhpc.log.controller;
|
||||
|
||||
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.log.service.StationLogService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/log/station")
|
||||
public class StationLogController extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
StationLogService stationLogService;
|
||||
|
||||
@GetMapping("/getPage")
|
||||
public TableDataInfo getPilePage(@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) Integer number) {
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("operatorId", SecurityUtils.getUserId());
|
||||
params.put("number", number);
|
||||
params.put("tenantId", tenantId);
|
||||
return getDataTable(stationLogService.getStationPage(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{stationId}")
|
||||
public TableDataInfo getPileDetailPage(@PathVariable("stationId") Long stationId) {
|
||||
startPage();
|
||||
return getDataTable(stationLogService.getStationRatePage(stationId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/rate/{rateId}")
|
||||
public AjaxResult getRateInfo(@PathVariable("rateId") Integer rateId) {
|
||||
return AjaxResult.success(stationLogService.getRateInfo(rateId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.xhpc.log.controller;
|
||||
|
||||
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.log.service.SystemLogService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 系统操作日志
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/log/system")
|
||||
public class SystemLogController extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
SystemLogService systemLogService;
|
||||
|
||||
|
||||
@GetMapping("/oper/getPage")
|
||||
public TableDataInfo getPage(@RequestParam(required = false) String tenantId,
|
||||
@RequestParam(required = false) Integer number){
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("operName", SecurityUtils.getUsername());
|
||||
params.put("tenantId", tenantId);
|
||||
return getDataTable(systemLogService.getPage(params));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,170 @@
|
||||
package com.xhpc.log.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
@Table(name="xhpc_charge_order")
|
||||
public class XhpcChargeOrderDomain implements Serializable {
|
||||
/**
|
||||
* 充电订单id
|
||||
*/
|
||||
private Long chargeOrderId;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
private Long chargingStationId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 终端id
|
||||
*/
|
||||
private Long terminalId;
|
||||
|
||||
/**
|
||||
* 互联网流水订单号
|
||||
*/
|
||||
private String internetSerialNumber;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 充电启始soc
|
||||
*/
|
||||
private String startSoc;
|
||||
|
||||
/**
|
||||
* 结束soc
|
||||
*/
|
||||
private String endSoc;
|
||||
|
||||
/**
|
||||
* 订单来源(0C端用户 1流量用户)
|
||||
*/
|
||||
private Integer source;
|
||||
|
||||
/**
|
||||
* 状态(-1准备充电 0开始充电 1自动结算,2异常,3平台结算)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 1代表删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 费率模型id
|
||||
*/
|
||||
private Long rateModelId;
|
||||
|
||||
/**
|
||||
* 充电方式
|
||||
*/
|
||||
private String chargingMode;
|
||||
|
||||
/**
|
||||
* 开始充电时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束充电时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 充电时长
|
||||
*/
|
||||
private String chargingTime;
|
||||
|
||||
/**
|
||||
* 充电度数
|
||||
*/
|
||||
private BigDecimal chargingDegree;
|
||||
|
||||
/**
|
||||
* 协议定,停止方式
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 异常备注
|
||||
*/
|
||||
private String erroRemark;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
private BigDecimal amountCharged;
|
||||
|
||||
/**
|
||||
* 功率
|
||||
*/
|
||||
private String power;
|
||||
|
||||
/**
|
||||
* 充电时长(秒)
|
||||
*/
|
||||
private Long chargingTimeNumber;
|
||||
|
||||
/**
|
||||
* 司机唯一标识(手机号)
|
||||
*/
|
||||
private String driverId;
|
||||
|
||||
/**
|
||||
* 充电金额
|
||||
*/
|
||||
private Integer chargingAmt;
|
||||
|
||||
/**
|
||||
* 车牌
|
||||
*/
|
||||
private String plateNum;
|
||||
|
||||
/**
|
||||
* 符合Evcs标准的订单号,并非来自第三方的订单号
|
||||
*/
|
||||
private String evcsOrderNo;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xhpc.log.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class XhpcDeviceMessageDomain {
|
||||
|
||||
private Long deviceMessageId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
private String content;
|
||||
|
||||
private String replyContent;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@ -0,0 +1,250 @@
|
||||
package com.xhpc.log.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* xhpc_history_order
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class XhpcHistoryOrderDomain implements Serializable {
|
||||
/**
|
||||
* 历史订单id
|
||||
*/
|
||||
private Long historyOrderId;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
private Long chargingStationId;
|
||||
|
||||
/**
|
||||
* 场站名称
|
||||
*/
|
||||
private String chargingStationName;
|
||||
|
||||
/**
|
||||
* 充电订单id
|
||||
*/
|
||||
private Long chargeOrderId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 终端id
|
||||
*/
|
||||
private Long terminalId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String serialNumber;
|
||||
|
||||
/**
|
||||
* 流量方订单号
|
||||
*/
|
||||
private String internetSerialNumber;
|
||||
|
||||
/**
|
||||
* 总电费
|
||||
*/
|
||||
private BigDecimal powerPriceTotal;
|
||||
|
||||
/**
|
||||
* 总服务费
|
||||
*/
|
||||
private BigDecimal servicePriceTotal;
|
||||
|
||||
/**
|
||||
* 订单总价
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/**
|
||||
* 电站活动抵扣--抵扣的总金额
|
||||
*/
|
||||
private BigDecimal promotionDiscount;
|
||||
|
||||
/**
|
||||
* 实际价格-用户支付的钱
|
||||
*/
|
||||
private BigDecimal actPrice;
|
||||
|
||||
/**
|
||||
* 实收电费-运营商电费
|
||||
*/
|
||||
private BigDecimal actPowerPrice;
|
||||
|
||||
/**
|
||||
* 实收服务费-运营商服务费
|
||||
*/
|
||||
private BigDecimal actServicePrice;
|
||||
|
||||
/**
|
||||
* 流量方总金额抽成
|
||||
*/
|
||||
private BigDecimal internetCommission;
|
||||
|
||||
/**
|
||||
* 流量方服务费抽成
|
||||
*/
|
||||
private BigDecimal internetSvcCommission;
|
||||
|
||||
/**
|
||||
* 平台总金额抽成
|
||||
*/
|
||||
private BigDecimal platformCommission;
|
||||
|
||||
/**
|
||||
* 平台服务费抽成
|
||||
*/
|
||||
private BigDecimal platformSvcCommisssion;
|
||||
|
||||
/**
|
||||
* 运维总抽成
|
||||
*/
|
||||
private BigDecimal operationCommission;
|
||||
|
||||
/**
|
||||
* 运维服务费抽成
|
||||
*/
|
||||
private BigDecimal operationSvcCommission;
|
||||
|
||||
/**
|
||||
* 开始充电soc
|
||||
*/
|
||||
private String startSoc;
|
||||
|
||||
/**
|
||||
* 结束时soc
|
||||
*/
|
||||
private String endSoc;
|
||||
|
||||
/**
|
||||
* 对账状态(0待确认 1已确认,2待提交,3待审核)
|
||||
*/
|
||||
private Integer reconciliationStatus;
|
||||
|
||||
/**
|
||||
* 清分状态(0待清分 1清分在途,2已提现,3待提交,4待审核)
|
||||
*/
|
||||
private Integer sortingStatus;
|
||||
|
||||
/**
|
||||
* 1 自动结算 2 平台结算
|
||||
*/
|
||||
private Byte type;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 0未统计 1小时统计 2 其他统计
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* VIN 码
|
||||
*/
|
||||
private String vinNormal;
|
||||
|
||||
private String searchValue;
|
||||
|
||||
/**
|
||||
* 运营商在EVCS分配的唯一OperatorID
|
||||
*/
|
||||
private String operatorIdEvcs;
|
||||
|
||||
private Integer chargeModelEvcs;
|
||||
|
||||
private Double connectorPowerEvcs;
|
||||
|
||||
private Double meterValueEndEvcs;
|
||||
|
||||
private Double meterValueStartEvcs;
|
||||
|
||||
private String operatorId3rdptyEvcs;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
private Integer stopReasonEvcs;
|
||||
|
||||
private Double totalPower;
|
||||
|
||||
private String userNameEvcs;
|
||||
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 互联网订单流水号
|
||||
*/
|
||||
private String evcsOrderNo;
|
||||
|
||||
/**
|
||||
* -1:未推送/推送失败 0:成功 1:争议交易 2~99:自定义
|
||||
*/
|
||||
private Integer confirmResult;
|
||||
|
||||
private Long rateModelId;
|
||||
|
||||
/**
|
||||
* 充电方式
|
||||
*/
|
||||
private String chargingMode;
|
||||
|
||||
/**
|
||||
* 充电度数
|
||||
*/
|
||||
private Double chargingDegree;
|
||||
|
||||
/**
|
||||
* 充电时长
|
||||
*/
|
||||
private String chargingTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.xhpc.log.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* program: ruoyi
|
||||
* User: HongYun
|
||||
* Date:2021-09-13 15
|
||||
*/
|
||||
public class XhpcMessageDomain extends BaseEntity {
|
||||
|
||||
private Long messageId;
|
||||
private String chargeOrderNo;
|
||||
private String content;
|
||||
private Integer status;
|
||||
|
||||
public Long getMessageId() {
|
||||
|
||||
return messageId;
|
||||
}
|
||||
|
||||
public void setMessageId(Long messageId) {
|
||||
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public String getChargeOrderNo() {
|
||||
|
||||
return chargeOrderNo;
|
||||
}
|
||||
|
||||
public void setChargeOrderNo(String chargeOrderNo) {
|
||||
|
||||
this.chargeOrderNo = chargeOrderNo;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 操作日志 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysOperLogMapper {
|
||||
|
||||
List<Map<String, Object>> selectUserOperLog(@Param("params") Map params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
import com.xhpc.common.domain.XhpcChargingPile;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/7/27 14:37
|
||||
*/
|
||||
public interface XhpcChargingPileMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 桩列表
|
||||
*
|
||||
*/
|
||||
List<Map<String, Object>> selectXhpcChargingPileList(@Param("params")Map params);
|
||||
|
||||
/**
|
||||
* 终端
|
||||
*
|
||||
* @param xhpcChargingPile 终端
|
||||
* @return 结果
|
||||
*/
|
||||
int addXhpcChargingPile(XhpcChargingPile xhpcChargingPile);
|
||||
|
||||
|
||||
/**
|
||||
* 查询电站
|
||||
*
|
||||
* @param chargingStationId 电站ID
|
||||
* @return 电站
|
||||
*/
|
||||
Map<String, Object> selectXhpcChargingStationById(Long chargingStationId);
|
||||
|
||||
/**
|
||||
* 查询桩
|
||||
*
|
||||
* @param chargingPileId 终端ID
|
||||
* @return 电站
|
||||
*/
|
||||
XhpcChargingPile selectXhpcChargingPileById(Long chargingPileId);
|
||||
|
||||
/**
|
||||
* 终端列表
|
||||
*
|
||||
* @param chargingPileId 桩id
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> selectXhpcTerminalList(@Param("chargingPileId") Long chargingPileId);
|
||||
|
||||
|
||||
XhpcChargingPile getXhpcChargingPileBySerialNumber(@Param("serialNumber") String serialNumber);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 电站Mapper接口
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2021-07-19
|
||||
*/
|
||||
public interface XhpcChargingStationMapper {
|
||||
|
||||
/**
|
||||
* 查询电站列表
|
||||
*
|
||||
* @return 电站集合
|
||||
*/
|
||||
List<Map<String, Object>> selectXhpcChargingStationList(@Param("params")Map params);
|
||||
|
||||
|
||||
List<Map<String, Object>> selectRateListByStationId(@Param("stationId")Long stationId);
|
||||
|
||||
|
||||
List<Map<String, Object>> selectRateTimeListByRateId(@Param("rateId")Integer rateId);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface XhpcDeviceMessageMapper {
|
||||
|
||||
List<Map<String, Object>> selectListByTypeAndSerialNumber(@Param("type") String type,
|
||||
@Param("serialNumber")String serialNumber);
|
||||
|
||||
|
||||
List<Map<String, Object>> selectListByParams(@Param("params")Map params);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface XhpcHistoryOrderMapper {
|
||||
|
||||
|
||||
List<Map<String, Object>> getOrderPage(@Param("params")Map params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xhpc.log.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface XhpcMessageMapper {
|
||||
|
||||
|
||||
List<Map<String, Object>> getOrderMessagePage(@Param("serialNumber")String serialNumber);
|
||||
|
||||
|
||||
List<Map<String, Object>> getOrderMessageByParams(@Param("params")Map params);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xhpc.log.service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface OrderLogService {
|
||||
|
||||
|
||||
List<Map<String, Object>> getOrderPage(Map<String, Object> params);
|
||||
|
||||
|
||||
List<Map<String, Object>> getOrderDetailPage(String orderId);
|
||||
|
||||
|
||||
void export(HttpServletResponse response, Map<String, Object> params) throws Exception;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xhpc.log.service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PileLogService {
|
||||
|
||||
|
||||
List<Map<String, Object>> getPilePage(Map<String, Object> params);
|
||||
|
||||
|
||||
List<Map<String, Object>> getPileRunLogPage(String pileId);
|
||||
|
||||
void export(HttpServletResponse response, Map<String, Object> params) throws Exception;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xhpc.log.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface StationLogService {
|
||||
|
||||
|
||||
List<Map<String, Object>> getStationPage(Map<String, Object> params);
|
||||
|
||||
|
||||
List<Map<String, Object>> getStationRatePage(Long stationId);
|
||||
|
||||
|
||||
List<Map<String, Object>> getRateInfo(int rateId);
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.xhpc.log.service;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface SystemLogService {
|
||||
|
||||
List<Map<String, Object>> getPage(Map<String, Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.xhpc.log.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.xhpc.log.mapper.XhpcHistoryOrderMapper;
|
||||
import com.xhpc.log.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.log.service.OrderLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class OrderLogServiceImpl implements OrderLogService {
|
||||
|
||||
@Resource
|
||||
XhpcHistoryOrderMapper historyOrderMapper;
|
||||
|
||||
@Resource
|
||||
XhpcMessageMapper messageMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getOrderPage(Map<String, Object> params){
|
||||
return historyOrderMapper.getOrderPage(params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getOrderDetailPage(String orderId){
|
||||
return messageMapper.getOrderMessagePage(orderId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void export(HttpServletResponse response, Map<String, Object> params) throws Exception{
|
||||
List<Map<String, Object>> list = messageMapper.getOrderMessageByParams(params);
|
||||
|
||||
ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||
writer.addHeaderAlias("serialNumber", "订单号");
|
||||
writer.addHeaderAlias("sourceName", "订单来源");
|
||||
writer.addHeaderAlias("chargingDegree", "充电电量");
|
||||
writer.addHeaderAlias("amountCharged", "总金额");
|
||||
writer.addHeaderAlias("chargingTime", "充电时长");
|
||||
writer.addHeaderAlias("startSOc", "充电启始soc");
|
||||
writer.addHeaderAlias("endSoc", "结束soc");
|
||||
writer.addHeaderAlias("startTime", "充电开始时间");
|
||||
writer.addHeaderAlias("endTime", "充电结束时间");
|
||||
writer.addHeaderAlias("power", "电桩功率(KW)");
|
||||
writer.addHeaderAlias("content", "充电报文");
|
||||
writer.addHeaderAlias("remark", "备注描述");
|
||||
writer.addHeaderAlias("createTime", "发送时间");
|
||||
|
||||
writer.setOnlyAlias(true);
|
||||
writer.write(list, true);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
|
||||
writer.flush(out, true);
|
||||
writer.close();
|
||||
IoUtil.close(out);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.xhpc.log.service.impl;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.log.mapper.XhpcChargingPileMapper;
|
||||
import com.xhpc.log.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.log.service.PileLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class PileLogServiceImpl implements PileLogService {
|
||||
|
||||
@Resource
|
||||
XhpcChargingPileMapper pileMapper;
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getPilePage(Map<String, Object> params){
|
||||
|
||||
return pileMapper.selectXhpcChargingPileList(params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getPileRunLogPage(String pileId){
|
||||
return deviceMessageMapper.selectListByTypeAndSerialNumber(StationDeviceEnum.PILE.getCode(), pileId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void export(HttpServletResponse response, Map<String, Object> params) throws Exception{
|
||||
List<Map<String, Object>> list = deviceMessageMapper.selectListByParams(params);
|
||||
|
||||
ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||
writer.addHeaderAlias("chargingStationName", "场站名称");
|
||||
writer.addHeaderAlias("chargingPileName", "充电桩名称");
|
||||
writer.addHeaderAlias("serialNumber", "桩编码");
|
||||
writer.addHeaderAlias("brandModel", "费率");
|
||||
writer.addHeaderAlias("pileType", "电桩类型");
|
||||
writer.addHeaderAlias("power", "电桩功率(KW)");
|
||||
writer.addHeaderAlias("content", "充电桩上传平台报文");
|
||||
writer.addHeaderAlias("replyContent", "平台回复报文");
|
||||
writer.addHeaderAlias("remark", "备注描述");
|
||||
writer.addHeaderAlias("createTime", "发送时间");
|
||||
|
||||
writer.setOnlyAlias(true);
|
||||
writer.write(list, true);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
|
||||
writer.flush(out, true);
|
||||
writer.close();
|
||||
IoUtil.close(out);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.xhpc.log.service.impl;
|
||||
|
||||
import com.xhpc.log.mapper.XhpcChargingStationMapper;
|
||||
import com.xhpc.log.service.StationLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class StationLogServiceImpl implements StationLogService {
|
||||
|
||||
@Resource
|
||||
XhpcChargingStationMapper stationMapper;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getStationPage(Map<String, Object> params){
|
||||
return stationMapper.selectXhpcChargingStationList(params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getStationRatePage(Long stationId){
|
||||
return stationMapper.selectRateListByStationId(stationId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getRateInfo(int rateId){
|
||||
return stationMapper.selectRateTimeListByRateId(rateId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xhpc.log.service.impl;
|
||||
|
||||
import com.xhpc.log.mapper.SysOperLogMapper;
|
||||
import com.xhpc.log.service.SystemLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class SystemLogServiceImpl implements SystemLogService {
|
||||
|
||||
@Resource
|
||||
SysOperLogMapper operLogMapper;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getPage(Map<String, Object> params){
|
||||
return operLogMapper.selectUserOperLog(params);
|
||||
}
|
||||
}
|
||||
9
xhpc-modules/xhpc-log/src/main/resources/banner.txt
Normal file
9
xhpc-modules/xhpc-log/src/main/resources/banner.txt
Normal file
@ -0,0 +1,9 @@
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
|
||||
,--.
|
||||
,--. ,--. | ,---. ,---. ,---.
|
||||
\ `' / | .-. | | .-. | | .--'
|
||||
/ /. \ | | | | | '-' ' \ `--.
|
||||
'--' '--' `--' `--' | |-' `---'
|
||||
`--'
|
||||
90
xhpc-modules/xhpc-log/src/main/resources/bootstrap.yml
Normal file
90
xhpc-modules/xhpc-log/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,90 @@
|
||||
|
||||
# Tomcat
|
||||
server:
|
||||
port: 8890
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: xhpc-log
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
root: info
|
||||
com.xhpc.tradebill.mapper: debug
|
||||
|
||||
file:
|
||||
path: "d:\\logs"
|
||||
|
||||
pattern:
|
||||
console: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n'
|
||||
file: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n'
|
||||
|
||||
wx:
|
||||
pay:
|
||||
appId: "wxd0a48e00319ef8a7"
|
||||
mchId: "1514355771"
|
||||
mchKey: "sichuanxianghuakejiyouxiangongsi"
|
||||
keyPath:
|
||||
|
||||
|
||||
alibaba:
|
||||
pay:
|
||||
gatewayDomain: "https://openapi.alipay.com/gateway.do"
|
||||
serverDomain: "https://www.scxhua.cn/prod-api/xhpc-payment/alipay/notifyUrl"
|
||||
publicKey:
|
||||
privateKey: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGHX1s315EKjoIBkNiF3IxCAmvtVg+TdCDL/XmJZWdcZ23tEWmmIMsLRCLUKsaPfTEhnqD6EFJnmpJu4teDImo3aDbOoO31YFEXjMXUnTTS/dtDVEo1OecsRL+Re43KSohOkIL1TMyTuNfeIglQTuhCSZ3LOEOx4OHpYwcrLp8p1ORvAS7x35nsmjLp3oQTJo9RWfzfEaKbm6cxsWLKyr5/5eGDXrUHNC5hIDLjoJbe6iqNKyIiPJHtPZfJ36PcWa7PFvx4X+Ded32KZb2AA3p9w/HX7gn1MnRfT5NGH0k3ggxLNarDU8g6JjQYgNtmE/R8gbp99BudZNfDoSF1llNAgMBAAECggEAaTa9bSoXM/bErALt3ghyx1B8+OGVpts5F5IKoVEe/PNjPfkpIzdGwONhtUnF0cKFQaAWgWE1xuGGlO2Sumevn1Cvnw1axF+1F8Om5UcE67cPFvh5kUTlpyGrutt1tMSQjpy7r7jEf1UwP3e5pzBz7TPWf2wv635OC56uOtivPJZ+8vg7VYon/mNXQuL4AavoxfSDtvo0ad30X2fK1WKeeBtgiT4UzV6ZGZh5igKQHM4lVvmbo/jOeQD0KAod7pRe/h4FBFmCVIWwgW+I+Hnzp8A/nJezoowJ3jiTt0FodC9uBCT64ZCz5dVCryD62LDVjKBxB7cfIoQA+PxCiXr9QQKBgQD+2v38J/MlfK/XCYldclzumizwIw6T0Mv6XvYwXQHYgYDKYNF6k1LhMEUo7fP3EsPdV8h/nXmdU4qadOVm6QSJ/rGEl22yGlO7woUzTY/Ls9eknoqfMYuyI1+ICMnNxmesQbWyc0cOHh44cEF+icfJxEDAmrHGLmBVsKuLUJUuVQKBgQCGt663TF7mixghiUOcT11zC1fqG+dIcvAwHpCHfdxsniYRqnv+SLf6eC5PCkQ5aNAAl/ywOLQAWS0XgYti3LyZ4iuGIYcUE0IDDmhWl68V27iXcLIK+rBRqBGxSdk8xR+zSE8fpO4mXpxn8SH0Butex8PJ+oHTbmdXIUAXdn6HGQKBgQCvAB1rqtsRoL72ADxtCHy78u5srwXxhmyqrc6LgzIjQzn2vejaLJO6wfSbmFnwDNimAwNQbgf2ekkwqphjxBozz8qB66GNrPpWccoZYmcdT48CIUO68MCmQBf3R2GbhWPnKu/ja7kc/p1tz9eJVn70E2kLWK4+EdZgwQHqlhj6SQKBgF4AmbdpYOb5s9Li1vyhHJIEHkpLQi15lkPdb/g7SK26BNJa5b5fu5DYf2fDwCtXCZ0AcN/+EQwVLbOzPzGy2R9/g+NKTdkiPvOnAAM8QH2+HaX+ix3CI3o3DnFpGF6hJieRkzR/f3Ximryks451rZMrTWEIncKMzSstFm3Izy0xAoGBAJQaMqlzpM+QaJiytJNeqRpPWRsi0Dkf4XqJXPWLOrApSISsafZF5vk2ZOeIqRsVCBH3LdfVIJxEBAF4l/Sd2q7xC9JHawJDqa4ea7VwL68ANH2w3jcJ3j6DQqf7NIe/lSGxYF6Jt+74oRFHxN3GDSf+z91DYfZz8hQnyphKDNEJ"
|
||||
appId: "2021002156615717"
|
||||
certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
|
||||
publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
|
||||
rootCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt"
|
||||
|
||||
###获取微信openid地址
|
||||
#WXGETJSCODE: "https://api.weixin.qq.com/sns/jscode2session?appid=wxb14ef93e9b7901f3&secret=b5c5672141b5930c30a1abee95a2dcbf&js_code="
|
||||
###阿里云身份证验证地址
|
||||
#VERIFYCARD: "http://idenauthen.market.alicloudapi.com/idenAuthentication"
|
||||
##阿里云身份证验证地址appcode
|
||||
#APPCODE: "APPCODE e26d9088b58e24af69411d5933cece47"
|
||||
##小程序appid
|
||||
#APPID: "wxd0a48e00319ef8a7"
|
||||
##小程序绑定商户id
|
||||
#MCHID: "1514355771"
|
||||
##商户后台设置的key
|
||||
#KEY: "sichuanxianghuakejiyouxiangongsi"
|
||||
##微信小程序支付地址
|
||||
#WXPAYUNIFIEDORDER: "https://api.mch.weixin.qq.com/pay/unifiedorder"
|
||||
##微信支付回调地址
|
||||
#SERVERDOMAIN: "http://www.scxhua.cn/prod-api/xhpc-payment/wx/paymentCallback"
|
||||
##微信小程序支付地址
|
||||
#WXTRANSFERS: "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"
|
||||
|
||||
##支付宝支付回调地址
|
||||
#ALIPAYPSERVERDOMAIN: "https://www.scxhua.cn/prod-api/xhpc-payment/alipay/notifyUrl"
|
||||
##支付宝公钥
|
||||
#ALIPAYPUBLICKEY:
|
||||
##应用私钥
|
||||
#ALIPAYPRIVATEKEY: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGHX1s315EKjoIBkNiF3IxCAmvtVg+TdCDL/XmJZWdcZ23tEWmmIMsLRCLUKsaPfTEhnqD6EFJnmpJu4teDImo3aDbOoO31YFEXjMXUnTTS/dtDVEo1OecsRL+Re43KSohOkIL1TMyTuNfeIglQTuhCSZ3LOEOx4OHpYwcrLp8p1ORvAS7x35nsmjLp3oQTJo9RWfzfEaKbm6cxsWLKyr5/5eGDXrUHNC5hIDLjoJbe6iqNKyIiPJHtPZfJ36PcWa7PFvx4X+Ded32KZb2AA3p9w/HX7gn1MnRfT5NGH0k3ggxLNarDU8g6JjQYgNtmE/R8gbp99BudZNfDoSF1llNAgMBAAECggEAaTa9bSoXM/bErALt3ghyx1B8+OGVpts5F5IKoVEe/PNjPfkpIzdGwONhtUnF0cKFQaAWgWE1xuGGlO2Sumevn1Cvnw1axF+1F8Om5UcE67cPFvh5kUTlpyGrutt1tMSQjpy7r7jEf1UwP3e5pzBz7TPWf2wv635OC56uOtivPJZ+8vg7VYon/mNXQuL4AavoxfSDtvo0ad30X2fK1WKeeBtgiT4UzV6ZGZh5igKQHM4lVvmbo/jOeQD0KAod7pRe/h4FBFmCVIWwgW+I+Hnzp8A/nJezoowJ3jiTt0FodC9uBCT64ZCz5dVCryD62LDVjKBxB7cfIoQA+PxCiXr9QQKBgQD+2v38J/MlfK/XCYldclzumizwIw6T0Mv6XvYwXQHYgYDKYNF6k1LhMEUo7fP3EsPdV8h/nXmdU4qadOVm6QSJ/rGEl22yGlO7woUzTY/Ls9eknoqfMYuyI1+ICMnNxmesQbWyc0cOHh44cEF+icfJxEDAmrHGLmBVsKuLUJUuVQKBgQCGt663TF7mixghiUOcT11zC1fqG+dIcvAwHpCHfdxsniYRqnv+SLf6eC5PCkQ5aNAAl/ywOLQAWS0XgYti3LyZ4iuGIYcUE0IDDmhWl68V27iXcLIK+rBRqBGxSdk8xR+zSE8fpO4mXpxn8SH0Butex8PJ+oHTbmdXIUAXdn6HGQKBgQCvAB1rqtsRoL72ADxtCHy78u5srwXxhmyqrc6LgzIjQzn2vejaLJO6wfSbmFnwDNimAwNQbgf2ekkwqphjxBozz8qB66GNrPpWccoZYmcdT48CIUO68MCmQBf3R2GbhWPnKu/ja7kc/p1tz9eJVn70E2kLWK4+EdZgwQHqlhj6SQKBgF4AmbdpYOb5s9Li1vyhHJIEHkpLQi15lkPdb/g7SK26BNJa5b5fu5DYf2fDwCtXCZ0AcN/+EQwVLbOzPzGy2R9/g+NKTdkiPvOnAAM8QH2+HaX+ix3CI3o3DnFpGF6hJieRkzR/f3Ximryks451rZMrTWEIncKMzSstFm3Izy0xAoGBAJQaMqlzpM+QaJiytJNeqRpPWRsi0Dkf4XqJXPWLOrApSISsafZF5vk2ZOeIqRsVCBH3LdfVIJxEBAF4l/Sd2q7xC9JHawJDqa4ea7VwL68ANH2w3jcJ3j6DQqf7NIe/lSGxYF6Jt+74oRFHxN3GDSf+z91DYfZz8hQnyphKDNEJ"
|
||||
##支付宝appid
|
||||
#ALIPAYAPPID: "2021002156615717"
|
||||
##应用公钥证书路径
|
||||
#CERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
|
||||
##支付宝公钥证书路径
|
||||
#PUBLICCERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
|
||||
##支付宝根证书路径
|
||||
#ROOTCRETPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt"
|
||||
75
xhpc-modules/xhpc-log/src/main/resources/logback.xml
Normal file
75
xhpc-modules/xhpc-log/src/main/resources/logback.xml
Normal file
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/xhpc-order"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern"
|
||||
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.xhpc" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.log.mapper.SysOperLogMapper">
|
||||
|
||||
<select id="selectUserOperLog" resultType="map">
|
||||
select
|
||||
oper_id as 'operId',
|
||||
title as 'title',
|
||||
business_type as 'businessType',
|
||||
method as 'method',
|
||||
request_method as 'requestMethod',
|
||||
operator_type as 'operatorType',
|
||||
oper_name as 'operName',
|
||||
dept_name as 'deptName',
|
||||
oper_url as 'operUrl',
|
||||
oper_id as 'operIp',
|
||||
oper_location as 'operLocation',
|
||||
oper_param as 'operParam',
|
||||
json_result as 'jsonResult',
|
||||
status as 'status',
|
||||
error_msg as 'errorMsg',
|
||||
oper_time as 'operTime'
|
||||
from sys_oper_log
|
||||
<where>
|
||||
<if test="params.operName!=null and params.operName!=''">
|
||||
oper_name = #{params.operName}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,426 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.log.mapper.XhpcChargingPileMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcChargingPile">
|
||||
<result property="chargingPileId" column="charging_pile_id"/>
|
||||
<result property="chargingStationId" column="charging_station_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="nationalStandard" column="national_standard"/>
|
||||
<result property="power" column="power"/>
|
||||
<result property="auxiliaryPowerSupply" column="auxiliary_power_supply"/>
|
||||
<result property="inputVoltage" column="input_voltage"/>
|
||||
<result property="maxVoltage" column="max_voltage"/>
|
||||
<result property="minVoltage" column="min_voltage"/>
|
||||
<result property="maxElectricCurrent" column="max_electric_current"/>
|
||||
<result property="minElectriCurrent" column="min_electric_current"/>
|
||||
<result property="serialNumber" column="serial_number"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="programVersion" column="program_version"/>
|
||||
<result property="networkLinkType" column="network_link_type"/>
|
||||
<result property="gunNumber" column="gun_number"/>
|
||||
<result property="communicationProtocolVersion" column="communication_protocol_version"/>
|
||||
<result property="communicationOperator" column="communication_operator"/>
|
||||
<result property="simCard" column="sim_card"/>
|
||||
<result property="rateModelId" column="rate_model_id"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="brandModel" column="brand_model"/>
|
||||
</resultMap>
|
||||
<sql id="selectXhpcChargingPileVo">
|
||||
select charging_pile_id,
|
||||
charging_station_id,
|
||||
name,
|
||||
national_standard,
|
||||
power,
|
||||
auxiliary_power_supply,
|
||||
input_voltage,
|
||||
max_voltage,
|
||||
min_voltage,
|
||||
max_electric_current,
|
||||
min_electric_current,
|
||||
serial_number,
|
||||
type,
|
||||
program_version,
|
||||
network_link_type,
|
||||
gun_number,
|
||||
communication_protocol_version,
|
||||
communication_operator,
|
||||
sim_card,
|
||||
rate_model_id,
|
||||
status,
|
||||
del_flag,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
remark,
|
||||
rate_model_id,
|
||||
brand_model,
|
||||
production_date productionDate,
|
||||
manufacture_name manufactureName,
|
||||
connector_type connectorType,
|
||||
current,
|
||||
equipment_type equipmentType
|
||||
from xhpc_charging_pile
|
||||
</sql>
|
||||
<select id="selectXhpcChargingPileList" resultType="java.util.Map">
|
||||
select
|
||||
cp.charging_pile_id as chargingPileId,
|
||||
cp.charging_station_id as chargingStationId,
|
||||
concat(cp.name,'号桩') as chargingPileName,
|
||||
st.name as chargingStationName,
|
||||
cp.serial_number as serialNumber,
|
||||
cp.brand_model as brandModel,
|
||||
cp.type as type,
|
||||
cp.power as power,
|
||||
cp.gun_number as gunNumber,
|
||||
cp.status as status
|
||||
from xhpc_charging_pile as cp
|
||||
left join xhpc_charging_station as st on st.charging_station_id =cp.charging_station_id
|
||||
where cp.del_flag =0
|
||||
<!-- <if test="name !=null and name !=''">-->
|
||||
<!-- and cp.name like CONCAT('%',#{name},'%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="type !=null and type !=''">-->
|
||||
<!-- and cp.type=#{type}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="serialNumber !=null and serialNumber!=''">-->
|
||||
<!-- and cp.serial_number=#{serialNumber}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="chargingStationId !=null and chargingStationId!=''">-->
|
||||
<!-- and cp.charging_station_id=#{chargingStationId}-->
|
||||
<!-- </if>-->
|
||||
<if test="params.number !=0 and params.number ==1">
|
||||
and cp.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.number !=0 and params.number ==2">
|
||||
and cp.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId != ''">
|
||||
and cp.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
order by cp.create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="addXhpcChargingPile" parameterType="com.xhpc.common.domain.XhpcChargingPile" useGeneratedKeys="true"
|
||||
keyProperty="chargingPileId">
|
||||
insert into xhpc_charging_pile
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
charging_station_id,
|
||||
</if>
|
||||
<if test="null != name ">
|
||||
name,
|
||||
</if>
|
||||
<if test="null != nationalStandard ">
|
||||
national_standard,
|
||||
</if>
|
||||
<if test="null != power ">
|
||||
power,
|
||||
</if>
|
||||
<if test="null != auxiliaryPowerSupply ">
|
||||
auxiliary_power_supply,
|
||||
</if>
|
||||
<if test="null != inputVoltage ">
|
||||
input_voltage,
|
||||
</if>
|
||||
<if test="null != maxVoltage ">
|
||||
max_voltage,
|
||||
</if>
|
||||
<if test="null != minVoltage ">
|
||||
min_voltage,
|
||||
</if>
|
||||
<if test="null != maxElectricCurrent ">
|
||||
max_electric_current,
|
||||
</if>
|
||||
<if test="null != minElectriCurrent ">
|
||||
min_electric_current,
|
||||
</if>
|
||||
<if test="null != serialNumber ">
|
||||
serial_number,
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
type,
|
||||
</if>
|
||||
<if test="null != programVersion ">
|
||||
program_version,
|
||||
</if>
|
||||
<if test="null != networkLinkType ">
|
||||
network_link_type,
|
||||
</if>
|
||||
<if test="null != gunNumber ">
|
||||
gun_number,
|
||||
</if>
|
||||
<if test="null != communicationProtocolVersion ">
|
||||
communication_protocol_version,
|
||||
</if>
|
||||
<if test="null != communicationOperator ">
|
||||
communication_operator,
|
||||
</if>
|
||||
<if test="null != simCard ">
|
||||
sim_card,
|
||||
</if>
|
||||
<if test="null != rateModelId ">
|
||||
rate_model_id,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != brandModel ">
|
||||
brand_model,
|
||||
</if>
|
||||
<if test="null != productionDate ">
|
||||
production_date,
|
||||
</if>
|
||||
<if test="null != manufactureName ">
|
||||
manufacture_name,
|
||||
</if>
|
||||
<if test="null != connectorType ">
|
||||
connector_type,
|
||||
</if>
|
||||
<if test="null != current ">
|
||||
current,
|
||||
</if>
|
||||
<if test="null != equipmentType ">
|
||||
equipment_type
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargingStationId ">
|
||||
#{chargingStationId},
|
||||
</if>
|
||||
<if test="null != name ">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="null != nationalStandard ">
|
||||
#{nationalStandard},
|
||||
</if>
|
||||
<if test="null != power ">
|
||||
#{power},
|
||||
</if>
|
||||
<if test="null != auxiliaryPowerSupply ">
|
||||
#{auxiliaryPowerSupply},
|
||||
</if>
|
||||
<if test="null != inputVoltage ">
|
||||
#{inputVoltage},
|
||||
</if>
|
||||
<if test="null != maxVoltage ">
|
||||
#{maxVoltage},
|
||||
</if>
|
||||
<if test="null != minVoltage ">
|
||||
#{minVoltage},
|
||||
</if>
|
||||
<if test="null != maxElectricCurrent ">
|
||||
#{maxElectricCurrent},
|
||||
</if>
|
||||
<if test="null != minElectriCurrent ">
|
||||
#{minElectriCurrent},
|
||||
</if>
|
||||
<if test="null != serialNumber ">
|
||||
#{serialNumber},
|
||||
</if>
|
||||
<if test="null != type ">
|
||||
#{type},
|
||||
</if>
|
||||
<if test="null != programVersion ">
|
||||
#{programVersion},
|
||||
</if>
|
||||
<if test="null != networkLinkType ">
|
||||
#{networkLinkType},
|
||||
</if>
|
||||
<if test="null != gunNumber ">
|
||||
#{gunNumber},
|
||||
</if>
|
||||
<if test="null != communicationProtocolVersion ">
|
||||
#{communicationProtocolVersion},
|
||||
</if>
|
||||
<if test="null != communicationOperator ">
|
||||
#{communicationOperator},
|
||||
</if>
|
||||
<if test="null != simCard ">
|
||||
#{simCard},
|
||||
</if>
|
||||
<if test="null != rateModelId ">
|
||||
#{rateModelId},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != brandModel ">
|
||||
#{brandModel},
|
||||
</if>
|
||||
<if test="null != productionDate ">
|
||||
#{productionDate},
|
||||
</if>
|
||||
<if test="null != manufactureName ">
|
||||
#{manufactureName},
|
||||
</if>
|
||||
<if test="null != connectorType ">
|
||||
#{connectorType},
|
||||
</if>
|
||||
<if test="null != current ">
|
||||
#{current},
|
||||
</if>
|
||||
<if test="null != equipmentType ">
|
||||
#{equipmentType}
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectXhpcChargingStationById" resultType="java.util.Map">
|
||||
select charging_station_id as chargingStationId,
|
||||
rate_model_id as rateModelId
|
||||
from xhpc_charging_station
|
||||
where charging_station_id = #{chargingStationId}
|
||||
</select>
|
||||
|
||||
<select id="selectXhpcChargingPileById" resultMap="BaseResultMap">
|
||||
select
|
||||
charging_pile_id,
|
||||
charging_station_id,
|
||||
name,
|
||||
national_standard,
|
||||
power,
|
||||
auxiliary_power_supply,
|
||||
input_voltage,
|
||||
max_voltage,
|
||||
min_voltage,
|
||||
max_electric_current,
|
||||
min_electric_current,
|
||||
serial_number,
|
||||
type,
|
||||
program_version,
|
||||
network_link_type,
|
||||
gun_number,
|
||||
communication_protocol_version,
|
||||
communication_operator,
|
||||
sim_card,
|
||||
rate_model_id,
|
||||
status,
|
||||
del_flag,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
remark,
|
||||
rate_model_id,
|
||||
brand_model,
|
||||
production_date productionDate,
|
||||
manufacture_name manufactureName,
|
||||
connector_type connectorType,
|
||||
current,
|
||||
equipment_type equipmentType
|
||||
from xhpc_charging_pile
|
||||
where charging_pile_id = #{chargingPileId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectXhpcTerminalList" resultType="java.util.Map">
|
||||
select
|
||||
te.terminal_id as terminalId,
|
||||
te.charging_pile_id as chargingPileId,
|
||||
te.charging_station_id as chargingStationId,
|
||||
te.name as terminalName,
|
||||
ct.name as chargingStationName,
|
||||
te.pile_serial_number as pileSerialNumber,
|
||||
cp.power as power,
|
||||
te.serial_number as serialNumber,
|
||||
cp.max_voltage as maxVoltage,
|
||||
cp.serial_number as serialNumber,
|
||||
cp.brand_model as brandModel,
|
||||
cp.type as pileType,
|
||||
te.status as status,
|
||||
te.work_status as workStatus
|
||||
from xhpc_terminal as te
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = te.charging_station_id
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
||||
where te.del_flag=0
|
||||
<if test="chargingPileId !=null">
|
||||
and te.charging_pile_id=#{chargingPileId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getXhpcChargingPileBySerialNumber" resultType="com.xhpc.common.domain.XhpcChargingPile">
|
||||
select
|
||||
charging_pile_id,
|
||||
charging_station_id,
|
||||
name,
|
||||
national_standard,
|
||||
power,
|
||||
auxiliary_power_supply,
|
||||
input_voltage,
|
||||
max_voltage,
|
||||
min_voltage,
|
||||
max_electric_current,
|
||||
min_electric_current,
|
||||
serial_number,
|
||||
type,
|
||||
program_version,
|
||||
network_link_type,
|
||||
gun_number,
|
||||
communication_protocol_version,
|
||||
communication_operator,
|
||||
sim_card,
|
||||
rate_model_id,
|
||||
status,
|
||||
del_flag,
|
||||
create_time,
|
||||
create_by,
|
||||
update_time,
|
||||
update_by,
|
||||
remark,
|
||||
rate_model_id,
|
||||
brand_model,
|
||||
production_date productionDate,
|
||||
manufacture_name manufactureName,
|
||||
connector_type connectorType,
|
||||
current,
|
||||
equipment_type equipmentType
|
||||
from xhpc_charging_pile
|
||||
where serial_number = #{serialNumber}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.log.mapper.XhpcChargingStationMapper">
|
||||
|
||||
<select id="selectXhpcChargingStationList" resultType="java.util.Map">
|
||||
select
|
||||
cs.charging_station_id as chargingStationId,
|
||||
cs.name as name,
|
||||
ope.name as operatorName,
|
||||
cs.address as address,
|
||||
(select url from xhpc_img where img_id = cs.img_id and del_flag =0 limit 1) as url,
|
||||
cs.client_visible as clientVisible,
|
||||
cs.status as status
|
||||
from xhpc_charging_station as cs
|
||||
left join xhpc_operator as ope on cs.operator_id = ope.operator_id
|
||||
where cs.del_flag =0
|
||||
<if test="params.number == 1">
|
||||
and cs.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.number == 2">
|
||||
and cs.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId != ''">
|
||||
and cs.tenant_id=#{params.tenantId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRateListByStationId" resultType="map">
|
||||
select
|
||||
rate_model_id as 'rateId',
|
||||
create_time as 'createTime'
|
||||
from xhpc_rate_time
|
||||
where charging_station_id=#{stationId}
|
||||
group by rate_model_id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRateTimeListByRateId" resultType="map">
|
||||
select rt.start_time as startTime,
|
||||
replace(rt.end_time, '00:00:00', '24:00:00') AS endTime,
|
||||
rt.rate_id as rateId,
|
||||
rt.rate_value as id,
|
||||
ra.name as rateName,
|
||||
ra.power_fee as powerFee,
|
||||
ra.service_fee as serviceFee
|
||||
from xhpc_rate_time as rt
|
||||
left join xhpc_rate as ra on ra.rate_id = rt.rate_id
|
||||
where rt.rate_model_id =#{rateId}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.log.mapper.XhpcDeviceMessageMapper">
|
||||
|
||||
<select id="selectListByTypeAndSerialNumber" resultType="map">
|
||||
select
|
||||
device_message_id as 'deviceMessageId',
|
||||
type as 'type',
|
||||
serial_number as 'serialNumber',
|
||||
content as 'content',
|
||||
reply_content as 'replyContent',
|
||||
status as 'status',
|
||||
remark as 'remark',
|
||||
create_time as 'createTime',
|
||||
create_by as 'createBy',
|
||||
update_time as 'updateTime',
|
||||
update_by as 'updateBy'
|
||||
from xhpc_device_message
|
||||
where type=#{type} and serial_number=#{serialNumber}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectListByParams" resultType="java.util.Map">
|
||||
select
|
||||
concat(cp.name,'号桩') as 'chargingPileName',
|
||||
st.name as 'chargingStationName',
|
||||
cp.brand_model as 'brandModel',
|
||||
cp.type as 'pileType',
|
||||
cp.power as 'power',
|
||||
cp.serial_number as 'serialNumber',
|
||||
m.device_message_id as 'deviceMessageId',
|
||||
m.type as 'type',
|
||||
m.serial_number as 'serialNumber',
|
||||
m.content as 'content',
|
||||
m.reply_content as 'replyContent',
|
||||
m.status as 'status',
|
||||
m.remark as 'remark',
|
||||
m.create_time as 'createTime',
|
||||
m.create_by as 'createBy',
|
||||
m.update_time as 'updateTime',
|
||||
from xhpc_device_message m
|
||||
left join xhpc_charging_pile cp on cp.serial_number=m.serial_number
|
||||
left join xhpc_charging_station st on st.charging_station_id =cp.charging_station_id
|
||||
where cp.del_flag =0
|
||||
<if test="params.number ==1">
|
||||
and cp.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.number ==2">
|
||||
and cp.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.type!=null and params.type!=''">
|
||||
and m.type=#{params.type}
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId != ''">
|
||||
and cp.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.serialNumber !=null and params.serialNumber!=''">
|
||||
and cp.serial_number=#{params.serialNumber}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.log.mapper.XhpcHistoryOrderMapper">
|
||||
|
||||
<select id="getOrderPage" resultType="map">
|
||||
select
|
||||
co.serial_number as 'serialNumber',
|
||||
co.source as 'source',
|
||||
case co.source when 0 then 'C端用户'
|
||||
when 1 then '流量方用户'
|
||||
when 2 then '社区用户'
|
||||
when 3 then 'B端用户' end as 'sourceName',
|
||||
co.start_time as 'startTime',
|
||||
co.end_time as 'endTime'
|
||||
from xhpc_charge_order as co
|
||||
left join xhpc_charging_station as st on st.charging_station_id =co.charging_station_id
|
||||
where co.del_flag =0
|
||||
<if test="params.number !=0 and params.number ==1">
|
||||
and co.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.number !=0 and params.number ==2">
|
||||
and co.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId != ''">
|
||||
and co.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
order by co.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.log.mapper.XhpcMessageMapper">
|
||||
|
||||
<select id="getOrderMessagePage" resultType="map">
|
||||
select m.message_id as 'messageId', m.charge_order_no as 'chargeOrderNo', m.content as 'content', m.status as 'status', m.remark as 'remark', m.create_time as 'createTime'
|
||||
from xhpc_message m
|
||||
where m.charge_order_no = #{serialNumber}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getOrderMessageByParams" resultType="java.util.Map">
|
||||
select
|
||||
co.serial_number as 'serialNumber',
|
||||
co.source as 'source',
|
||||
case co.source when 0 then 'C端用户'
|
||||
when 1 then '流量方用户'
|
||||
when 2 then '社区用户'
|
||||
when 3 then 'B端用户' end as 'sourceName',
|
||||
co.start_time as 'startTime',
|
||||
co.end_time as 'endTime',
|
||||
co.charging_degree as 'chargingDegree',
|
||||
co.amount_charged as 'amountCharged',
|
||||
co.charging_time as 'chargingTime',
|
||||
co.start_soc as 'startSOc',
|
||||
co.end_soc as 'endSoc',
|
||||
m.message_id as 'messageId',
|
||||
m.charge_order_no as 'chargeOrderNo',
|
||||
m.content as 'content',
|
||||
m.status as 'status',
|
||||
m.remark as 'remark',
|
||||
m.create_time as 'createTime'
|
||||
from xhpc_message m
|
||||
LEFT JOIN xhpc_charge_order as co on co.serial_number = m.charge_order_no
|
||||
left join xhpc_charging_station as st on st.charging_station_id = co.charging_station_id
|
||||
where co.del_flag =0
|
||||
<if test="params.number !=0 and params.number ==1">
|
||||
and co.charging_station_id in(select charging_station_id from xhpc_charging_station where operator_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.number !=0 and params.number ==2">
|
||||
and co.charging_station_id in(select charging_station_id from xhpc_user_privilege where user_id=#{params.operatorId})
|
||||
</if>
|
||||
<if test="params.tenantId != null and params.tenantId != ''">
|
||||
and co.tenant_id = #{params.tenantId}
|
||||
</if>
|
||||
<if test="params.serialNumber !=null and params.serialNumber !=''">
|
||||
and co.serial_number=#{serialNumber}
|
||||
</if>
|
||||
order by m.charge_order_no asc, m.create_time asc
|
||||
</select>
|
||||
</mapper>
|
||||
@ -33,6 +33,7 @@ public class DaoAspect {
|
||||
private static final String CREATE_TIME = "createTime";
|
||||
private static final String UPDATE_USER = "updateBy";
|
||||
private static final String UPDATE_TIME = "updateTime";
|
||||
private static final String TENANT_ID = "tenantId";
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.update*(..))")
|
||||
public void daoUpdate() {
|
||||
@ -134,6 +135,10 @@ public class DaoAspect {
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, date);
|
||||
}
|
||||
|
||||
if (isProperty(arg, TENANT_ID) && StringUtils.isEmpty(BeanUtils.getProperty(arg, TENANT_ID))) {
|
||||
BeanUtils.setProperty(arg, TENANT_ID, loginUser.getTenantId());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -0,0 +1,371 @@
|
||||
package com.xhpc.order.service.impl;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StreamTokenizer;
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Calc {
|
||||
|
||||
public static void main(String[] argv) {
|
||||
|
||||
test("-1 + 2", 1);
|
||||
test("2 * (3 * (4 + 5)) / 9 / 6", 1);
|
||||
test("max(1, 2 + 3)", 5);
|
||||
test("min(3 - 1, 1)", 1);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("totalPower", new BigDecimal("400000.000000"));
|
||||
StandardEvaluationContext stdContext = new StandardEvaluationContext();
|
||||
stdContext.setVariables(map);
|
||||
String ruleExpression = "#totalPower >= 500000 ? 'e1' : 'e2'";
|
||||
// Evaluate the SpEL expression
|
||||
ExpressionParser parser = new SpelExpressionParser();
|
||||
Expression expression = parser.parseExpression(ruleExpression);
|
||||
String rs = expression.getValue(stdContext, String.class);
|
||||
System.out.println(rs);
|
||||
}
|
||||
|
||||
private static void test(String s, double x) {
|
||||
|
||||
double v = eval(s);
|
||||
System.out.println((v == x) + ": " + s + " = " + v);
|
||||
}
|
||||
|
||||
private static double eval(String s) {
|
||||
|
||||
Parser p = Parser.parse(s);
|
||||
double v = p.value();
|
||||
|
||||
if (p.isValid()) {
|
||||
return v;
|
||||
} else {
|
||||
throw new ArithmeticException("error check: " + p.error() + ": " + s);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse via recursive descent using the following LL(1) grammar:
|
||||
* <code>
|
||||
* expr = [addop] term {(addop) term} end
|
||||
* term = factor {(mulop) factor} end
|
||||
* factor = word | number | "(" expr ")" end
|
||||
* word = name ["(" expr] ["," expr] ")"] end
|
||||
* addop = "+" | "-"
|
||||
* mulop = "*" | "/"
|
||||
* </code>
|
||||
*
|
||||
* @param s the string to be evaluated.
|
||||
* @see <a href="http://en.wikipedia.org/wiki/Recursive_descent_parser">
|
||||
* Recursive descent parser</a>.
|
||||
*/
|
||||
class Parser extends Object {
|
||||
|
||||
private final StreamTokenizer tokens;
|
||||
private int token;
|
||||
private final double value;
|
||||
private String error;
|
||||
|
||||
private Parser(String s) {
|
||||
|
||||
Reader reader = new StringReader(s);
|
||||
tokens = new StreamTokenizer(reader);
|
||||
tokens.ordinaryChar(Symbol.SLASH.toChar());
|
||||
|
||||
getToken();
|
||||
value = expr();
|
||||
if (!tokenIs(Symbol.END))
|
||||
putError("syntax error");
|
||||
}
|
||||
|
||||
public static Parser parse(String s) {
|
||||
|
||||
return new Parser(s);
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
|
||||
return error == null;
|
||||
}
|
||||
|
||||
public double value() {
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public String error() {
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
// expr = [addop] term {(addop) term} end
|
||||
private double expr() {
|
||||
|
||||
BigDecimal sign = BigDecimal.ONE;
|
||||
accept(Symbol.PLUS);
|
||||
if (accept(Symbol.MINUS)) {
|
||||
sign = BigDecimal.valueOf(-1);
|
||||
}
|
||||
BigDecimal value = sign.multiply(term());
|
||||
while (Symbol.isAddOp(token)) {
|
||||
if (accept(Symbol.PLUS)) {
|
||||
value = value.add(term());
|
||||
}
|
||||
if (accept(Symbol.MINUS)) {
|
||||
value = value.subtract(term());
|
||||
}
|
||||
}
|
||||
return value.doubleValue();
|
||||
}
|
||||
|
||||
// term = factor {(mulop) factor} end
|
||||
private BigDecimal term() {
|
||||
|
||||
BigDecimal value = factor();
|
||||
while (Symbol.isMulOp(token)) {
|
||||
if (accept(Symbol.STAR)) {
|
||||
value = value.multiply(factor());
|
||||
}
|
||||
if (accept(Symbol.SLASH)) {
|
||||
value = value.divide(factor());
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// factor = word | number | "(" expr ")" end
|
||||
private BigDecimal factor() {
|
||||
|
||||
BigDecimal value = BigDecimal.ZERO;
|
||||
if (tokenIs(Symbol.WORD)) {
|
||||
value = word();
|
||||
} else if (tokenIs(Symbol.NUMBER)) {
|
||||
value = new BigDecimal(tokens.nval);
|
||||
getToken();
|
||||
} else if (accept(Symbol.OPEN)) {
|
||||
value = BigDecimal.valueOf(expr());
|
||||
expect(Symbol.CLOSE);
|
||||
} else {
|
||||
putError("factor error");
|
||||
getToken();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// word = name ["(" expr] ["," expr] ")"] end
|
||||
private BigDecimal word() {
|
||||
|
||||
BigDecimal value = BigDecimal.ZERO;
|
||||
String name = tokens.sval;
|
||||
FunctionAdapter fa = Function.lookup(name);
|
||||
getToken();
|
||||
if (fa != null) {
|
||||
int count = fa.getCount();
|
||||
if (count == 0) {
|
||||
value = BigDecimal.valueOf(fa.eval());
|
||||
} else if (accept(Symbol.OPEN)) {
|
||||
double[] args = new double[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
args[i] = expr();
|
||||
if (i < count - 1)
|
||||
expect(Symbol.COMMA);
|
||||
}
|
||||
value = BigDecimal.valueOf(fa.eval(args));
|
||||
expect(Symbol.CLOSE);
|
||||
} else putError("missing " + Symbol.OPEN.toChar());
|
||||
} else putError("undefined " + name);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the next token in the stream.
|
||||
*/
|
||||
private void getToken() {
|
||||
|
||||
try {
|
||||
token = tokens.nextToken();
|
||||
} catch (IOException e) {
|
||||
putError("i/o error " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the current token matches the given symbol.
|
||||
*/
|
||||
private boolean tokenIs(Symbol symbol) {
|
||||
|
||||
return token == symbol.token();
|
||||
}
|
||||
|
||||
/**
|
||||
* Require a matching symbol; gerate an error if it's unexpected.
|
||||
*/
|
||||
private void expect(Symbol symbol) {
|
||||
|
||||
if (accept(symbol)) return;
|
||||
putError("missing " + symbol.toChar());
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance if the current token matches the given symbol.
|
||||
*/
|
||||
private boolean accept(Symbol symbol) {
|
||||
|
||||
if (tokenIs(symbol)) {
|
||||
getToken();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an error; ignore line numbers.
|
||||
*/
|
||||
private void putError(String s) {
|
||||
|
||||
if (error == null)
|
||||
error = s + " at " + tokens.toString().replaceAll(",.*$", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate the terminal symbols recognized by the Parser.
|
||||
* Each symbol's token field is initialized with a value that
|
||||
* matches one returned by StreamTokenizer's nextToken() method.
|
||||
*/
|
||||
enum Symbol {
|
||||
PLUS('+'), MINUS('-'), STAR('*'), SLASH('/'),
|
||||
OPEN('('), CLOSE(')'), COMMA(','),
|
||||
END(StreamTokenizer.TT_EOF),
|
||||
WORD(StreamTokenizer.TT_WORD),
|
||||
NUMBER(StreamTokenizer.TT_NUMBER);
|
||||
|
||||
private final int token;
|
||||
|
||||
Symbol(int token) {
|
||||
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return this symbol's token.
|
||||
*/
|
||||
public int token() {
|
||||
|
||||
return this.token;
|
||||
}
|
||||
|
||||
/**
|
||||
* If printable, return character for this symbol's token.
|
||||
*/
|
||||
public char toChar() {
|
||||
|
||||
if (this.token < 32) return '\ufffd';
|
||||
else return (char) this.token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the given token matches PLUS or MINUS.
|
||||
*/
|
||||
public static boolean isAddOp(int token) {
|
||||
|
||||
return token == PLUS.token || token == MINUS.token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the given token matches STAR or SLASH.
|
||||
*/
|
||||
public static boolean isMulOp(int token) {
|
||||
|
||||
return token == STAR.token || token == SLASH.token;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate the available functions. Although an enum may define
|
||||
* <i>constant-specific</i> methods, an included adpter or interface
|
||||
* is perhaps easier to read, initialize and maintain.
|
||||
*/
|
||||
enum Function {
|
||||
MAX(new Max()),
|
||||
MIN(new Min());
|
||||
|
||||
private final FunctionAdapter fa;
|
||||
|
||||
/**
|
||||
* Construct a Function with the specified adapter.
|
||||
**/
|
||||
Function(FunctionAdapter fa) {
|
||||
|
||||
this.fa = fa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Function's adapter by name; null if unknown.
|
||||
*/
|
||||
public static FunctionAdapter lookup(String name) {
|
||||
|
||||
Function f;
|
||||
try {
|
||||
f = Enum.valueOf(Function.class, name.toUpperCase());
|
||||
} catch (RuntimeException e) {
|
||||
return null;
|
||||
}
|
||||
return f.fa;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapt to functions with a variable number of arguments.
|
||||
* Concrete implementations should override getCount() to indicate
|
||||
* the expected number of arguments. The default is one.
|
||||
*/
|
||||
abstract class FunctionAdapter {
|
||||
|
||||
public int getCount() {
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
abstract double eval(double... args);
|
||||
|
||||
}
|
||||
|
||||
class Max extends FunctionAdapter {
|
||||
|
||||
public int getCount() {
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
public double eval(double... args) {
|
||||
|
||||
return Math.max(args[0], args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Min extends FunctionAdapter {
|
||||
|
||||
public int getCount() {
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
public double eval(double... args) {
|
||||
|
||||
return Math.min(args[0], args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -33,6 +33,7 @@ public class DaoAspect {
|
||||
private static final String CREATE_TIME = "createTime";
|
||||
private static final String UPDATE_USER = "updateBy";
|
||||
private static final String UPDATE_TIME = "updateTime";
|
||||
private static final String TENANT_ID = "tenantId";
|
||||
|
||||
@Pointcut("execution(* com.xhpc..*.update*(..))")
|
||||
public void daoUpdate() {
|
||||
@ -135,6 +136,9 @@ public class DaoAspect {
|
||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||
BeanUtils.setProperty(arg, UPDATE_TIME, date);
|
||||
}
|
||||
if (isProperty(arg, TENANT_ID) && StringUtils.isEmpty(BeanUtils.getProperty(arg, TENANT_ID))) {
|
||||
BeanUtils.setProperty(arg, TENANT_ID, loginUser.getTenantId());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -1,34 +1,32 @@
|
||||
package com.xhpc.payment.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.CertAlipayRequest;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.domain.AlipayTradeAppPayModel;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import com.alipay.api.internal.util.AntCertificationUtil;
|
||||
import com.alipay.api.request.AlipayTradeAppPayRequest;
|
||||
import com.alipay.api.request.AlipayTradeCreateRequest;
|
||||
import com.alipay.api.request.AlipayTradeRoyaltyRelationBindRequest;
|
||||
import com.alipay.api.response.AlipayTradeCreateResponse;
|
||||
import com.alipay.api.response.AlipayTradeRoyaltyRelationBindResponse;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import com.xhpc.payment.domain.AlipayNotifyParam;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import com.xhpc.common.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.domain.*;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcCommonPayment;
|
||||
import com.xhpc.payment.service.IXhpcRechargeOrderService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
@ -59,6 +57,13 @@ public class AlipayPaymentController {
|
||||
private PowerPileService powerPileService;
|
||||
@Autowired
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private IXhpcCommonPayment xhpcCommonPayment;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AlipayPaymentController.class);
|
||||
|
||||
@ -83,30 +88,40 @@ public class AlipayPaymentController {
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空");
|
||||
}
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(Long.parseLong(userId));
|
||||
|
||||
LoginUser loginUser = tokenService.getLoginUser(servletRequest);
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId);
|
||||
if (StringUtils.isNotNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");
|
||||
}
|
||||
String orderNumber = StringUtils.numFormat(Long.parseLong(userId), 1, StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
String orderNumber = StringUtils.numFormat(userid, 1, StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_ALI_PAY_TYPE, tenantId);
|
||||
if(xhpcSettingConfig ==null){
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "支付宝充值失败,继续充值请联系客服");
|
||||
}
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), "2", orderNumber);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId+"", BigDecimal.valueOf(Double.parseDouble(amount)), "2", orderNumber,userType);
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
|
||||
/** 初始化 **/
|
||||
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
|
||||
/** 支付宝网关 **/
|
||||
certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do");
|
||||
certAlipayRequest.setServerUrl(xhpcSettingConfig.getZhbServerUrl());
|
||||
/** 应用id,如何获取请参考:https://opensupport.alipay.com/support/helpcenter/190/201602493024 **/
|
||||
certAlipayRequest.setAppId(environment.getProperty("ALIPAYAPPID"));
|
||||
certAlipayRequest.setAppId(xhpcSettingConfig.getZfbAppId());
|
||||
/** 应用私钥, 如何获取请参考:https://opensupport.alipay.com/support/helpcenter/207/201602471154?ant_source=antsupport **/
|
||||
certAlipayRequest.setPrivateKey(environment.getProperty("ALIPAYPRIVATEKEY"));
|
||||
certAlipayRequest.setPrivateKey(xhpcSettingConfig.getZfbPrivateKey());
|
||||
/** 应用公钥证书路径,下载后保存位置的绝对路径 **/
|
||||
certAlipayRequest.setCertPath(environment.getProperty("CERTPATH"));
|
||||
certAlipayRequest.setCertPath(xhpcSettingConfig.getZfbAppCertPublicKey());
|
||||
/** 支付宝公钥证书路径,下载后保存位置的绝对路径 **/
|
||||
certAlipayRequest.setAlipayPublicCertPath(environment.getProperty("PUBLICCERTPATH"));
|
||||
certAlipayRequest.setAlipayPublicCertPath(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa());
|
||||
/** 支付宝根证书路径,下载后保存位置的绝对路径 **/
|
||||
certAlipayRequest.setRootCertPath(environment.getProperty("ROOTCRETPATH"));
|
||||
certAlipayRequest.setRootCertPath(xhpcSettingConfig.getZfbAlipayRootCert());
|
||||
/** 设置签名类型 **/
|
||||
certAlipayRequest.setSignType("RSA2");
|
||||
/** 设置请求格式,固定值json **/
|
||||
@ -125,7 +140,7 @@ public class AlipayPaymentController {
|
||||
"\"passback_params\":\""+encode+"\"," +
|
||||
"\"buyer_id\":\""+openid+"\"" +
|
||||
"}");
|
||||
request.setNotifyUrl(environment.getProperty("ALIPAYPSERVERDOMAIN"));
|
||||
request.setNotifyUrl(xhpcSettingConfig.getZfbCallbackUrl());
|
||||
try {
|
||||
//这里和普通的接口调用不同,使用的是sdkExecute
|
||||
AlipayTradeCreateResponse response = alipayClient.certificateExecute(request);
|
||||
@ -153,43 +168,47 @@ public class AlipayPaymentController {
|
||||
Map<String, String> params = convertRequestParamsToMap(request);
|
||||
// 将异步通知中收到的待验证所有参数都存放到map中
|
||||
logger.info("<<<<<<<<<<<<params>>>>>>>>>"+params);
|
||||
logger.info("<<<<<<<<<<<<>>>>>>>>>");
|
||||
try{
|
||||
String publiccertpath = getAlipayPublicKey(environment.getProperty("PUBLICCERTPATH"));
|
||||
logger.info("<<<<<<<<<<<<支付宝公钥证书>>>>>>>>>"+publiccertpath);
|
||||
// 调用SDK验证签名
|
||||
boolean signVerified = AlipaySignature.rsaCheckV1(params, publiccertpath, "utf-8", "RSA2");
|
||||
logger.info("<<<<<<<<<<<<验证签名>>>>>>>>>"+signVerified);
|
||||
if (signVerified) {
|
||||
//("支付宝回调签名认证成功");
|
||||
AlipayNotifyParam param = buildAlipayNotifyParam(params);
|
||||
String trade_status = param.getTradeStatus();
|
||||
// 支付成功
|
||||
if (trade_status.equals("TRADE_SUCCESS") || trade_status.equals("TRADE_FINISHED")) {
|
||||
// 处理支付成功逻辑
|
||||
try{
|
||||
String passbackParams = param.getPassbackParams();
|
||||
String tradeStatus = param.getTradeStatus();
|
||||
if ("TRADE_SUCCESS".equals(tradeStatus)) {
|
||||
// 业务参数主要转码回来
|
||||
JSONObject jsonObject = JSON.parseObject(URLDecoder.decode(passbackParams));
|
||||
logger.info("<<<<<<<<<<<<jsonObject>>>>>>>>>"+jsonObject.toString());
|
||||
String out_trade_no = jsonObject.getString("out_trade_no");
|
||||
String transaction_id = params.get("trade_no");
|
||||
paymentCallback(out_trade_no, transaction_id);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.infoRechargeOrderNumber(params.get("out_trade_no").toString());
|
||||
if(xhpcRechargeOrder!=null){
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_ALI_PAY_TYPE, xhpcRechargeOrder.getTenantId());
|
||||
if(xhpcSettingConfig !=null){
|
||||
String publiccertpath = getAlipayPublicKey(xhpcSettingConfig.getZfbAlipayCertPublicKeyRsa());
|
||||
logger.info("<<<<<<<<<<<<支付宝公钥证书>>>>>>>>>"+publiccertpath);
|
||||
// 调用SDK验证签名
|
||||
boolean signVerified = AlipaySignature.rsaCheckV1(params, publiccertpath, "utf-8", "RSA2");
|
||||
logger.info("<<<<<<<<<<<<验证签名>>>>>>>>>"+signVerified);
|
||||
if (signVerified) {
|
||||
//("支付宝回调签名认证成功");
|
||||
AlipayNotifyParam param = buildAlipayNotifyParam(params);
|
||||
String trade_status = param.getTradeStatus();
|
||||
// 支付成功
|
||||
if (trade_status.equals("TRADE_SUCCESS") || trade_status.equals("TRADE_FINISHED")) {
|
||||
// 处理支付成功逻辑
|
||||
try{
|
||||
String passbackParams = param.getPassbackParams();
|
||||
String tradeStatus = param.getTradeStatus();
|
||||
if ("TRADE_SUCCESS".equals(tradeStatus)) {
|
||||
// 业务参数主要转码回来
|
||||
JSONObject jsonObject = JSON.parseObject(URLDecoder.decode(passbackParams));
|
||||
String out_trade_no = jsonObject.getString("out_trade_no");
|
||||
String transaction_id = params.get("trade_no");
|
||||
paymentCallback(out_trade_no, transaction_id);
|
||||
}
|
||||
}catch (Exception e){
|
||||
//("支付宝回调业务处理报错,params:" + paramsJson, e);
|
||||
}
|
||||
}else{
|
||||
//("没有处理支付宝回调业务,支付宝交易状态:{},params:{}",trade_status,paramsJson);
|
||||
}
|
||||
}catch (Exception e){
|
||||
//("支付宝回调业务处理报错,params:" + paramsJson, e);
|
||||
// 业务处理失败,可查看日志进行补偿,跟支付宝已经没多大关系。
|
||||
return "success";
|
||||
}else{
|
||||
return "failure";
|
||||
}
|
||||
}else{
|
||||
//("没有处理支付宝回调业务,支付宝交易状态:{},params:{}",trade_status,paramsJson);
|
||||
}
|
||||
|
||||
// 业务处理失败,可查看日志进行补偿,跟支付宝已经没多大关系。
|
||||
return "success";
|
||||
}else{
|
||||
return "failure";
|
||||
}
|
||||
return "failure";
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
//logger.error("支付宝回调签名认证失败,paramsJson:{},errorMsg:{}", paramsJson, e.getMessage());
|
||||
@ -252,31 +271,41 @@ public class AlipayPaymentController {
|
||||
//修改充值订单状态
|
||||
iXhpcRechargeOrderService.updateRechargeOrder(xhpcRechargeOrder.getRechargeOrderId(), StatusConstants.OPERATION_ALI_PAY_TYPE, StatusConstants.RECHARGE_ORDER_STATUS_SUCCESS, transaction_id);
|
||||
}
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(xhpcRechargeOrder.getUserId());
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
Long userId = xhpcRechargeOrder.getUserId();
|
||||
Integer source = xhpcRechargeOrder.getSource();
|
||||
String tenantId = xhpcRechargeOrder.getTenantId();
|
||||
//判断用户
|
||||
R user = userTypeService.getUser(null,userId, source, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
String balance = StringUtils.valueOf(map.get("balance"));
|
||||
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
|
||||
//判断用户是否在充电中
|
||||
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId());
|
||||
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
|
||||
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber:"+serialMumber);
|
||||
if(!"".equals(serialMumber) && serialMumber !=null){
|
||||
//充电中
|
||||
postRefreshBalance(money, serialMumber);
|
||||
}
|
||||
//增加用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(money);
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
|
||||
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
|
||||
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
|
||||
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
xhpcUserAccountStatement.setRemark("支付宝充值订单!");
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
if(UserTypeUtil.USER_TYPE.equals(xhpcRechargeOrder.getSource())){
|
||||
//增加用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(money);
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
|
||||
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
|
||||
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
|
||||
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
xhpcUserAccountStatement.setRemark("支付宝充值订单!");
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
}else{
|
||||
//增加用户余额
|
||||
userTypeService.insertUserBalance(money,userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.payment.controller;
|
||||
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
@ -8,12 +9,17 @@ import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.utils.WXPayUtil;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.common.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.payment.domain.XhpcSettingConfig;
|
||||
import com.xhpc.payment.domain.XhpcUserAccountStatement;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcCommonPayment;
|
||||
import com.xhpc.payment.service.IXhpcRechargeOrderService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
@ -54,26 +60,22 @@ public class WxPaymentController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcRechargeOrderService iXhpcRechargeOrderService;
|
||||
|
||||
@Autowired
|
||||
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
|
||||
|
||||
@Autowired
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
@Autowired
|
||||
private PowerPileService powerPileService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
private UserTypeService userTypeService;
|
||||
@Autowired
|
||||
private IXhpcCommonPayment xhpcCommonPayment;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(WxPaymentController.class);
|
||||
private int number;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
number =1;
|
||||
}
|
||||
|
||||
@PostMapping("/payment")
|
||||
@ApiOperation(value = "微信支付")
|
||||
@ -96,10 +98,12 @@ public class WxPaymentController {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "请在我的里面进行充值");
|
||||
}
|
||||
String userId = StringUtils.valueOf(map.get("userId"));
|
||||
// if (StringUtils.isEmpty(userId)) {
|
||||
// return AjaxResult.error(HttpStatus.NOT_NULL, "用户信息不能为空");
|
||||
// }
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(Long.parseLong(userId));
|
||||
|
||||
LoginUser loginUser = tokenService.getLoginUser(servletRequest);
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId);
|
||||
if (StringUtils.isNotNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "用户存正在退款");
|
||||
}
|
||||
@ -108,8 +112,13 @@ public class WxPaymentController {
|
||||
if (0.0 == amount1) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "充值金额不能为0");
|
||||
}
|
||||
XhpcSettingConfig xhpcSettingConfig = xhpcCommonPayment.getXhpcSettingConfigTenantId(UserTypeUtil.OPERATION_WX_TYPE, tenantId);
|
||||
if(xhpcSettingConfig ==null){
|
||||
return AjaxResult.error(HttpStatus.ALREADY_EXISTING, "支付宝充值失败,继续充值请联系客服");
|
||||
}
|
||||
|
||||
//生成充值订单
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), "1", orderNumber);
|
||||
XhpcRechargeOrder xhpcRechargeOrder = iXhpcRechargeOrderService.addRechargeOrder(userId, BigDecimal.valueOf(Double.parseDouble(amount)), "1", orderNumber,userType);
|
||||
//附加数据(否)
|
||||
String attach = attachYu(StringUtils.valueOf(xhpcRechargeOrder.getRechargeOrderId()), StringUtils.valueOf(amount), null, orderNumber);
|
||||
//商品描述(是)
|
||||
@ -132,7 +141,7 @@ public class WxPaymentController {
|
||||
BufferedReader in = null;
|
||||
StringBuffer result = new StringBuffer();
|
||||
try {
|
||||
URL realUrl = new URL(environment.getProperty("WXPAYUNIFIEDORDER"));
|
||||
URL realUrl = new URL(xhpcSettingConfig.getWxPaymentUrl());
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
@ -145,7 +154,7 @@ public class WxPaymentController {
|
||||
conn.setDoInput(true);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
out.print(createXMLParam(Fee, attach, tradeType, spbillCreateIp, outTradeNo, body, timeStr, environment.getProperty("SERVERDOMAIN"), environment.getProperty("APPID"), environment.getProperty("MCHID"), environment.getProperty("KEY"), openid));
|
||||
out.print(createXMLParam(Fee, attach, tradeType, spbillCreateIp, outTradeNo, body, timeStr, xhpcSettingConfig.getWxCallbackUrl(), xhpcSettingConfig.getWxAppId(), xhpcSettingConfig.getWxMchId(), xhpcSettingConfig.getWxMchKey(), openid));
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
@ -174,7 +183,7 @@ public class WxPaymentController {
|
||||
}
|
||||
}
|
||||
//app
|
||||
Map<String, String> sign = createSign(result.toString(), Double.parseDouble(amount));
|
||||
Map<String, String> sign = createSign(result.toString(), Double.parseDouble(amount),xhpcSettingConfig.getWxMchKey());
|
||||
return AjaxResult.success(sign);
|
||||
}
|
||||
|
||||
@ -184,7 +193,7 @@ public class WxPaymentController {
|
||||
* @param result xml格式字符串
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> createSign(String result, Double amount) {
|
||||
public Map<String, String> createSign(String result, Double amount,String key) {
|
||||
try {
|
||||
Map<String, String> map = WXPayUtil.xmlToMap(result);
|
||||
String return_code = map.get("return_code");
|
||||
@ -206,7 +215,7 @@ public class WxPaymentController {
|
||||
map1.put("timestamp", timeStr);
|
||||
map1.put("sign", map.get("sign"));
|
||||
map1.put("url", map.get("code_url"));
|
||||
map1.put("key", environment.getProperty("KEY"));
|
||||
map1.put("key", key);
|
||||
return map1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -365,32 +374,43 @@ public class WxPaymentController {
|
||||
//修改充值订单状态
|
||||
iXhpcRechargeOrderService.updateRechargeOrder(xhpcRechargeOrder.getRechargeOrderId(), StatusConstants.OPERATION_WX_TYPE, StatusConstants.RECHARGE_ORDER_STATUS_SUCCESS, transaction_id);
|
||||
}
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(xhpcRechargeOrder.getUserId());
|
||||
if (StringUtils.isNotNull(appUserInfo)) {
|
||||
String balance = StringUtils.valueOf(appUserInfo.get("balance"));
|
||||
|
||||
Long userId = xhpcRechargeOrder.getUserId();
|
||||
Integer source = xhpcRechargeOrder.getSource();
|
||||
String tenantId = xhpcRechargeOrder.getTenantId();
|
||||
R user = userTypeService.getUser(null,userId, source, null, tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
String balance = StringUtils.valueOf(map.get("balance"));
|
||||
BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount());
|
||||
//判断用户是否在充电中
|
||||
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId());
|
||||
String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId(),source,tenantId);
|
||||
logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber:"+serialMumber);
|
||||
if(!"".equals(serialMumber) && serialMumber !=null){
|
||||
//充电中
|
||||
postRefreshBalance(money, serialMumber);
|
||||
//充电中
|
||||
postRefreshBalance(money, serialMumber);
|
||||
}
|
||||
if(UserTypeUtil.USER_TYPE.equals(xhpcRechargeOrder.getSource())){
|
||||
//增加用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(money);
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
|
||||
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
|
||||
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
|
||||
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
xhpcUserAccountStatement.setRemark("微信充值订单!");
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
}else{
|
||||
//增加用户余额
|
||||
userTypeService.insertUserBalance(money,userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
|
||||
}
|
||||
//增加用户余额
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcAppUser.setBalance(money);
|
||||
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
|
||||
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
|
||||
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
|
||||
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
|
||||
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
|
||||
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
|
||||
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
|
||||
xhpcUserAccountStatement.setCreateTime(new Date());
|
||||
xhpcUserAccountStatement.setRemark("微信充值订单!");
|
||||
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void postRefreshBalance(BigDecimal money, String serialMumber) {
|
||||
|
||||
@ -16,13 +16,15 @@ import com.xhpc.common.core.utils.WXPayUtil;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
import com.xhpc.payment.domain.XhpcRefundOrder;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcRefundAuditService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.payment.service.impl.XhpcUserAccountStatementServiceImpl;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.http.HttpEntity;
|
||||
@ -45,6 +47,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
@ -77,6 +80,8 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SmsService smsService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(XhpcRefundAuditController.class);
|
||||
/**
|
||||
@ -160,12 +165,16 @@ public class XhpcRefundAuditController extends BaseController {
|
||||
@PostMapping("/cancelExamine")
|
||||
@ApiOperation(value = "取消申请")
|
||||
@Transactional
|
||||
public AjaxResult cancelExamine(@RequestBody Map<String, Object> map) {
|
||||
public AjaxResult cancelExamine(HttpServletRequest request, @RequestBody Map<String, Object> map) {
|
||||
String userId = StringUtils.valueOf(map.get("userId"));
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return AjaxResult.error(HttpStatus.NOT_NULL, "用户id不能为空");
|
||||
}
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(Long.parseLong(userId));
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
Map<String, Object> refundOrder = iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId);
|
||||
if (StringUtils.isNull(refundOrder)) {
|
||||
return AjaxResult.error(HttpStatus.DATA_ERROR, "退款订单不存在");
|
||||
}
|
||||
|
||||
@ -6,12 +6,15 @@ import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
@ -25,7 +28,8 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcRefundOrderService iXhpcRefundOrderService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
/**
|
||||
* 申请退款
|
||||
*
|
||||
@ -94,8 +98,12 @@ public class XhpcRefundOrderController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/getNotRefundOrder")
|
||||
@ApiOperation(value = "用户id查询未完成退款订单")
|
||||
public AjaxResult getNotRefundOrder(@RequestParam Long userId) {
|
||||
return AjaxResult.success(iXhpcRefundOrderService.getNotRefundOrder(userId));
|
||||
public AjaxResult getNotRefundOrder(HttpServletRequest request, @RequestParam Long userId) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
Long userid = loginUser.getUserid();
|
||||
Integer userType = loginUser.getUserType();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
return AjaxResult.success(iXhpcRefundOrderService.getNotRefundOrder(userid,userType,tenantId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,100 @@
|
||||
package com.xhpc.payment.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2022/1/6 14:33
|
||||
*/
|
||||
@Data
|
||||
public class XhpcSettingConfig extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 支付设置
|
||||
*/
|
||||
private Long settingConfigId;
|
||||
|
||||
/**
|
||||
* 微信小程序id
|
||||
*/
|
||||
private String wxAppId;
|
||||
|
||||
/**
|
||||
* 微信小程序密钥
|
||||
*/
|
||||
private String wxAppSecret;
|
||||
/**
|
||||
* 微信商户id
|
||||
*/
|
||||
private String wxMchId;
|
||||
/**
|
||||
* 微信商户平台Key
|
||||
*/
|
||||
private String wxMchKey;
|
||||
/**
|
||||
* 微信小程序支付地址
|
||||
*/
|
||||
private String wxPaymentUrl;
|
||||
/**
|
||||
* 微信回调地址
|
||||
*/
|
||||
private String wxCallbackUrl;
|
||||
/**
|
||||
* 向微信用户个人付款地址
|
||||
*/
|
||||
private String wxTransfersUrl;
|
||||
/**
|
||||
* 微信证书
|
||||
*/
|
||||
private String wxApiclientCertPem;
|
||||
/**
|
||||
* 微信证书
|
||||
*/
|
||||
private String wxApiclientKeyPem;
|
||||
/**
|
||||
* 微信证书
|
||||
*/
|
||||
private String wxAppCertPublicKey;
|
||||
/**
|
||||
* 支付宝appid
|
||||
*/
|
||||
private String zfbAppId;
|
||||
/**
|
||||
* 支付宝应用私钥
|
||||
*/
|
||||
private String zfbPrivateKey;
|
||||
/**
|
||||
* 支付宝回调地址
|
||||
*/
|
||||
private String zfbCallbackUrl;
|
||||
/**
|
||||
* 支付宝应用公钥证书路径
|
||||
*/
|
||||
private String zfbAppCertPublicKey;
|
||||
/**
|
||||
* 支付宝公钥证书路径
|
||||
*/
|
||||
private String zfbAlipayCertPublicKeyRsa;
|
||||
/**
|
||||
* 支付宝根证书路径
|
||||
*/
|
||||
private String zfbAlipayRootCert;
|
||||
/**
|
||||
* 支付宝网管
|
||||
*/
|
||||
private String zhbServerUrl;
|
||||
/**
|
||||
* 1微信 2支付宝
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
*删除标志(0代表存在 1代表删除)
|
||||
*/
|
||||
private Integer delFlag;
|
||||
/**
|
||||
*租户id
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xhpc.payment.mapper;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcSettingConfig;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2022/1/6 14:31
|
||||
*/
|
||||
public interface XhpcCommonPaymentMapper {
|
||||
|
||||
/**
|
||||
* 根据租户id获取支付信息
|
||||
*/
|
||||
XhpcSettingConfig getXhpcSettingConfigTenantId(@Param("status") Integer status,@Param("tenantId") String tenantId);
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.xhpc.payment.mapper;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.common.domain.XhpcRechargeOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.xhpc.payment.mapper;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcRefundOrder;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -94,7 +94,7 @@ public interface XhpcRefundOrderMapper {
|
||||
* @param userId 用户id
|
||||
* @return 结果
|
||||
*/
|
||||
public Map<String, Object> getNotRefundOrder(@Param("userId") Long userId);
|
||||
public Map<String, Object> getNotRefundOrder(@Param("userId") Long userId,@Param("userType")Integer userType,@Param("tenantId")String tenantId);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -70,6 +70,6 @@ public interface XhpcUserAccountStatementMapper {
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
String getUserHistotyChargeOrder(@Param("userId") Long userId);
|
||||
String getUserHistotyChargeOrder(@Param("userId") Long userId,@Param("source") Integer source,@Param("tenantId")String tenantId);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.xhpc.payment.service;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcSettingConfig;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2022/1/6 14:29
|
||||
*/
|
||||
public interface IXhpcCommonPayment {
|
||||
|
||||
/**
|
||||
* 根据租户id获取支付信息
|
||||
*/
|
||||
XhpcSettingConfig getXhpcSettingConfigTenantId(Integer status,String tenantId);
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.xhpc.payment.service;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.common.domain.XhpcRechargeOrder;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
@ -76,7 +76,7 @@ public interface IXhpcRechargeOrderService {
|
||||
* @param type 充值渠道(1微信 2支付宝)
|
||||
* @return
|
||||
*/
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber);
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber,Integer userType);
|
||||
|
||||
/**
|
||||
* 修改订单状态 充值订单
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package com.xhpc.payment.service;
|
||||
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.payment.domain.XhpcRefundOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
@ -88,7 +87,7 @@ public interface IXhpcRefundOrderService {
|
||||
* @param userId 用户id
|
||||
* @return 结果
|
||||
*/
|
||||
public Map<String, Object> getNotRefundOrder(Long userId);
|
||||
public Map<String, Object> getNotRefundOrder(Long userId,Integer userType,String tenantId);
|
||||
|
||||
/**
|
||||
* 修改退款订单信息
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xhpc.payment.service.impl;
|
||||
|
||||
import com.xhpc.payment.domain.XhpcSettingConfig;
|
||||
import com.xhpc.payment.mapper.XhpcCommonPaymentMapper;
|
||||
import com.xhpc.payment.service.IXhpcCommonPayment;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2022/1/6 14:29
|
||||
*/
|
||||
@Service
|
||||
public class XhpcCommonPaymentImpl implements IXhpcCommonPayment {
|
||||
|
||||
@Autowired
|
||||
private XhpcCommonPaymentMapper xhpcCommonPaymentMapper;
|
||||
@Override
|
||||
public XhpcSettingConfig getXhpcSettingConfigTenantId(Integer status, String tenantId) {
|
||||
return xhpcCommonPaymentMapper.getXhpcSettingConfigTenantId(status, tenantId);
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,7 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.common.domain.XhpcRechargeOrder;
|
||||
import com.xhpc.payment.mapper.XhpcRechargeOrderMapper;
|
||||
import com.xhpc.payment.service.IXhpcRechargeOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -131,13 +130,14 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber) {
|
||||
public XhpcRechargeOrder addRechargeOrder(String appUserId, BigDecimal amount, String type, String orderNumber,Integer userType) {
|
||||
XhpcRechargeOrder xhpcRechargeOrder = new XhpcRechargeOrder();
|
||||
xhpcRechargeOrder.setUserId(Long.parseLong(appUserId));
|
||||
xhpcRechargeOrder.setAmount(amount);
|
||||
xhpcRechargeOrder.setRechargeOrderNumber(orderNumber);
|
||||
xhpcRechargeOrder.setType(Integer.parseInt(type));
|
||||
xhpcRechargeOrder.setCreateTime(new Date());
|
||||
xhpcRechargeOrder.setSource(userType);
|
||||
xhpcRechargeOrderMapper.insert(xhpcRechargeOrder);
|
||||
return xhpcRechargeOrder;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package com.xhpc.payment.service.impl;
|
||||
import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.payment.domain.XhpcRefundAudit;
|
||||
import com.xhpc.payment.domain.XhpcRefundOrder;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import com.xhpc.payment.mapper.XhpcRefundAuditMapper;
|
||||
import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
|
||||
import com.xhpc.payment.service.IXhpcRefundAuditService;
|
||||
|
||||
@ -8,7 +8,7 @@ import com.xhpc.common.core.constant.StatusConstants;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.payment.domain.XhpcAppUser;
|
||||
import com.xhpc.payment.domain.XhpcRefundOrder;
|
||||
import com.xhpc.common.domain.XhpcRefundOrder;
|
||||
import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
|
||||
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
|
||||
import com.xhpc.payment.service.IXhpcRefundOrderService;
|
||||
@ -171,8 +171,8 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getNotRefundOrder(Long userId) {
|
||||
return xhpcRefundOrderMapper.getNotRefundOrder(userId);
|
||||
public Map<String, Object> getNotRefundOrder(Long userId,Integer userType,String tenantId) {
|
||||
return xhpcRefundOrderMapper.getNotRefundOrder(userId,userType,tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -28,7 +28,7 @@ logging:
|
||||
com.xhpc.order.mapper: debug
|
||||
|
||||
##获取微信openid地址
|
||||
WXGETJSCODE: "https://api.weixin.qq.com/sns/jscode2session?appid=wxb14ef93e9b7901f3&secret=b5c5672141b5930c30a1abee95a2dcbf&js_code="
|
||||
WXGETJSCODE: "https://api.weixin.qq.com/sns/jscode2session?appid=wxd0a48e00319ef8a7&secret=e26d9088b58e24af69411d5933cece47&js_code="
|
||||
##阿里云身份证验证地址
|
||||
VERIFYCARD: "http://idenauthen.market.alicloudapi.com/idenAuthentication"
|
||||
#阿里云身份证验证地址appcode
|
||||
@ -43,7 +43,7 @@ KEY: "sichuanxianghuakejiyouxiangongsi"
|
||||
WXPAYUNIFIEDORDER: "https://api.mch.weixin.qq.com/pay/unifiedorder"
|
||||
#微信支付回调地址
|
||||
SERVERDOMAIN: "http://www.scxhua.cn/prod-api/xhpc-payment/wx/paymentCallback"
|
||||
#微信小程序支付地址
|
||||
#向微信用户个人付款
|
||||
WXTRANSFERS: "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"
|
||||
|
||||
#支付宝支付回调地址
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.payment.mapper.XhpcCommonPaymentMapper">
|
||||
|
||||
<resultMap type="com.xhpc.payment.domain.XhpcSettingConfig" id="XhpcSettingConfigResult">
|
||||
|
||||
<result column="setting_config_id" property="settingConfigId"/>
|
||||
<result column="wx_app_id" property="wxAppId"/>
|
||||
<result column="wx_app_secret" property="wxAppSecret"/>
|
||||
<result column="wx_mch_id" property="wxMchId"/>
|
||||
<result column="wx_mch_key" property="wxMchKey"/>
|
||||
<result column="wx_payment_url" property="wxPaymentUrl"/>
|
||||
<result column="wx_callback_url" property="wxCallbackUrl"/>
|
||||
<result column="wx_transfers_url" property="wxTransfersUrl"/>
|
||||
<result column="wx_apiclient_cert_pem" property="wxApiclientCertPem"/>
|
||||
<result column="wx_apiclient_key_pem" property="wxApiclientKeyPem"/>
|
||||
<result column="wx_app_cert_public_key" property="wxAppCertPublicKey"/>
|
||||
<result column="zfb_app_id" property="zfbAppId"/>
|
||||
<result column="zfb_private_key" property="zfbPrivateKey"/>
|
||||
<result column="zfb_callback_url" property="zfbCallbackUrl"/>
|
||||
<result column="zfb_app_cert_public_key" property="zfbAppCertPublicKey"/>
|
||||
<result column="zfb_app_cert_public_key" property="zfbAlipayCertPublicKeyRsa"/>
|
||||
<result column="zfb_alipay_root_cert" property="zfbAlipayRootCert"/>
|
||||
<result column="zhb_server_url" property="zhbServerUrl"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getXhpcSettingConfigTenantId" resultMap="XhpcSettingConfigResult">
|
||||
select * from xhpc_setting_config where del_flag =0 and status=#{status} and tenant_id=#{tenantId} limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
@ -4,7 +4,7 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.payment.mapper.XhpcRechargeOrderMapper">
|
||||
|
||||
<resultMap type="com.xhpc.payment.domain.XhpcRechargeOrder" id="XhpcRechargeOrderResult">
|
||||
<resultMap type="com.xhpc.common.domain.XhpcRechargeOrder" id="XhpcRechargeOrderResult">
|
||||
<result column="recharge_order_id" property="rechargeOrderId" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="recharge_order_number" property="rechargeOrderNumber"/>
|
||||
@ -22,7 +22,7 @@
|
||||
<result column="source" property="source" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.xhpc.payment.domain.XhpcRechargeOrder" useGeneratedKeys="true"
|
||||
<insert id="insert" parameterType="com.xhpc.common.domain.XhpcRechargeOrder" useGeneratedKeys="true"
|
||||
keyProperty="rechargeOrderId">
|
||||
INSERT INTO xhpc_recharge_order
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@ -115,7 +115,7 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.xhpc.payment.domain.XhpcRechargeOrder">
|
||||
<update id="update" parameterType="com.xhpc.common.domain.XhpcRechargeOrder">
|
||||
UPDATE xhpc_recharge_order
|
||||
<set>
|
||||
<if test="null != userId and '' != userId">user_id = #{userId},</if>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.payment.mapper.XhpcRefundOrderMapper">
|
||||
|
||||
<resultMap type="com.xhpc.payment.domain.XhpcRefundOrder" id="XhpcRefundOrderResult">
|
||||
<resultMap type="com.xhpc.common.domain.XhpcRefundOrder" id="XhpcRefundOrderResult">
|
||||
<result column="refund_order_id" property="refundOrderId"/>
|
||||
<result column="refund_order_number" property="refundOrderNumber"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
@ -28,7 +28,7 @@
|
||||
<result column="trans_pay_time" property="transPayTime" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="com.xhpc.payment.domain.XhpcRefundOrder" useGeneratedKeys="true"
|
||||
<insert id="insert" parameterType="com.xhpc.common.domain.XhpcRefundOrder" useGeneratedKeys="true"
|
||||
keyProperty="refundOrderId">
|
||||
INSERT INTO xhpc_refund_order
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@ -127,7 +127,7 @@
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.xhpc.payment.domain.XhpcRefundOrder">
|
||||
<update id="update" parameterType="com.xhpc.common.domain.XhpcRefundOrder">
|
||||
UPDATE xhpc_refund_order
|
||||
<set>
|
||||
<if test="null != refundOrderNumber and '' != refundOrderNumber">refund_order_number =#{refundOrderNumber},</if>
|
||||
@ -153,7 +153,7 @@
|
||||
WHERE refund_order_id = #{refundOrderId}
|
||||
</update>
|
||||
|
||||
<update id="updateStatus" parameterType="com.xhpc.payment.domain.XhpcRefundOrder">
|
||||
<update id="updateStatus" parameterType="com.xhpc.common.domain.XhpcRefundOrder">
|
||||
UPDATE xhpc_refund_order
|
||||
<set>
|
||||
<if test="null != status">status = #{status},</if>
|
||||
@ -162,7 +162,7 @@
|
||||
WHERE refund_order_id = #{refundOrderId} and examine_status = 0
|
||||
</update>
|
||||
|
||||
<update id="updateExamineStatus" parameterType="com.xhpc.payment.domain.XhpcRefundOrder">
|
||||
<update id="updateExamineStatus" parameterType="com.xhpc.common.domain.XhpcRefundOrder">
|
||||
UPDATE xhpc_refund_order
|
||||
<set>
|
||||
<if test="null != status">examine_status = #{examineStatus},</if>
|
||||
@ -233,6 +233,9 @@
|
||||
<if test="type != null ">
|
||||
and xro.type = #{type}
|
||||
</if>
|
||||
<if test="userId != null ">
|
||||
and xro.user_id = #{userId}
|
||||
</if>
|
||||
ORDER BY xro.create_time DESC
|
||||
</select>
|
||||
|
||||
@ -279,15 +282,20 @@
|
||||
select xro.refund_order_id refundOrderId ,xro.refund_order_number refundOrderNumber,
|
||||
xro.alipay_id alipayId ,xro.open_id openId,xro.user_id userId,xro.amount,
|
||||
xro.type,xro.examine_status examineStatus,xro.`status`,xro.create_time createTime,
|
||||
xro.source source,xau.phone,sdd.dict_label statusName,sdds.dict_label examineStatusName
|
||||
xro.source source,sdd.dict_label statusName,sdds.dict_label examineStatusName
|
||||
from xhpc_refund_order xro
|
||||
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xro.user_id
|
||||
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'refund_order_status' and sdd.dict_value = xro.`status`
|
||||
LEFT JOIN sys_dict_data sdds on sdds.`dict_type` = 'refund_examine_status' and sdds.dict_value =
|
||||
xro.examine_status
|
||||
where xro.del_flag = 0 and xro.examine_status = 0 and xro.status = 0
|
||||
<if test="userId != null and userId != ''">
|
||||
and xau.app_user_id = #{userId}
|
||||
and xro.user_id = #{userId}
|
||||
</if>
|
||||
<if test="tenantId != null and tenantId != ''">
|
||||
and xro.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="userType != null">
|
||||
and xro.source = #{userType}
|
||||
</if>
|
||||
ORDER BY xro.create_time DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
@ -193,6 +193,6 @@
|
||||
select
|
||||
serial_number as serialMumber
|
||||
from xhpc_terminal
|
||||
where terminal_id =(select terminal_id from xhpc_charge_order where user_id = #{userId} and status=0 and del_flag =0 limit 1)
|
||||
where terminal_id =(select terminal_id from xhpc_charge_order where user_id = #{userId} and source=#{source} and tenant_id=#{tenantId} and status=0 and del_flag =0 limit 1)
|
||||
</select>
|
||||
</mapper>
|
||||
@ -13,4 +13,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface XhpcMessageMapper {
|
||||
|
||||
int insertItemsBy(XhpcMessage xhpcMessage);
|
||||
|
||||
// void deleteByLastThreeMonth(String expireDate);
|
||||
|
||||
void deleteByLastThreeMonth(String expireDate);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.pp.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
@ -7,7 +8,10 @@ import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.logic.RateModelRequestLogic;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.server.ChargingPileServer;
|
||||
import com.xhpc.pp.utils.HexUtils;
|
||||
import com.xhpc.pp.utils.security.CRCCalculator;
|
||||
@ -20,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
@ -41,6 +46,10 @@ public class ChargingController {
|
||||
|
||||
@Autowired
|
||||
private PowerPileService powerPileService;
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
private static final List<String> etable = Arrays.asList((new String[]{"离线", "故障"}).clone());
|
||||
|
||||
@PostMapping("test/pile/charging/order")
|
||||
@ -328,6 +337,15 @@ public class ChargingController {
|
||||
String msg = HexUtils.toHex(data);
|
||||
msg = msg.concat(CRCCalculator.calcCrc(msg));
|
||||
log.debug("start charging order[{}], send msg >>>> |{}|", startChargingData.getOrderNo(), msg);
|
||||
|
||||
// 写入设备日志表数据
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(startChargingData.getPileNo());
|
||||
deviceMessage.setRemark("平台下发开机指令");
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent(msg);
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return HexUtils.toBytes(msg);
|
||||
}
|
||||
|
||||
@ -341,6 +359,14 @@ public class ChargingController {
|
||||
String msg = HexUtils.toHex(data);
|
||||
msg = msg.concat(CRCCalculator.calcCrc(msg));
|
||||
log.debug("stop charging, send msg to terminal ({}) >>>> {}", connectorId, msg);
|
||||
// 写入设备日志表数据
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(StrUtil.sub(connectorId, 0, -2));
|
||||
deviceMessage.setRemark("平台下发停机指令");
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent(msg.toString());
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return HexUtils.toBytes(msg);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xhpc.pp.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class XhpcDeviceMessage {
|
||||
|
||||
private Long deviceMessageId;
|
||||
|
||||
private String type;
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
private String content;
|
||||
|
||||
private String replyContent;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.data.up.BalanceUpdateReplyData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -18,6 +22,9 @@ public class BalanceUpdateReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BalanceUpdateReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -25,6 +32,16 @@ public class BalanceUpdateReplyDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
BalanceUpdateReplyData balanceUpdateReplyData = objectMapper.convertValue(req, BalanceUpdateReplyData.class);
|
||||
log.debug("balanceUpdateResult({}) [{}]", balanceUpdateReplyData.getPileNo(), balanceUpdateReplyData.getModifyResult());
|
||||
|
||||
String remark = "充电桩余额更新应答";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.domain.XhpcMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -20,16 +24,26 @@ public class BmsChargerInterruptDataLogic implements ServiceLogic {
|
||||
private static final Logger log = LoggerFactory.getLogger(BmsChargerInterruptDataLogic.class);
|
||||
@Autowired
|
||||
private XhpcMessageMapper xhpcMessageMapper;
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
String remark = "充电桩与 BMS 充电阶段充电机中止报文";
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
XhpcMessage msg = new XhpcMessage();
|
||||
msg.setContent((String) req.get("hex"));
|
||||
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||
msg.setRemark("充电桩与 BMS 充电阶段充电机中止报文");
|
||||
msg.setRemark(remark);
|
||||
xhpcMessageMapper.insertItemsBy(msg);
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.domain.XhpcMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -21,15 +25,28 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
|
||||
@Autowired
|
||||
private XhpcMessageMapper xhpcMessageMapper;
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
String remark = "充电桩与 BMS 充电结束阶段报文";
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
XhpcMessage msg = new XhpcMessage();
|
||||
msg.setContent((String) req.get("hex"));
|
||||
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||
msg.setRemark("充电桩与 BMS 充电结束阶段报文");
|
||||
msg.setRemark(remark);
|
||||
xhpcMessageMapper.insertItemsBy(msg);
|
||||
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.domain.XhpcMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -21,15 +25,28 @@ public class BmsChargingConfigDataLogic implements ServiceLogic {
|
||||
@Autowired
|
||||
private XhpcMessageMapper xhpcMessageMapper;
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
String remark = "充电桩与 BMS 参数配置阶段报文";
|
||||
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
XhpcMessage msg = new XhpcMessage();
|
||||
msg.setContent((String) req.get("hex"));
|
||||
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||
msg.setRemark("充电桩与 BMS 参数配置阶段报文");
|
||||
msg.setRemark(remark);
|
||||
xhpcMessageMapper.insertItemsBy(msg);
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.domain.XhpcMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -21,15 +25,28 @@ public class BmsChargingHandshakeDataLogic implements ServiceLogic {
|
||||
@Autowired
|
||||
private XhpcMessageMapper xhpcMessageMapper;
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
String remark = "充电桩与 BMS 充电握手阶段报文";
|
||||
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
XhpcMessage msg = new XhpcMessage();
|
||||
msg.setContent((String) req.get("hex"));
|
||||
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||
msg.setRemark("充电桩与 BMS 充电握手阶段报文");
|
||||
msg.setRemark(remark);
|
||||
xhpcMessageMapper.insertItemsBy(msg);
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.domain.XhpcMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -20,16 +24,26 @@ public class BmsErrorDataLogic implements ServiceLogic {
|
||||
private static final Logger log = LoggerFactory.getLogger(BmsErrorDataLogic.class);
|
||||
@Autowired
|
||||
private XhpcMessageMapper xhpcMessageMapper;
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
String remark = "充电桩与 BMS 充电错误报文";
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
XhpcMessage msg = new XhpcMessage();
|
||||
msg.setContent((String) req.get("hex"));
|
||||
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||
msg.setRemark("充电桩与 BMS 充电错误报文");
|
||||
msg.setRemark(remark);
|
||||
xhpcMessageMapper.insertItemsBy(msg);
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.mapper.XhpcMessageMapper;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.domain.XhpcMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -20,16 +24,27 @@ public class BmsInterruptDataLogic implements ServiceLogic {
|
||||
private static final Logger log = LoggerFactory.getLogger(BmsInterruptDataLogic.class);
|
||||
@Autowired
|
||||
private XhpcMessageMapper xhpcMessageMapper;
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
String remark = "充电桩与 BMS 充电阶段 BMS 中止报文";
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
XhpcMessage msg = new XhpcMessage();
|
||||
msg.setContent((String) req.get("hex"));
|
||||
msg.setChargeOrderNo((String) req.get("orderNo"));
|
||||
msg.setRemark("充电桩与 BMS 充电阶段 BMS 中止报文");
|
||||
msg.setRemark(remark);
|
||||
xhpcMessageMapper.insertItemsBy(msg);
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -8,16 +11,30 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Lazy
|
||||
@Component("OfflineCardEraseReplyDataLogic")
|
||||
public class OfflineCardEraseReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(OfflineCardEraseReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
//todo
|
||||
String remark = "充电桩下发离线卡数据清除";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) sp.getParameters().get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -8,16 +11,29 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Lazy
|
||||
@Component("OfflineCardInquiryReplyDataLogic")
|
||||
public class OfflineCardInquiryReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(OfflineCardInquiryReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
//todo
|
||||
String remark = "充电桩下发离线卡数据查询";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) sp.getParameters().get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.data.up.OfflineCardSyncReplyData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -18,6 +22,9 @@ public class OfflineCardSyncReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(OfflineCardSyncReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -25,6 +32,14 @@ public class OfflineCardSyncReplyDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
OfflineCardSyncReplyData offlineCardSyncReplyData = objectMapper.convertValue(req, OfflineCardSyncReplyData.class);
|
||||
//todo
|
||||
String remark = "充电桩下发离线卡数据同步应答";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.data.up.PileConfigReplyData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -18,6 +22,9 @@ public class PileConfigReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(PileConfigReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -25,6 +32,14 @@ public class PileConfigReplyDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
PileConfigReplyData pileConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
|
||||
//todo
|
||||
String remark = "充电桩工作参数设置";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.data.up.PileStartChargingData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -18,6 +22,9 @@ public class PileStartChargingDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(PileStartChargingDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -25,6 +32,14 @@ public class PileStartChargingDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
PileStartChargingData pileStartChargingData = objectMapper.convertValue(req, PileStartChargingData.class);
|
||||
//todo
|
||||
String remark = "充电桩主动申请起动充电";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,9 @@ package com.xhpc.pp.logic;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.data.up.PileTimeConfigReplyData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
|
||||
@ -23,6 +27,9 @@ public class PileTimeConfigReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PileTimeConfigReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -36,6 +43,15 @@ public class PileTimeConfigReplyDataLogic implements ServiceLogic {
|
||||
cachePile.put("configTime", configTime);
|
||||
REDIS.setCacheMap(pk, cachePile);
|
||||
log.debug("({}) set time success√: [{}]", pileNo, configTime);
|
||||
|
||||
String remark = "充电桩同步时钟";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,9 @@ package com.xhpc.pp.logic;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.data.up.PileConfigReplyData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
@ -22,6 +26,9 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(RateModelConfigReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -29,6 +36,8 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
PileConfigReplyData pileRateModelConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
|
||||
String configResult = pileRateModelConfigReplyData.getConfigResult();
|
||||
|
||||
String result = FAIL;
|
||||
if (HEX_01.equals(configResult)) {
|
||||
// 确定设置成功的rateModelId 可能涉及协议修改
|
||||
final String pkey = "pile:".concat(pileRateModelConfigReplyData.getPileNo());
|
||||
@ -36,9 +45,20 @@ public class RateModelConfigReplyDataLogic implements ServiceLogic {
|
||||
ChargingStationDto cacheStation = REDIS.getCacheObject("station:".concat(cachePile.get("stationId").toString()));
|
||||
cachePile.put("rateModelId", cacheStation.getRateModelId());
|
||||
REDIS.setCacheMap(pkey, cachePile);
|
||||
return new ServiceResult(OK);
|
||||
result = OK;
|
||||
}
|
||||
return new ServiceResult(FAIL);
|
||||
|
||||
String remark = "充电桩收到计费模型应答";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessage.setReplyContent(result);
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -14,6 +17,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
@ -26,6 +30,9 @@ public class RateModelRequestLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(RateModelRequestLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -42,6 +49,16 @@ public class RateModelRequestLogic implements ServiceLogic {
|
||||
return new ServiceResult((byte[]) null, ServiceResult.FAIL, json);
|
||||
}
|
||||
String resultStr = translate(pileNo, stationRateModelId, "000A");
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(pileNo);
|
||||
deviceMessage.setRemark("充电桩计费模型请求");
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessage.setReplyContent(resultStr);
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(HexUtils.toBytes(resultStr), ServiceResult.OK);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
@ -23,6 +27,9 @@ public class RateModelValidateLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(RateModelValidateLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -58,6 +65,16 @@ public class RateModelValidateLogic implements ServiceLogic {
|
||||
String resultStr =
|
||||
"680E".concat(seq).concat("0006").concat(pileNo).concat(String.format("%04X", csRateModelId)).concat(hexCode);
|
||||
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(pileNo);
|
||||
deviceMessage.setRemark("计费模型验证请求");
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessage.setReplyContent(resultStr);
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(HexUtils.toBytes(resultStr), resultCode);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
package com.xhpc.pp.logic;
|
||||
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.evcs.dto.ConnectorStatusInfo;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -11,6 +14,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -27,6 +31,9 @@ public class RegisterLogic implements ServiceLogic {
|
||||
public static final String REGISTERED = "已注册";
|
||||
private static final Logger log = LoggerFactory.getLogger(RegisterLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -76,6 +83,17 @@ public class RegisterLogic implements ServiceLogic {
|
||||
String seq = seqHex(skey);
|
||||
String resultStr = "680C".concat(seq).concat("0002").concat(pileNo).concat(hexCode);
|
||||
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
|
||||
|
||||
// 写入设备日志表数据
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(pileNo);
|
||||
deviceMessage.setRemark("充电桩登录认证");
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessage.setReplyContent(resultStr);
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(HexUtils.toBytes(resultStr), resultCode);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.data.up.PileConfigReplyData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -18,6 +22,9 @@ public class RemoteRestartReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(RemoteRestartReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -25,6 +32,15 @@ public class RemoteRestartReplyDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
PileConfigReplyData pileConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
|
||||
//todo
|
||||
String remark = "充电桩收到远程重启应答";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@ package com.xhpc.pp.logic;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.data.up.PileConfigReplyData;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import com.xhpc.pp.tx.ServiceParameter;
|
||||
import com.xhpc.pp.tx.ServiceResult;
|
||||
import com.xhpc.pp.tx.logic.ServiceLogic;
|
||||
@ -10,6 +13,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Lazy
|
||||
@ -18,6 +22,9 @@ public class RemoteUpgradeReplyDataLogic implements ServiceLogic {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(RemoteUpgradeReplyDataLogic.class);
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
|
||||
@ -25,6 +32,16 @@ public class RemoteUpgradeReplyDataLogic implements ServiceLogic {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
PileConfigReplyData pileRateModelConfigReplyData = objectMapper.convertValue(req, PileConfigReplyData.class);
|
||||
//todo
|
||||
|
||||
String remark = "充电桩收到远程更新应答";
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
deviceMessage.setSerialNumber(sp.getPileNo());
|
||||
deviceMessage.setRemark(remark);
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.xhpc.pp.mapper;
|
||||
|
||||
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface XhpcDeviceMessageMapper {
|
||||
|
||||
int insertByDomain(XhpcDeviceMessage xhpcDeviceMessage);
|
||||
|
||||
|
||||
void deleteByLastThreeMonth(String expireDate);
|
||||
}
|
||||
@ -1,8 +1,14 @@
|
||||
package com.xhpc.pp.server;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.pp.domain.XhpcDeviceMessage;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -15,6 +21,9 @@ import static com.xhpc.pp.logic.RegisterLogic.DISCONNECTED;
|
||||
@Component
|
||||
public class HBCheckTask {
|
||||
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
|
||||
@Scheduled(fixedRate = 10000)
|
||||
protected void run() {
|
||||
|
||||
@ -29,6 +38,16 @@ public class HBCheckTask {
|
||||
cacheGun.put("statusInt", OFF_LINE);
|
||||
cacheGun.put("status", DISCONNECTED);
|
||||
REDIS.setCacheMap(gunkey, cacheGun);
|
||||
|
||||
XhpcDeviceMessage deviceMessage = new XhpcDeviceMessage();
|
||||
deviceMessage.setType(StationDeviceEnum.PILE.getCode());
|
||||
|
||||
String pileId= StrUtil.sub(gunkey.substring(gunkey.lastIndexOf(":") + 1), 0, -2);
|
||||
deviceMessage.setSerialNumber(pileId);
|
||||
deviceMessage.setContent(JSON.toJSONString(cacheGun));
|
||||
deviceMessage.setStatus(0);
|
||||
deviceMessage.setRemark("充电桩心跳掉线");
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.xhpc.pp.server;
|
||||
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.xhpc.common.util.DateUtil;
|
||||
import com.xhpc.mapper.XhpcMessageMapper;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
public class MessageCLeanTask {
|
||||
|
||||
@Resource
|
||||
XhpcMessageMapper messageMapper;
|
||||
|
||||
/**
|
||||
* 每天定时清理message表三个月前的数据
|
||||
*/
|
||||
@Scheduled(cron = "0 0 05 1/1 * ?")
|
||||
private void run(){
|
||||
|
||||
String expireDate = DateUtil.date2String(DateUtil.addDay(new Date(), -90), DateUtil.DATE_FORMAT_DATE_TIME) ;
|
||||
messageMapper.deleteByLastThreeMonth(expireDate);
|
||||
|
||||
}
|
||||
}
|
||||
@ -18,10 +18,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.31.183.135:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.31.183.135:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.pp.mapper.XhpcDeviceMessageMapper">
|
||||
|
||||
<resultMap type="com.xhpc.pp.domain.XhpcDeviceMessage" id="XhpcDeviceMessageResult">
|
||||
<id property="deviceMessageId" column="device_message_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="serialNumber" column="serial_number"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="replyContent" column="reply_content"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertByDomain" parameterType="com.xhpc.pp.domain.XhpcDeviceMessage">
|
||||
insert into xhpc_device_message(
|
||||
<if test="type != null and type != 0">type,</if>
|
||||
<if test="serialNumber != null and serialNumber != 0">serial_number,</if>
|
||||
<if test="content != null and content != ''">content,</if>
|
||||
<if test="replyContent != null and replyContent != ''">reply_content,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
create_time,
|
||||
update_time
|
||||
)values(
|
||||
<if test="type != null and type != 0">#{type},</if>
|
||||
<if test="serialNumber != null and serialNumber != 0">#{serialNumber},</if>
|
||||
<if test="content != null and content != ''">#{content},</if>
|
||||
<if test="replyContent != null and replyContent != ''">#{replyContent},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||
sysdate(),
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByLastThreeMonth">
|
||||
delete from xhpc_message
|
||||
where create_time <![CDATA[ <= ]]> #{expireDate};
|
||||
</delete>
|
||||
</mapper>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user