修改接口文档,申请开票接口

This commit is contained in:
2023-04-14 15:22:27 +08:00
parent 0a63c5044d
commit ed7f55ddad
7 changed files with 270 additions and 172 deletions

View File

@@ -10,7 +10,7 @@
以下接口反参指的是obj中的数据接口返回都有resCodemsgobj这三个字段。
### 示例
**示例**
~~~json
# 入参
@@ -67,7 +67,7 @@
}
~~~
# 会员接口
## 1001 登录注册接口
@@ -77,17 +77,17 @@
>
> 请求方式GET
### 入参
**入参**
null在Header中需传Authorization
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| -------- | ------ | -------- | ------------ |
| MemberVO | Object | Y | 用户信息对象 |
### MemberVO
**MemberVO**
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------------ | ------ | -------- | --------------------------- |
@@ -109,7 +109,8 @@ null在Header中需传Authorization
> 请求方式POST
>
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------- | ------ | -------- | ---------------- |
| titleType | String | Y | 抬头类型1-单位2-个人)|
@@ -120,7 +121,7 @@ null在Header中需传Authorization
| bankName | String | N | 开户银行 |
| bankAccountNumber | String | N | 银行账户 |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | ------ |
@@ -134,11 +135,12 @@ null在Header中需传Authorization
> 请求方式GET
>
### 入参
**入参**
null在Header中需传Authorization
### 反参
**反参**
取obj中的list, 下面是list中对象字段信息
| 字段名 | 类型 | 是否必传 | 备注 |
@@ -148,13 +150,100 @@ null在Header中需传Authorization
| titleType | String | Y | 抬头类型 (单位或个人) |
## 1006 查询余额明细
> 请求地址: http://localhost:8080/uniapp/member/getMemberBalanceChanges
>
> 请求方式POST
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------- | ------ | -------- | ------------------------ |
| memberToken | String | Y | 会员令牌 |
| type | String | Y | 交易类型 1-进账2-出账 |
| pageSize | | | |
| pageNum | | | |
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------------ | ------ | -------- | -------------------------- |
| memberId | String | Y | 会员Id |
| principalBalance | Number | Y | 当前账户本金余额 |
| giftBalance | Number | Y | 当前账户赠送余额 |
| totalAccountAmount | Number | Y | 账户总余额 |
| type | String | Y | 交易类型 1-进账2-出账 |
| subType | String | Y | 子类型 |
| amount | String | Y | 出账/入账金额 |
| transactionTime | String | Y | 交易时间 |
| category | String | Y | 余额类型1-本金2-赠送) |
## 1007 通过 memberId 查询用户个人基本信息(查询用户是否已绑定车牌号)
> 请求地址: http://localhost:8080/uniapp/member/getMemberCarNoInfo
>
> 请求方式GET
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------------ | ------ | -------- | -------- |
| memberId | String | Y | 会员id |
| phoneNumber | String | Y | 手机号码 |
| licensePlateNumber | String | Y | 车牌号 |
| createTime | String | Y | 创建时间 |
## 1008 用户绑定车牌号
> 请求地址http://localhost:8080/uniapp/member/memberBindingCarNo
>
> 请求方式POST
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ---------------- | ------ | -------- | ---------- |
| phoneNumber | String | Y | 手机号码 |
| verificationCode | String | Y | 短信验证码 |
| carNo | String | Y | 车牌号 |
## 1009 用户(批量)解绑车牌号
> 请求地址http://localhost:8080/uniapp/member/memberUnbindCarNo
>
> 请求方式POST
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ------------- | -------- | -------------- |
| id | List<Integer> | Y | 要删除的Id集合 |
**反参**
会在 “obj” 中返回解绑的条数
# 充电站接口
## 2001 根据经纬度查询充电站列表(分页排序)
> 接口地址http://localhost:8080/uniapp/pile/queryStationInfos
>
> 请求类型POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------- | ------ | -------- | ---------------- |
@@ -164,7 +253,7 @@ null在Header中需传Authorization
| pageSize | Number | Y | 每页数量 |
| stationName | String | y | 站点名称(搜索) |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| -------- | ---------------- | -------- | ---------- |
@@ -193,14 +282,21 @@ StationVO
| stationLng | String | Y | 经度 |
| stationLat | String | Y | 纬度 |
# 充电桩接口
## 3001 查询充电桩详情
## 3002 查询充电桩枪口详情
> 接口地址http://localhost:8080/uniapp/pile/selectConnectorListByParams
>
> 请求类型POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------------- | -------- | --------------------------- |
@@ -212,7 +308,7 @@ StationVO
| connectorIdList | Array<Long> | N | 枪口id列表 |
| connectorCodeList | Array<String> | N | 枪口号列表 |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| -------- | -------------------------- | -------- | ------------ |
@@ -222,7 +318,7 @@ StationVO
| total | Number | Y | 总数 |
| pages | Number | Y | 总页数 |
### PileConnectorInfoVO
**PileConnectorInfoVO**
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------------ | ---------- | :------: | ------------------------------------------------------------ |
@@ -251,7 +347,7 @@ StationVO
| chargingDegree | BigDecimal | Y | 充电度数 |
| businessType | | y | 经营类型1-运营桩2-个人桩) |
### 示例:
**示例:**
```json
#
@@ -301,13 +397,15 @@ StationVO
}
```
## 3003 站点详情页面
接口地址:
请求方式:
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ---- | -------- | ------ |
@@ -315,7 +413,7 @@ StationVO
| | | | |
| | | | |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ---------------- | ---- | -------- | -------- |
@@ -334,13 +432,15 @@ StationVO
## 4001 启动充电
# 订单接口
## 5001 生成订单
> 接口地址http://localhost:8080/uniapp/order/generateOrder
>
> 请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | --------------------------- |
@@ -351,14 +451,9 @@ StationVO
备注pileSn + connectorCode 或 pileConnectorCode 选其一,接口都支持
### 反参
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | ------ |
| orderCode | String | Y | 订单号 |
**反参**
```
## 4002 结束充电
> 接口地址http://localhost:8080/uniapp/order/settleOrder
@@ -377,23 +472,70 @@ StationVO
### 反参
null若成功msg中会有“==操作成功==”提示
```
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | ------ |
| orderCode | String | Y | 订单号 |
## 5001 查询订单列表
## 5002 支付订单
> 请求地址http://localhost:8080/uniapp/pay/payOrder
>
> 请求方式POST
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | -------- |
| orderCode | String | Y | 订单号 |
| payMode | String | Y | 支付方式 |
| payAmount | String | Y | 支付金额 |
**反参**
null提示”==操作成功==“
## 5003 结算订单
> 接口地址http://localhost:8080/uniapp/order/settleOrder
>
> 请求方式POST
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | --------------------------- |
| orderCode | String | Y | 订单号 |
| pileSn | String | Y | 桩编码 |
| connectorCode | String | Y | 枪口号 |
| pileConnectorCode | String | Y | 桩枪口编号(桩编码+枪口号) |
**反参**
null若成功msg中会有“==操作成功==”提示
## 5004 查询订单列表
> 请求地址http://localhost:8080/uniapp/order/getOrderList
>
> 请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | --------------------------- |
| memberId | String | Y | 会员id |
| pageSize | Number | Y | |
| pageNum | Number | Y | |
| orderStatus | String | Y | 订单状态 1-全部 2-未完成 3-已完成 |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | --------------------------- |
@@ -411,93 +553,21 @@ null若成功msg中会有“==操作成功==”提示
| payStatus | String | Y | 支付状态(0-待支付1-支付完成) |
| reason | String | Y | 订单异常原因 |
## 60001 查询余额明细
> 请求地址: http://localhost:8080/uniapp/member/getMemberBalanceChanges
>
> 请求方式POST
### 入参
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------- | ------ | -------- | ------------------------ |
| memberToken | String | Y | 会员令牌 |
| type | String | Y | 交易类型 1-进账2-出账 |
| pageSize | | | |
| pageNum | | | |
### 反参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------------ | ------ | -------- | -------------------------- |
| memberId | String | Y | 会员Id |
| principalBalance | Number | Y | 当前账户本金余额 |
| giftBalance | Number | Y | 当前账户赠送余额 |
| totalAccountAmount | Number | Y | 账户总余额 |
| type | String | Y | 交易类型 1-进账2-出账 |
| subType | String | Y | 子类型 |
| amount | String | Y | 出账/入账金额 |
| transactionTime | String | Y | 交易时间 |
| category | String | Y | 余额类型1-本金2-赠送) |
## 7001 生成订单
> 请求地址http://localhost:8080/uniapp/order/generateOrder
>
> 请求方式POST
### 入参
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | ---------- |
| pileConnectorCode | String | Y | 桩枪口编码 |
| chargeAmount | Number | Y | 充电金额 |
### 反参
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | ------ |
| orderCode | String | Y | 订单号 |
## 7002 支付订单
> 请求地址http://localhost:8080/uniapp/pay/payOrder
>
> 请求方式POST
### 入参
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | -------- |
| orderCode | String | Y | 订单号 |
| payMode | String | Y | 支付方式 |
| payAmount | String | Y | 支付金额 |
### 反参
null提示”==操作成功==“
## 7003 订单停止充电
## 5005 订单停止充电
> 请求地址http://localhost:8080/uniapp/order/stopCharging
>
> 请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | ------ |
| orderCode | String | Y | 订单号 |
### 反参
**反参**
null提示”==操作成功==“
@@ -515,13 +585,13 @@ null提示”==操作成功==“
>
> 请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | ------ |
| stationId | String | N | 站点id |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| --------------------- | ------ | -------- | ---------- |
@@ -539,13 +609,13 @@ null提示”==操作成功==“
>
> 请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| --------- | ------ | -------- | ------ |
| stationId | String | N | 站点id |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| -------------------------- | ------ | -------- | -------------- |
@@ -567,7 +637,7 @@ null提示”==操作成功==“
>
> 请求方式: POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ---------------- | ------ | -------- | -------------- |
@@ -575,7 +645,7 @@ null提示”==操作成功==“
| phoneNumber | String | Y | 用户手机号码 |
| verificationCode | String | Y | 用户手机验证码 |
### 反参
**反参**
@@ -587,7 +657,7 @@ null提示”==操作成功==“
>
> 请求方式: POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------- | ------ | -------- | -------------------- |
@@ -602,9 +672,9 @@ null提示”==操作成功==“
>
> 请求方式: GET
### 反参
**反参**
### List<PersonalPileInfoVO>
**List<PersonalPileInfoVO>**
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------ | ------ | -------- | ---------------------------- |
@@ -628,13 +698,13 @@ null提示”==操作成功==“
>
> 请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | -------- |
| pileConnectorCode | String | Y | 桩枪口号 |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| -------------- | ------ | -------- | -------- |
@@ -650,7 +720,7 @@ null提示”==操作成功==“
>
> 请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | -------- |
@@ -658,7 +728,7 @@ null提示”==操作成功==“
| startTime | String | Y | 开始日期 |
| endTime | String | Y | 结束日期 |
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ---------------------- | ------ | -------- | ------------ |
@@ -676,7 +746,7 @@ null提示”==操作成功==“
请求方式POST
### 入参
**入参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ----------------- | ------ | -------- | -------- |
@@ -686,7 +756,7 @@ null提示”==操作成功==“
### 反参
**反参**
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------------- | ------ | -------- | -------- |
@@ -695,50 +765,3 @@ null提示”==操作成功==“
| chargingElectricity | String | Y | 用电量 |
| chargingTime | String | Y | 充电时长 |
## 10001 通过 memberId 查询用户个人基本信息(查询用户是否已绑定车牌号)
> 请求地址: http://localhost:8080/uniapp/member/getMemberCarNoInfo
>
> 请求方式GET
### 反参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------------------ | ------ | -------- | -------- |
| memberId | String | Y | 会员id |
| phoneNumber | String | Y | 手机号码 |
| licensePlateNumber | String | Y | 车牌号 |
| createTime | String | Y | 创建时间 |
## 10002 用户绑定车牌号
> 请求地址http://localhost:8080/uniapp/member/memberBindingCarNo
>
> 请求方式POST
### 入参
| 字段名 | 类型 | 是否必传 | 备注 |
| ---------------- | ------ | -------- | ---------- |
| phoneNumber | String | Y | 手机号码 |
| verificationCode | String | Y | 短信验证码 |
| carNo | String | Y | 车牌号 |
## 10003 用户(批量)解绑车牌号
> 请求地址http://localhost:8080/uniapp/member/memberUnbindCarNo
>
> 请求方式POST
### 入参
| 字段名 | 类型 | 是否必传 | 备注 |
| ------ | ------------- | -------- | -------------- |
| id | List<Integer> | Y | 要删除的Id集合 |
### 反参
会在 “obj” 中返回解绑的条数

View File

@@ -275,6 +275,7 @@ public class OrderController extends BaseController {
/**
* 申请开票接口
*/
@PostMapping("/applyOrderInvoice")
public RestApiResponse<?> applyOrderInvoice(HttpServletRequest request, @RequestBody ApplyOrderInvoiceDTO dto) {
RestApiResponse<?> response;
try {

View File

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
@@ -82,12 +83,14 @@ import java.math.BigDecimal;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -1011,11 +1014,10 @@ public class OrderService {
}
// 排除掉已经申请过的订单
List<String> orderCodeList = Lists.newArrayList();
for (OrderInvoiceRecord orderInvoiceRecord : orderInvoiceRecords) {
String orderCodes = orderInvoiceRecord.getOrderCodes();
orderCodeList.addAll(Lists.newArrayList(StringUtils.split(orderCodes, ",")));
}
List<String> orderCodeList = orderInvoiceRecords.stream() // 转化为 Stream
.map(OrderInvoiceRecord::getOrderCodes) // 获取 OrderInvoiceRecord 中的 orderCodes 字符串
.flatMap(str -> Arrays.stream(str.split(","))) // 分隔逗号并转化为 Stream
.collect(Collectors.toList()); // 收集为 List<String>
orderList = orderList.stream()
.filter(x -> !orderCodeList.contains(x.getOrderCode()))
@@ -1029,11 +1031,47 @@ public class OrderService {
* @param dto
*/
public void applyOrderInvoice(ApplyOrderInvoiceDTO dto) {
// 校验订单是否已经开票
int i = 60;
// 查询最近60天完成的订单
LocalDateTime dateTime = LocalDateTime.now().plusDays(-i);
// 查询最近60天申请开票记录
QueryInvoiceRecordDTO build = QueryInvoiceRecordDTO.builder()
.memberId(dto.getMemberId())
.startTime(dateTime)
.build();
List<OrderInvoiceRecord> orderInvoiceRecords = orderInvoiceRecordService.selectInvoiceRecordList(build);
List<String> orderCodeList = orderInvoiceRecords.stream() // 转化为 Stream
.map(OrderInvoiceRecord::getOrderCodes) // 获取 OrderInvoiceRecord 中的 orderCodes 字符串
.flatMap(str -> Arrays.stream(str.split(","))) // 分隔逗号并转化为 Stream
.collect(Collectors.toList()); // 收集为 List<String>
// 取交集 校验订单是否已经开票
Set<String> intersection = Sets.intersection(Sets.newHashSet(orderCodeList), Sets.newHashSet(dto.getOrderCodes()));
if (CollectionUtils.isNotEmpty(intersection)) {
log.info("申请开票前端传的:{}订单号list, 包含已经申请的订单:{}", dto.getOrderCodes(), intersection);
return;
}
// 整理数据
List<OrderVO> orderVOList = orderBasicInfoService.getListByOrderCodes(dto.getOrderCodes());
BigDecimal totalAmount = BigDecimal.ZERO;
BigDecimal totalElecAmount = BigDecimal.ZERO;
BigDecimal totalServiceAmount = BigDecimal.ZERO;
for (OrderVO orderVO : orderVOList) {
totalAmount = totalAmount.add(orderVO.getOrderAmount());
totalElecAmount = totalElecAmount.add(orderVO.getTotalElectricityAmount());
totalServiceAmount = totalServiceAmount.add(orderVO.getTotalServiceAmount());
}
// 入库
OrderInvoiceRecord orderInvoiceRecord = new OrderInvoiceRecord();
orderInvoiceRecord.setStatus("0");
orderInvoiceRecord.setMemberId(dto.getMemberId());
orderInvoiceRecord.setTitleId(dto.getTitleId());
orderInvoiceRecord.setOrderCodes(String.join(",", dto.getOrderCodes()));
orderInvoiceRecord.setTotalAmount(totalAmount);
orderInvoiceRecord.setTotalElecAmount(totalElecAmount);
orderInvoiceRecord.setTotalServiceAmount(totalServiceAmount);
orderInvoiceRecordService.insertOrderInvoiceRecord(orderInvoiceRecord);
}
}

View File

@@ -190,4 +190,6 @@ public interface OrderBasicInfoMapper {
List<PersonPileConnectorSumInfoVO> getAccumulativeInfo(QueryPersonPileDTO dto);
List<OrderBasicInfo> getAppointmentOrder(LocalDateTime dateTime);
List<OrderVO> getListByOrderCodes(@Param("orderCodes") List<String> orderCodes);
}

View File

@@ -200,6 +200,8 @@ public interface IOrderBasicInfoService {
*/
void closeStartFailedOrder(String startTime, String endTime);
List<OrderVO> getListByOrderCodes(List<String> orderCodes);
/**
* 个人桩查询充电数据
* @param dto

View File

@@ -1197,6 +1197,11 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
return orderBasicInfoMapper.getListByMemberIdAndOrderStatus(memberId, orderStatusList, dateTime);
}
@Override
public List<OrderVO> getListByOrderCodes(List<String> orderCodes) {
return orderBasicInfoMapper.getListByOrderCodes(orderCodes);
}
/**
* 个人桩查询充电数据
*

View File

@@ -895,4 +895,31 @@
and order_status = '0'
and appointment_time <![CDATA[ <= ]]> #{dateTime,jdbcType=TIMESTAMP}
</select>
<select id="getListByOrderCodes" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
SELECT
t1.order_code as orderCode,
t1.order_status as orderStatus,
t1.reason,
t1.station_id,
t3.station_name as stationName,
t1.pile_sn as pileSn,
t1.connector_code as connectorCode,
t1.pay_status as payStatus,
t1.order_amount as orderAmount,
t1.pay_amount as payAmount,
t2.total_used_electricity as chargingDegree,
t1.charge_start_time as startTime,
t1.charge_end_time as endTime,
t2.total_electricity_amount as totalElectricityAmount,
t2.total_service_amount as totalServiceAmount
from order_basic_info t1
join order_detail t2 on t1.order_code = t2.order_code
join pile_station_info t3 on t1.station_id = t3.id
where t1.del_flag = '0'
and t1.order_code in
<foreach collection="orderCodes" item="orderCode" open="(" separator="," close=")">
#{orderCode,jdbcType=VARCHAR}
</foreach>
</select>
</mapper>