mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 04:25:21 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -3,12 +3,12 @@ package com.jsowell.api.thirdparty;
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.thirdparty.platform.dto.BatteryChargeReportDTO;
|
||||
import com.jsowell.thirdparty.platform.service.impl.BatteryChargeReportService;
|
||||
import com.jsowell.thirdparty.platform.service.impl.ChargeAlgorithmService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 算法应用Controller
|
||||
@@ -24,12 +24,20 @@ public class ChargeAlgorithmController extends BaseController {
|
||||
@Autowired
|
||||
private ChargeAlgorithmService chargeAlgorithmService;
|
||||
|
||||
@GetMapping("/pushOrderInfo/{orderCode}")
|
||||
public RestApiResponse<?> pushOrderInfo(@PathVariable("orderCode") String orderCode) {
|
||||
@Autowired
|
||||
private BatteryChargeReportService batteryChargeReportService;
|
||||
|
||||
@PostMapping("/pushOrderInfo")
|
||||
public RestApiResponse<?> pushOrderInfo(@RequestBody BatteryChargeReportDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
String result = chargeAlgorithmService.pushOrderInfo(orderCode);
|
||||
response = new RestApiResponse<>(result);
|
||||
// String result = chargeAlgorithmService.pushOrderInfo(orderCode);
|
||||
String taskId = batteryChargeReportService.getTaskIdByOrderCode(dto.getOrderCode());
|
||||
String url = "";
|
||||
if (StringUtils.isNotBlank(taskId)) {
|
||||
url = batteryChargeReportService.getUrlByTaskId(taskId, dto.getReportType());
|
||||
}
|
||||
response = new RestApiResponse<>(url);
|
||||
}catch (Exception e) {
|
||||
logger.error("算法应用推送订单信息 error, ", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.service.CarCouponRecordService;
|
||||
import com.jsowell.pile.service.ChargeAlgorithmRecordService;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import com.jsowell.pile.vo.base.StationInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.ChargeAlgorithmRecordVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
||||
@@ -50,6 +51,9 @@ public class OrderController extends BaseController {
|
||||
@Autowired
|
||||
private CarCouponRecordService carCouponRecordService;
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
/**
|
||||
* 生成订单/创建订单
|
||||
* http://localhost:8080/uniapp/order/generateOrder
|
||||
@@ -436,4 +440,23 @@ public class OrderController extends BaseController {
|
||||
logger.info("查询停车优免订单 memberId:{}, result:{}", memberId, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭待支付的订单
|
||||
* @param orderCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/closeOrderByOrderCode/{orderCode}")
|
||||
public RestApiResponse<?> closeOrderByOrderCode(@PathVariable("orderCode") String orderCode) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
orderBasicInfoService.closeOrderByOrderCode(orderCode);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (Exception e) {
|
||||
logger.error("关闭订单号:{} 的订单失败, error:", orderCode, e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
logger.info("关闭订单:{}", orderCode);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,6 +151,9 @@ public class OrderService {
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private IOrderInsuranceInfoService orderInsuranceInfoService;
|
||||
|
||||
// 引入线程池
|
||||
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
|
||||
|
||||
@@ -1221,10 +1224,18 @@ public class OrderService {
|
||||
}
|
||||
}, executor);
|
||||
|
||||
// 初始化充电金额
|
||||
BigDecimal chargeAmount = amount;
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
BigDecimal insuranceAmount = orderBasicInfo.getInsuranceAmount();
|
||||
if (insuranceAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// 如果用户支付了保险金额,则充电金额需将保险金额减去
|
||||
chargeAmount = amount.subtract(insuranceAmount).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
// 支付订单成功
|
||||
PayOrderSuccessCallbackDTO callbackDTO = PayOrderSuccessCallbackDTO.builder()
|
||||
.orderCode(orderCode)
|
||||
.payAmount(amount)
|
||||
.payAmount(chargeAmount) // amount
|
||||
// .payMode(OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())
|
||||
.payMode(payModel)
|
||||
.acquirer(AcquirerEnum.ADAPAY.getValue())
|
||||
|
||||
Reference in New Issue
Block a user