bug修复
This commit is contained in:
parent
35de1bd0e1
commit
af3895d0b4
@ -0,0 +1,14 @@
|
||||
package com.cdzy.orders.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cdzy.orders.model.entity.EbikePayment;
|
||||
|
||||
/**
|
||||
* 用户订单支付记录 映射层。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-07-07
|
||||
*/
|
||||
public interface EbikePaymentMapper extends BaseMapper<EbikePayment> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.cdzy.orders.model.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户订单支付记录 实体类。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-07-07
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("ebike_payment")
|
||||
public class EbikePayment implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id
|
||||
private String recordId;
|
||||
|
||||
/**
|
||||
* 骑行订单号
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 支付交易用订单编号,重新请求时需要更新
|
||||
*/
|
||||
private String paymentId;
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 微信支付订单号, 仅支付成功有
|
||||
*/
|
||||
private String transactionId;
|
||||
|
||||
/**
|
||||
* 提交时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 支付成功时间
|
||||
*/
|
||||
private LocalDateTime paymentTime;
|
||||
|
||||
/**
|
||||
* 支付方式;wechat/alipay/balance
|
||||
*/
|
||||
private String paymentMethod;
|
||||
|
||||
/**
|
||||
* 支付状态;0支付成功 1退款 2未支付 3关闭 4取消 5支付中 6支付错误 7接受
|
||||
*/
|
||||
private String tradeState;
|
||||
|
||||
/**
|
||||
* 订单原价
|
||||
*/
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 支付货币
|
||||
*/
|
||||
private String currency;
|
||||
|
||||
/**
|
||||
* 支付总金额
|
||||
*/
|
||||
private BigDecimal total;
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cdzy.orders.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cdzy.orders.model.entity.EbikePayment;
|
||||
|
||||
/**
|
||||
* 用户订单支付记录 服务层。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-07-07
|
||||
*/
|
||||
public interface EbikePaymentService extends IService<EbikePayment> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.cdzy.orders.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cdzy.orders.model.entity.EbikePayment;
|
||||
import com.cdzy.orders.mapper.EbikePaymentMapper;
|
||||
import com.cdzy.orders.service.EbikePaymentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户订单支付记录 服务层实现。
|
||||
*
|
||||
* @author attiya
|
||||
* @since 2025-07-07
|
||||
*/
|
||||
@Service
|
||||
public class EbikePaymentServiceImpl extends ServiceImpl<EbikePaymentMapper, EbikePayment> implements EbikePaymentService{
|
||||
|
||||
}
|
||||
@ -13,7 +13,9 @@ import com.cdzy.orders.mapper.UserOrdersMapper;
|
||||
import com.cdzy.orders.model.dto.req.*;
|
||||
import com.cdzy.orders.model.dto.res.*;
|
||||
import com.cdzy.orders.model.entity.EbikeOrderDetails;
|
||||
import com.cdzy.orders.model.entity.EbikePayment;
|
||||
import com.cdzy.orders.model.entity.EbikeUserOrders;
|
||||
import com.cdzy.orders.service.EbikePaymentService;
|
||||
import com.cdzy.orders.service.UserOrdersService;
|
||||
import com.cdzy.orders.uitls.NumberUtils;
|
||||
import com.cdzy.orders.uitls.RedisUtil;
|
||||
@ -25,6 +27,7 @@ import com.ebike.feign.model.res.ResFeignEbikeSysRcostsetTimePeriodDto;
|
||||
import com.ebike.feign.model.res.ResFeignEbikeSysRcostsetWeekDto;
|
||||
import com.ebike.feign.model.res.ResFeignOrderPaymentDto;
|
||||
import com.ebike.feign.model.rsp.*;
|
||||
import com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -73,6 +76,11 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
|
||||
@Resource
|
||||
EbikeOrderDetailsMapper orderDetailsMapper;
|
||||
|
||||
@Resource
|
||||
EbikePaymentService paymentService;
|
||||
|
||||
private static SnowFlakeIDKeyGenerator snowFlakeIDKeyGenerator = new SnowFlakeIDKeyGenerator();
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Long saveRide(ReqOrderDto orderDto) {
|
||||
@ -181,6 +189,15 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
|
||||
if (jsonObject.getInteger("code") != 0) {
|
||||
throw new RuntimeException("关锁失败");
|
||||
}
|
||||
//生成支付订单
|
||||
EbikePayment payment = EbikePayment.builder()
|
||||
.orderId(String.valueOf(userOrders.getOrderId()))
|
||||
.paymentId(String.valueOf(snowFlakeIDKeyGenerator.nextId()))
|
||||
.total(userOrders.getTotalAmount())
|
||||
.userId(userId)
|
||||
.createTime(LocalDateTime.now())
|
||||
.build();
|
||||
paymentService.save(payment);
|
||||
//添加还车单量
|
||||
Long siteRegionId = redisUtil.isPointInSiteWithSiteRegionId(resGpsDto.getLongitude(), resGpsDto.getLatitude(), regionDto.getOperationRegionId());
|
||||
operateFeignClient.addReturn(siteRegionId);
|
||||
|
||||
@ -16,6 +16,7 @@ import com.ebike.feign.model.res.ResFeignEbikeSysRcostsetDto;
|
||||
import com.ebike.feign.model.res.ResFeignEbikeSysRcostsetWeekDto;
|
||||
import com.mybatisflex.codegen.Generator;
|
||||
import com.mybatisflex.codegen.config.GlobalConfig;
|
||||
import com.mybatisflex.core.keygen.impl.SnowFlakeIDKeyGenerator;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import com.cdzy.orders.uitls.TimeUtils;
|
||||
import com.ebike.feign.clients.MaintenanceFeignClient;
|
||||
@ -49,18 +50,15 @@ class EbikeOrdersApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
|
||||
SnowFlakeIDKeyGenerator keyGenerator = new SnowFlakeIDKeyGenerator();
|
||||
System.out.println(keyGenerator.nextId());
|
||||
}
|
||||
|
||||
private static final String model_path = "D:/Projects/eBIKE/mybatis-flex/ebike-orders";
|
||||
private static final String mapperPath = "D:/Projects/eBIKE/mybatis-flex/ebike-orders/resources/mapper";
|
||||
private static final String packageName = "com.cdzy.orders";
|
||||
private static final String[] tables = new String[]{
|
||||
"ebike_order_attachment_file",
|
||||
"ebike_user_faultreport",
|
||||
"ebike_attachefile_assosiated",
|
||||
"ebike_faultreport_review",
|
||||
"ebike_user_backsite_deal"
|
||||
"ebike_payment"
|
||||
};
|
||||
|
||||
@Test
|
||||
|
||||
@ -96,7 +96,7 @@ public class EbikePaymentServiceImpl extends ServiceImpl<EbikePaymentMapper, Ebi
|
||||
.when(2).then("骑行卡购买")
|
||||
.when(3).then("会员卡续费").end().as("goods_tag"),
|
||||
EBIKE_USER_ORDERS.START_TIME, EBIKE_USER_ORDERS.END_TIME,
|
||||
EBIKE_USER_ORDERS.USER_ID, EBIKE_USER.OPEN_ID
|
||||
EBIKE_USER_ORDERS.USER_ID, EBIKE_USER.OPEN_ID,EBIKE_USER_ORDERS.TOTAL_AMOUNT,EBIKE_USER_ORDERS.ACTUAL_AMOUNT
|
||||
)
|
||||
.from(EBIKE_USER_ORDERS)
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER_ORDERS.USER_ID.eq(EBIKE_USER.USER_ID))
|
||||
|
||||
@ -5,7 +5,7 @@ spring:
|
||||
name: ebike-payment
|
||||
cloud:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848 # nacos
|
||||
server-addr: 192.168.2.226:8848 # nacos
|
||||
username: nacos
|
||||
password: nacos
|
||||
jackson:
|
||||
@ -51,8 +51,8 @@ payment:
|
||||
wx-pay:
|
||||
app-id: wx327d788d7bd6eddf
|
||||
merchant-id: 1715147005
|
||||
private-key-path: D:/Projects/eBIKE/docs/secrets/apiclient_key.pem
|
||||
public-key-path: D:/Projects/eBIKE/docs/secrets/apiclient_pubkey.pem
|
||||
private-key-path: /opt/wxpay/apiclient_key.pem
|
||||
public-key-path: /opt/wxpay/pub_key.pem
|
||||
merchant-serial-number: 7873E3E694ADD0368EA3E9FAC929F496EECB8DF9
|
||||
api-v3-key: 1715147005V3Key20250425174554633
|
||||
public-key-id: PUB_KEY_ID_0117151470052025042500331704000601
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user