mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 10:00:11 +08:00
新增刷数据接口
This commit is contained in:
@@ -9,15 +9,12 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.file.AliyunOssUploadUtils;
|
||||
import com.jsowell.common.util.file.FileUtils;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||
import com.jsowell.pile.vo.uniapp.PileConnectorVO;
|
||||
import com.jsowell.service.PileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -31,6 +28,9 @@ public class JumpController extends BaseController {
|
||||
@Autowired
|
||||
private PileService pileService;
|
||||
|
||||
@Autowired
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
/**
|
||||
* 查询充电桩详情
|
||||
* http://localhost:8080/app-xcx-h5/pile/pileDetail/{pileSn}
|
||||
@@ -97,4 +97,27 @@ public class JumpController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 临时刷数据接口
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("tempUpdateVirtualAmount")
|
||||
public RestApiResponse<?> tempUpdateVirtualAmount(HttpServletRequest request, QueryOrderDTO dto) {
|
||||
logger.info("临时刷数据接口 param:{}", dto);
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
orderBasicInfoService.tempUpdateVirtualAmount(dto);
|
||||
response = new RestApiResponse<>();
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("临时刷数据接口 warn", e);
|
||||
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("临时刷数据接口 error", e);
|
||||
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_PILE_DETAIL_ERROR);
|
||||
}
|
||||
logger.info("临时刷数据接口 result:{}", JSONObject.toJSONString(response));
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,10 +41,8 @@ import com.jsowell.pile.vo.base.OrderPeriodAmountVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.base.StationInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.*;
|
||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||
import com.jsowell.pile.vo.web.OrderDetailInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO;
|
||||
import com.jsowell.pile.vo.uniapp.InvoiceRecordVO;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
import com.jsowell.wxpay.dto.WeChatRefundDTO;
|
||||
import com.jsowell.wxpay.response.WechatPayNotifyParameter;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
@@ -255,4 +255,5 @@ public interface IOrderBasicInfoService {
|
||||
List<OrderPeriodAmountVO> transformPeriodAmountByOrderDetail(OrderDetail orderDetail);
|
||||
|
||||
|
||||
void tempUpdateVirtualAmount(QueryOrderDTO dto);
|
||||
}
|
||||
|
||||
@@ -175,8 +175,11 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
if (orderListVO.getVirtualAmount() != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 订单总消费金额
|
||||
BigDecimal orderAmount = new BigDecimal(orderListVO.getOrderAmount());
|
||||
// 使用虚拟金额消费 金额
|
||||
BigDecimal virtualAmount = BigDecimal.ZERO;
|
||||
// 结算金额
|
||||
BigDecimal settleAmount = BigDecimal.ZERO;
|
||||
|
||||
if (StringUtils.equals(orderListVO.getPayMode(), OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue())) {
|
||||
@@ -185,13 +188,20 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
如果使用了赠送金额,虚拟金额为赠送金额支付部分,结算金额=订单消费金额-虚拟金额消费部分
|
||||
*/
|
||||
// 查询支付记录
|
||||
|
||||
List<OrderPayRecord> orderPayRecordList = orderPayRecordService.getOrderPayRecordList(orderListVO.getOrderCode());
|
||||
for (OrderPayRecord orderPayRecord : orderPayRecordList) {
|
||||
if (StringUtils.equals(orderPayRecord.getPayMode(), OrderPayRecordEnum.GIFT_BALANCE_PAYMENT.getValue())) {
|
||||
BigDecimal bigDecimal = orderPayRecord.getRefundAmount() == null ? BigDecimal.ZERO : orderPayRecord.getRefundAmount();
|
||||
virtualAmount = orderPayRecord.getPayAmount().subtract(bigDecimal);
|
||||
settleAmount = orderAmount.subtract(virtualAmount);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (StringUtils.equals(orderListVO.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
||||
/*
|
||||
微信支付 虚拟金额为0 结算金额等于订单消费金额
|
||||
*/
|
||||
settleAmount = new BigDecimal(orderListVO.getOrderAmount());
|
||||
settleAmount = orderAmount;
|
||||
}
|
||||
|
||||
OrderBasicInfo build = OrderBasicInfo.builder()
|
||||
@@ -1678,4 +1688,13 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
|
||||
return Lists.newArrayList(sharp, peak, flat, valley);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tempUpdateVirtualAmount(QueryOrderDTO dto) {
|
||||
List<OrderListVO> orderListVOS = orderBasicInfoMapper.selectOrderBasicInfoList(dto);
|
||||
if (CollectionUtils.isEmpty(orderListVOS)) {
|
||||
return;
|
||||
}
|
||||
tempUpdateVirtualAmount(orderListVOS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user