mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
Merge branch 'dev' of https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web into dev
This commit is contained in:
184
jsowell-pile/CLAUDE.md
Normal file
184
jsowell-pile/CLAUDE.md
Normal file
@@ -0,0 +1,184 @@
|
||||
[根目录](../CLAUDE.md) > **jsowell-pile**
|
||||
|
||||
# jsowell-pile 模块
|
||||
|
||||
充电桩业务核心模块,包含订单、会员、计费、支付等核心业务逻辑。
|
||||
|
||||
---
|
||||
|
||||
## 变更记录 (Changelog)
|
||||
|
||||
### 2026-02-03 11:32:30
|
||||
- 初始化模块文档
|
||||
- 识别 80 个 Service 实现类
|
||||
- 统计 60+ Mapper XML 文件
|
||||
|
||||
---
|
||||
|
||||
## 模块职责
|
||||
|
||||
- **订单管理**: 充电订单创建、结算、分账、退款
|
||||
- **会员服务**: 会员注册、钱包管理、积分系统
|
||||
- **计费管理**: 计费模板、时段电价、服务费
|
||||
- **支付集成**: 微信支付、支付宝、汇付支付(Adapay)
|
||||
- **设备管理**: 充电桩、充电枪、站点信息
|
||||
- **商户管理**: 商户信息、分账配置、清算账单
|
||||
|
||||
---
|
||||
|
||||
## 入口与启动
|
||||
|
||||
本模块为业务模块,无独立启动入口,由 `jsowell-admin` 模块引用。
|
||||
|
||||
### 核心 Service
|
||||
|
||||
| Service | 说明 |
|
||||
|---------|------|
|
||||
| `OrderBasicInfoServiceImpl` | 订单核心服务(创建、结算、分账) |
|
||||
| `MemberBasicInfoServiceImpl` | 会员服务 |
|
||||
| `MemberWalletInfoServiceImpl` | 钱包服务 |
|
||||
| `MemberPointsInfoServiceImpl` | 积分服务 |
|
||||
| `PileStationInfoServiceImpl` | 站点服务 |
|
||||
| `PileBasicInfoServiceImpl` | 充电桩服务 |
|
||||
| `PileConnectorInfoServiceImpl` | 充电枪服务 |
|
||||
| `PileBillingTemplateServiceImpl` | 计费模板服务 |
|
||||
| `WechatPayServiceImpl` | 微信支付服务 |
|
||||
| `AdapayService` | 汇付支付服务 |
|
||||
|
||||
---
|
||||
|
||||
## 对外接口
|
||||
|
||||
### RPC 服务
|
||||
|
||||
```java
|
||||
// WccServiceImpl.java - Dubbo RPC 服务
|
||||
@DubboService
|
||||
public class WccServiceImpl implements WccService {
|
||||
// 提供给其他服务调用的接口
|
||||
}
|
||||
```
|
||||
|
||||
### RabbitMQ 消费者
|
||||
|
||||
```java
|
||||
// OrderRabbitListener.java
|
||||
@RabbitListener(queues = RabbitConstants.ORDER_QUEUE)
|
||||
public void handleOrderMessage(Message message) {
|
||||
// 处理订单消息
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 关键依赖与配置
|
||||
|
||||
### Maven 依赖
|
||||
|
||||
```xml
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jsowell</groupId>
|
||||
<artifactId>jsowell-framework</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.huifu.adapay</groupId>
|
||||
<artifactId>adapay-java-sdk</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 数据模型
|
||||
|
||||
### 核心实体
|
||||
|
||||
| 实体类 | 数据库表 | 说明 |
|
||||
|--------|---------|------|
|
||||
| `OrderBasicInfo` | `order_basic_info` | 充电订单 |
|
||||
| `OrderPayRecord` | `order_pay_record` | 支付记录 |
|
||||
| `OrderSplitRecord` | `order_split_record` | 分账记录 |
|
||||
| `MemberBasicInfo` | `member_basic_info` | 会员信息 |
|
||||
| `MemberWalletInfo` | `member_wallet_info` | 会员钱包 |
|
||||
| `MemberPointsInfo` | `member_points_info` | 会员积分 |
|
||||
| `PileStationInfo` | `pile_station_info` | 充电站 |
|
||||
| `PileBasicInfo` | `pile_basic_info` | 充电桩 |
|
||||
| `PileConnectorInfo` | `pile_connector_info` | 充电枪 |
|
||||
| `PileBillingTemplate` | `pile_billing_template` | 计费模板 |
|
||||
| `PileMerchantInfo` | `pile_merchant_info` | 商户信息 |
|
||||
| `ClearingBillInfo` | `clearing_bill_info` | 清算账单 |
|
||||
|
||||
### Mapper XML 文件
|
||||
|
||||
位置:`src/main/resources/mapper/pile/`
|
||||
|
||||
主要文件:
|
||||
- `OrderBasicInfoMapper.xml` (3620 行)
|
||||
- `PileMerchantInfoMapper.xml` (1304 行)
|
||||
- `PersonalChargingRecordMapper.xml` (1413 行)
|
||||
- `OrderDetailMapper.xml` (1306 行)
|
||||
- `OrderPileOccupyMapper.xml` (1043 行)
|
||||
|
||||
---
|
||||
|
||||
## 测试与质量
|
||||
|
||||
### 单元测试
|
||||
|
||||
测试位于 `jsowell-admin/src/test/java/`,涉及本模块的测试:
|
||||
- `OrderServiceWhitelistCompletionTest`
|
||||
- `WhitelistOrderCompletionDefaultsTest`
|
||||
|
||||
---
|
||||
|
||||
## 常见问题 (FAQ)
|
||||
|
||||
### Q: 订单分账失败如何处理?
|
||||
检查 `OrderBasicInfoServiceImpl.realTimeOrderSplit()` 方法,查看分账配置和汇付账户状态
|
||||
|
||||
### Q: 积分发放延迟?
|
||||
积分通过 RabbitMQ 异步发放,检查 `PointsRabbitConfig` 配置和消息队列状态
|
||||
|
||||
### Q: 支付回调未收到?
|
||||
检查支付平台回调地址配置,查看 `WxpayCallbackRecord` 或 `AdapayCallbackRecord` 表
|
||||
|
||||
---
|
||||
|
||||
## 相关文件清单
|
||||
|
||||
```
|
||||
jsowell-pile/
|
||||
├── src/main/java/com/jsowell/
|
||||
│ ├── adapay/ # 汇付支付
|
||||
│ │ ├── config/ # 支付配置
|
||||
│ │ ├── dto/ # 数据传输对象
|
||||
│ │ ├── service/ # 支付服务
|
||||
│ │ └── vo/ # 视图对象
|
||||
│ ├── alipay/ # 支付宝
|
||||
│ ├── wxpay/ # 微信支付
|
||||
│ ├── mq/ # RabbitMQ 消费者
|
||||
│ ├── pile/
|
||||
│ │ ├── domain/ # 实体类
|
||||
│ │ ├── dto/ # DTO
|
||||
│ │ ├── mapper/ # Mapper 接口
|
||||
│ │ ├── service/ # Service 接口
|
||||
│ │ │ └── impl/ # Service 实现
|
||||
│ │ ├── vo/ # VO
|
||||
│ │ ├── jcpp/ # JCPP 协议
|
||||
│ │ ├── rpc/ # RPC 服务
|
||||
│ │ └── transaction/ # 事务服务
|
||||
│ └── thirdparty/ # 第三方服务
|
||||
├── src/main/resources/
|
||||
│ └── mapper/pile/ # Mapper XML (60+ 文件)
|
||||
└── src/main/proto/ # Protobuf 定义
|
||||
```
|
||||
@@ -42,15 +42,20 @@ public class BusinessFinancialServiceImpl implements BusinessFinancialService {
|
||||
|
||||
// 查询账户余额
|
||||
BigDecimal acctBalance = BigDecimal.ZERO;
|
||||
BigDecimal pendingAmount = BigDecimal.ZERO;
|
||||
try {
|
||||
AdapayAccountBalanceVO accountBalanceVO = adapayService.queryAdapayAccountBalance(dto.getMerchantId());
|
||||
if (accountBalanceVO != null && accountBalanceVO.getAcctBalance() != null) {
|
||||
acctBalance = accountBalanceVO.getAcctBalance();
|
||||
}
|
||||
if (accountBalanceVO != null && accountBalanceVO.getPendingAmount() != null) {
|
||||
pendingAmount = accountBalanceVO.getPendingAmount();
|
||||
}
|
||||
} catch (BaseAdaPayException e) {
|
||||
log.error("查询汇付账户余额异常 merchantId:{}", dto.getMerchantId(), e);
|
||||
}
|
||||
result.getMerchantOrderReport().setAcctBalance(acctBalance);
|
||||
result.getMerchantOrderReport().setPendingAmount(pendingAmount);
|
||||
|
||||
// 查询累计提现金额
|
||||
BigDecimal totalWithdraw = BigDecimal.ZERO;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -68,7 +69,6 @@ import com.jsowell.pile.vo.uniapp.business.BusinessOrderListVO;
|
||||
import com.jsowell.pile.vo.uniapp.business.BusinessOrderQueryResultVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.*;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
import com.jsowell.pile.vo.web.OrderStatisticsVO;
|
||||
import com.jsowell.wxpay.common.WeChatPayParameter;
|
||||
import com.jsowell.wxpay.response.WechatPayRefundRequest;
|
||||
import com.jsowell.wxpay.response.WechatPayRefundResponse;
|
||||
@@ -295,6 +295,9 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
}
|
||||
dto.setStationDeptIds(authorizedMap.getStationDeptIds());
|
||||
dto.setMerchantDeptIds(authorizedMap.getMerchantDeptIds());
|
||||
if (Objects.nonNull(SecurityUtils.getLoginUser())) {
|
||||
dto.setParams(ImmutableMap.of("roleId", SecurityUtils.getLoginUser().getUserId()));
|
||||
}
|
||||
return selectOrderBasicInfoList(dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ public class UserUtils {
|
||||
if (Objects.isNull(loginUser)) {
|
||||
return resultVO;
|
||||
}
|
||||
resultVO.setLoginUser(loginUser);
|
||||
// 获取登录用户对应的user对象
|
||||
SysUser user = loginUser.getUser();
|
||||
if (Objects.isNull(user)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.pile.vo.base;
|
||||
|
||||
import com.jsowell.common.core.domain.model.LoginUser;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -11,6 +12,10 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
public class LoginUserDetailVO {
|
||||
/**
|
||||
* 登录用户
|
||||
*/
|
||||
LoginUser loginUser;
|
||||
/**
|
||||
* 有权限的一级运营商idList
|
||||
* 平台级账号有多个一级运营商权限
|
||||
|
||||
@@ -52,4 +52,7 @@ public class OrderReportDetail {
|
||||
*/
|
||||
private BigDecimal totalWithdraw;
|
||||
|
||||
// 在途金额
|
||||
private BigDecimal pendingAmount;
|
||||
|
||||
}
|
||||
|
||||
@@ -2004,6 +2004,9 @@
|
||||
<if test="vinCode != null and vinCode != ''">
|
||||
and t1.vin_code = #{vinCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="params != null and params.roleId != null and params.roleId > 2">
|
||||
and t1.review_flag = '1'
|
||||
</if>
|
||||
<if test="plateNumber != null and plateNumber != ''">
|
||||
and t1.plate_number = #{plateNumber,jdbcType=VARCHAR}
|
||||
</if>
|
||||
@@ -2055,6 +2058,9 @@
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and t1.create_time <![CDATA[ <= ]]> #{endTime,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="params != null and params.roleId != null and params.roleId > 2">
|
||||
and t1.review_flag = '1'
|
||||
</if>
|
||||
<if test="startSettleTime != null and startSettleTime != ''">
|
||||
and t1.settlement_time <![CDATA[ >= ]]> #{startSettleTime,jdbcType=VARCHAR}
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user