|
|
@@ -1,10 +1,13 @@
|
|
|
package org.dromara.bill.controller;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import jakarta.validation.constraints.NotEmpty;
|
|
|
import jakarta.validation.constraints.NotNull;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.dromara.bill.domain.StatementOrder;
|
|
|
import org.dromara.bill.domain.bo.StatementOrderBo;
|
|
|
import org.dromara.bill.domain.dto.StatementOrderItem;
|
|
|
import org.dromara.bill.domain.vo.StatementDetailVo;
|
|
|
@@ -20,10 +23,12 @@ import org.dromara.common.log.annotation.Log;
|
|
|
import org.dromara.common.log.enums.BusinessType;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -47,9 +52,48 @@ public class StatementOrderController extends BaseController {
|
|
|
// @SaCheckPermission("bill:statementOrder:list")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo<StatementOrderVo> list(StatementOrderBo bo, PageQuery pageQuery) {
|
|
|
+ Long partnerId = LoginHelper.getLoginUser().getPartnerId();
|
|
|
+ if (ObjectUtil.isNotEmpty(partnerId)) {
|
|
|
+ bo.setCustomerId(partnerId);
|
|
|
+ }
|
|
|
return statementOrderService.queryPageList(bo, pageQuery);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/bpStatementOrderList")
|
|
|
+ public TableDataInfo<StatementOrderVo> bpStatementOrderList(StatementOrderBo bo, PageQuery pageQuery) {
|
|
|
+ Long partnerId = LoginHelper.getLoginUser().getPartnerId();
|
|
|
+
|
|
|
+ // PC端权限控制:强制只查询状态为 1、2、3 的对账单
|
|
|
+ LambdaQueryWrapper<StatementOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(StatementOrder::getCustomerId, partnerId);
|
|
|
+ wrapper.in(StatementOrder::getStatementStatus, Arrays.asList("1", "2", "3"));
|
|
|
+
|
|
|
+ // 如果用户指定了状态,且状态在允许范围内,则使用用户指定的状态
|
|
|
+ String statementStatus = bo.getStatementStatus();
|
|
|
+ if (statementStatus != null && !statementStatus.isEmpty()) {
|
|
|
+ if ("1".equals(statementStatus) || "2".equals(statementStatus) || "3".equals(statementStatus)) {
|
|
|
+ // 用户指定的状态在允许范围内,覆盖 IN 条件
|
|
|
+ wrapper.clear();
|
|
|
+ wrapper.eq(StatementOrder::getStatementStatus, statementStatus);
|
|
|
+ }
|
|
|
+ // 如果用户指定了不允许的状态(0或4),保持 IN 条件,会返回空结果
|
|
|
+ }
|
|
|
+
|
|
|
+ // 添加其他查询条件
|
|
|
+ if (bo.getStatementOrderNo() != null && !bo.getStatementOrderNo().isEmpty()) {
|
|
|
+ wrapper.like(StatementOrder::getStatementOrderNo, bo.getStatementOrderNo());
|
|
|
+ }
|
|
|
+ if (bo.getIsInvoiceStatus() != null && !bo.getIsInvoiceStatus().isEmpty()) {
|
|
|
+ wrapper.eq(StatementOrder::getIsInvoiceStatus, bo.getIsInvoiceStatus());
|
|
|
+ }
|
|
|
+ if (bo.getIsPaymentStatus() != null && !bo.getIsPaymentStatus().isEmpty()) {
|
|
|
+ wrapper.eq(StatementOrder::getIsPaymentStatus, bo.getIsPaymentStatus());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 使用新添加的 PC 端专用方法
|
|
|
+ return statementOrderService.queryPageListByWrapper(wrapper, pageQuery);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据订单id查询订单商品
|
|
|
*/
|
|
|
@@ -143,4 +187,21 @@ public class StatementOrderController extends BaseController {
|
|
|
PageQuery pageQuery) {
|
|
|
return statementOrderService.listDetailsByCustomerIdPage(customerId, pageQuery);
|
|
|
}
|
|
|
+
|
|
|
+ @Log(title = "对账单确认", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/confirm")
|
|
|
+ public R<Void> confirm(@RequestBody StatementOrderBo bo) {
|
|
|
+ bo.setStatementStatus("2");
|
|
|
+ return toAjax(statementOrderService.updateStatus(bo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驳回对账单
|
|
|
+ */
|
|
|
+ @Log(title = "对账单驳回", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/reject")
|
|
|
+ public R<Void> reject(@RequestBody StatementOrderBo bo) {
|
|
|
+ bo.setStatementStatus("3");
|
|
|
+ return toAjax(statementOrderService.updateStatus(bo));
|
|
|
+ }
|
|
|
}
|