申请退款,取消退款优化

This commit is contained in:
yuyang 2021-10-11 15:56:44 +08:00
parent ce309e5feb
commit 80731e0ae8
6 changed files with 58 additions and 0 deletions

View File

@ -136,6 +136,7 @@ public class XhpcRefundAuditController extends BaseController {
String refundOrderId = StringUtils.valueOf(refundOrder.get("refundOrderId"));
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setRefundOrderId(Long.parseLong(refundOrderId));
xhpcRefundOrder.setExamineStatus(1);
xhpcRefundOrder.setStatus(StatusConstants.REFUND_ORDER_STATUS_CANCEL);
int updateStatus = iXhpcRefundOrderService.updateStatus(xhpcRefundOrder);
if (updateStatus == 0) {

View File

@ -54,6 +54,18 @@ public class XhpcRefundOrderController extends BaseController {
if (StringUtils.isEmpty(type)) {
return AjaxResult.error(HttpStatus.NOT_NULL, "退款渠道不能为空");
}
//是否有实时数据
int i =iXhpcRefundOrderService.countXhpcRealTimeOrder(Long.valueOf(userId));
if (i > 0) {
return AjaxResult.error(1103, "车辆正在充电,不能退款");
}
// 是否有异常订单
int j =iXhpcRefundOrderService.countXhpcChargeOrder(Long.valueOf(userId));
if (j > 0) {
return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决");
}
//生成退款订单
String orderOutNumber = StringUtils.numFormat(Long.parseLong(userId), Integer.parseInt(type), StatusConstants.FLOWING_WATER_REFUND_TYPE);
String remark = StringUtils.valueOf(map.get("remark"));

View File

@ -81,4 +81,14 @@ public interface XhpcRefundOrderMapper {
*/
public Map<String, Object> getNotRefundOrder(@Param("userId") Long userId);
/**
* 判断用户是否在充电中
*/
int countXhpcRealTimeOrder(@Param("userId")Long userId);
/**
* 判断用户是否有异常订单未处理
*/
int countXhpcChargeOrder(@Param("userId")Long userId);
}

View File

@ -2,6 +2,7 @@ package com.xhpc.payment.service;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.payment.domain.XhpcRefundOrder;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
@ -67,4 +68,17 @@ public interface IXhpcRefundOrderService {
* @return 结果
*/
public int updateStatus(XhpcRefundOrder xhpcRefundOrder);
//是否有正在充电的订单
/**
* 判断用户是否在充电中
*/
int countXhpcRealTimeOrder(Long userId);
//是否有异常订单
/**
* 判断用户是否有异常订单未处理
*/
int countXhpcChargeOrder(Long userId);
}

View File

@ -132,4 +132,15 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
public int updateStatus(XhpcRefundOrder xhpcRefundOrder) {
return xhpcRefundOrderMapper.updateStatus(xhpcRefundOrder);
}
@Override
public int countXhpcRealTimeOrder(Long userId) {
return xhpcRefundOrderMapper.countXhpcRealTimeOrder(userId);
}
@Override
public int countXhpcChargeOrder(Long userId) {
return xhpcRefundOrderMapper.countXhpcChargeOrder(userId);
}
}

View File

@ -142,6 +142,7 @@
UPDATE xhpc_refund_order
<set>
<if test="null != status">status = #{status},</if>
<if test="null != examineStatus">examine_status = #{examineStatus},</if>
</set>
WHERE refund_order_id = #{refundOrderId} and examine_status = 0
</update>
@ -221,4 +222,13 @@
</if>
ORDER BY xro.create_time DESC LIMIT 1
</select>
<select id="countXhpcRealTimeOrder" resultType="int">
select charge_order_id as chargeOrderId from xhpc_charge_order where user_id =#{userId} and status=0 and del_flag =0 limit 1
</select>
<select id="countXhpcChargeOrder" resultType="int">
select count(charge_order_id) from xhpc_charge_order where user_id =#{userId} and status =2 and del_flag =0
</select>
</mapper>