记得上下班打卡 | git大法好,push需谨慎

Commit 79641e55 authored by jiangxiulong's avatar jiangxiulong

refund

parent 8d2e2a2a
......@@ -20,19 +20,18 @@ public class KylinTableStatusConst {
public static final Integer STATUS_TARGET_TYPE = 1; // 演出
// 退款
public static final Integer ORDER_REFUND_STATUS_APPLY = 0; // 客服(待审核),用户(正在退款)
public static final Integer ORDER_REFUND_STATUS_APPROVED = 1; // 客服(已通过),用户(正在退款)
public static final Integer ORDER_REFUND_STATUS_CANCEL = 2; // 客服(已取消),用户(取消退款,恢复正常订单)
public static final Integer ORDER_REFUND_STATUS_REFUNDING = 3; // 客服(正在退款),用户(正在退款)
public static final Integer ORDER_REFUND_STATUS_REFUNDED = 4; // 客服(退款成功),用户(完成退款,部分退款为正常订单,全额退款为退款订单)
public static final Integer ORDER_REFUND_STATUS_REJECT = 5; // 客服(被审核员驳回),用户(正在退款)
public static final Integer ORDER_REFUND_STATUS_ERROR = 6; // 客服(退款失败),用户(正在退款)
public static final Integer ORDER_REFUND_STATUS_UNFILLED = 7; // 客服(等待退款),用户(正在退款)
public static final Integer ORDER_REFUND_STATUS_REFUSE = 8; // 客服(被执行员拒绝),用户(正在退款)
public static final Integer ORDER_REFUND_STATUS_APPLY = 0; // 请求退款
public static final Integer ORDER_REFUND_STATUS_APPROVED = 1; // 一审同意 审核通过
public static final Integer ORDER_REFUND_STATUS_CANCEL = 2; // 取消退款
public static final Integer ORDER_REFUND_STATUS_REFUNDING = 3; // 正在退款
public static final Integer ORDER_REFUND_STATUS_REFUNDED = 4; // 完成退款
public static final Integer ORDER_REFUND_STATUS_REJECT = 5; // 一审驳回退款
public static final Integer ORDER_REFUND_STATUS_ERROR = 6; // 退款失败
public static final Integer ORDER_REFUND_STATUS_UNFILLED = 7; // 二审同意 等待退款
public static final Integer ORDER_REFUND_STATUS_REFUSE = 8; // 二审拒绝
public static final Integer ORDER_REFUND_TYPE_APPLY = 0; // 人工申请类型的退款,可以取消退款,退款完成需返还库存
public static final Integer ORDER_REFUND_TYPE_AUTO = 1; // 自动申请类型的退款,无法取消退款,退款完成不返还库存
/**
* 订单状态表状态
*/
......
package com.liquidnet.service.kylin.controller.admin;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
import com.liquidnet.service.kylin.service.impl.admin.KylinOrderRefundsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 后台单订单退款 服务实现类
......@@ -54,7 +57,126 @@ public class KylinOrderRefundAdminController {
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
}
}
@PostMapping("cancel")
@ApiOperation("取消退款")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "Lsit", name = "orderRefundsIdList", value = "退款id 支持批量", required = true)
})
public ResponseDto<Object> refundApply(
@RequestBody List orderRefundsIdList
) {
try {
Boolean res = kylinOrderRefundsServiceImpl.refundCancel(orderRefundsIdList);
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure("取消退款失败");
}
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
}
}
@PostMapping("reapply")
@ApiOperation("再次提交审核")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "Lsit", name = "orderRefundsIdList", value = "退款id 支持批量", required = true)
})
public ResponseDto<Object> refundReapply(
@RequestBody List orderRefundsIdList
) {
try {
Boolean res = kylinOrderRefundsServiceImpl.refundReapply(orderRefundsIdList);
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure("再次申请退款失败");
}
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
}
}
@PostMapping("review")
@ApiOperation("一审运营 审核/驳回")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "Lsit", name = "orderRefundsIdList", value = "退款id 支持批量", required = true),
@ApiImplicitParam(type = "body", dataType = "Integer", name = "status", value = "批量id", required = true),
@ApiImplicitParam(type = "body", dataType = "String", name = "reject", value = "备注", required = true)
})
public ResponseDto<Object> refundReview(
@RequestBody List orderRefundsIdList,
@RequestBody Integer status,
@RequestBody String reject
) {
try {
Boolean res = false;
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED) { // 通过
res = kylinOrderRefundsServiceImpl.refundApproved(orderRefundsIdList, reject);
}
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT) { // 驳回
res = kylinOrderRefundsServiceImpl.refundReject(orderRefundsIdList, reject);
}
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure("审核退款失败");
}
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
}
}
@PostMapping("execute")
@ApiOperation("二审财务 审核(执行退款)/驳回")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "Lsit", name = "orderRefundsIdList", value = "退款id 支持批量", required = true),
@ApiImplicitParam(type = "body", dataType = "Integer", name = "status", value = "批量id", required = true),
@ApiImplicitParam(type = "body", dataType = "String", name = "refuse", value = "备注", required = true)
})
public ResponseDto<Object> refundExecute(
@RequestBody List orderRefundsIdList,
@RequestBody Integer status,
@RequestBody String refuse
) {
try {
Boolean res = false;
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_UNFILLED) { // 通过
res = kylinOrderRefundsServiceImpl.refundUnfilled(orderRefundsIdList, refuse);
}
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE) { // 驳回
res = kylinOrderRefundsServiceImpl.refundRefuse(orderRefundsIdList, refuse);
}
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure("审核退款失败");
}
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
}
}
@PostMapping("refundCompleted")
@ApiOperation("主动关闭订单,完成退款")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "Integer", name = "orderRefundsId", value = "退款id", required = true)
})
public ResponseDto<Object> refundCompleted(
@RequestBody Integer orderRefundsId
) {
try {
Boolean res = kylinOrderRefundsServiceImpl.refundCompleted(orderRefundsId);
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure("关闭订单失败");
}
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
}
}
}
package com.liquidnet.service.kylin.service.impl.admin;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fasterxml.jackson.databind.JsonNode;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
import com.liquidnet.service.kylin.entity.KylinOrderRefunds;
import com.liquidnet.service.kylin.entity.KylinOrderTickets;
import com.liquidnet.service.kylin.mapper.KylinOrderRefundsMapper;
......@@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 订单退款表 服务实现类
......@@ -29,6 +31,9 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
@Autowired
private KylinRefundsStatusServiceImpl kylinRefundsStatusServiceImpl;
@Autowired
private KylinOrderRefundsMapper kylinOrderRefundsMapper;
public Boolean refundApply(String orderTicketsId, String reason, String orderRefundBatchesId, String refundData) throws Exception {
int count = 0;
count = kylinOrderTicketsMapper.selectCount(
......@@ -45,4 +50,128 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
return false;
}
}
public Boolean refundCancel(List orderRefundsIdList) throws Exception {
Integer[] orderRefundStatus = {KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.selectList(
new QueryWrapper<KylinOrderRefunds>()
.eq("type", KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY)
.in("order_refunds_id", orderRefundsIdList)
.in("status", orderRefundStatus)
);
if (orderRefundsIdList.size() != refundList.size()) {
throw new Exception("订单需未审核、已驳回、已回绝,非自动退款订单");
}
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefundCancel(refundList);
if (res) {
return true;
} else {
return false;
}
}
public Boolean refundReapply(List orderRefundsIdList) throws Exception {
Integer[] orderRefundStatus = {KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.selectList(
new QueryWrapper<KylinOrderRefunds>()
.eq("type", KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY)
.in("order_refunds_id", orderRefundsIdList)
.in("status", orderRefundStatus)
);
if (orderRefundsIdList.size() != refundList.size()) {
throw new Exception("订单需已驳回、已回绝");
}
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefundReapply(refundList);
if (res) {
return true;
} else {
return false;
}
}
public Boolean refundApproved(List orderRefundsIdList, String reject) throws Exception {
Integer[] orderRefundStatus = {KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.selectList(
new QueryWrapper<KylinOrderRefunds>()
.eq("type", KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY)
.in("order_refunds_id", orderRefundsIdList)
.in("status", orderRefundStatus)
);
if (orderRefundsIdList.size() != refundList.size()) {
throw new Exception("订单需未审核、已驳回、已回绝,请检查订单状态");
}
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefundApproved(refundList, reject);
if (res) {
return true;
} else {
return false;
}
}
public Boolean refundReject(List orderRefundsIdList, String reject) throws Exception {
Integer[] orderRefundStatus = {KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.selectList(
new QueryWrapper<KylinOrderRefunds>()
.eq("type", KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY)
.in("order_refunds_id", orderRefundsIdList)
.in("status", orderRefundStatus)
);
if (orderRefundsIdList.size() != refundList.size()) {
throw new Exception("订单需未审核、已审核、已回绝,请检查订单状态");
}
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefundReject(refundList, reject);
if (res) {
return true;
} else {
return false;
}
}
public Boolean refundUnfilled(List orderRefundsIdList, String refuse) throws Exception {
Integer[] orderRefundStatus = {KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED, KylinTableStatusConst.ORDER_REFUND_STATUS_ERROR};
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.selectList(
new QueryWrapper<KylinOrderRefunds>()
.eq("type", KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY)
.in("order_refunds_id", orderRefundsIdList)
.in("status", orderRefundStatus)
);
if (orderRefundsIdList.size() != refundList.size()) {
throw new Exception("订单需已审核、退款失败,请检查订单状态");
}
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefundUnfilled(refundList, refuse);
if (res) {
return true;
} else {
return false;
}
}
public Boolean refundRefuse(List orderRefundsIdList, String refuse) throws Exception {
Integer[] orderRefundStatus = {KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED, KylinTableStatusConst.ORDER_REFUND_STATUS_ERROR};
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.selectList(
new QueryWrapper<KylinOrderRefunds>()
.eq("type", KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY)
.in("order_refunds_id", orderRefundsIdList)
.in("status", orderRefundStatus)
);
if (orderRefundsIdList.size() != refundList.size()) {
throw new Exception("订单需已审核、退款失败,请检查订单状态");
}
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefundRefuse(refundList, refuse);
if (res) {
return true;
} else {
return false;
}
}
public Boolean refundCompleted(Integer orderRefundsId) {
return false;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment