mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
112 lines
4.2 KiB
Java
112 lines
4.2 KiB
Java
package com.jsowell.api.uniapp;
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.google.common.collect.ImmutableMap;
|
|
import com.jsowell.common.annotation.Anonymous;
|
|
import com.jsowell.common.core.controller.BaseController;
|
|
import com.jsowell.common.core.page.PageResponse;
|
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
|
import com.jsowell.common.exception.BusinessException;
|
|
import com.jsowell.common.response.RestApiResponse;
|
|
import com.jsowell.common.util.StringUtils;
|
|
import com.jsowell.pile.domain.OrderPileOccupy;
|
|
import com.jsowell.pile.dto.GenerateOccupyOrderDTO;
|
|
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
|
import com.jsowell.pile.service.IPileBillingTemplateService;
|
|
import com.jsowell.pile.service.OrderPileOccupyService;
|
|
import com.jsowell.pile.vo.uniapp.OccupyOrderDetailVO;
|
|
import com.jsowell.pile.vo.uniapp.OrderPileOccupyVO;
|
|
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 占桩订单controller
|
|
*
|
|
* @author Lemon
|
|
* @Date 2023/8/18 8:55
|
|
*/
|
|
@Anonymous
|
|
@RestController
|
|
@RequestMapping("/uniapp/occupyOrder")
|
|
public class OccupyOrderController extends BaseController {
|
|
@Autowired
|
|
private OrderPileOccupyService orderPileOccupyService;
|
|
|
|
@Autowired
|
|
private IPileBillingTemplateService pileBillingTemplateService;
|
|
|
|
/**
|
|
* 查询站点占桩费率
|
|
* https://api.jsowellcloud.com/uniapp/occupyOrder/getStationOccupyFee/{stationId}
|
|
* @param stationId
|
|
* @return
|
|
*/
|
|
@GetMapping("/getStationOccupyFee/{stationId}")
|
|
public RestApiResponse<?> getStationOccupyFee(@PathVariable("stationId") String stationId) {
|
|
logger.info("查询站点占桩费率 params:{}", stationId);
|
|
RestApiResponse<?> response = null;
|
|
try {
|
|
BillingTemplateVO vo = pileBillingTemplateService.queryUsedBillingTemplate(stationId);
|
|
response = new RestApiResponse<>(vo);
|
|
} catch (Exception e) {
|
|
logger.error("查询站点占桩费率 error,", e);
|
|
response = new RestApiResponse<>(e);
|
|
}
|
|
logger.info("查询站点占桩费率 result:{}", response);
|
|
return response;
|
|
}
|
|
|
|
/**
|
|
* 查询占桩订单列表页
|
|
* https://api.jsowellcloud.com/uniapp/occupyOrder/getOccupyOrderInfo
|
|
* @param request
|
|
* @return
|
|
*/
|
|
@PostMapping("/getOccupyOrderInfo")
|
|
public RestApiResponse<?> getOccupyOrderInfo(HttpServletRequest request, @RequestBody QueryOccupyOrderDTO dto) {
|
|
// 获取memberId
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
if (StringUtils.isEmpty(memberId)) {
|
|
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
|
|
}
|
|
logger.info("查询占桩订单列表页 params:{}", JSON.toJSONString(dto));
|
|
RestApiResponse<?> response = null;
|
|
dto.setMemberId(memberId);
|
|
try {
|
|
PageResponse pageInfo = orderPileOccupyService.getOccupyOrderInfo(dto);
|
|
response = new RestApiResponse<>(pageInfo);
|
|
} catch (Exception e) {
|
|
logger.error("查询占桩订单列表页 error, ", e);
|
|
response = new RestApiResponse<>(e);
|
|
}
|
|
logger.info("查询占桩订单列表页 result:{}", response);
|
|
return response;
|
|
}
|
|
|
|
|
|
/**
|
|
* 查询占桩订单详情页
|
|
* https://api.jsowellcloud.com/uniapp/occupyOrder/getOccupyOrderDetail/{occupyCode}
|
|
* @param occupyCode
|
|
* @return
|
|
*/
|
|
@GetMapping("/getOccupyOrderDetail/{occupyCode}")
|
|
public RestApiResponse<?> getOccupyOrderDetail(@PathVariable("occupyCode") String occupyCode) {
|
|
logger.info("查询占桩订单详情页 param:{}", occupyCode);
|
|
RestApiResponse<?> response = null;
|
|
try {
|
|
OccupyOrderDetailVO vo = orderPileOccupyService.getOccupyOrderDetail(occupyCode);
|
|
response = new RestApiResponse<>(vo);
|
|
} catch (Exception e) {
|
|
logger.error("查询占桩订单详情页 error,", e);
|
|
response = new RestApiResponse<>(e);
|
|
}
|
|
logger.info("查询占桩订单详情页 result:{}", response);
|
|
return response;
|
|
}
|
|
}
|