mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update
This commit is contained in:
@@ -13,6 +13,7 @@ import com.jsowell.pile.dto.QueryStationDTO;
|
||||
import com.jsowell.pile.dto.RemoteGroundLockDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.ThirdPartySnRelationVO;
|
||||
import com.jsowell.web.controller.pile.PileConnectorInfoController;
|
||||
@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 充电桩相关接口
|
||||
@@ -219,12 +221,28 @@ public class PileController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@GetMapping("/selectConnectorInfoList/{pileSn}")
|
||||
public RestApiResponse<?> selectConnectorInfoList(@PathVariable("pileSn") String pileSn) {
|
||||
@PostMapping("/selectConnectorInfoList")
|
||||
public RestApiResponse<?> selectConnectorInfoList(@RequestBody QueryConnectorListDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
List<ConnectorInfoVO> connectorInfoVOS = pileConnectorInfoService.selectConnectorInfoList(pileSn);
|
||||
response = new RestApiResponse<>(connectorInfoVOS);
|
||||
// List<ConnectorInfoVO> connectorInfoVOS = pileConnectorInfoService.selectConnectorInfoList(pileSn);
|
||||
CompletableFuture<List<ConnectorInfoVO>> connectorInfoListFuture = CompletableFuture.supplyAsync(() -> pileConnectorInfoService.selectConnectorInfoList(dto.getPileSn()));
|
||||
logger.info("查询充电枪口详情-supplyAsync-selectConnectorInfoList:{}", connectorInfoListFuture);
|
||||
|
||||
// 查计费模板信息
|
||||
CompletableFuture<List<BillingPriceVO>> billingPriceFuture = CompletableFuture.supplyAsync(() -> pileBillingTemplateService.queryBillingPrice(dto.getStationId()));
|
||||
logger.info("查询充电枪口详情-supplyAsync-queryBillingPrice:{}", billingPriceFuture);
|
||||
|
||||
// 查询运营商信息
|
||||
CompletableFuture<MerchantInfoVO> merchantInfoVOFuture = CompletableFuture.supplyAsync(() -> pileMerchantInfoService.getMerchantInfoVO(dto.getMerchantId()));
|
||||
logger.info("查询充电枪口详情-supplyAsync-getMerchantInfoVO:{}", merchantInfoVOFuture);
|
||||
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(connectorInfoListFuture, merchantInfoVOFuture, billingPriceFuture);
|
||||
// .join()和.get()都会阻塞并获取线程的执行情况
|
||||
// .join()会抛出未经检查的异常,不会强制开发者处理异常 .get()会抛出检查异常,需要开发者处理
|
||||
all.join();
|
||||
all.get();
|
||||
response = new RestApiResponse<>(connectorInfoListFuture.get());
|
||||
}catch (Exception e) {
|
||||
logger.error("查询充电枪口详情 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
|
||||
Reference in New Issue
Block a user