mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-03 13:38:02 +08:00
临时接口,订单退款
This commit is contained in:
@@ -121,4 +121,26 @@ public class JumpController extends BaseController {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 临时订单退款
|
||||
* http://localhost:8080/app-xcx-h5/tempOrderRefund
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("tempOrderRefund")
|
||||
public RestApiResponse<?> tempOrderRefund() {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
orderBasicInfoService.tempOrderRefund();
|
||||
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_WEIXIN_REFUND_ERROR);
|
||||
}
|
||||
logger.info("临时刷数据接口 result:{}", JSONObject.toJSONString(response));
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -833,13 +833,9 @@ public class OrderService {
|
||||
|
||||
// 监控信息
|
||||
OrderDetailInfoVO.OrderRealTimeInfo realTimeInfo = new OrderDetailInfoVO.OrderRealTimeInfo();
|
||||
|
||||
RealTimeMonitorData realTimeMonitorData = chargingRealTimeDataList.get(0);
|
||||
realTimeInfo.setOrderAmount(realTimeMonitorData.getChargingAmount());
|
||||
// realTimeInfo.setTotalElectricityAmount();
|
||||
// realTimeInfo.setTotalServiceAmount();
|
||||
realTimeInfo.setChargedDegree(realTimeMonitorData.getChargingDegree());
|
||||
// realTimeInfo.setSOC(realTimeMonitorData.getSOC());
|
||||
realTimeInfo.setChargingTime(realTimeMonitorData.getSumChargingTime());
|
||||
vo.setOrderRealTimeInfo(realTimeInfo);
|
||||
|
||||
|
||||
@@ -208,4 +208,6 @@ public interface OrderBasicInfoMapper {
|
||||
int batchUpdateOrderDetail(@Param("list") List<OrderDetail> orderDetailList);
|
||||
|
||||
List<OrderDetail> getOrderDetailList(List<String> orderCodes);
|
||||
|
||||
List<OrderBasicInfo> tempQueryWeChatRefundOrders(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.WxpayRefundCallback;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,4 +19,6 @@ public interface WxpayRefundCallbackMapper {
|
||||
// int updateByPrimaryKey(WxpayRefundCallback record);
|
||||
|
||||
List<WxpayRefundCallback> selectWxpayRefundCallbackList(List<String> outTradeNoList);
|
||||
|
||||
List<WxpayRefundCallback> selectByOrderCodeList(@Param("orderCodes") List<String> orderCodeList);
|
||||
}
|
||||
@@ -132,7 +132,9 @@ public interface IOrderBasicInfoService {
|
||||
|
||||
List<OrderVO> getListByMemberIdAndOrderStatus(String memberId, List<String> orderStatusList, LocalDateTime dateTime, String stationId);
|
||||
|
||||
void realTimeMonitorDataRedis2DB(String transactionCode, String orderCode);
|
||||
void tempOrderRefund();
|
||||
|
||||
void realTimeMonitorDataRedis2DB(String transactionCode, String orderCode);
|
||||
|
||||
void updateElecAmount();
|
||||
|
||||
|
||||
@@ -16,4 +16,6 @@ public interface WxpayRefundCallbackService {
|
||||
// int updateByPrimaryKey(WxpayRefundCallback record);
|
||||
|
||||
List<WxpayRefundCallback> selectWxpayRefundCallbackList(List<String> outTradeNoList);
|
||||
|
||||
List<WxpayRefundCallback> selectByOrderCodeList(List<String> orderCodeList);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.Refund;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
@@ -776,8 +777,39 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
|
||||
// TODO 推送停止充电结果 notification_stop_charge_result
|
||||
}
|
||||
|
||||
/**
|
||||
* 临时订单退款
|
||||
*/
|
||||
@Override
|
||||
public void tempOrderRefund() {
|
||||
// 查询出2023-05-29 12:00:00到2023-05-30 23:59:59中使用微信支付,并且有退款金额的订单
|
||||
String startTime = "2023-05-29 12:00:00";
|
||||
String endTime = "2023-05-30 23:59:59";
|
||||
List<OrderBasicInfo> orderList = orderBasicInfoMapper.tempQueryWeChatRefundOrders(startTime, endTime);
|
||||
Map<String, OrderBasicInfo> orderBasicInfoMap = orderList.stream().collect(Collectors.toMap(OrderBasicInfo::getOrderCode, Function.identity(), (k1, k2) -> k1));
|
||||
Set<String> orderCodes = orderBasicInfoMap.keySet();
|
||||
|
||||
// 根据上面的订单号,查微信退款回调,找出没有记录的订单,重新发起一遍退款
|
||||
List<WxpayRefundCallback> wxpayRefundCallbacks = wxpayRefundCallbackService.selectByOrderCodeList(Lists.newArrayList(orderCodes));
|
||||
Set<String> refundOrders = wxpayRefundCallbacks.stream().map(WxpayRefundCallback::getOrderCode).collect(Collectors.toSet());
|
||||
|
||||
// orderCodeList refundOrders 取差集
|
||||
Sets.SetView<String> difference = Sets.difference(orderCodes, refundOrders);
|
||||
for (String orderCode : difference) {
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoMap.get(orderCode);
|
||||
if (orderBasicInfo == null) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal refundAmount = orderBasicInfo.getRefundAmount();
|
||||
// 微信退款逻辑
|
||||
WeChatRefundDTO weChatRefundDTO = new WeChatRefundDTO();
|
||||
weChatRefundDTO.setOrderCode(orderBasicInfo.getOrderCode());
|
||||
weChatRefundDTO.setRefundType("1");
|
||||
weChatRefundDTO.setRefundAmount(refundAmount);
|
||||
this.weChatRefund(weChatRefundDTO);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.pile.domain.WxpayRefundCallback;
|
||||
import com.jsowell.pile.mapper.WxpayRefundCallbackMapper;
|
||||
import com.jsowell.pile.service.WxpayRefundCallbackService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -29,6 +31,14 @@ public class WxpayRefundCallbackServiceImpl implements WxpayRefundCallbackServic
|
||||
return wxpayRefundCallbackMapper.selectWxpayRefundCallbackList(outTradeNoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WxpayRefundCallback> selectByOrderCodeList(List<String> orderCodeList) {
|
||||
if (CollectionUtils.isEmpty(orderCodeList)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return wxpayRefundCallbackMapper.selectByOrderCodeList(orderCodeList);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public WxpayRefundCallback selectByPrimaryKey(Integer id) {
|
||||
// return wxpayRefundCallbackMapper.selectByPrimaryKey(id);
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
left join member_basic_info t2 on t1.member_id = t2.member_id
|
||||
join pile_station_info t3 on t1.station_id = t3.id
|
||||
join order_detail t4 on t4.order_code = t1.order_code
|
||||
join member_transaction_record t5 on t5.order_code = t1.order_code
|
||||
join member_transaction_record t5 on t5.order_code = t1.order_code and action_type = 'forward'
|
||||
where t1.del_flag = '0'
|
||||
<if test="pileSn != null and pileSn != ''">
|
||||
and t1.pile_sn = #{pileSn,jdbcType=VARCHAR}
|
||||
@@ -1019,4 +1019,13 @@
|
||||
#{item,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="tempQueryWeChatRefundOrders" resultMap="OrderBasicInfoResult">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from order_basic_info
|
||||
where del_flag = '0'
|
||||
and pay_mode = '4'
|
||||
and refund_amount > '0.00'
|
||||
and create_time BETWEEN #{startTime} and #{endTime}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -234,4 +234,13 @@
|
||||
#{item,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectByOrderCodeList" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from wxpay_refund_callback
|
||||
where order_code in
|
||||
<foreach collection="orderCodes" item="item" open="(" separator="," close=")">
|
||||
#{item,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -173,6 +173,25 @@
|
||||
<div class="marginTop"></div>
|
||||
</el-card>
|
||||
|
||||
<!-- 退款信息 -->
|
||||
<el-card class="cardStyle">
|
||||
<h3>退款信息</h3>
|
||||
<el-table style="width: 100%" :data="payDetail" border>
|
||||
<el-table-column prop="payAmount" label="支付金额" align="center"/>
|
||||
<el-table-column prop="payModeDesc" label="支付方式" align="center"/>
|
||||
<el-table-column prop="payStatus" label="支付状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
scope.row.payStatus === "1" ? "支付完成" : "待支付"
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="payTime" label="支付时间" align="center"/>
|
||||
<el-table-column prop="outTradeNo" label="商务单号" align="center"/>
|
||||
</el-table>
|
||||
<div class="marginTop"></div>
|
||||
</el-card>
|
||||
|
||||
<!-- 设备信息 -->
|
||||
<el-card class="cardStyle">
|
||||
<h3>设备信息</h3>
|
||||
|
||||
Reference in New Issue
Block a user