bug修复:车辆列表、车辆状态
This commit is contained in:
parent
02cf3aec30
commit
265ab3517c
@ -19,7 +19,7 @@ import java.util.UUID;
|
||||
* MQTT 连接工厂(负责创建/销毁连接)
|
||||
*/
|
||||
@Slf4j
|
||||
public class MqttConnectionFactory extends BasePooledObjectFactory<Channel> {
|
||||
public class MqttConnectionFactory extends BasePooledObjectFactory<Channel> {
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
|
||||
@Override
|
||||
|
||||
@ -1533,7 +1533,7 @@ public class EbikeBikeInfoServiceImpl extends ServiceImpl<EbikeBikeInfoMapper, E
|
||||
.leftJoin(EBIKE_ECU_INFO).on(EBIKE_ECU_INFO.ECU_ID.eq(EBIKE_BIKE_INFO.ECU_ID))
|
||||
.where(EBIKE_ECU_INFO.ECU_SN.in(ecuSnDto.getList()))
|
||||
.where(EBIKE_BIKE_INFO.IS_IN_WAREHOUSE.eq("0"))
|
||||
.where(EBIKE_BIKE_INFO.USAGE_STATUS.eq(2));
|
||||
.where(EBIKE_BIKE_INFO.STATE.eq("2"));
|
||||
return ebikeBikeInfoMapper.selectListByQueryAs(query, EbikeOrderBikeDto.class);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ package com.cdzy.ebikeoperate.mapper;
|
||||
|
||||
import com.cdzy.ebikeoperate.model.pojo.EbikeComponentInventory;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 映射层。
|
||||
@ -11,4 +13,28 @@ import com.mybatisflex.core.BaseMapper;
|
||||
*/
|
||||
public interface EbikeComponentInventoryMapper extends BaseMapper<EbikeComponentInventory> {
|
||||
|
||||
|
||||
// @Select({
|
||||
// "SELECT COUNT(1) FROM ebike_component_inventory a" +
|
||||
// "WHERE (a.item_code = #{itemCode} or a.serial_number= #{itemCode}) " +
|
||||
// "AND a.component_type = #{componentType} " +
|
||||
// "AND a.state = #{state} "
|
||||
// })
|
||||
// int selectCount(@Param("itemCode") String itemCode,@Param("componentType") String componentType,@Param("state") Integer state);
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT COUNT(1) FROM ebike_component_inventory a",
|
||||
"WHERE (a.item_code = #{itemCode} OR a.serial_number = #{itemCode})",
|
||||
"AND a.component_type = #{componentType}",
|
||||
"<if test='state != null'>",
|
||||
"AND a.state = #{state}",
|
||||
"</if>",
|
||||
"</script>"
|
||||
})
|
||||
int selectCount(
|
||||
@Param("itemCode") String itemCode,
|
||||
@Param("componentType") String componentType,
|
||||
@Param("state") Integer state
|
||||
);
|
||||
}
|
||||
|
||||
@ -841,13 +841,17 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
||||
}
|
||||
|
||||
public boolean isDuplicateEntry(String itemCode, String componentType, Boolean isNew) {
|
||||
QueryWrapper query = new QueryWrapper();
|
||||
query.eq("item_code", itemCode);
|
||||
query.eq("component_type", componentType);
|
||||
// QueryWrapper query = new QueryWrapper();
|
||||
// query.and(qw -> qw.eq("item_code", itemCode).or().eq("serial_number", itemCode));
|
||||
// query.eq("component_type", componentType);
|
||||
|
||||
Integer state = null;
|
||||
if (!isNew) {
|
||||
query.eq("state", 1); // 假设 1 表示已已入库
|
||||
// query.eq("state", 1); // 假设 1 表示已已入库
|
||||
state=1;
|
||||
}
|
||||
long count = ebikeComponentInventoryMapper.selectCountByQuery(query); // 查询符合条件的记录数
|
||||
long count = ebikeComponentInventoryMapper.selectCount(itemCode,componentType,state);
|
||||
// long count = ebikeComponentInventoryMapper.selectCountByQuery(query); // 查询符合条件的记录数
|
||||
return count > 0; // 如果记录数大于 0,说明已经存在重复入库
|
||||
}
|
||||
|
||||
|
||||
@ -103,10 +103,10 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
|
||||
}
|
||||
FeignEbikeBikeInfoDto bikeInfoDto = jsonResult.getData();
|
||||
// 判断车辆状态
|
||||
if ("3".equals(bikeInfoDto.getState())) {
|
||||
if ("骑行中".equals(bikeInfoDto.getState())) {
|
||||
throw new RuntimeException("车辆使用中");
|
||||
}
|
||||
if ("4".equals(bikeInfoDto.getState())) {
|
||||
if ("待维修".equals(bikeInfoDto.getState())) {
|
||||
throw new RuntimeException("车辆故障,暂不可用");
|
||||
}
|
||||
FeignEbikeEcuInfo ecuInfo = bikeInfoDto.getEbikeEcuInfo();
|
||||
|
||||
@ -119,6 +119,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
EbikePayment ebikePayment = ebikePaymentService.getByOrderId(orderId);
|
||||
if (ebikePayment != null) {
|
||||
String tradeState = ebikePayment.getTradeState();
|
||||
|
||||
if (String.valueOf(Transaction.TradeStateEnum.SUCCESS.ordinal()).equals(tradeState)) {
|
||||
log.info("订单已经支付成功,订单号:{}", orderId);
|
||||
r.put("error", "订单已经支付成功");
|
||||
@ -149,6 +150,31 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
r.put("error", "订单状态异常: ");
|
||||
return r;
|
||||
}
|
||||
|
||||
// 获取两小时后的时间
|
||||
LocalDateTime createTime = ebikePayment.getCreateTime();
|
||||
// // 定义一个持续时间为2小时的Duration
|
||||
// Duration twoHours = Duration.ofHours(2);
|
||||
// LocalDateTime twoHoursLater = createTime.plus(twoHours);
|
||||
|
||||
// 判断当前时间是否大于两小时前的时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
// if (now.isAfter(twoHoursLater)) {
|
||||
// //时间过期
|
||||
// ebikePayment.setPaymentId(StringUtils.generateSnowflakeId("paymentId"));
|
||||
// ebikePayment.setCreateTime(now);
|
||||
// }
|
||||
|
||||
// 计算两个时间点之间的差异
|
||||
Duration duration = Duration.between(createTime, now);
|
||||
// 获取差异的秒数
|
||||
long seconds = duration.getSeconds();
|
||||
// 判断是否大于7200秒(即2小时)
|
||||
if (seconds > 7200) {
|
||||
//时间过期
|
||||
ebikePayment.setPaymentId(StringUtils.generateSnowflakeId("paymentId"));
|
||||
ebikePayment.setCreateTime(now);
|
||||
}
|
||||
}
|
||||
//查询订单, orderFeingClient.getOrderById(orderId)
|
||||
EbikePaymentDto paymentDto = ebikePaymentService.getPaymentDetails(orderId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user