完成退款用户订单记录接口,判断是否上报故障
This commit is contained in:
parent
ed7049cfdc
commit
4d37f2b8d4
@ -33,7 +33,12 @@ public class OrderRecord {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createAt;
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 骑行时长
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
package com.cdzy.payment.model.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户上报故障信息 实体类。
|
||||
*
|
||||
* @author dingchao
|
||||
* @since 2025-04-16
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("ebike_user_faultreport")
|
||||
public class EbikeUserFaultreport implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Id
|
||||
private String faultReportId;
|
||||
|
||||
/**
|
||||
* 车辆编号
|
||||
*/
|
||||
private String bikeCode;
|
||||
|
||||
/**
|
||||
* 当前位置
|
||||
*/
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 损坏部件
|
||||
*/
|
||||
private String faultPart;
|
||||
|
||||
/**
|
||||
* 故障说明
|
||||
*/
|
||||
private String faultDescription;
|
||||
|
||||
/**
|
||||
* 上报时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime reportAt;
|
||||
|
||||
/**
|
||||
* 删除状态;1已删除
|
||||
*/
|
||||
private String isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onUpdateValue = "now()")
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private LocalDateTime deletedAt;
|
||||
|
||||
/**
|
||||
* 上报人
|
||||
*/
|
||||
private String reportUser;
|
||||
|
||||
/**
|
||||
* 上报来源
|
||||
*/
|
||||
private String reportSource;
|
||||
|
||||
/**
|
||||
* 处理状态
|
||||
*/
|
||||
private String handleState;
|
||||
|
||||
/**
|
||||
* 当前位置经度
|
||||
*/
|
||||
private Double longitude;
|
||||
|
||||
/**
|
||||
* 当前位置纬度
|
||||
*/
|
||||
private Double latitude;
|
||||
|
||||
/**
|
||||
* 工单ID
|
||||
*/
|
||||
private String workorderId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
}
|
||||
@ -112,4 +112,5 @@ public interface EbikeRefundService extends IService<EbikeRefund> {
|
||||
* @return 用户订单列表
|
||||
*/
|
||||
Page<OrderRecord> getRefundOrderRecords(ReqUserQueryDto reqRefundRecordDto);
|
||||
|
||||
}
|
||||
|
||||
@ -5,10 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cdzy.payment.model.dto.req.ReqRefundDto;
|
||||
import com.cdzy.payment.model.dto.req.ReqRefundProcessDto;
|
||||
import com.cdzy.payment.model.dto.req.ReqRefundQueryDto;
|
||||
import com.cdzy.payment.model.dto.res.HandleNotifyResult;
|
||||
import com.cdzy.payment.model.dto.res.ResOrderInfoDto;
|
||||
import com.cdzy.payment.model.dto.res.ResRefundOrderInfo;
|
||||
import com.cdzy.payment.model.dto.res.UserBasicInformation;
|
||||
import com.cdzy.payment.model.dto.res.*;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
|
||||
@ -28,6 +28,7 @@ import java.util.List;
|
||||
|
||||
import static com.cdzy.payment.model.entity.table.EbikePaymentTableDef.EBIKE_PAYMENT;
|
||||
import static com.cdzy.payment.model.entity.table.EbikeRefundTableDef.EBIKE_REFUND;
|
||||
import static com.cdzy.payment.model.entity.table.EbikeUserFaultreportTableDef.EBIKE_USER_FAULTREPORT;
|
||||
import static com.cdzy.payment.model.entity.table.EbikeUserOrdersTableDef.EBIKE_USER_ORDERS;
|
||||
import static com.cdzy.payment.model.entity.table.EbikeUserTableDef.EBIKE_USER;
|
||||
import static com.cdzy.payment.model.enums.RefundProcessState.*;
|
||||
@ -376,7 +377,56 @@ public class EbikeRefundServiceImpl extends ServiceImpl<EbikeRefundMapper, Ebike
|
||||
|
||||
@Override
|
||||
public Page<OrderRecord> getRefundOrderRecords(ReqUserQueryDto reqRefundRecordDto) {
|
||||
return null;
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_USER_ORDERS.ORDER_ID, EBIKE_USER_ORDERS.BIKE_CODE, EBIKE_USER_ORDERS.CREATED_AT,
|
||||
EBIKE_USER_ORDERS.START_TIME, EBIKE_USER_ORDERS.END_TIME,
|
||||
EBIKE_USER_ORDERS.ACTUAL_AMOUNT, EBIKE_USER_ORDERS.TOTAL_AMOUNT,
|
||||
EBIKE_USER_ORDERS.END_TIME.as("lock_car_time"), EBIKE_PAYMENT.PAYMENT_TIME.as("pay_time"),
|
||||
QueryMethods.case_(EBIKE_PAYMENT.TRADE_STATE)
|
||||
.when("0").then("支付成功")
|
||||
.when("1").then("退款")
|
||||
.when("2").then("未支付")
|
||||
.when("3").then("关闭")
|
||||
.when("4").then("取消")
|
||||
.when("5").then("支付中")
|
||||
.when("6").then("支付错误")
|
||||
.when("7").then("接受支付")
|
||||
.end().as("pay_state"),
|
||||
QueryMethods.case_(EBIKE_PAYMENT.PAYMENT_METHOD)
|
||||
.when(PayMethod.wechat.name()).then("微信支付")
|
||||
.when(PayMethod.alipay.name()).then("支付宝")
|
||||
.when(PayMethod.balance.name()).then("余额").end().as("pay_method"),
|
||||
EBIKE_PAYMENT.TRANSACTION_ID.as("trade_serial_number")
|
||||
)
|
||||
.from(EBIKE_USER_ORDERS).leftJoin(EBIKE_PAYMENT).on(EBIKE_USER_ORDERS.ORDER_ID.eq(EBIKE_PAYMENT.ORDER_ID))
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER.USER_ID.eq(EBIKE_USER_ORDERS.USER_ID))
|
||||
.where(EBIKE_USER.MOBILE.eq(reqRefundRecordDto.getPhone()));
|
||||
Page<OrderRecord> page = reqRefundRecordDto.getPageParam().getPage();
|
||||
Page<OrderRecord> list = pageAs(page, query, OrderRecord.class);
|
||||
list.getRecords().forEach(item -> {
|
||||
item.setOperate(getOperationArea(item.getBikeCode()));
|
||||
if(item.getStartTime()!=null&&item.getEndTime()!=null) {
|
||||
item.setCyclingDuration(StringUtils.getDurationTimeString(item.getStartTime(), item.getEndTime()));
|
||||
}
|
||||
if(item.getTotalAmount()!=null&& item.getActualAmount()!=null) {
|
||||
item.setDiscountAmount(item.getTotalAmount() - item.getActualAmount());
|
||||
}
|
||||
item.setHasFaultReport(getFaultReportCount(item.getOrderId())>0?"是":"否");
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单id获取故障报告数量
|
||||
* @param orderId 订单id
|
||||
* @return 故障报告数量
|
||||
*/
|
||||
private long getFaultReportCount(String orderId){
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(QueryMethods.count(EBIKE_USER_FAULTREPORT.ALL_COLUMNS))
|
||||
.from(EBIKE_USER_FAULTREPORT)
|
||||
.where(EBIKE_USER_FAULTREPORT.ORDER_CODE.eq(orderId));
|
||||
return (long)getObj(query);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -762,7 +762,6 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取车辆经纬度
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user