查询订单优化

This commit is contained in:
2025-08-23 22:45:32 +08:00
parent 26cd9002bb
commit 39a7ff8a99
4 changed files with 86 additions and 4 deletions

View File

@ -671,7 +671,7 @@ public class OrderServiceImpl implements OrderService {
//去查看订单是否支付成功 //去查看订单是否支付成功
LambdaQueryWrapper<OrderSubPO> querySubOrderWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrderSubPO> querySubOrderWrapper = new LambdaQueryWrapper<>();
querySubOrderWrapper.eq(OrderSubPO::getOrderId, orderMainPO.getOrderId()) querySubOrderWrapper.eq(OrderSubPO::getOrderId, orderMainPO.getOrderId())
.in(OrderSubPO::getSuborderType, Arrays.asList(SubOrderTypeEnum.RENTBATTEY.getCode(), SubOrderTypeEnum.RENTCAR.getCode())) .in(OrderSubPO::getSuborderType, Arrays.asList(SubOrderTypeEnum.OVERDUE.getCode(), SubOrderTypeEnum.RENTCAR.getCode()))
.ne(OrderSubPO::getPayStatus, PayStatusEnum.SUCCESS).orderByDesc(OrderSubPO::getCreatedAt).last(" limit 1"); .ne(OrderSubPO::getPayStatus, PayStatusEnum.SUCCESS).orderByDesc(OrderSubPO::getCreatedAt).last(" limit 1");
OrderSubPO orderSubPO = orderSubRepo.getOne(querySubOrderWrapper); OrderSubPO orderSubPO = orderSubRepo.getOne(querySubOrderWrapper);
if(orderSubPO!=null){ if(orderSubPO!=null){

View File

@ -0,0 +1,43 @@
package com.sczx.order.thirdpart.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@ApiModel(value = "SysConfigDTO")
@Data
public class SysConfigDTO {
@ApiModelProperty("参数主键")
private Integer configId;
@ApiModelProperty("参数名称")
private String configName;
@ApiModelProperty("参数键名")
private String configKey;
@ApiModelProperty("参数键值")
private String configValue;
@ApiModelProperty("系统内置Y是 N否")
private String configType;
@ApiModelProperty("创建者")
private String createBy;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新者")
private String updateBy;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("备注")
private String remark;
}

View File

@ -2,11 +2,12 @@ package com.sczx.order.thirdpart.facade;
import com.sczx.order.common.Result; import com.sczx.order.common.Result;
import com.sczx.order.thirdpart.dto.CompanyStoreDTO; import com.sczx.order.thirdpart.dto.CompanyStoreDTO;
import com.sczx.order.thirdpart.dto.SysConfigDTO;
import com.sczx.order.thirdpart.dto.SysDictDataDTO; import com.sczx.order.thirdpart.dto.SysDictDataDTO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import java.util.List;
@FeignClient(name = "sczx-store", url = "${sczx-store.ribbon.listOfServers:}") @FeignClient(name = "sczx-store", url = "${sczx-store.ribbon.listOfServers:}")
public interface StoreFacade { public interface StoreFacade {
@ -17,4 +18,11 @@ public interface StoreFacade {
@GetMapping("/sys/getDictDataByDicTypeAndValue") @GetMapping("/sys/getDictDataByDicTypeAndValue")
Result<SysDictDataDTO> getDictDataByDicTypeAndValue(@RequestParam(name = "dicType") String dicType, @RequestParam(name = "dicValue") String dicValue); Result<SysDictDataDTO> getDictDataByDicTypeAndValue(@RequestParam(name = "dicType") String dicType, @RequestParam(name = "dicValue") String dicValue);
@PostMapping("/listConfigByConfigKey")
Result<List<SysConfigDTO>> listConfigByConfigKey(@RequestBody List<String> configKeys);
@GetMapping("/getConfigByConfigKey")
Result<SysConfigDTO> getConfigByConfigKey(@RequestParam(name = "configKey") String configKey);
} }

View File

@ -3,12 +3,15 @@ package com.sczx.order.thirdpart.integration;
import com.sczx.order.common.Result; import com.sczx.order.common.Result;
import com.sczx.order.exception.InnerException; import com.sczx.order.exception.InnerException;
import com.sczx.order.thirdpart.dto.CompanyStoreDTO; import com.sczx.order.thirdpart.dto.CompanyStoreDTO;
import com.sczx.order.thirdpart.dto.SysConfigDTO;
import com.sczx.order.thirdpart.dto.SysDictDataDTO; import com.sczx.order.thirdpart.dto.SysDictDataDTO;
import com.sczx.order.thirdpart.facade.StoreFacade; import com.sczx.order.thirdpart.facade.StoreFacade;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j @Slf4j
@Component @Component
public class StoreInteg { public class StoreInteg {
@ -41,4 +44,32 @@ public class StoreInteg {
} }
return null; return null;
} }
public List<SysConfigDTO> listConfigByConfigKey(List<String> configKeys){
try{
Result<List<SysConfigDTO>> result = storeFacade.listConfigByConfigKey(configKeys);
if(result.isSuccess()){
return result.getData();
}
} catch (Exception e){
log.error("根据系统配置key获取配置失败",e);
throw new InnerException("根据系统配置key获取配置失败");
}
return null;
}
public SysConfigDTO getConfigByConfigKey(String configKey){
try{
Result<SysConfigDTO> result = storeFacade.getConfigByConfigKey(configKey);
if(result.isSuccess()){
return result.getData();
}
} catch (Exception e){
log.error("根据系统配置key获取配置失败",e);
throw new InnerException("根据系统配置key获取配置失败");
}
return null;
}
} }