From b02f0bfdf3d505a3b3d265dc52f392e07c5eb388 Mon Sep 17 00:00:00 2001 From: panshuling321 Date: Thu, 14 Apr 2022 17:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=85=E5=88=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/v2.1.sql | 136 +++- xhpc-modules/pom.xml | 1 + xhpc-modules/xhpc-clearing/.gitignore | 35 + xhpc-modules/xhpc-clearing/pom.xml | 136 ++++ .../com/xhpc/XhpcClearingApplication.java | 28 + .../clearing/config/AliOSSProperties.java | 24 + .../XhpcClearingBankController.java | 95 +++ .../XhpcClearingCheckoutController.java | 125 ++++ .../XhpcClearingHistoryOrderController.java | 135 ++++ .../domain/XhpcClearingBankDomain.java | 106 +++ .../domain/XhpcClearingCheckoutDomain.java | 101 +++ .../XhpcClearingHistoryOrderDomain.java | 305 +++++++++ .../domain/XhpcClearingReceiptDomain.java | 49 ++ .../domain/XhpcHistoryOrderDomain.java | 277 ++++++++ .../mapper/XhpcClearingBankMapper.java | 28 + .../mapper/XhpcClearingCheckoutMapper.java | 34 + .../XhpcClearingHistoryOrderMapper.java | 53 ++ .../mapper/XhpcClearingReceiptMapper.java | 18 + .../mapper/XhpcHistoryOrderMapper.java | 24 + .../service/XhpcClearingBankService.java | 23 + .../service/XhpcClearingCheckoutService.java | 35 + .../XhpcClearingHistoryOrderService.java | 23 + .../impl/XhpcClearingBankServiceImpl.java | 136 ++++ .../impl/XhpcClearingCheckoutServiceImpl.java | 320 +++++++++ .../XhpcClearingHistoryOrderServiceImpl.java | 172 +++++ .../clearing/task/SyncHistoryOrderTask.java | 54 ++ .../com/xhpc/clearing/utils/DownloadUtil.java | 20 + .../com/xhpc/clearing/vo/CheckoutBankVo.java | 70 ++ .../com/xhpc/clearing/vo/ClearingOrderVo.java | 25 + .../xhpc/clearing/vo/ClearingReceiptVo.java | 18 + .../src/main/resources/banner.txt | 9 + .../src/main/resources/bootstrap.yml | 34 + .../src/main/resources/logback.xml | 75 +++ .../mapper/XhpcClearingBankMapper.xml | 132 ++++ .../mapper/XhpcClearingCheckoutMapper.xml | 157 +++++ .../mapper/XhpcClearingHistoryOrderMapper.xml | 609 ++++++++++++++++++ .../mapper/XhpcClearingReceiptMapper.xml | 51 ++ .../mapper/XhpcHistoryOrderMapper.xml | 107 +++ 38 files changed, 3776 insertions(+), 4 deletions(-) create mode 100644 xhpc-modules/xhpc-clearing/.gitignore create mode 100644 xhpc-modules/xhpc-clearing/pom.xml create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/XhpcClearingApplication.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/config/AliOSSProperties.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingBankController.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingCheckoutController.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingHistoryOrderController.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingBankDomain.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingCheckoutDomain.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingHistoryOrderDomain.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingReceiptDomain.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcHistoryOrderDomain.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingBankMapper.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingCheckoutMapper.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingHistoryOrderMapper.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingReceiptMapper.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcHistoryOrderMapper.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingBankService.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingCheckoutService.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingHistoryOrderService.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingBankServiceImpl.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingCheckoutServiceImpl.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingHistoryOrderServiceImpl.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/task/SyncHistoryOrderTask.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/utils/DownloadUtil.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/CheckoutBankVo.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingOrderVo.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingReceiptVo.java create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/banner.txt create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/bootstrap.yml create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/logback.xml create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingBankMapper.xml create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingReceiptMapper.xml create mode 100644 xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcHistoryOrderMapper.xml diff --git a/sql/v2.1.sql b/sql/v2.1.sql index 15caf122..c00c916c 100644 --- a/sql/v2.1.sql +++ b/sql/v2.1.sql @@ -687,7 +687,7 @@ CREATE TABLE `t_iccard_client_users` `corpNo` VARCHAR(10) NOT NULL DEFAULT '0' COMMENT '所属运营商前缀' COLLATE 'utf8mb4_bin', `corpName` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT '所属运营商名称' COLLATE 'utf8mb4_bin', `usersTime` DATETIME NULL DEFAULT NULL COMMENT '添加日期', - `status` smallint(4) DEFAULT '0' COMMENT '状态(0-正常,1-冻结)', + `status` smallint(4) DEFAULT '0' COMMENT '状态(0-正常,1-冻结)', PRIMARY KEY (`usersID`), UNIQUE INDEX `usersName` (`usersName`) ) COMMENT ='发卡客户端用户表' @@ -808,8 +808,8 @@ CREATE TABLE `xhpc_activity_cash` `start_time` datetime DEFAULT NULL COMMENT '开始时间', `end_time` datetime DEFAULT NULL COMMENT '结束时间', `receive_count` int(9) DEFAULT '0' COMMENT '领取次数', - `auto_receive` smallint(2) DEFAULT '0' COMMENT '是否自动领取(0-否,1-是)', - `auto_status` smallint(2) DEFAULT '0' COMMENT '是否自动发送完成(0-未完成,1-已完成)', + `auto_receive` smallint(2) DEFAULT '0' COMMENT '是否自动领取(0-否,1-是)', + `auto_status` smallint(2) DEFAULT '0' COMMENT '是否自动发送完成(0-未完成,1-已完成)', `amount` decimal(4, 2) DEFAULT '0' COMMENT '红包金额', `app_user_list` text COMMENT 'C端用户ID(-1表示全部)', `com_user_list` text COMMENT '社区用户ID列表(-1表示全部)', @@ -881,7 +881,8 @@ CREATE TABLE `xhpc_activity_formula` `activity_id` int(11) DEFAULT NULL COMMENT '活动ID', `start_time` time DEFAULT NULL COMMENT '开始时间', `end_time` time DEFAULT NULL COMMENT '结束时间', - `service_price` decimal(10, 2) DEFAULT NULL COMMENT '服务费', + `power_price` decimal(10, 2) DEFAULT NULL COMMENT '电费', + `service_price` decimal(10, 2) DEFAULT null COMMENT '服务费', `compute_formula` varchar(200) DEFAULT NULL COMMENT '计算公式', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', @@ -912,6 +913,7 @@ CREATE TABLE `xhpc_activity_internet` `internet_name` varchar(64) DEFAULT NULL COMMENT '流量方名称', `compute_type` smallint(4) DEFAULT NULL COMMENT '计算类型(1-总金额,2-服务费,3-电量)', `compute_formula` varchar(200) DEFAULT NULL COMMENT '默认计算公式', + `power_price` decimal(10, 2) DEFAULT NULL COMMENT '默认电费', `service_price` decimal(10, 2) DEFAULT NULL COMMENT '默认服务费', `start_time` datetime DEFAULT NULL COMMENT '开始时间', `end_time` datetime DEFAULT NULL COMMENT '结束时间', @@ -941,3 +943,129 @@ CREATE TABLE `xhpc_activity_record` PRIMARY KEY (`activity_record_id`) ) ENGINE=InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET=utf8mb4 COMMENT='活动参与领取表'; + +CREATE TABLE `xhpc_clearing_bank` +( + `clearing_bank_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '提现银行记录ID', + `operator_id` bigint(20) DEFAULT NULL COMMENT '运营商ID', + `operator_name` varchar(200) DEFAULT NULL COMMENT '运营商名称', + `area_code` int(10) DEFAULT NULL COMMENT '地址code', + `bank_name` varchar(200) DEFAULT NULL COMMENT '开户行名称', + `operator_account` varchar(200) DEFAULT NULL COMMENT '运营商收款账户名称', + `bank_no` varchar(64) DEFAULT NULL COMMENT '收款卡号', + `address` varchar(200) DEFAULT NULL COMMENT '地址', + `contact_name` varchar(64) DEFAULT NULL COMMENT '联系人', + `contact_phone` varchar(16) DEFAULT NULL COMMENT '联系电话', + `remark` varchar(255) DEFAULT NULL COMMENT '备注', + `status` int(6) DEFAULT NULL COMMENT '状态(1-正常)', + `del_flag` int(6) DEFAULT NULL COMMENT '是否删除(0-正常,2-已删除)', + `tenant_id` varchar(16) DEFAULT NULL COMMENT '租户ID', + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`clearing_bank_id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='清分提现银行账户信息表'; + + + +CREATE TABLE `xhpc_clearing_checkout` +( + `clearing_checkout_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '结算记录ID', + `clearing_bank_id` bigint(20) DEFAULT NULL COMMENT '收款账号信息', + `apply_amount` decimal(10, 2) DEFAULT NULL COMMENT '申请金额', + `handling_fee` decimal(10, 2) DEFAULT NULL COMMENT '手续费', + `bank_fee` decimal(10, 2) DEFAULT NULL COMMENT '银行手续费', + `received_amount` decimal(10, 2) DEFAULT NULL COMMENT '到账金额', + `status` int(6) DEFAULT NULL COMMENT '状态(0-已审核待清分,1-提现中,2-审核失败,3-审核成功,4-转账失败,5-转账成功,6-提现完成)', + `del_flag` int(2) DEFAULT '0' COMMENT '删除标识(0-正常,2-删除)', + `operator_id` bigint(20) DEFAULT NULL COMMENT '运营商ID', + `tenant_id` varchar(16) DEFAULT NULL COMMENT '租户ID', + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT NULL COMMENT '更新人', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `check_by` varchar(64) DEFAULT NULL COMMENT '审核人', + `check_time` datetime DEFAULT NULL COMMENT '审核时间', + PRIMARY KEY (`clearing_checkout_id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='清分提现订单表'; + + + +CREATE TABLE `xhpc_clearing_history_order` +( + `clearing_order_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '清分订单id', + `charging_station_id` bigint(20) DEFAULT NULL COMMENT '电站id', + `charge_order_id` bigint(20) DEFAULT NULL COMMENT '充电订单id', + `user_id` bigint(20) DEFAULT NULL COMMENT '用户id', + `terminal_id` bigint(20) DEFAULT NULL COMMENT '终端id', + `serial_number` varchar(64) CHARACTER SET utf8 DEFAULT NULL COMMENT '订单编号', + `internet_serial_number` varchar(30) DEFAULT NULL COMMENT '流量方订单号', + `power_price_total` decimal(10, 2) DEFAULT NULL COMMENT '总电费', + `service_price_total` decimal(10, 2) DEFAULT NULL COMMENT '总服务费', + `total_price` decimal(10, 2) DEFAULT '0.00' COMMENT '订单总价', + `promotion_discount` decimal(10, 2) DEFAULT '0.00' COMMENT '电站活动抵扣--抵扣的总金额', + `act_price` decimal(10, 2) DEFAULT '0.00' COMMENT '实际价格-用户支付的钱', + `act_power_price` decimal(10, 2) DEFAULT '0.00' COMMENT '实收电费-运营商电费', + `act_service_price` decimal(10, 2) DEFAULT '0.00' COMMENT '实收服务费-运营商服务费', + `internet_commission` decimal(10, 2) DEFAULT '0.00' COMMENT '流量方总金额抽成', + `internet_svc_commission` decimal(10, 2) DEFAULT '0.00' COMMENT '流量方服务费抽成', + `platform_commission` decimal(10, 2) DEFAULT '0.00' COMMENT '平台总金额抽成', + `platform_svc_commisssion` decimal(10, 2) DEFAULT '0.00' COMMENT '平台服务费抽成', + `operation_commission` decimal(10, 2) DEFAULT '0.00' COMMENT '运维总抽成', + `operation_svc_commission` decimal(10, 2) DEFAULT '0.00' COMMENT '运维服务费抽成', + `start_soc` varchar(10) CHARACTER SET utf8 DEFAULT NULL COMMENT '开始充电soc', + `end_soc` varchar(10) CHARACTER SET utf8 DEFAULT NULL COMMENT '结束时soc', + `reconciliation_status` int(10) DEFAULT NULL COMMENT '对账状态(0待确认 1已确认,2待提交,3待审核)', + `sorting_status` int(10) DEFAULT '0' COMMENT '清分状态(0待清分 1清分在途,2已提现,3待提交,4待审核)', + `type` tinyint(2) DEFAULT NULL COMMENT '1 自动结算 2 平台结算', + `status` int(10) DEFAULT '0' COMMENT '状态(0正常 1停用)', + `del_flag` int(2) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)', + `create_time` datetime DEFAULT NULL 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` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注', + `state` int(2) DEFAULT '0' COMMENT '0未统计 1小时统计 2 其他统计', + `vin_normal` varchar(100) DEFAULT NULL COMMENT 'VIN 码', + `search_value` varchar(255) DEFAULT NULL, + `operator_id_evcs` varchar(50) DEFAULT NULL COMMENT '运营商在EVCS分配的唯一OperatorID', + `charge_model_evcs` int(11) DEFAULT NULL COMMENT '终端客户开启充电方式', + `connector_power_evcs` double DEFAULT NULL COMMENT '接口额定功率', + `meter_value_end_evcs` double DEFAULT NULL COMMENT '电表总起值', + `meter_value_start_evcs` double DEFAULT NULL COMMENT '电表总结束值', + `operator_id3rdpty_evcs` varchar(50) DEFAULT NULL COMMENT '流量方OperatorID', + `start_time` datetime DEFAULT NULL, + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `stop_reason_evcs` int(11) DEFAULT NULL, + `total_power` double(10, 4) DEFAULT NULL COMMENT '电量', + `user_name_evcs` varchar(100) DEFAULT NULL, + `phone` varchar(50) DEFAULT NULL, + `evcs_order_no` varchar(255) DEFAULT NULL COMMENT '互联网订单流水号', + `confirm_Result` int(4) DEFAULT '-1' COMMENT '-1:未推送/推送失败 0:成功 1:争议交易 2~99:自定义', + `rate_model_id` bigint(20) DEFAULT NULL, + `charging_mode` varchar(255) DEFAULT NULL COMMENT '充电方式', + `internet_degree_commission` decimal(10,2) DEFAULT NULL COMMENT '流量方电量抽成', + `source` int(10) DEFAULT NULL COMMENT '订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户)', + `tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户id', + `operator_id` bigint(20) DEFAULT NULL COMMENT '运营商ID', + `operator_name` varchar(200) DEFAULT NULL COMMENT '运营商名称', + `clearing_checkout_id` bigint(20) DEFAULT NULL COMMENT '清算记录ID', + `check_status` int(4) DEFAULT NULL COMMENT '审核状态(0-未审核,1-审核不通过,2-审核通过)', + `check_by` varchar(64) DEFAULT NULL COMMENT '审核人', + `check_time` datetime DEFAULT NULL COMMENT '审核时间', + PRIMARY KEY (`clearing_order_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='历史订单清分审核表'; + + +CREATE TABLE `xhpc_clearing_receipt` +( + `clearing_receipt_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '回执图片ID', + `type` int(4) DEFAULT NULL COMMENT '文件类型(1-图片,2-Excel)', + `name` varchar(100) DEFAULT NULL COMMENT '文件名称', + `url` varchar(200) DEFAULT NULL COMMENT '文件地址', + `clearing_checkout_ids` varchar(200) DEFAULT NULL COMMENT '提现单ID', + `create_time` datetime DEFAULT NULL COMMENT '上传时间', + `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', + PRIMARY KEY (`clearing_receipt_id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='清分银行回执信息表'; \ No newline at end of file diff --git a/xhpc-modules/pom.xml b/xhpc-modules/pom.xml index bb11e8aa..1c0579c5 100644 --- a/xhpc-modules/pom.xml +++ b/xhpc-modules/pom.xml @@ -26,6 +26,7 @@ xhpc-tenant xhpc-activity xhpc-log + xhpc-clearing xhpc-modules diff --git a/xhpc-modules/xhpc-clearing/.gitignore b/xhpc-modules/xhpc-clearing/.gitignore new file mode 100644 index 00000000..54283dd4 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/.gitignore @@ -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/ diff --git a/xhpc-modules/xhpc-clearing/pom.xml b/xhpc-modules/xhpc-clearing/pom.xml new file mode 100644 index 00000000..4e532491 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/pom.xml @@ -0,0 +1,136 @@ + + + + com.ruoyi + xhpc-modules + 3.0.0 + + 4.0.0 + + xhpc-clearing + + + 清分服务 + + + 8 + 8 + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + org.mybatis + mybatis + 3.5.6 + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-web + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-common-datasource + + + + + com.ruoyi + ruoyi-common-core + + + + com.ruoyi + xhpc-common + 3.0.0 + compile + + + + org.apache.ant + ant + 1.10.12 + + + com.aliyun.oss + aliyun-sdk-oss + 3.10.2 + compile + + + com.ruoyi + ruoyi-common-log + + + + + + ${project.artifactId} + + + src/main/resources + + + src/main/java + + **/*.xml + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.4.0 + + + + repackage + + + + + + + + diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/XhpcClearingApplication.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/XhpcClearingApplication.java new file mode 100644 index 00000000..63d2d8cf --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/XhpcClearingApplication.java @@ -0,0 +1,28 @@ +package com.xhpc; + +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.boot.context.properties.ConfigurationPropertiesScan; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.scheduling.annotation.EnableScheduling; + + +@EnableConfigurationProperties +@ConfigurationPropertiesScan(basePackages = {"com.xhpc.clearing.config"}) +@EnableScheduling +@EnableCustomConfig +@EnableRyFeignClients +@EnableFeignClients +@SpringBootApplication +@MapperScan("com.xhpc.clearing.mapper") +public class XhpcClearingApplication { + + public static void main(String[] args) { + + SpringApplication.run(XhpcClearingApplication.class, args); + } +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/config/AliOSSProperties.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/config/AliOSSProperties.java new file mode 100644 index 00000000..c8decbc0 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/config/AliOSSProperties.java @@ -0,0 +1,24 @@ +package com.xhpc.clearing.config; + + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + + +/** + * 支付宝支付配置类 + */ +@Data +@ConfigurationProperties(prefix = "oss") +public class AliOSSProperties { + + private boolean enabled; + private String name; + private boolean tenantMode; + private String endpoint; + private String accessKey; + private String secretKey; + private String bucketName; + private String region; + private String domain; +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingBankController.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingBankController.java new file mode 100644 index 00000000..91e372c0 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingBankController.java @@ -0,0 +1,95 @@ +package com.xhpc.clearing.controller; + + +import com.xhpc.clearing.domain.XhpcClearingBankDomain; +import com.xhpc.clearing.service.XhpcClearingBankService; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.util.LogUserUtils; +import com.xhpc.system.api.model.LoginUser; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/clearing/bank") +public class XhpcClearingBankController extends BaseController { + + @Resource + XhpcClearingBankService bankService; + + @Resource + LogUserUtils logUserUtils; + + + @GetMapping("/getPage") + public TableDataInfo getPage(HttpServletRequest request, + String status) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + startPage(); + Map params = new HashMap<>(); + params.put("tenantId", loginUser.getTenantId()); + params.put("status", status); + return getDataTable(bankService.getPage(params)); + } + + + @GetMapping("/detail") + public R getDetail(@RequestParam("bankId") Long bankId) { + + return R.ok(bankService.getDomainByPk(bankId)); + } + + @Log(title = "清分管理-发送绑定银行卡验证短信", businessType = BusinessType.INSERT) + @PostMapping("/sendBindSms") + public R sendBindBankSms(String phone){ + + return R.ok(bankService.sendBindBankSms(phone)); + } + + + @Log(title = "清分管理-发送提现到银行卡验证短信", businessType = BusinessType.INSERT) + @PostMapping("/sendCashSms") + public R sendCashSms(String phone){ + + return R.ok(bankService.sendCashSms(phone)); + } + + + @Log(title = "清分管理-增加清分转账银行信息", businessType = BusinessType.INSERT) + @PostMapping("/") + public R insertDomain(HttpServletRequest request, @RequestBody XhpcClearingBankDomain domain) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + domain.setCreateBy(loginUser.getUserid().toString()); + domain.setUpdateBy(loginUser.getUserid().toString()); + domain.setTenantId(loginUser.getTenantId()); + return R.ok(bankService.insertDomain(domain)); + } + + + @Log(title = "清分管理-更新清分转账银行信息", businessType = BusinessType.UPDATE) + @PutMapping("/detail") + public R updateDomain(HttpServletRequest request, @RequestBody XhpcClearingBankDomain domain) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + domain.setUpdateBy(loginUser.getUserid().toString()); + return R.ok(bankService.updateDomain(domain)); + } + + + @Log(title = "清分管理-删除现金红包活动", businessType = BusinessType.DELETE) + @DeleteMapping("/{bankId}") + public R deleteDomainByPk(@PathVariable("bankId") Long bankId) { + + return R.ok(bankService.deleteByPk(bankId)); + } + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingCheckoutController.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingCheckoutController.java new file mode 100644 index 00000000..a3ae6054 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingCheckoutController.java @@ -0,0 +1,125 @@ +package com.xhpc.clearing.controller; + + +import com.xhpc.clearing.domain.XhpcClearingCheckoutDomain; +import com.xhpc.clearing.service.XhpcClearingCheckoutService; +import com.xhpc.clearing.vo.ClearingReceiptVo; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.util.LogUserUtils; +import com.xhpc.system.api.model.LoginUser; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/clearing/checkout") +public class XhpcClearingCheckoutController extends BaseController { + + @Resource + XhpcClearingCheckoutService checkoutService; + + @Resource + LogUserUtils logUserUtils; + + + @GetMapping("/getPage") + public TableDataInfo getPage(HttpServletRequest request, + String status, + String operatorId, + String startTime, + String endTime) { + LoginUser loginUser = logUserUtils.getLogUser(request); + startPage(); + Map params = new HashMap<>(); + params.put("tenantId", loginUser.getTenantId()); + params.put("status", status); + params.put("operatorId", operatorId); + params.put("startTime", startTime); + params.put("endTime", endTime); + return getDataTable(checkoutService.getPage(params)); + } + + + @GetMapping("/detail") + public R getDetail(@RequestParam("checkoutId") Long checkoutId) { + return R.ok(checkoutService.getDomainByPk(checkoutId)); + } + + + @GetMapping("/temp") + public R getTmpCheckoutData(HttpServletRequest request) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + return R.ok(checkoutService.getTmpCheckoutData(loginUser.getSysUser().getOperatorId())); + } + + + @Log(title = "清分管理-新增提现申请", businessType = BusinessType.INSERT) + @PostMapping("/") + public R insertDomain(HttpServletRequest request, @RequestBody XhpcClearingCheckoutDomain domain) { + + LoginUser loginUser = logUserUtils.getLogUser(request); + domain.setCreateBy(loginUser.getUserid().toString()); + domain.setUpdateBy(loginUser.getUserid().toString()); + domain.setTenantId(loginUser.getTenantId()); + + return R.ok(checkoutService.insertDomain(domain)); + } + + + /** + * 导出银行转账单 + * + * @param response + * @throws IOException + */ + @Log(title = "清分管理-导出待提现订单", businessType = BusinessType.INSERT) + @PostMapping("/bankExport") + public void getBankExport(HttpServletResponse response, String checkoutIds) throws IOException { + + checkoutService.bankExport(response, checkoutIds); + } + + + /** + * 导出提现单订单记录 + * + * @param response + * @throws IOException + */ + @Log(title = "清分管理-导出提现记录", businessType = BusinessType.INSERT) + @PostMapping("/orderExport") + public void getOrderExport(HttpServletResponse response, String checkoutIds) throws IOException { + + checkoutService.orderExport(response, checkoutIds); + } + + + @Log(title = "清分管理-导入银行回执", businessType = BusinessType.INSERT) + @PostMapping("/importReceipt") + public R importReceipt(HttpServletRequest request, @RequestBody ClearingReceiptVo receiptVo) throws Exception { + + LoginUser loginUser = logUserUtils.getLogUser(request); + receiptVo.setCreateBy(loginUser.getUserid().toString()); + return R.ok(checkoutService.insertReceipt(receiptVo)); + } + + + @GetMapping("/getListPage") + public TableDataInfo getListPage(String phone, String transactionNumber, @RequestParam("status") Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, @RequestParam("userId") Long userId, Integer type, + String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult, Integer checkoutId) { + List> listPage = checkoutService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, checkoutId); + return getDataTable(listPage); + } + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingHistoryOrderController.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingHistoryOrderController.java new file mode 100644 index 00000000..e4c83118 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/controller/XhpcClearingHistoryOrderController.java @@ -0,0 +1,135 @@ +package com.xhpc.clearing.controller; + + +import com.alibaba.fastjson.JSON; +import com.xhpc.clearing.domain.XhpcClearingCheckoutDomain; +import com.xhpc.clearing.service.XhpcClearingCheckoutService; +import com.xhpc.clearing.service.XhpcClearingHistoryOrderService; +import com.xhpc.clearing.vo.ClearingOrderVo; +import com.xhpc.common.core.domain.R; +import com.xhpc.common.core.exception.CustomException; +import com.xhpc.common.core.utils.StringUtils; +import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.core.web.page.TableDataInfo; +import com.xhpc.common.log.annotation.Log; +import com.xhpc.common.log.enums.BusinessType; +import com.xhpc.common.util.LogUserUtils; +import com.xhpc.system.api.model.LoginUser; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/clearing/order") +public class XhpcClearingHistoryOrderController extends BaseController { + + @Resource + XhpcClearingHistoryOrderService orderService; + + @Resource + LogUserUtils logUserUtils; + + + @GetMapping("/getPage") + public TableDataInfo getUnclearingPage(HttpServletRequest request, + String startTime, + String endTime, + String orderNo, + String userType, + String internetName, + String operatorId, + String stationId) { +// LoginUser loginUser = logUserUtils.getLogUser(request); + startPage(); + Map params = new HashMap<>(); +// params.put("tenantId", loginUser.getTenantId()); + params.put("startTime", startTime); + params.put("endTime", endTime); + params.put("orderNo", orderNo); + params.put("userType", userType); + params.put("internetName", internetName); + params.put("operatorId", operatorId); + params.put("stationId", stationId); + return getDataTable(orderService.getPage(params)); + } + + + @Log(title = "清分管理-审核待清分清单", businessType = BusinessType.UPDATE) + @PutMapping("/check") + public R updateDomainConfig(HttpServletRequest request, @RequestBody ClearingOrderVo domain) { + LoginUser loginUser = logUserUtils.getLogUser(request); + domain.setCheckBy(loginUser.getUserid().toString()); + return R.ok(orderService.checkDomainList(domain)); + } + + + @Log(title = "清分管理-导出待清分清单", businessType = BusinessType.UPDATE) + @PostMapping("/export") + public void getExport(HttpServletResponse response, + HttpServletRequest request, + String startTime, + String endTime, + String orderNo, + String userType, + String internetName, + String operatorId, + String stationId, + String orderIds) throws IOException { + LoginUser loginUser = logUserUtils.getLogUser(request); + Map params = new HashMap<>(); + params.put("tenantId", loginUser.getTenantId()); + params.put("startTime", startTime); + params.put("endTime", endTime); + params.put("orderNo", orderNo); + params.put("userType", userType); + params.put("internetName", internetName); + params.put("operatorId", operatorId); + params.put("stationId", stationId); + params.put("orderIds", orderIds); + orderService.export(response, params); + } + + + // ============================== 清分 ============================ + @GetMapping("/getOrderPage") + public TableDataInfo getOrderPage(HttpServletRequest request, String operatorId){ + LoginUser loginUser = logUserUtils.getLogUser(request); + startPage(); + Map params = new HashMap<>(); + params.put("tenantId", loginUser.getTenantId()); + if(StringUtils.isEmpty(operatorId)){ + params.put("operatorId", loginUser.getSysUser().getOperatorId()); + }else { + params.put("operatorId", operatorId); + } + if(StringUtils.isEmpty(params.get("operatorId").toString())){ + throw new CustomException("缺少运营商ID"); + } + return getDataTable(orderService.getOrderPage(params)); + } + + + @GetMapping("/getOperatorData") + public R getOperatorData(HttpServletRequest request, String operatorId){ + LoginUser loginUser = logUserUtils.getLogUser(request); + + Map params = new HashMap<>(); + params.put("tenantId", loginUser.getTenantId()); + if(StringUtils.isEmpty(operatorId)){ + params.put("operatorId", loginUser.getSysUser().getOperatorId()); + }else { + params.put("operatorId", operatorId); + } + + if(StringUtils.isEmpty(params.get("operatorId").toString())){ + throw new CustomException("缺少运营商ID"); + } + + return R.ok(orderService.getOperatorData(params)); + } +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingBankDomain.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingBankDomain.java new file mode 100644 index 00000000..02333c53 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingBankDomain.java @@ -0,0 +1,106 @@ +package com.xhpc.clearing.domain; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * xhpc_clearing_bank + * @author + */ +@Data +public class XhpcClearingBankDomain implements Serializable { + /** + * 提现银行记录ID + */ + private Long clearingBankId; + + /** + * 运营商ID + */ + private Long operatorId; + + /** + * 运营商名称 + */ + private String operatorName; + + /** + * 地址code + */ + private Integer areaCode; + + /** + * 开户行名称 + */ + private String bankName; + + /** + * 运营商收款账户名称 + */ + private String operatorAccount; + + /** + * 收款卡号 + */ + private String bankNo; + + /** + * 地址 + */ + private String address; + + /** + * 联系人 + */ + private String contactName; + + /** + * 联系电话 + */ + private String contactPhone; + + /** + * 备注 + */ + private String remark; + + /** + * 状态(1-正常) + */ + private Integer status; + + /** + * 是否删除(0-正常,2-已删除) + */ + private Integer delFlag; + + /** + * 租户ID + */ + private String tenantId; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + + private String code; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingCheckoutDomain.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingCheckoutDomain.java new file mode 100644 index 00000000..88d42f48 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingCheckoutDomain.java @@ -0,0 +1,101 @@ +package com.xhpc.clearing.domain; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +/** + * xhpc_clearing_checkout + * @author + */ +@Data +public class XhpcClearingCheckoutDomain implements Serializable { + /** + * 结算记录ID + */ + private Long clearingCheckoutId; + + /** + * 收款账号信息 + */ + private Long clearingBankId; + + /** + * 申请金额 + */ + private BigDecimal applyAmount; + + /** + * 手续费 + */ + private BigDecimal handlingFee; + + /** + * 银行手续费 + */ + private BigDecimal bankFee; + + /** + * 到账金额 + */ + private BigDecimal receivedAmount; + + /** + * 状态(0-已审核待清分,1-提现中,2-审核失败,3-审核成功,4-转账失败,5-转账成功,6-提现完成) + */ + private Integer status; + + + /** + * 删除标识(0-正常,2-删除) + */ + private Integer delFlag; + + + private Long operatorId; + private String operatorName; + + /** + * 租户ID + */ + private String tenantId; + + /** + * 创建人 + */ + private String createBy; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新人 + */ + private String updateBy; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 审核人 + */ + private String checkBy; + + /** + * 审核时间 + */ + private Date checkTime; + + private XhpcClearingBankDomain clearingBank; + + private String code; + + private String clearingOrderIds; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingHistoryOrderDomain.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingHistoryOrderDomain.java new file mode 100644 index 00000000..f1a01e7d --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingHistoryOrderDomain.java @@ -0,0 +1,305 @@ +package com.xhpc.clearing.domain; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +/** + * xhpc_clearing_history_order + * @author + */ +@Data +public class XhpcClearingHistoryOrderDomain implements Serializable { + /** + * 清分订单id + */ + private Long clearingOrderId; + + /** + * 电站id + */ + private Long chargingStationId; + + /** + * 充电订单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; + + /** + * 流量方OperatorID + */ + 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 BigDecimal internetDegreeCommission; + + /** + * 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户) + */ + private Integer source; + + /** + * 租户id + */ + private String tenantId; + + /** + * 运营商ID + */ + private Long operatorId; + + /** + * 运营商名称 + */ + private String operatorName; + + /** + * 清算记录ID + */ + private Long clearingCheckoutId; + + /** + * 审核状态(0-未审核,1-审核不通过,2-审核通过) + */ + private Integer checkStatus; + + /** + * 审核人 + */ + private String checkBy; + + /** + * 审核时间 + */ + private Date checkTime; + + + + private String stationName; + + private String sourceName; + + private String chargingModeName; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingReceiptDomain.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingReceiptDomain.java new file mode 100644 index 00000000..b0821764 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcClearingReceiptDomain.java @@ -0,0 +1,49 @@ +package com.xhpc.clearing.domain; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * xhpc_clearing_receipt + * @author + */ +@Data +public class XhpcClearingReceiptDomain implements Serializable { + /** + * 回执图片ID + */ + private Long clearingReceiptId; + + /** + * 文件类型(1-图片,2-Excel) + */ + private Integer type; + + /** + * 文件名称 + */ + private String name; + + /** + * 文件地址 + */ + private String url; + + /** + * 提现单ID + */ + private String clearingCheckoutIds; + + /** + * 上传时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private String createBy; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcHistoryOrderDomain.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcHistoryOrderDomain.java new file mode 100644 index 00000000..6c7b83de --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/domain/XhpcHistoryOrderDomain.java @@ -0,0 +1,277 @@ +package com.xhpc.clearing.domain; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +/** + * xhpc_history_order + * @author + */ +@Data +public class XhpcHistoryOrderDomain implements Serializable { + /** + * 历史订单id + */ + private Long historyOrderId; + + /** + * 电站id + */ + private Long chargingStationId; + + /** + * 充电订单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; + + /** + * 流量方OperatorID + */ + 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 BigDecimal internetDegreeCommission; + + /** + * 订单来源(0 C端用户 1 流量方用户 2社区用户 3B端用户) + */ + private Integer source; + + /** + * 租户id + */ + private String tenantId; + + + private String stationName; + + private Long operatorId; + private String operatorName; + + private String sourceName; + + private String chargingModeName; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingBankMapper.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingBankMapper.java new file mode 100644 index 00000000..3e45c509 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingBankMapper.java @@ -0,0 +1,28 @@ +package com.xhpc.clearing.mapper; + +import com.xhpc.clearing.domain.XhpcClearingBankDomain; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +public interface XhpcClearingBankMapper { + int deleteByPrimaryKey(Long clearingBankId); + + int insert(XhpcClearingBankDomain record); + + XhpcClearingBankDomain selectByPrimaryKey(Long clearingBankId); + + int updateByPrimaryKey(XhpcClearingBankDomain record); + + int deleteLogicByPrimaryKey(Long clearingBankId); + + int deleteLogicByOperatorId(Long operatorId); + + List selectByParams(Map params); + + XhpcClearingBankDomain selectOneByOperatorId(@Param("operatorId")String operatorId); + + Map selectOneMapByOperatorId(@Param("operatorId")String operatorId); + +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingCheckoutMapper.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingCheckoutMapper.java new file mode 100644 index 00000000..ab2eb793 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingCheckoutMapper.java @@ -0,0 +1,34 @@ +package com.xhpc.clearing.mapper; + +import com.xhpc.clearing.domain.XhpcClearingCheckoutDomain; +import com.xhpc.clearing.vo.CheckoutBankVo; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +public interface XhpcClearingCheckoutMapper { + int deleteByPrimaryKey(Long clearingCheckoutId); + + int insert(XhpcClearingCheckoutDomain record); + + XhpcClearingCheckoutDomain selectByPrimaryKey(Long clearingCheckoutId); + + int updateByPrimaryKey(XhpcClearingCheckoutDomain record); + + List selectByParams(@Param("params") Map params); + + int deleteLogicByPrimaryKey(Long clearingCheckoutId); + + boolean checkByPrimaryKey(XhpcClearingCheckoutDomain domain); + + boolean updateStatusByPrimaryKey(XhpcClearingCheckoutDomain domain); + + BigDecimal selectAmountByStatus(@Param("tenantId")String tenantId, @Param("operatorId")String operatorId, @Param("status")Integer status); + + + List selectOrderMapByCheckoutIds(@Param("checkoutIds")String checkoutIds); + + int updateStatusByIds(@Param("checkoutIds")String checkoutIds, @Param("status")Integer status); +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingHistoryOrderMapper.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingHistoryOrderMapper.java new file mode 100644 index 00000000..659cf608 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingHistoryOrderMapper.java @@ -0,0 +1,53 @@ +package com.xhpc.clearing.mapper; + +import com.xhpc.clearing.domain.XhpcClearingHistoryOrderDomain; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +public interface XhpcClearingHistoryOrderMapper { + int deleteLogicByPrimaryKey(Long clearingOrderId); + + int deleteByPrimaryKey(Long clearingOrderId); + + int insertBatch(@Param("domainList") List domainList); + + int insert(XhpcClearingHistoryOrderDomain record); + + XhpcClearingHistoryOrderDomain selectByPrimaryKey(Long clearingOrderId); + + int updateByPrimaryKey(XhpcClearingHistoryOrderDomain record); + + List getListPage(@Param("params") Map params); + + int updateStatusBatchByOrderIds(@Param("orderIds") String orderIds, @Param("status") Integer status, @Param("checkBy")String checkBy); + + BigDecimal selectCheckedAmount(@Param("operatorId")String operatorId); + + Map selectCashAmount(@Param("operatorId")String operatorId); + + List> selectOrderPage(@Param("params") Map params); + + List selectOrderListByOperator(@Param("operatorId")String operatorId); + + int updateCheckoutByOperator(@Param("operatorId")Long operatorId, @Param("checkoutId")Long checkoutId); + + int updateCheckoutByOrderId(@Param("orderIds")String orderIds, @Param("checkoutId")Long checkoutId); + + + /** + * 获取登陆用户信息 + */ + Map getLandUser(@Param("userId")Long userId); + + + + /** + * 历史订单记录(PC) + * @return + */ + List> getOrderListPage(@Param("phone")String phone,@Param("transactionNumber")String transactionNumber,@Param("status")Integer status,@Param("chargingStationName")String chargingStationName,@Param("operatorId")Long operatorId,@Param("source")Integer source,@Param("beginStartTime")String beginStartTime,@Param("beginEndTime")String beginEndTime,@Param("userId")Long userId,@Param("type")Integer type,@Param("number")Integer number,@Param("affiliationOrganization")String affiliationOrganization,@Param("evcsOrderNo")String evcsOrderNo,@Param("plateNum")String plateNum,@Param("internetId")Integer internetId,@Param("internetSerialNumber")String internetSerialNumber,@Param("terminalName")String terminalName,@Param("vinCode")String vinCode,@Param("overStartTime")String overStartTime,@Param("overEndTime")String overEndTime,@Param("personnelId")Long personnelId,@Param("confirmResult")Integer confirmResult,@Param("tenantId")String tenantId,@Param("isNotNull")Integer isNotNull, @Param("checkoutId")Integer checkoutId); + +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingReceiptMapper.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingReceiptMapper.java new file mode 100644 index 00000000..8ce790cb --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcClearingReceiptMapper.java @@ -0,0 +1,18 @@ +package com.xhpc.clearing.mapper; + +import com.xhpc.clearing.domain.XhpcClearingReceiptDomain; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface XhpcClearingReceiptMapper { + int deleteByPrimaryKey(Long clearingReceiptId); + + int insert(XhpcClearingReceiptDomain record); + + XhpcClearingReceiptDomain selectByPrimaryKey(Long clearingReceiptId); + + int deleteByCheckoutId(@Param("checkoutId")Long checkoutId); + + int insretBatch(List domainList); +} \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcHistoryOrderMapper.java new file mode 100644 index 00000000..35c9470b --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/mapper/XhpcHistoryOrderMapper.java @@ -0,0 +1,24 @@ +package com.xhpc.clearing.mapper; + +import com.xhpc.clearing.domain.XhpcHistoryOrderDomain; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 历史订单信息 数据层 + * + * @author ruoyi + */ +public interface XhpcHistoryOrderMapper { + + List selectUnsyncOrderList(); + + + int updateStatusBatchByOrderIds(@Param("orderIds") List orderIds, @Param("status") Integer status); + + + BigDecimal selectUnclearingAmount(@Param("operatorId")String operatorId); + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingBankService.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingBankService.java new file mode 100644 index 00000000..faad997c --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingBankService.java @@ -0,0 +1,23 @@ +package com.xhpc.clearing.service; + +import com.xhpc.clearing.domain.XhpcClearingBankDomain; + +import java.util.List; +import java.util.Map; + +public interface XhpcClearingBankService { + + List getPage(Map params); + + XhpcClearingBankDomain getDomainByPk(Long bankId); + + boolean insertDomain(XhpcClearingBankDomain domain); + + boolean updateDomain(XhpcClearingBankDomain domain); + + boolean deleteByPk(Long bankId); + + boolean sendBindBankSms(String phone); + + boolean sendCashSms(String phone); +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingCheckoutService.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingCheckoutService.java new file mode 100644 index 00000000..f5210c5f --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingCheckoutService.java @@ -0,0 +1,35 @@ +package com.xhpc.clearing.service; + +import com.xhpc.clearing.domain.XhpcClearingCheckoutDomain; +import com.xhpc.clearing.domain.XhpcClearingHistoryOrderDomain; +import com.xhpc.clearing.vo.ClearingReceiptVo; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public interface XhpcClearingCheckoutService { + + List getPage(Map params); + + XhpcClearingCheckoutDomain getDomainByPk(Long checkoutId); + + Map getTmpCheckoutData(Long operatorId); + + boolean insertDomain(XhpcClearingCheckoutDomain domain); + + void bankExport(HttpServletResponse response, String checkoutIds) throws IOException; + + void orderExport(HttpServletResponse response, String checkoutIds) throws IOException; + + boolean insertReceipt(ClearingReceiptVo receiptVo) throws Exception; + + + /** + * 历史订单记录(PC) + * @return + */ + List> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String beginStartTime,String beginEndTime,Long userId,Integer type,String affiliationOrganization,String evcsOrderNo,String plateNum,Integer internetId,String internetSerialNumber,String terminalName,String vinCode,String overStartTime,String overEndTime,Long personnelId,Integer confirmResult, Integer checkoutId); + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingHistoryOrderService.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingHistoryOrderService.java new file mode 100644 index 00000000..f85152e8 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/XhpcClearingHistoryOrderService.java @@ -0,0 +1,23 @@ +package com.xhpc.clearing.service; + +import com.xhpc.clearing.domain.XhpcClearingHistoryOrderDomain; +import com.xhpc.clearing.vo.ClearingOrderVo; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public interface XhpcClearingHistoryOrderService { + + List getPage(Map params); + + void export(HttpServletResponse response, Map params) throws IOException; + + boolean checkDomainList(ClearingOrderVo orderVo); + + List> getOrderPage(Map params); + + Map getOperatorData(Map params); + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingBankServiceImpl.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingBankServiceImpl.java new file mode 100644 index 00000000..4aa39f19 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingBankServiceImpl.java @@ -0,0 +1,136 @@ +package com.xhpc.clearing.service.impl; + +import com.xhpc.clearing.domain.XhpcClearingBankDomain; +import com.xhpc.clearing.mapper.XhpcClearingBankMapper; +import com.xhpc.clearing.service.XhpcClearingBankService; +import com.xhpc.common.api.SmsService; +import com.xhpc.common.core.exception.CustomException; +import com.xhpc.common.core.utils.StringUtils; +import com.xhpc.common.redis.service.RedisService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.TimeUnit; + + +@Service +public class XhpcClearingBankServiceImpl implements XhpcClearingBankService { + + + @Resource + XhpcClearingBankMapper bankMapper; + + @Resource + SmsService smsService; + + @Resource + RedisService redisService; + + + @Override + public List getPage(Map params){ + + return bankMapper.selectByParams(params); + } + + + @Override + public XhpcClearingBankDomain getDomainByPk(Long bankId){ + return bankMapper.selectByPrimaryKey(bankId); + + } + + + @Override + public boolean insertDomain(XhpcClearingBankDomain domain){ + + if(StringUtils.isEmpty(domain.getContactPhone()) || StringUtils.isEmpty(domain.getContactName()) + || StringUtils.isEmpty(domain.getBankNo()) || StringUtils.isEmpty(domain.getBankName()) + || StringUtils.isEmpty(domain.getCode())){ + throw new CustomException("必填项不能为空"); + } + + String key = "opbind:" + domain.getContactPhone(); + String redisCode = redisService.getCacheObject(key); + if(StringUtils.isEmpty(redisCode)){ + throw new CustomException("短信验证码已失效,请重新发送"); + } + + if(!redisCode.equals(domain.getCode())){ + throw new CustomException("短信验证码错误,请重试"); + } + + bankMapper.deleteLogicByOperatorId(domain.getOperatorId()); + return bankMapper.insert(domain) > 0; + } + + + @Override + public boolean updateDomain(XhpcClearingBankDomain domain){ + String key = "opbind:" + domain.getContactPhone(); + String redisCode = redisService.getCacheObject(key); + if(StringUtils.isEmpty(redisCode)){ + throw new CustomException("短信验证码已失效,请重新发送"); + } + + if(!redisCode.equals(domain.getCode())){ + throw new CustomException("短信验证码错误,请重试"); + } + + return bankMapper.updateByPrimaryKey(domain) > 0; + } + + + @Override + public boolean deleteByPk(Long bankId){ + + return bankMapper.deleteLogicByPrimaryKey(bankId) > 0; + } + + + @Override + public boolean sendBindBankSms(String phone){ + String random = getRandom(); + + HashMap paramMap = new HashMap<>(); + paramMap.put("phone", phone); + paramMap.put("code", random); + paramMap.put("content", "您的动态码为:" + random + ",您正在进行绑定对公银行账户操作,如非本人操作,请忽略本短信!"); + smsService.sendNotice(paramMap); + + String key = "opbind:" + phone; + redisService.setCacheObject(key, random, 300L, TimeUnit.SECONDS); + + return true; + } + + @Override + public boolean sendCashSms(String phone){ + String random = getRandom(); + HashMap paramMap = new HashMap<>(); + paramMap.put("phone", phone); + paramMap.put("code", random); + paramMap.put("content", "【小华充电】您的动态码为:" + random + ",您正在进行提现到银行账户操作,如非本人操作,请忽略本短信!"); + smsService.sendNotice(paramMap); + + String key = "opcash:" + phone; + redisService.setCacheObject(key, random, 300L, TimeUnit.SECONDS); + return true; + } + + + private String getRandom(){ + Random rnd = new Random(); + int i = rnd.nextInt(999999); + if(i<100000){ + i=i+100000; + } + return i+""; + } + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingCheckoutServiceImpl.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingCheckoutServiceImpl.java new file mode 100644 index 00000000..b8cd52fd --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingCheckoutServiceImpl.java @@ -0,0 +1,320 @@ +package com.xhpc.clearing.service.impl; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.poi.excel.BigExcelWriter; +import cn.hutool.poi.excel.ExcelUtil; +import cn.hutool.poi.excel.ExcelWriter; +import com.xhpc.clearing.config.AliOSSProperties; +import com.xhpc.clearing.domain.XhpcClearingBankDomain; +import com.xhpc.clearing.domain.XhpcClearingCheckoutDomain; +import com.xhpc.clearing.domain.XhpcClearingHistoryOrderDomain; +import com.xhpc.clearing.domain.XhpcClearingReceiptDomain; +import com.xhpc.clearing.mapper.XhpcClearingBankMapper; +import com.xhpc.clearing.mapper.XhpcClearingCheckoutMapper; +import com.xhpc.clearing.mapper.XhpcClearingHistoryOrderMapper; +import com.xhpc.clearing.mapper.XhpcClearingReceiptMapper; +import com.xhpc.clearing.service.XhpcClearingCheckoutService; +import com.xhpc.clearing.utils.DownloadUtil; +import com.xhpc.clearing.vo.CheckoutBankVo; +import com.xhpc.clearing.vo.ClearingReceiptVo; +import com.xhpc.common.core.exception.CustomException; +import com.xhpc.common.core.utils.SecurityUtils; +import com.xhpc.common.core.utils.StringUtils; +import com.xhpc.common.core.web.service.BaseService; +import com.xhpc.common.redis.service.RedisService; +import com.xhpc.common.security.service.TokenService; +import com.xhpc.common.util.UserTypeUtil; +import com.xhpc.system.api.domain.SysUser; +import com.xhpc.system.api.model.LoginUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Service +@Transactional +public class XhpcClearingCheckoutServiceImpl extends BaseService implements XhpcClearingCheckoutService { + + + @Resource + XhpcClearingCheckoutMapper checkoutMapper; + + @Resource + XhpcClearingHistoryOrderMapper historyOrderMapper; + + @Resource + XhpcClearingBankMapper bankMapper; + + @Resource + XhpcClearingReceiptMapper receiptMapper; + + @Resource + RedisService redisService; + + @Resource + AliOSSProperties ossProperties; + + @Resource + TokenService tokenService; + + + @Override + public List getPage(Map params) { + return checkoutMapper.selectByParams(params); + } + + @Override + public Map getTmpCheckoutData(Long operatorId) { + XhpcClearingBankDomain bankDomain = bankMapper.selectOneByOperatorId(operatorId.toString()); + if (bankDomain == null) { + throw new CustomException("请先输入一个有效的提现账户"); + } + + // 可提现金额 + BigDecimal bankRate = new BigDecimal("0.006"); + BigDecimal handlingRate = BigDecimal.TEN; + + Map cashMap = historyOrderMapper.selectCashAmount(operatorId.toString()); + BigDecimal bankFee = new BigDecimal(cashMap.get("amount").toString()).multiply(bankRate).setScale(2, BigDecimal.ROUND_UP); + BigDecimal actAmount = new BigDecimal(cashMap.get("amount").toString()).subtract(handlingRate).subtract(bankFee); + + Map resultMap = new HashMap<>(); + resultMap.put("bankNo", bankDomain.getBankNo()); + resultMap.put("contactPhone", bankDomain.getContactPhone()); + resultMap.put("applyAmount", cashMap.get("amount")); + resultMap.put("clearingOrderIds", cashMap.get("clearingOrderIds")); + resultMap.put("handlingFee", handlingRate); + resultMap.put("bankFee", bankFee); + resultMap.put("receivedAmount", actAmount.compareTo(BigDecimal.ZERO) >= 0 ? actAmount : BigDecimal.ZERO); + resultMap.put("clearingBankId", bankDomain.getClearingBankId()); + return resultMap; + } + + + @Override + public XhpcClearingCheckoutDomain getDomainByPk(Long checkoutId) { + XhpcClearingCheckoutDomain checkoutDomain = checkoutMapper.selectByPrimaryKey(checkoutId); + checkoutDomain.setClearingBank(bankMapper.selectByPrimaryKey(checkoutDomain.getClearingBankId())); + return checkoutDomain; + } + + + @Override + public boolean insertDomain(XhpcClearingCheckoutDomain domain) { + + XhpcClearingBankDomain bankDomain; + if (domain.getClearingBankId() == null) { + bankDomain = bankMapper.selectOneByOperatorId(domain.getOperatorId().toString()); + domain.setClearingBankId(bankDomain.getClearingBankId()); + } else { + bankDomain = bankMapper.selectByPrimaryKey(domain.getClearingBankId()); + } + + String key = "opcash:" + bankDomain.getContactPhone(); + String redisCode = redisService.getCacheObject(key); + if (StringUtils.isEmpty(redisCode)) { + throw new CustomException("短信验证码已失效,请重新发送"); + } + + if (!redisCode.equals(domain.getCode())) { + throw new CustomException("短信验证码错误,请重试"); + } + + checkoutMapper.insert(domain); + + if (StringUtils.isEmpty(domain.getClearingOrderIds())) { + historyOrderMapper.updateCheckoutByOperator(domain.getOperatorId(), domain.getClearingCheckoutId()); + } else { + // ... + historyOrderMapper.updateCheckoutByOrderId(domain.getClearingOrderIds(), domain.getClearingCheckoutId()); + } + + + return true; + } + + + @Override + public void bankExport(HttpServletResponse response, String checkoutIds) throws IOException { + + List list = checkoutMapper.selectOrderMapByCheckoutIds(checkoutIds); + + com.xhpc.common.core.utils.poi.ExcelUtil util = new com.xhpc.common.core.utils.poi.ExcelUtil(CheckoutBankVo.class); + util.exportExcel(response, list, "待提现订单列表"); + +// ExcelWriter writer = ExcelUtil.getWriter(true); +// writer.addHeaderAlias("curreyType", "币种"); +// writer.addHeaderAlias("date", "日期"); +// writer.addHeaderAlias("detailFlag", "明细标志"); +// writer.addHeaderAlias("index", "顺序号"); +// writer.addHeaderAlias("payBank", "付款帐号开户行"); +// writer.addHeaderAlias("payBankAccount", "付款帐号/卡号"); +// writer.addHeaderAlias("payBankName", "付款账号名称/卡名称"); +// writer.addHeaderAlias("receiveBank", "收款账号开户行"); +// writer.addHeaderAlias("receiveProvice", "收款账号省份"); +// writer.addHeaderAlias("receiveCity", "收款账号地市"); +// writer.addHeaderAlias("receiveCode", "收款账号地区码"); +// writer.addHeaderAlias("receiveAccount", "收款账号"); +// writer.addHeaderAlias("receiveName", "收款账号名称"); +// writer.addHeaderAlias("amount", "金额"); +// writer.addHeaderAlias("purposes", "汇款用途"); +// writer.addHeaderAlias("remark", "备注信息"); +// writer.addHeaderAlias("transType", "汇款方式"); +// writer.addHeaderAlias("mobile", "收款账户短信通知手机号"); +// writer.addHeaderAlias("customeIndex", "自定义序号"); +// writer.addHeaderAlias("applyCheckNo", "预先审批编号"); +// +// 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); + } + + + @Override + public void orderExport(HttpServletResponse response, String checkoutIds) throws IOException { + Map params = new HashMap<>(); + params.put("checkoutIds", checkoutIds); + + List list = historyOrderMapper.getListPage(params); + + // 通过工具类创建writer,默认创建xls格式 + BigExcelWriter writer = ExcelUtil.getBigWriter("HistoryOrder_" + System.currentTimeMillis() + ".xlsx"); + writer.addHeaderAlias("serialNumber", "订单号"); + writer.addHeaderAlias("sourceName", "用户类型"); + writer.addHeaderAlias("chargingModeName", "流量方名称"); + writer.addHeaderAlias("stationName", "电站名称"); + writer.addHeaderAlias("terminalName", "终端名称"); + writer.addHeaderAlias("operatorName", "运营商"); + writer.addHeaderAlias("powerPriceTotal", "电费(元)"); + writer.addHeaderAlias("servicePriceTotal", "服务费(元)"); + writer.addHeaderAlias("totalPrice", "订单总金额(元)"); + writer.addHeaderAlias("promotionDiscount", "抵扣总金额(元)"); + writer.addHeaderAlias("actPrice", "用户支付的金额(元)"); + writer.addHeaderAlias("internetCommission", "流量方总金额抽成(元)"); + writer.addHeaderAlias("internetSvcCommission", "流量方服务费抽成(元)"); + writer.addHeaderAlias("internetDegreeCommission", "流量方电量抽成(元)"); + writer.addHeaderAlias("platformCommission", "平台总金额抽成(元)"); + writer.addHeaderAlias("platformSvcCommisssion", "平台服务费抽成(元)"); + writer.addHeaderAlias("operationCommission", "运维总抽成(元)"); + writer.addHeaderAlias("operationSvcCommission", "运维服务费抽成(元)"); + writer.addHeaderAlias("actPowerPrice", "运营商实收电费(元)"); + writer.addHeaderAlias("actServicePrice", "运营商实收服务费(元)"); + writer.addHeaderAlias("startSoc", "启动SOC"); + writer.addHeaderAlias("endSoc", "结算SOC"); + writer.addHeaderAlias("startTime", "开始充电时间"); + writer.addHeaderAlias("endTime", "结束充电时间"); + // 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之 + writer.setOnlyAlias(true); + // 一次性写出内容,使用默认样式,强制输出标题 + writer.write(list, true); + //out为OutputStream,需要写出到的目标流 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); +// //response为HttpServletResponse对象 +// response.setContentType("application/vnd.ms-excel;charset=utf-8"); +// //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 +// response.setHeader("Content-Disposition", "attachment;filename=历史订单列表.xls"); + ServletOutputStream out = response.getOutputStream(); + + writer.flush(out, true); + // 关闭writer,释放内存 + writer.close(); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + + + @Override + public boolean insertReceipt(ClearingReceiptVo receiptVo) throws Exception { + String fileUrl = receiptVo.getFile(); + if (!fileUrl.startsWith("http")) { + String domain = ossProperties.getDomain(); + if (!domain.endsWith("/")) { + domain = domain + "/"; + } + fileUrl = domain + fileUrl; + } + + File dataFile = DownloadUtil.downloadFile(fileUrl); + com.xhpc.common.core.utils.poi.ExcelUtil util = new com.xhpc.common.core.utils.poi.ExcelUtil(CheckoutBankVo.class); + List checkoutList = util.importExcel(new FileInputStream(dataFile)); + + String checkoutIds = checkoutList.stream().map(CheckoutBankVo::getIndex).collect(Collectors.joining(",")); + + if (checkoutIds.length() > 1) { + List receiptDomainList = receiptVo.getReceiptList(); + for (XhpcClearingReceiptDomain receiptDomain : receiptDomainList) { + receiptDomain.setClearingCheckoutIds(checkoutIds); + receiptDomain.setCreateBy(receiptVo.getCreateBy()); + } + receiptMapper.insretBatch(receiptDomainList); + } + + checkoutMapper.updateStatusByIds(checkoutIds, 6); + return true; + } + + + @Override + public List> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult, Integer checkoutId) { + + Integer number = 0; + //电话和用户类型都不为null number =3 + //电话不为null,用户类型为null number =1 + //电话为null,用户类型不为null number=2 + //电话为null,用户类型为null number=0 + if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) { + number = 3; + } else if (!"".equals(phone) && phone != null && source == null) { + number = 1; + } else if (phone == null && source != null) { + number = 2; + } + //获取登陆用户 + Long logUserId = SecurityUtils.getUserId(); + LoginUser loginUser = tokenService.getLoginUser(); + String tenantId = loginUser.getTenantId(); + //桩的统计、该时段金额 + List> list = new ArrayList<>(); + if (userId != UserTypeUtil.USER_ID) { + Map landUser = historyOrderMapper.getLandUser(logUserId); + if (landUser != null) { + if (landUser.get("userType") != null) { + startPage(); + if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(landUser.get("userType").toString())) { + Long logOperatorId = Long.valueOf(landUser.get("operatorId").toString()); + //运营商看自己的场站 + list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId); + } else { + //查询赋值的场站 + list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId); + } + } + } + + } else { + startPage(); + list = historyOrderMapper.getOrderListPage(phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0, checkoutId); + } + return list; + } + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingHistoryOrderServiceImpl.java new file mode 100644 index 00000000..9011deae --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/service/impl/XhpcClearingHistoryOrderServiceImpl.java @@ -0,0 +1,172 @@ +package com.xhpc.clearing.service.impl; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.poi.excel.ExcelUtil; +import cn.hutool.poi.excel.ExcelWriter; +import com.alibaba.fastjson.JSON; +import com.xhpc.clearing.domain.XhpcClearingBankDomain; +import com.xhpc.clearing.domain.XhpcClearingHistoryOrderDomain; +import com.xhpc.clearing.mapper.XhpcClearingBankMapper; +import com.xhpc.clearing.mapper.XhpcClearingCheckoutMapper; +import com.xhpc.clearing.mapper.XhpcClearingHistoryOrderMapper; +import com.xhpc.clearing.mapper.XhpcHistoryOrderMapper; +import com.xhpc.clearing.service.XhpcClearingHistoryOrderService; +import com.xhpc.clearing.vo.ClearingOrderVo; +import com.xhpc.common.core.exception.CustomException; +import com.xhpc.common.core.utils.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + + +@Service +@Transactional +public class XhpcClearingHistoryOrderServiceImpl implements XhpcClearingHistoryOrderService { + + @Resource + XhpcClearingHistoryOrderMapper historyOrderMapper; + + @Resource + XhpcClearingCheckoutMapper checkoutMapper; + + @Resource + XhpcClearingBankMapper bankMapper; + + @Resource + XhpcHistoryOrderMapper orderMapper; + + + @Override + public List getPage(Map params) { + return historyOrderMapper.getListPage(params); + } + + + @Override + public boolean checkDomainList(ClearingOrderVo orderVo) { + if (StringUtils.isEmpty(orderVo.getOrderIds())) { + throw new CustomException("缺少订单ID"); + } + + String orderIds = ""; + + if (orderVo.getOrderIds().equals("-1")) { + Map params = new HashMap<>(); + params.put("startTime", orderVo.getStartTime()); + params.put("endTime", orderVo.getEndTime()); + params.put("orderNo", orderVo.getOrderNo()); + params.put("userType", orderVo.getUserType()); + params.put("internetName", orderVo.getInternetName()); + params.put("operatorId", orderVo.getOperatorId()); + params.put("stationId", orderVo.getStationId()); + + List orderDomainList = historyOrderMapper.getListPage(params); + orderIds = orderDomainList.stream().map(n -> n.getClearingOrderId().toString()).collect(Collectors.joining(",")); + } else { + orderIds = orderVo.getOrderIds(); + } + + return historyOrderMapper.updateStatusBatchByOrderIds(orderIds, orderVo.getStatus(), orderVo.getCheckBy()) > 0; + + } + + + @Override + public void export(HttpServletResponse response, Map params) throws IOException { + List list = historyOrderMapper.getListPage(params); + + // 通过工具类创建writer,默认创建xls格式 + ExcelWriter writer = ExcelUtil.getWriter(true); + writer.addHeaderAlias("serialNumber", "订单号"); + writer.addHeaderAlias("sourceName", "用户类型"); + writer.addHeaderAlias("chargingModeName", "流量方名称"); + writer.addHeaderAlias("stationName", "电站名称"); + writer.addHeaderAlias("operatorName", "运营商"); + writer.addHeaderAlias("powerPriceTotal", "电费(元)"); + writer.addHeaderAlias("servicePriceTotal", "服务费(元)"); + writer.addHeaderAlias("totalPrice", "订单总金额(元)"); + writer.addHeaderAlias("promotionDiscount", "抵扣总金额(元)"); + writer.addHeaderAlias("actPrice", "用户支付的金额(元)"); + writer.addHeaderAlias("internetCommission", "流量方总金额抽成(元)"); + writer.addHeaderAlias("internetSvcCommission", "流量方服务费抽成(元)"); + writer.addHeaderAlias("internetDegreeCommission", "流量方电量抽成(元)"); + writer.addHeaderAlias("platformCommission", "平台总金额抽成(元)"); + writer.addHeaderAlias("platformSvcCommisssion", "平台服务费抽成(元)"); + writer.addHeaderAlias("operationCommission", "运维总抽成(元)"); + writer.addHeaderAlias("operationSvcCommission", "运维服务费抽成(元)"); + writer.addHeaderAlias("actPowerPrice", "运营商实收电费(元)"); + writer.addHeaderAlias("actServicePrice", "运营商实收服务费(元)"); + writer.addHeaderAlias("startSoc", "启动SOC"); + writer.addHeaderAlias("endSoc", "结算SOC"); + writer.addHeaderAlias("startTime", "开始充电时间"); + writer.addHeaderAlias("endTime", "结束充电时间"); + // 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之 + writer.setOnlyAlias(true); + // 一次性写出内容,使用默认样式,强制输出标题 + writer.write(list, true); + //out为OutputStream,需要写出到的目标流 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); +// //response为HttpServletResponse对象 +// response.setContentType("application/vnd.ms-excel;charset=utf-8"); +// //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 +// response.setHeader("Content-Disposition", "attachment;filename=历史订单列表.xls"); + ServletOutputStream out = response.getOutputStream(); + + writer.flush(out, true); + // 关闭writer,释放内存 + writer.close(); + //此处记得关闭输出Servlet流 + IoUtil.close(out); + } + + + // =========================== + @Override + public List> getOrderPage(Map params) { + return historyOrderMapper.selectOrderPage(params); + } + + + @Override + public Map getOperatorData(Map params) { + + String operatorId = params.get("operatorId").toString(); + String tenantId = params.get("tenantId").toString(); + + Map bankDomain = bankMapper.selectOneMapByOperatorId(operatorId); + // 待清分金额 + BigDecimal unClearingAmount = orderMapper.selectUnclearingAmount(operatorId); + + // 已审核通过金额 + BigDecimal checkedAmount = historyOrderMapper.selectCheckedAmount(operatorId); + + // 已提现金额 + BigDecimal cashedAmount = checkoutMapper.selectAmountByStatus(tenantId, operatorId, 6); + + // 提现中金额 + BigDecimal cashingAmount = checkoutMapper.selectAmountByStatus(tenantId, operatorId, 1); + + // 可提现金额 + Map cashMap = historyOrderMapper.selectCashAmount(operatorId); + + if (bankDomain == null) { + bankDomain = new HashMap<>(); + } + + bankDomain.put("cashedAmount", cashedAmount); + bankDomain.put("unclearingAmount", unClearingAmount); + bankDomain.put("cashingAmount", cashingAmount); + bankDomain.put("cashAmount", cashMap.get("amount")); + + return bankDomain; + } + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/task/SyncHistoryOrderTask.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/task/SyncHistoryOrderTask.java new file mode 100644 index 00000000..24568baf --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/task/SyncHistoryOrderTask.java @@ -0,0 +1,54 @@ +package com.xhpc.clearing.task; + + +import com.xhpc.clearing.domain.XhpcClearingHistoryOrderDomain; +import com.xhpc.clearing.domain.XhpcHistoryOrderDomain; +import com.xhpc.clearing.mapper.XhpcClearingHistoryOrderMapper; +import com.xhpc.clearing.mapper.XhpcHistoryOrderMapper; +import com.xhpc.common.core.utils.bean.BeanUtils; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + + +@Component +@Transactional +public class SyncHistoryOrderTask { + + + @Resource + XhpcHistoryOrderMapper historyOrderMapper; + + @Resource + XhpcClearingHistoryOrderMapper clearingHistoryOrderMapper; + + + /** + * 每天六点自动同步一天之前所有未同步订单 + */ + @Scheduled(cron = "0 0 6 * * ? ") + private void ExpiredTenantStatusTask(){ + + List unclearingDomainList = historyOrderMapper.selectUnsyncOrderList(); + + List clearingHistoryOrderDomainList = new ArrayList<>(); + List orderIds = new ArrayList<>(); + for (XhpcHistoryOrderDomain domain : unclearingDomainList){ + XhpcClearingHistoryOrderDomain clearingDomain = new XhpcClearingHistoryOrderDomain(); + + BeanUtils.copyProperties(domain, clearingDomain); + clearingDomain.setClearingOrderId(domain.getHistoryOrderId()); + clearingDomain.setCheckStatus(0); + clearingHistoryOrderDomainList.add(clearingDomain); + orderIds.add(domain.getHistoryOrderId()); + } + clearingHistoryOrderMapper.insertBatch(clearingHistoryOrderDomainList); + historyOrderMapper.updateStatusBatchByOrderIds(orderIds, 3); + + } + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/utils/DownloadUtil.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/utils/DownloadUtil.java new file mode 100644 index 00000000..72d9a8a9 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/utils/DownloadUtil.java @@ -0,0 +1,20 @@ +package com.xhpc.clearing.utils; + +import cn.hutool.http.HttpUtil; +import com.xhpc.common.core.utils.StringUtils; + +import java.io.File; + +public class DownloadUtil { + + + public static File downloadFile(String fileUrl) throws Exception { + + if (StringUtils.isEmpty(fileUrl)) { + throw new Exception("文件地址为空"); + } + String suffix = fileUrl.substring(fileUrl.lastIndexOf(".")); + + return HttpUtil.downloadFileFromUrl(fileUrl, File.createTempFile("temp_", suffix)); + } +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/CheckoutBankVo.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/CheckoutBankVo.java new file mode 100644 index 00000000..97e3abae --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/CheckoutBankVo.java @@ -0,0 +1,70 @@ +package com.xhpc.clearing.vo; + + +import com.xhpc.common.core.annotation.Excel; +import lombok.Data; + +@Data +public class CheckoutBankVo { + + @Excel(name = "币种") + private String curreyType; + + @Excel(name = "日期") + private String date; + + @Excel(name = "明细标志") + private String detailFlag; + + @Excel(name = "顺序号") + private String index; + + @Excel(name = "付款帐号开户行") + private String payBank; + + @Excel(name = "付款帐号/卡号") + private String payBankAccount; + + @Excel(name = "付款账号名称/卡名称") + private String payBankName; + + @Excel(name = "收款账号开户行") + private String receiveBank; + + @Excel(name = "收款账号省份") + private String receiveProvice; + + @Excel(name = "收款账号地市") + private String receiveCity; + + @Excel(name = "收款账号地区码") + private String receiveCode; + + @Excel(name = "收款账号") + private String receiveAccount; + + @Excel(name = "收款账号名称") + private String receiveName; + + @Excel(name = "金额") + private String amount; + + @Excel(name = "汇款用途") + private String purposes; + + @Excel(name = "备注信息") + private String remark; + + @Excel(name = "汇款方式") + private String transType; + + @Excel(name = "收款账户短信通知手机号") + private String mobile; + + + @Excel(name = "自定义序号") + private String customeIndex; + + @Excel(name = "预先审批编号") + private String applyCheckNo; +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingOrderVo.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingOrderVo.java new file mode 100644 index 00000000..6505a925 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingOrderVo.java @@ -0,0 +1,25 @@ +package com.xhpc.clearing.vo; + + +import lombok.Data; + +import java.util.List; + +@Data +public class ClearingOrderVo { + + private String orderIds; + + private Integer status; + + private String checkBy; + + private String startTime; + private String endTime; + private String orderNo; + private String userType; + private String internetName; + private String operatorId; + private String stationId; + +} diff --git a/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingReceiptVo.java b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingReceiptVo.java new file mode 100644 index 00000000..49742ee3 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/java/com/xhpc/clearing/vo/ClearingReceiptVo.java @@ -0,0 +1,18 @@ +package com.xhpc.clearing.vo; + +import com.xhpc.clearing.domain.XhpcClearingReceiptDomain; +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + + +@Data +public class ClearingReceiptVo { + + private List receiptList; + + private String file; + + private String createBy; +} diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/banner.txt b/xhpc-modules/xhpc-clearing/src/main/resources/banner.txt new file mode 100644 index 00000000..6801d887 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/banner.txt @@ -0,0 +1,9 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} + + _ _ _ + __ _| |__ _ __ ___ ___| | ___ __ _ _ __(_)_ __ __ _ + \ \/ / '_ \| '_ \ / __/ __| |/ _ \/ _` | '__| | '_ \ / _` | + > <| | | | |_) | (_| (__| | __/ (_| | | | | | | | (_| | + /_/\_\_| |_| .__/ \___\___|_|\___|\__,_|_| |_|_| |_|\__, | + |_| |___/ \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-clearing/src/main/resources/bootstrap.yml new file mode 100644 index 00000000..7843faad --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/bootstrap.yml @@ -0,0 +1,34 @@ + +# Tomcat +server: + port: 8913 + +# Spring +spring: + application: + # 应用名称 + name: xhpc-clearing + 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.clearing.mapper: debug + + 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' \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/logback.xml b/xhpc-modules/xhpc-clearing/src/main/resources/logback.xml new file mode 100644 index 00000000..c162b4d0 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/logback.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingBankMapper.xml b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingBankMapper.xml new file mode 100644 index 00000000..8194f497 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingBankMapper.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + clearing_bank_id + , operator_id, operator_name, area_code, bank_name, operator_account, + bank_no, address, contact_name, contact_phone, remark, `status`, del_flag, tenant_id, create_by, + create_time, update_by, update_time + + + + + update xhpc_clearing_bank + set del_flag=2 + where clearing_bank_id = #{clearingBankId,jdbcType=BIGINT} + + + + + + + + + + + + + + + + + delete + from xhpc_clearing_bank + where clearing_bank_id = #{clearingBankId,jdbcType=BIGINT} + + + + + update xhpc_clearing_bank + set del_flag=2 + where operator_id = #{operatorId} + + + + + insert into xhpc_clearing_bank (operator_id, operator_name, area_code, + bank_name, operator_account, bank_no, + address, contact_name, contact_phone, + remark, `status`, del_flag, + tenant_id, create_by, create_time, + update_by, update_time) + values (#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, #{areaCode,jdbcType=INTEGER}, + #{bankName,jdbcType=VARCHAR}, #{operatorAccount,jdbcType=VARCHAR}, #{bankNo,jdbcType=VARCHAR}, + #{address,jdbcType=VARCHAR}, #{contactName,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, + #{remark,jdbcType=VARCHAR}, 1, 0, + #{tenantId,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, sysdate(), + #{updateBy,jdbcType=VARCHAR}, sysdate()) + + + + + update xhpc_clearing_bank + set operator_id = #{operatorId,jdbcType=BIGINT}, + operator_name = #{operatorName,jdbcType=VARCHAR}, + area_code = #{areaCode,jdbcType=INTEGER}, + bank_name = #{bankName,jdbcType=VARCHAR}, + operator_account = #{operatorAccount,jdbcType=VARCHAR}, + bank_no = #{bankNo,jdbcType=VARCHAR}, + address = #{address,jdbcType=VARCHAR}, + contact_name = #{contactName,jdbcType=VARCHAR}, + contact_phone = #{contactPhone,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=INTEGER}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = sysdate() + where clearing_bank_id = #{clearingBankId,jdbcType=BIGINT} + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml new file mode 100644 index 00000000..35bf5edf --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + cc.clearing_checkout_id, cc.clearing_bank_id, cc.apply_amount, cc.handling_fee, cc.received_amount, cc.bank_fee, cc.del_flag, + cc.`status`, cc.operator_id, cc.tenant_id, cc.create_by, cc.create_time, cc.update_by, cc.update_time, cc.check_by, cc.check_time + + + + + + + + + + + + + + + + + + update xhpc_clearing_checkout set del_flag=2 + where clearing_checkout_id = #{clearingCheckoutId,jdbcType=BIGINT} + + + + + delete from xhpc_clearing_checkout + where clearing_checkout_id = #{clearingCheckoutId,jdbcType=BIGINT} + + + + + insert into xhpc_clearing_checkout (clearing_bank_id, apply_amount, handling_fee, bank_fee, + received_amount, del_flag, `status`, operator_id, tenant_id, + create_by, create_time, + update_by,update_time, check_by, check_time) + values (#{clearingBankId,jdbcType=BIGINT}, #{applyAmount,jdbcType=DECIMAL}, #{handlingFee,jdbcType=DECIMAL}, #{bankFee}, + #{receivedAmount,jdbcType=DECIMAL}, 0, #{status}, #{operatorId}, #{tenantId,jdbcType=VARCHAR}, + #{createBy,jdbcType=VARCHAR}, sysdate(), #{updateBy,jdbcType=VARCHAR}, + sysdate(), #{checkBy}, sysdate()) + + + + + update xhpc_clearing_checkout + set clearing_bank_id = #{clearingBankId,jdbcType=BIGINT}, + apply_amount = #{applyAmount,jdbcType=DECIMAL}, + handling_fee = #{handlingFee,jdbcType=DECIMAL}, + bank_fee = #{bankFee}, + received_amount = #{receivedAmount,jdbcType=DECIMAL}, + `status` = #{status,jdbcType=INTEGER}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = sysdate() + where clearing_checkout_id = #{clearingCheckoutId,jdbcType=BIGINT} + + + + + update xhpc_clearing_checkout + set `status` = #{status,jdbcType=INTEGER}, + check_by = #{updateBy,jdbcType=VARCHAR}, + check_time = #{updateTime,jdbcType=TIMESTAMP} + where clearing_checkout_id = #{clearingCheckoutId,jdbcType=BIGINT} + + + + + update xhpc_clearing_checkout + set `status` = #{status,jdbcType=INTEGER}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = sysdate() + where clearing_checkout_id = #{clearingCheckoutId,jdbcType=BIGINT} + + + + + update xhpc_clearing_checkout + set `status` = #{status} + where find_in_set(clearing_checkout_id, #{checkoutIds}) + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml new file mode 100644 index 00000000..4a6b5f37 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingHistoryOrderMapper.xml @@ -0,0 +1,609 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ho.clearing_order_id, ho.charging_station_id, ho.charge_order_id, ho.user_id, ho.terminal_id, ho.serial_number, + ho.internet_serial_number, ho.power_price_total, ho.service_price_total, ho.total_price, ho.promotion_discount, + ho.act_price, ho.act_power_price, ho.act_service_price, ho.internet_commission, ho.internet_svc_commission, + ho.platform_commission, ho.platform_svc_commisssion, ho.operation_commission, ho.operation_svc_commission, + ho.start_soc, ho.end_soc, ho.reconciliation_status, ho.sorting_status, ho.`type`, ho.`status`, ho.del_flag, + ho.create_time, ho.create_by, ho.update_time, ho.update_by, ho.remark, ho.`state`, ho.vin_normal, ho.search_value, + ho.operator_id_evcs, ho.charge_model_evcs, ho.connector_power_evcs, ho.meter_value_end_evcs, + ho.meter_value_start_evcs, ho.operator_id3rdpty_evcs, ho.start_time, ho.end_time, ho.stop_reason_evcs, + ho.total_power, ho.user_name_evcs, ho.phone, ho.evcs_order_no, ho.confirm_Result, ho.rate_model_id, + ho.charging_mode, ho.internet_degree_commission, ho.`source`, ho.tenant_id, ho.operator_id, ho.operator_name, + ho.clearing_checkout_id, ho.check_status, ho.check_by, ho.check_time + + + + + + update xhpc_clearing_history_order set check_status=#{status}, check_by=#{checkBy}, check_time=sysdate() + where find_in_set(clearing_order_id, #{orderIds}) + + + + + + + + + + + + + + + + + + + + + + + update xhpc_clearing_history_order + set del_flag=2 + where clearing_order_id = #{clearingOrderId,jdbcType=BIGINT} + + + + + delete + from xhpc_clearing_history_order + where clearing_order_id = #{clearingOrderId,jdbcType=BIGINT} + + + + + insert into xhpc_clearing_history_order (clearing_order_id, charging_station_id, charge_order_id, user_id, + terminal_id, serial_number, internet_serial_number, + power_price_total, service_price_total, total_price, + promotion_discount, act_price, act_power_price, + act_service_price, internet_commission, internet_svc_commission, + platform_commission, platform_svc_commisssion, + operation_commission, operation_svc_commission, + start_soc, end_soc, reconciliation_status, + sorting_status, `type`, `status`, + del_flag, create_time, create_by, + update_time, update_by, remark, + `state`, vin_normal, search_value, + operator_id_evcs, charge_model_evcs, connector_power_evcs, + meter_value_end_evcs, meter_value_start_evcs, operator_id3rdpty_evcs, + start_time, end_time, stop_reason_evcs, + total_power, user_name_evcs, phone, + evcs_order_no, confirm_Result, rate_model_id, + charging_mode, internet_degree_commission, + `source`, tenant_id, operator_id, + operator_name, clearing_checkout_id, check_status) + values + + (#{domain.clearingOrderId}, #{domain.chargingStationId,jdbcType=BIGINT}, #{domain.chargeOrderId,jdbcType=BIGINT}, + #{domain.userId,jdbcType=BIGINT}, + #{domain.terminalId,jdbcType=BIGINT}, #{domain.serialNumber,jdbcType=VARCHAR}, + #{domain.internetSerialNumber,jdbcType=VARCHAR}, + #{domain.powerPriceTotal,jdbcType=DECIMAL}, #{domain.servicePriceTotal,jdbcType=DECIMAL}, + #{domain.totalPrice,jdbcType=DECIMAL}, + #{domain.promotionDiscount,jdbcType=DECIMAL}, #{domain.actPrice,jdbcType=DECIMAL}, + #{domain.actPowerPrice,jdbcType=DECIMAL}, + #{domain.actServicePrice,jdbcType=DECIMAL}, #{domain.internetCommission,jdbcType=DECIMAL}, + #{domain.internetSvcCommission,jdbcType=DECIMAL}, + #{domain.platformCommission,jdbcType=DECIMAL}, #{domain.platformSvcCommisssion,jdbcType=DECIMAL}, + #{domain.operationCommission,jdbcType=DECIMAL}, #{domain.operationSvcCommission,jdbcType=DECIMAL}, + #{domain.startSoc,jdbcType=VARCHAR}, #{domain.endSoc,jdbcType=VARCHAR}, + #{domain.reconciliationStatus,jdbcType=INTEGER}, + #{domain.sortingStatus,jdbcType=INTEGER}, #{domain.type,jdbcType=TINYINT}, + #{domain.status,jdbcType=INTEGER}, + #{domain.delFlag,jdbcType=INTEGER}, #{domain.createTime,jdbcType=TIMESTAMP}, + #{domain.createBy,jdbcType=VARCHAR}, + #{domain.updateTime,jdbcType=TIMESTAMP}, #{domain.updateBy,jdbcType=VARCHAR}, + #{domain.remark,jdbcType=VARCHAR}, + #{domain.state,jdbcType=INTEGER}, #{domain.vinNormal,jdbcType=VARCHAR}, + #{domain.searchValue,jdbcType=VARCHAR}, + #{domain.operatorIdEvcs,jdbcType=VARCHAR}, #{domain.chargeModelEvcs,jdbcType=INTEGER}, + #{domain.connectorPowerEvcs,jdbcType=DOUBLE}, + #{domain.meterValueEndEvcs,jdbcType=DOUBLE}, #{domain.meterValueStartEvcs,jdbcType=DOUBLE}, + #{domain.operatorId3rdptyEvcs,jdbcType=VARCHAR}, + #{domain.startTime,jdbcType=TIMESTAMP}, #{domain.endTime,jdbcType=TIMESTAMP}, + #{domain.stopReasonEvcs,jdbcType=INTEGER}, + #{domain.totalPower,jdbcType=DOUBLE}, #{domain.userNameEvcs,jdbcType=VARCHAR}, + #{domain.phone,jdbcType=VARCHAR}, + #{domain.evcsOrderNo,jdbcType=VARCHAR}, #{domain.confirmResult,jdbcType=INTEGER}, + #{domain.rateModelId,jdbcType=BIGINT}, + #{domain.chargingMode,jdbcType=VARCHAR}, #{domain.internetDegreeCommission,jdbcType=DECIMAL}, + #{domain.source,jdbcType=INTEGER}, #{domain.tenantId,jdbcType=VARCHAR}, + #{domain.operatorId,jdbcType=BIGINT}, + #{domain.operatorName,jdbcType=VARCHAR}, #{domain.clearingCheckoutId,jdbcType=BIGINT}, #{domain.checkStatus}) + + + + + + insert into xhpc_clearing_history_order (charging_station_id, charge_order_id, user_id, + terminal_id, serial_number, internet_serial_number, + power_price_total, service_price_total, total_price, + promotion_discount, act_price, act_power_price, + act_service_price, internet_commission, internet_svc_commission, + platform_commission, platform_svc_commisssion, + operation_commission, operation_svc_commission, + start_soc, end_soc, reconciliation_status, + sorting_status, `type`, `status`, + del_flag, create_time, create_by, + update_time, update_by, remark, + `state`, vin_normal, search_value, + operator_id_evcs, charge_model_evcs, connector_power_evcs, + meter_value_end_evcs, meter_value_start_evcs, operator_id3rdpty_evcs, + start_time, end_time, stop_reason_evcs, + total_power, user_name_evcs, phone, + evcs_order_no, confirm_Result, rate_model_id, + charging_mode, internet_degree_commission, + `source`, tenant_id, operator_id, + operator_name, clearing_checkout_id, check_status) + values (#{chargingStationId,jdbcType=BIGINT}, #{chargeOrderId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, + #{terminalId,jdbcType=BIGINT}, #{serialNumber,jdbcType=VARCHAR}, + #{internetSerialNumber,jdbcType=VARCHAR}, + #{powerPriceTotal,jdbcType=DECIMAL}, #{servicePriceTotal,jdbcType=DECIMAL}, + #{totalPrice,jdbcType=DECIMAL}, + #{promotionDiscount,jdbcType=DECIMAL}, #{actPrice,jdbcType=DECIMAL}, #{actPowerPrice,jdbcType=DECIMAL}, + #{actServicePrice,jdbcType=DECIMAL}, #{internetCommission,jdbcType=DECIMAL}, + #{internetSvcCommission,jdbcType=DECIMAL}, + #{platformCommission,jdbcType=DECIMAL}, #{platformSvcCommisssion,jdbcType=DECIMAL}, + #{operationCommission,jdbcType=DECIMAL}, #{operationSvcCommission,jdbcType=DECIMAL}, + #{startSoc,jdbcType=VARCHAR}, #{endSoc,jdbcType=VARCHAR}, #{reconciliationStatus,jdbcType=INTEGER}, + #{sortingStatus,jdbcType=INTEGER}, #{type,jdbcType=TINYINT}, #{status,jdbcType=INTEGER}, + #{delFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR}, + #{updateTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, + #{state,jdbcType=INTEGER}, #{vinNormal,jdbcType=VARCHAR}, #{searchValue,jdbcType=VARCHAR}, + #{operatorIdEvcs,jdbcType=VARCHAR}, #{chargeModelEvcs,jdbcType=INTEGER}, + #{connectorPowerEvcs,jdbcType=DOUBLE}, + #{meterValueEndEvcs,jdbcType=DOUBLE}, #{meterValueStartEvcs,jdbcType=DOUBLE}, + #{operatorId3rdptyEvcs,jdbcType=VARCHAR}, + #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{stopReasonEvcs,jdbcType=INTEGER}, + #{totalPower,jdbcType=DOUBLE}, #{userNameEvcs,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, + #{evcsOrderNo,jdbcType=VARCHAR}, #{confirmResult,jdbcType=INTEGER}, #{rateModelId,jdbcType=BIGINT}, + #{chargingMode,jdbcType=VARCHAR}, #{internetDegreeCommission,jdbcType=DECIMAL}, + #{source,jdbcType=INTEGER}, #{tenantId,jdbcType=VARCHAR}, #{operatorId,jdbcType=BIGINT}, + #{operatorName,jdbcType=VARCHAR}, #{clearingCheckoutId,jdbcType=BIGINT}, #{checkStatus}) + + + + + update xhpc_clearing_history_order + set charging_station_id = #{chargingStationId,jdbcType=BIGINT}, + charge_order_id = #{chargeOrderId,jdbcType=BIGINT}, + user_id = #{userId,jdbcType=BIGINT}, + terminal_id = #{terminalId,jdbcType=BIGINT}, + serial_number = #{serialNumber,jdbcType=VARCHAR}, + internet_serial_number = #{internetSerialNumber,jdbcType=VARCHAR}, + power_price_total = #{powerPriceTotal,jdbcType=DECIMAL}, + service_price_total = #{servicePriceTotal,jdbcType=DECIMAL}, + total_price = #{totalPrice,jdbcType=DECIMAL}, + promotion_discount = #{promotionDiscount,jdbcType=DECIMAL}, + act_price = #{actPrice,jdbcType=DECIMAL}, + act_power_price = #{actPowerPrice,jdbcType=DECIMAL}, + act_service_price = #{actServicePrice,jdbcType=DECIMAL}, + internet_commission = #{internetCommission,jdbcType=DECIMAL}, + internet_svc_commission = #{internetSvcCommission,jdbcType=DECIMAL}, + platform_commission = #{platformCommission,jdbcType=DECIMAL}, + platform_svc_commisssion = #{platformSvcCommisssion,jdbcType=DECIMAL}, + operation_commission = #{operationCommission,jdbcType=DECIMAL}, + operation_svc_commission = #{operationSvcCommission,jdbcType=DECIMAL}, + start_soc = #{startSoc,jdbcType=VARCHAR}, + end_soc = #{endSoc,jdbcType=VARCHAR}, + reconciliation_status = #{reconciliationStatus,jdbcType=INTEGER}, + sorting_status = #{sortingStatus,jdbcType=INTEGER}, + `type` = #{type,jdbcType=TINYINT}, + `status` = #{status,jdbcType=INTEGER}, + del_flag = #{delFlag,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + create_by = #{createBy,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + update_by = #{updateBy,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=VARCHAR}, + `state` = #{state,jdbcType=INTEGER}, + vin_normal = #{vinNormal,jdbcType=VARCHAR}, + search_value = #{searchValue,jdbcType=VARCHAR}, + operator_id_evcs = #{operatorIdEvcs,jdbcType=VARCHAR}, + charge_model_evcs = #{chargeModelEvcs,jdbcType=INTEGER}, + connector_power_evcs = #{connectorPowerEvcs,jdbcType=DOUBLE}, + meter_value_end_evcs = #{meterValueEndEvcs,jdbcType=DOUBLE}, + meter_value_start_evcs = #{meterValueStartEvcs,jdbcType=DOUBLE}, + operator_id3rdpty_evcs = #{operatorId3rdptyEvcs,jdbcType=VARCHAR}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + end_time = #{endTime,jdbcType=TIMESTAMP}, + stop_reason_evcs = #{stopReasonEvcs,jdbcType=INTEGER}, + total_power = #{totalPower,jdbcType=DOUBLE}, + user_name_evcs = #{userNameEvcs,jdbcType=VARCHAR}, + phone = #{phone,jdbcType=VARCHAR}, + evcs_order_no = #{evcsOrderNo,jdbcType=VARCHAR}, + confirm_Result = #{confirmResult,jdbcType=INTEGER}, + rate_model_id = #{rateModelId,jdbcType=BIGINT}, + charging_mode = #{chargingMode,jdbcType=VARCHAR}, + internet_degree_commission = #{internetDegreeCommission,jdbcType=DECIMAL}, + `source` = #{source,jdbcType=INTEGER}, + tenant_id = #{tenantId,jdbcType=VARCHAR}, + operator_id = #{operatorId,jdbcType=BIGINT}, + operator_name = #{operatorName,jdbcType=VARCHAR}, + clearing_checkout_id = #{clearingCheckoutId,jdbcType=BIGINT} + where clearing_order_id = #{clearingOrderId,jdbcType=BIGINT} + + + update xhpc_clearing_history_order set clearing_checkout_id=#{checkoutId} + where del_flag=0 and check_status=2 and clearing_checkout_id is null and operator_id=#{operatorId} + + + + + update xhpc_clearing_history_order set clearing_checkout_id=#{checkoutId} + where find_in_set(clearing_order_id, #{orderIds}) + + + + + + + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingReceiptMapper.xml b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingReceiptMapper.xml new file mode 100644 index 00000000..2db30350 --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcClearingReceiptMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + clearing_receipt_id, `type`, `name`, url, clearing_checkout_ids, create_time, create_by + + + + + + + + + insert into xhpc_clearing_receipt (`type`, `name`, url, + clearing_checkout_ids, create_time, create_by + ) + values (#{type,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, + #{clearingCheckoutIds,jdbcType=BIGINT}, sysdate(), #{createBy,jdbcType=VARCHAR} + ) + + + + + insert into xhpc_clearing_receipt (`type`, `name`, url, + clearing_checkout_ids, create_time, create_by + ) values + + (#{domain.type,jdbcType=INTEGER}, #{domain.name,jdbcType=VARCHAR}, #{domain.url,jdbcType=VARCHAR}, + #{domain.clearingCheckoutIds,jdbcType=BIGINT}, sysdate(), #{domain.createBy,jdbcType=VARCHAR} + ) + + + + + + + \ No newline at end of file diff --git a/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcHistoryOrderMapper.xml new file mode 100644 index 00000000..6a4d7b7b --- /dev/null +++ b/xhpc-modules/xhpc-clearing/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ho.history_order_id, ho.charging_station_id, ho.charge_order_id, ho.user_id, ho.terminal_id, ho.serial_number, + ho.internet_serial_number, ho.power_price_total, ho.service_price_total, ho.total_price, ho.promotion_discount, + ho.act_price, ho.act_power_price, ho.act_service_price, ho.internet_commission, ho.internet_svc_commission, + ho.platform_commission, ho.platform_svc_commisssion, ho.operation_commission, ho.operation_svc_commission, + ho.start_soc, ho.end_soc, ho.reconciliation_status, ho.sorting_status, ho.`type`, ho.`status`, ho.del_flag, + ho.create_time, ho.create_by, ho.update_time, ho.update_by, ho.remark, ho.`state`, ho.vin_normal, ho.search_value, + ho.operator_id_evcs, ho.charge_model_evcs, ho.connector_power_evcs, ho.meter_value_end_evcs, + ho.meter_value_start_evcs, ho.operator_id3rdpty_evcs, ho.start_time, ho.end_time, ho.stop_reason_evcs, + ho.total_power, ho.user_name_evcs, ho.phone, ho.evcs_order_no, ho.confirm_Result, ho.rate_model_id, + ho.charging_mode, ho.internet_degree_commission, ho.`source`, ho.tenant_id + + + + + + + + + + + update xhpc_history_order set state=#{status} + where history_order_id in + + #{item} + + +