feat: 添加订单状态(10)为部分退款
This commit is contained in:
+3
-1
@@ -16,6 +16,8 @@ public class OrderStatusConstants {
|
||||
// 退款状态集合(退款中、已退款)
|
||||
public static final String REFUND_STATUS = String.format("(%d,%d)",
|
||||
OrderStatus.REFUNDING.getId(), // 7-退款中
|
||||
OrderStatus.REFUNDED.getId() // 8-已退款
|
||||
OrderStatus.REFUNDED.getId(), // 8-已退款
|
||||
OrderStatus.REFUND_FAILED, // 9 退款失败
|
||||
OrderStatus.PART_REFUNDED //10 部分退款(新加)
|
||||
);
|
||||
}
|
||||
+5
-3
@@ -1038,8 +1038,8 @@ public class OrderController {
|
||||
public PageResult<Map> listImageOrdersByUser(@RequestParam Map<String, Object> params) {
|
||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||
params.put("userId", user.getId());
|
||||
List<Integer> orderStatusList = List.of(OrderStatus.COMPLETE.getId(), OrderStatus.UPLOADING.getId(), OrderStatus.UPLOADED.getId());
|
||||
params.put("orderStatusList", orderStatusList);
|
||||
// List<Integer> orderStatusList = List.of(OrderStatus.COMPLETE.getId(), OrderStatus.UPLOADING.getId(), OrderStatus.UPLOADED.getId());
|
||||
params.put("orderStatusList", getCompletedOrderStatuses());
|
||||
|
||||
PageResult<Order> result = orderService.findListByUser(params);
|
||||
if (result.getCount() > 0){
|
||||
@@ -1135,7 +1135,9 @@ public class OrderController {
|
||||
return List.of(
|
||||
OrderStatus.COMPLETE.getId(),
|
||||
OrderStatus.UPLOADING.getId(),
|
||||
OrderStatus.UPLOADED.getId()
|
||||
OrderStatus.UPLOADED.getId(),
|
||||
OrderStatus.REFUNDING.getId(),
|
||||
OrderStatus.PART_REFUNDED.getId()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+12
-3
@@ -173,7 +173,7 @@ public class RefundController {
|
||||
return Result.failed("处理退款失败");
|
||||
}
|
||||
|
||||
@Operation(summary = "微信支付退款")
|
||||
@Operation(summary = "微信支付部分退款")
|
||||
@PostMapping("/approve/custom")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<com.central.order.model.Refund> approveCustomOrderAmount(@RequestBody ApproveCustomRefundAmountRequest refundRequest) {
|
||||
@@ -190,20 +190,29 @@ public class RefundController {
|
||||
if (! refundRequest.getStatus().equals(OrderStatus.REFUNDING.getId())){
|
||||
return Result.failed("该状态不支持审核");
|
||||
}
|
||||
|
||||
if (refundRequest.getState().equals(RefundState.APPROVED.getId())){
|
||||
dealCustomRefundAmountRequest(order,null);
|
||||
refundorder.setApproveReason(refundRequest.getApproveReason());
|
||||
refundorder.setState(refundRequest.getState()); //全额退款
|
||||
refundService.updateById(refundorder);
|
||||
return Result.succeed("已处理全额退款");
|
||||
}
|
||||
if (refundRequest.getState().equals(RefundState.PART.getId())){
|
||||
dealCustomRefundAmountRequest(order,refundRequest.getRefundAmount());
|
||||
refundorder.setApproveReason(refundRequest.getApproveReason());
|
||||
refundorder.setState(refundRequest.getState()); //部分退款
|
||||
if(refundRequest.getRefundAmount()!=null){
|
||||
refundorder.setRefundAmount(refundRequest.getRefundAmount());
|
||||
}
|
||||
refundService.updateById(refundorder);
|
||||
return Result.succeed("已处理退款");
|
||||
return Result.succeed("已处理部分退款");
|
||||
}
|
||||
if (refundRequest.getState().equals(RefundState.REFUSED.getId())){
|
||||
order.setOrderStatus(OrderStatus.REFUND_FAILED.getId());
|
||||
refundorder.setStatus(OrderStatus.REFUND_FAILED.getId());
|
||||
refundorder.setApproveReason(refundRequest.getApproveReason());
|
||||
refundorder.setState(refundRequest.getState());
|
||||
refundorder.setState(refundRequest.getState()); //拒绝退款
|
||||
orderService.updateOrder(order);
|
||||
refundService.updateById(refundorder);
|
||||
return Result.succeed("处理成功");
|
||||
|
||||
+33
-6
@@ -282,14 +282,27 @@ public class WxPayController {
|
||||
// 退款成功,更新订单状态等操作
|
||||
com.central.order.model.Refund refund = refundService.getRefundByNo(outRefundNo);
|
||||
Assert.notNull(refund,"退款订单数据不存在");
|
||||
refund.setStatus(OrderStatus.REFUNDED.getId());
|
||||
refund.setState(RefundState.APPROVED.getId());
|
||||
if(refund.getState().equals(RefundState.PART.getId())){
|
||||
//部分退款
|
||||
refund.setStatus(OrderStatus.PART_REFUNDED.getId());
|
||||
}else {
|
||||
//全额退款
|
||||
refund.setStatus(OrderStatus.REFUNDED.getId());
|
||||
}
|
||||
// refund.setState(RefundState.APPROVED.getId());
|
||||
refund.setRefundTime(new Date());
|
||||
refundService.updateById(refund);
|
||||
|
||||
Order order = orderService.getOrderByNumber(refund.getOrderNo());
|
||||
Assert.notNull(order,"订单数据不存在");
|
||||
order.setOrderStatus(OrderStatus.REFUNDED.getId());
|
||||
// order.setOrderStatus(OrderStatus.REFUNDED.getId());
|
||||
if(refund.getState().equals(RefundState.PART.getId())){
|
||||
//部分退款
|
||||
order.setOrderStatus(OrderStatus.PART_REFUNDED.getId());
|
||||
}else {
|
||||
//全额退款
|
||||
order.setOrderStatus(OrderStatus.REFUNDED.getId());
|
||||
}
|
||||
orderService.updateOrder(order);
|
||||
} else if ("CLOSED".equals(notification.getRefundStatus())) {
|
||||
// 退款关闭,处理退款关闭逻辑
|
||||
@@ -314,14 +327,28 @@ public class WxPayController {
|
||||
// 退款成功,更新订单状态等操作
|
||||
com.central.order.model.Refund refund = refundService.getRefundByNo(outRefundNo);
|
||||
Assert.notNull(refund,"退款订单数据不存在");
|
||||
refund.setStatus(OrderStatus.REFUNDED.getId());
|
||||
refund.setState(RefundState.APPROVED.getId());
|
||||
// refund.setStatus(OrderStatus.REFUNDED.getId());
|
||||
// refund.setState(RefundState.APPROVED.getId());
|
||||
if(refund.getState().equals(RefundState.PART.getId())){
|
||||
//部分退款
|
||||
refund.setStatus(OrderStatus.PART_REFUNDED.getId());
|
||||
}else {
|
||||
//全额退款
|
||||
refund.setStatus(OrderStatus.REFUNDED.getId());
|
||||
}
|
||||
refund.setRefundTime(new Date());
|
||||
refundService.updateById(refund);
|
||||
|
||||
Order order = orderService.getOrderByNumber(refund.getOrderNo());
|
||||
Assert.notNull(order,"订单数据不存在");
|
||||
order.setOrderStatus(OrderStatus.REFUNDED.getId());
|
||||
// order.setOrderStatus(OrderStatus.REFUNDED.getId());
|
||||
if(refund.getState().equals(RefundState.PART.getId())){
|
||||
//部分退款
|
||||
order.setOrderStatus(OrderStatus.PART_REFUNDED.getId());
|
||||
}else {
|
||||
//全额退款
|
||||
order.setOrderStatus(OrderStatus.REFUNDED.getId());
|
||||
}
|
||||
orderService.updateOrder(order);
|
||||
} else if ("CLOSED".equals(notification.getRefundStatus())) {
|
||||
// 退款关闭,处理退款关闭逻辑
|
||||
|
||||
@@ -19,7 +19,8 @@ OrderStatus implements ZltEnum {
|
||||
UPLOADED(6,"素材上传完成(任务完成)"),
|
||||
REFUNDING(7,"退款中"),
|
||||
REFUNDED(8,"已退款"),
|
||||
REFUND_FAILED(9,"退款失败");
|
||||
REFUND_FAILED(9,"退款失败"),
|
||||
PART_REFUNDED(10,"部分退款");
|
||||
|
||||
OrderStatus(Integer id, String content) {
|
||||
this.id = id;
|
||||
|
||||
@@ -11,8 +11,9 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum RefundState implements ZltEnum {
|
||||
APPROVING(0,"审核中"),
|
||||
APPROVED(1, "已通过"),
|
||||
REFUSED(2,"已拒绝");
|
||||
APPROVED(1, "全额退款"),
|
||||
REFUSED(2,"拒绝退款"),
|
||||
PART(3,"部分退款");
|
||||
|
||||
|
||||
RefundState(Integer id, String content) {
|
||||
|
||||
+17
-16
@@ -22,7 +22,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
@@ -62,7 +62,7 @@ public interface DashboardMapper {
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND DATE(o.create_time) = CURDATE()",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
@@ -90,7 +90,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status = 8",
|
||||
"AND o.order_status IN ( 8,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
@@ -129,7 +129,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status = 8",
|
||||
"AND o.order_status IN ( 8,10)",
|
||||
"AND DATE(o.create_time) = CURDATE()",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
@@ -151,7 +151,7 @@ public interface DashboardMapper {
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT",
|
||||
" SUM(CASE WHEN o.order_status IN (1, 3, 4, 5, 7) THEN 1 ELSE 0 END) as count",
|
||||
" SUM(CASE WHEN o.order_status IN (1, 3, 4, 5, 7,9) THEN 1 ELSE 0 END) as count",
|
||||
"FROM orders o",
|
||||
"JOIN qrcodes q ON o.code_id = q.code_id",
|
||||
"WHERE 1=1",
|
||||
@@ -190,7 +190,7 @@ public interface DashboardMapper {
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT",
|
||||
" SUM(CASE WHEN o.order_status IN (1, 3, 4, 5, 7) THEN 1 ELSE 0 END) as count",
|
||||
" SUM(CASE WHEN o.order_status IN (1, 3, 4, 5, 7,9) THEN 1 ELSE 0 END) as count",
|
||||
"FROM orders o",
|
||||
"JOIN qrcodes q ON o.code_id = q.code_id",
|
||||
"WHERE 1=1",
|
||||
@@ -319,7 +319,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status = 8",
|
||||
"AND o.order_status IN (8,10)",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
"</if>",
|
||||
@@ -355,7 +355,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 6, 7, 8, 9)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 6, 7, 8, 9,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
@@ -390,7 +390,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status = 8",
|
||||
"AND o.order_status IN ( 8,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
@@ -432,7 +432,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.startTime != null and p.startTime != \"\"'>",
|
||||
" AND o.create_time >= #{p.startTime}",
|
||||
@@ -516,7 +516,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
" AND o.order_status = 8",
|
||||
" AND o.order_status IN ( 8,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.startTime != null and p.startTime != \"\"'>",
|
||||
" AND o.create_time >= #{p.startTime}",
|
||||
@@ -592,7 +592,7 @@ public interface DashboardMapper {
|
||||
" <if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'> AND q.is_test = 0 </if>",
|
||||
" AND q.is_del = 0",
|
||||
"LEFT JOIN orders o ON q.code_id = o.code_id",
|
||||
" AND o.order_status IN (3, 7)",
|
||||
" AND o.order_status IN (3, 7 ,9)",
|
||||
" AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
" <if test='p.startTime != null and p.startTime != \"\"'> AND o.create_time >= #{p.startTime} </if>",
|
||||
" <if test='p.endTime != null and p.endTime != \"\"'> AND o.create_time <= #{p.endTime} </if>",
|
||||
@@ -622,7 +622,7 @@ public interface DashboardMapper {
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND DATE(o.create_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.tourismId != null'>",
|
||||
" AND o.tourism_id = #{p.tourismId}",
|
||||
@@ -692,7 +692,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 7, 8, 9 ,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.startTime != null and p.startTime != \"\"'>",
|
||||
" AND o.create_time >= #{p.startTime}",
|
||||
@@ -734,7 +734,7 @@ public interface DashboardMapper {
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND q.is_test = 0",
|
||||
"</if>",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 6, 7, 8, 9)",
|
||||
"AND o.order_status IN (1, 3, 4, 5, 6, 7, 8, 9 ,10)",
|
||||
"AND (o.pay_type = 1 OR o.pay_type IS NULL)",
|
||||
"<if test='p.startTime != null and p.startTime != \"\"'>",
|
||||
" AND o.create_time >= #{p.startTime}",
|
||||
@@ -862,6 +862,7 @@ public interface DashboardMapper {
|
||||
" WHEN 7 THEN '退款中'",
|
||||
" WHEN 8 THEN '已退款'",
|
||||
" WHEN 9 THEN '退款失败'",
|
||||
" WHEN 10 THEN '部分退款'",
|
||||
" ELSE '其他'",
|
||||
" END as type,",
|
||||
" COUNT(*) as value",
|
||||
@@ -900,7 +901,7 @@ public interface DashboardMapper {
|
||||
"<script>",
|
||||
"SELECT",
|
||||
" '平台分账' as type,",
|
||||
" COALESCE(SUM(CASE WHEN o.order_status IN (1, 3, 4, 5, 6, 7, 8, 9) THEN o.order_amount * 0.3 ELSE 0 END), 0) as value",
|
||||
" COALESCE(SUM(CASE WHEN o.order_status IN (1, 3, 4, 5, 6, 7, 8, 9 ,10) THEN o.order_amount * 0.3 ELSE 0 END), 0) as value",
|
||||
"FROM orders o",
|
||||
"JOIN qrcodes q ON o.code_id = q.code_id",
|
||||
"WHERE 1=1",
|
||||
|
||||
Reference in New Issue
Block a user