Просмотр исходного кода

Merge remote-tracking branch 'origin/master' into master

# Conflicts:
#	ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/pc/PcOrderController.java
#	ruoyi-modules/ruoyi-product/src/main/resources/mapper/product/ProductBaseMapper.xml
肖路 1 месяц назад
Родитель
Сommit
2b300da8c5
36 измененных файлов с 1768 добавлено и 61 удалено
  1. 3 1
      ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/interceptor/PlatformDataScopeInterceptor.java
  2. 106 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/CreditApplyController.java
  3. 106 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/CustomerExpenseTypeController.java
  4. 55 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcCreditApplyController.java
  5. 108 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcCustomerExpenseTypeController.java
  6. 104 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CreditApply.java
  7. 67 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerExpenseType.java
  8. 102 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CreditApplyBo.java
  9. 59 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CustomerExpenseTypeBo.java
  10. 133 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CreditApplyVo.java
  11. 76 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerExpenseTypeVo.java
  12. 15 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/mapper/CreditApplyMapper.java
  13. 15 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/mapper/CustomerExpenseTypeMapper.java
  14. 70 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICreditApplyService.java
  15. 70 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICustomerExpenseTypeService.java
  16. 160 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CreditApplyServiceImpl.java
  17. 138 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerExpenseTypeServiceImpl.java
  18. 7 0
      ruoyi-modules/ruoyi-customer/src/main/resources/mapper/customer/CustomerExpenseTypeMapper.xml
  19. 100 12
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/pc/PcOrderController.java
  20. 5 5
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/pc/PcOrderReturnController.java
  21. 3 1
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/OrderReturn.java
  22. 21 0
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/OrderReturnItem.java
  23. 1 1
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/bo/OrderReturnBo.java
  24. 21 0
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/bo/OrderReturnItemBo.java
  25. 23 0
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/bo/PcCheckOrderBo.java
  26. 5 0
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/vo/OrderProductVo.java
  27. 15 2
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/vo/OrderReturnItemVo.java
  28. 1 1
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/vo/OrderReturnVo.java
  29. 2 0
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/mapper/OrderProductMapper.java
  30. 7 4
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/IOrderMainService.java
  31. 22 14
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderCustomerFlowServiceImpl.java
  32. 35 4
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderMainServiceImpl.java
  33. 19 6
      ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderReturnServiceImpl.java
  34. 11 9
      ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMainMapper.xml
  35. 56 1
      ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderProductMapper.xml
  36. 27 0
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/pc/PcOrderReturnReasonController.java

+ 3 - 1
ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/interceptor/PlatformDataScopeInterceptor.java

@@ -94,7 +94,9 @@ public class PlatformDataScopeInterceptor implements Interceptor {
         "address_area",
         "supplier_",
         "supply_area",
-        "authorize_type_level"
+        "authorize_type_level",
+        "order_return",
+        "order_return_item"
 
 
         // 注意:前缀匹配需特殊处理(如 qrtz_),见 isIgnoreTable 方法

+ 106 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/CreditApplyController.java

@@ -0,0 +1,106 @@
+package org.dromara.customer.controller;
+
+import java.util.List;
+
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.customer.domain.vo.CreditApplyVo;
+import org.dromara.customer.domain.bo.CreditApplyBo;
+import org.dromara.customer.service.ICreditApplyService;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+
+/**
+ * 信用额度申请
+ * 前端访问路由地址为:/customer/creditApply
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/creditApply")
+public class CreditApplyController extends BaseController {
+
+    private final ICreditApplyService creditApplyService;
+
+    /**
+     * 查询信用额度申请列表
+     */
+    //@SaCheckPermission("customer:creditApply:list")
+    @GetMapping("/list")
+    public TableDataInfo<CreditApplyVo> list(CreditApplyBo bo, PageQuery pageQuery) {
+        return creditApplyService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出信用额度申请列表
+     */
+    //@SaCheckPermission("customer:creditApply:export")
+    @Log(title = "信用额度申请", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(CreditApplyBo bo, HttpServletResponse response) {
+        List<CreditApplyVo> list = creditApplyService.queryList(bo);
+        ExcelUtil.exportExcel(list, "信用额度申请", CreditApplyVo.class, response);
+    }
+
+    /**
+     * 获取信用额度申请详细信息
+     *
+     * @param id 主键
+     */
+    //@SaCheckPermission("customer:creditApply:query")
+    @GetMapping("/{id}")
+    public R<CreditApplyVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable("id") Long id) {
+        return R.ok(creditApplyService.queryById(id));
+    }
+
+    /**
+     * 新增信用额度申请
+     */
+    //@SaCheckPermission("customer:creditApply:add")
+    @Log(title = "信用额度申请", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody CreditApplyBo bo) {
+        return toAjax(creditApplyService.insertByBo(bo));
+    }
+
+    /**
+     * 修改信用额度申请
+     */
+    //@SaCheckPermission("customer:creditApply:edit")
+    @Log(title = "信用额度申请", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody CreditApplyBo bo) {
+        return toAjax(creditApplyService.updateByBo(bo));
+    }
+
+    /**
+     * 删除信用额度申请
+     *
+     * @param ids 主键串
+     */
+    //@SaCheckPermission("customer:creditApply:remove")
+    @Log(title = "信用额度申请", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable("ids") Long[] ids) {
+        return toAjax(creditApplyService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 106 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/CustomerExpenseTypeController.java

@@ -0,0 +1,106 @@
+package org.dromara.customer.controller;
+
+import java.util.List;
+
+import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.validation.constraints.*;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+import org.dromara.common.log.annotation.Log;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.log.enums.BusinessType;
+import org.dromara.common.excel.utils.ExcelUtil;
+import org.dromara.customer.domain.vo.CustomerExpenseTypeVo;
+import org.dromara.customer.domain.bo.CustomerExpenseTypeBo;
+import org.dromara.customer.service.ICustomerExpenseTypeService;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+
+/**
+ * 客户费用类型
+ * 前端访问路由地址为:/customer/expenseType
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/expenseType")
+public class CustomerExpenseTypeController extends BaseController {
+
+    private final ICustomerExpenseTypeService customerExpenseTypeService;
+
+    /**
+     * 查询客户费用类型列表
+     */
+    //@SaCheckPermission("customer:expenseType:list")
+    @GetMapping("/list")
+    public TableDataInfo<CustomerExpenseTypeVo> list(CustomerExpenseTypeBo bo, PageQuery pageQuery) {
+        return customerExpenseTypeService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 导出客户费用类型列表
+     */
+    //@SaCheckPermission("customer:expenseType:export")
+    @Log(title = "客户费用类型", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(CustomerExpenseTypeBo bo, HttpServletResponse response) {
+        List<CustomerExpenseTypeVo> list = customerExpenseTypeService.queryList(bo);
+        ExcelUtil.exportExcel(list, "客户费用类型", CustomerExpenseTypeVo.class, response);
+    }
+
+    /**
+     * 获取客户费用类型详细信息
+     *
+     * @param id 主键
+     */
+    //@SaCheckPermission("customer:expenseType:query")
+    @GetMapping("/{id}")
+    public R<CustomerExpenseTypeVo> getInfo(@NotNull(message = "主键不能为空")
+                                     @PathVariable("id") Long id) {
+        return R.ok(customerExpenseTypeService.queryById(id));
+    }
+
+    /**
+     * 新增客户费用类型
+     */
+    //@SaCheckPermission("customer:expenseType:add")
+    @Log(title = "客户费用类型", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody CustomerExpenseTypeBo bo) {
+        return toAjax(customerExpenseTypeService.insertByBo(bo));
+    }
+
+    /**
+     * 修改客户费用类型
+     */
+    //@SaCheckPermission("customer:expenseType:edit")
+    @Log(title = "客户费用类型", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody CustomerExpenseTypeBo bo) {
+        return toAjax(customerExpenseTypeService.updateByBo(bo));
+    }
+
+    /**
+     * 删除客户费用类型
+     *
+     * @param ids 主键串
+     */
+    //@SaCheckPermission("customer:expenseType:remove")
+    @Log(title = "客户费用类型", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable("ids") Long[] ids) {
+        return toAjax(customerExpenseTypeService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 55 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcCreditApplyController.java

@@ -0,0 +1,55 @@
+package org.dromara.customer.controller.pc;
+
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+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.dromara.customer.domain.bo.CreditApplyBo;
+import org.dromara.customer.domain.bo.CustomerExpenseTypeBo;
+import org.dromara.customer.domain.vo.CreditApplyVo;
+import org.dromara.customer.domain.vo.CustomerExpenseTypeVo;
+import org.dromara.customer.service.ICreditApplyService;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/pcCreditApply")
+public class PcCreditApplyController extends BaseController {
+
+    private final ICreditApplyService creditApplyService;
+
+
+    @GetMapping("/list")
+    public TableDataInfo<CreditApplyVo> list(CreditApplyBo bo, PageQuery pageQuery) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        // 强制设置企业ID,防止越权访问
+        bo.setCustomerId(customerId);
+
+        return creditApplyService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 新增费用类型
+     */
+    @Log(title = "PC端-额度申请", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody CreditApplyBo bo) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        // 强制设置企业ID,防止为其他企业添加地址
+        bo.setCustomerId(customerId);
+
+        return toAjax(creditApplyService.insertByBo(bo));
+    }
+}

+ 108 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcCustomerExpenseTypeController.java

@@ -0,0 +1,108 @@
+package org.dromara.customer.controller.pc;
+
+import jakarta.validation.constraints.NotEmpty;
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
+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.dromara.customer.domain.bo.CustomerExpenseTypeBo;
+import org.dromara.customer.domain.bo.CustomerShippingAddressBo;
+import org.dromara.customer.domain.vo.CustomerExpenseTypeVo;
+import org.dromara.customer.domain.vo.CustomerShippingAddressVo;
+import org.dromara.customer.service.ICustomerExpenseTypeService;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/pcCustomerExpenseType")
+public class PcCustomerExpenseTypeController extends BaseController {
+
+    private final ICustomerExpenseTypeService customerExpenseTypeService;
+
+    @GetMapping("/list")
+    public TableDataInfo<CustomerExpenseTypeVo> list(CustomerExpenseTypeBo bo, PageQuery pageQuery) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        // 强制设置企业ID,防止越权访问
+        bo.setCustomerId(customerId);
+
+        return customerExpenseTypeService.queryPageList(bo, pageQuery);
+    }
+
+    /**
+     * 新增费用类型
+     */
+    @Log(title = "PC端-费用类型", businessType = BusinessType.INSERT)
+    @RepeatSubmit()
+    @PostMapping()
+    public R<Void> add(@Validated(AddGroup.class) @RequestBody CustomerExpenseTypeBo bo) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+        // 强制设置企业ID,防止为其他企业添加地址
+        bo.setCustomerId(customerId);
+
+        return toAjax(customerExpenseTypeService.insertByBo(bo));
+    }
+
+    /**
+     * 修改费用类型
+     */
+    @Log(title = "PC端-费用类型", businessType = BusinessType.UPDATE)
+    @RepeatSubmit()
+    @PutMapping()
+    public R<Void> edit(@Validated(EditGroup.class) @RequestBody CustomerExpenseTypeBo bo) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+
+        // 验证是否属于当前用户的企业
+        CustomerExpenseTypeVo customerExpenseTypeVo = customerExpenseTypeService.queryById(bo.getId());
+        if (customerExpenseTypeVo == null) {
+            return R.fail("类型不存在");
+        }
+        if (!customerId.equals(customerExpenseTypeVo.getCustomerId())) {
+            return R.fail("无权修改该类型");
+        }
+
+        // 强制设置企业ID
+        bo.setCustomerId(customerId);
+
+        return toAjax(customerExpenseTypeService.updateByBo(bo));
+    }
+
+    /**
+     * 删除收货地址
+     *
+     * @param ids 主键串
+     */
+    @Log(title = "PC端-费用类型", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R<Void> remove(@NotEmpty(message = "主键不能为空")
+                          @PathVariable("ids") Long[] ids) {
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+
+        // 验证所有地址是否都属于当前用户的企业
+        for (Long id : ids) {
+            CustomerExpenseTypeVo customerExpenseTypeVo = customerExpenseTypeService.queryById(id);
+            if (customerExpenseTypeVo == null) {
+                return R.fail("类型ID " + id + " 不存在");
+            }
+            if (!customerId.equals(customerExpenseTypeVo.getCustomerId())) {
+                return R.fail("无权删除类型ID " + id);
+            }
+        }
+
+        return toAjax(customerExpenseTypeService.deleteWithValidByIds(List.of(ids), true));
+    }
+}

+ 104 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CreditApply.java

@@ -0,0 +1,104 @@
+package org.dromara.customer.domain;
+
+import org.dromara.common.tenant.core.TenantEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.math.BigDecimal;
+import org.dromara.common.translation.annotation.Translation;
+import org.dromara.common.translation.constant.TransConstant;
+
+import java.io.Serial;
+
+/**
+ * 信用额度申请对象 credit_apply
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("credit_apply")
+public class CreditApply extends TenantEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 客户id
+     */
+    private Long customerId;
+
+    /**
+     * 客户编号
+     */
+    private String customerNo;
+
+    /**
+     * 申请单号
+     */
+    private String applyNo;
+
+    /**
+     * 月采购额
+     */
+    private BigDecimal monthPurchase;
+
+    /**
+     * 年采购额
+     */
+    private BigDecimal yearPurchase;
+
+    /**
+     * 申请额度(单位:元)
+     */
+    private BigDecimal applyAmount;
+
+    /**
+     * 额度有效期(如:6个月、12个月)
+     */
+    private Integer amountPeriod;
+
+    /**
+     * 主要采购产品
+     */
+    private String mainPurchase;
+
+    /**
+     * 其他采购产品
+     */
+    private String otherPurchase;
+
+    /**
+     * 合作证明图片路径
+     */
+    private String cooperationImage;
+
+    /**
+     * 审批状态(0-待审核, 1-通过, 2-拒绝)
+     */
+    private String approvalStatus;
+
+    /**
+     * 审批意见
+     */
+    private String approvalComment;
+
+    /**
+     * 原有额度
+     */
+    private BigDecimal oldAmount;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 67 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerExpenseType.java

@@ -0,0 +1,67 @@
+package org.dromara.customer.domain;
+
+import org.dromara.common.tenant.core.TenantEntity;
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+
+/**
+ * 客户费用类型对象 customer_expense_type
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("customer_expense_type")
+public class CustomerExpenseType extends TenantEntity {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 客户编号
+     */
+    private Long customerId;
+
+    /**
+     * 客户编号
+     */
+    private String customerNo;
+
+    /**
+     * 费用名称
+     */
+    private String expenseName;
+
+    /**
+     * 费用类型(业务自定义)
+     */
+    private String type;
+
+    /**
+     * 状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 删除标志(0代表存在 2代表删除)
+     */
+    @TableLogic
+    private String delFlag;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 102 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CreditApplyBo.java

@@ -0,0 +1,102 @@
+package org.dromara.customer.domain.bo;
+
+import org.dromara.customer.domain.CreditApply;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+import java.math.BigDecimal;
+import org.dromara.common.translation.annotation.Translation;
+import org.dromara.common.translation.constant.TransConstant;
+
+/**
+ * 信用额度申请业务对象 credit_apply
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = CreditApply.class, reverseConvertGenerate = false)
+public class CreditApplyBo extends BaseEntity {
+
+    /**
+     * 主键ID
+     */
+    private Long id;
+
+    /**
+     * 客户id
+     */
+    private Long customerId;
+
+    /**
+     * 客户编号
+     */
+    private String customerNo;
+
+    /**
+     * 申请单号
+     */
+    private String applyNo;
+
+    /**
+     * 月采购额
+     */
+    private BigDecimal monthPurchase;
+
+    /**
+     * 年采购额
+     */
+    private BigDecimal yearPurchase;
+
+    /**
+     * 申请额度(单位:元)
+     */
+    private BigDecimal applyAmount;
+
+    /**
+     * 额度有效期(如:6个月、12个月)
+     */
+    private Integer amountPeriod;
+
+    /**
+     * 主要采购产品
+     */
+    private String mainPurchase;
+
+    /**
+     * 其他采购产品
+     */
+    private String otherPurchase;
+
+    /**
+     * 合作证明图片路径
+     */
+    private String cooperationImage;
+
+    /**
+     * 审批状态(0-待审核, 1-通过, 2-拒绝)
+     */
+    private String approvalStatus;
+
+    /**
+     * 审批意见
+     */
+    private String approvalComment;
+
+    /**
+     * 原有额度
+     */
+    private BigDecimal oldAmount;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 59 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CustomerExpenseTypeBo.java

@@ -0,0 +1,59 @@
+package org.dromara.customer.domain.bo;
+
+import org.dromara.customer.domain.CustomerExpenseType;
+import org.dromara.common.mybatis.core.domain.BaseEntity;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import jakarta.validation.constraints.*;
+
+/**
+ * 客户费用类型业务对象 customer_expense_type
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = CustomerExpenseType.class, reverseConvertGenerate = false)
+public class CustomerExpenseTypeBo extends BaseEntity {
+
+    /**
+     * 主键ID
+     */
+    private Long id;
+
+    /**
+     * 客户编号
+     */
+    private Long customerId;
+
+    /**
+     * 客户编号
+     */
+    private String customerNo;
+
+    /**
+     * 费用名称
+     */
+    private String expenseName;
+
+    /**
+     * 费用类型(业务自定义)
+     */
+    private String type;
+
+    /**
+     * 状态(0正常 1停用)
+     */
+    private String status;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+}

+ 133 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CreditApplyVo.java

@@ -0,0 +1,133 @@
+package org.dromara.customer.domain.vo;
+
+import java.math.BigDecimal;
+
+import org.dromara.common.translation.annotation.Translation;
+import org.dromara.common.translation.constant.TransConstant;
+import org.dromara.customer.domain.CreditApply;
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 信用额度申请视图对象 credit_apply
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = CreditApply.class)
+public class CreditApplyVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @ExcelProperty(value = "主键ID")
+    private Long id;
+
+    /**
+     * 客户id
+     */
+    @ExcelProperty(value = "客户id")
+    private Long customerId;
+
+    /**
+     * 客户编号
+     */
+    @ExcelProperty(value = "客户编号")
+    private String customerNo;
+
+    /**
+     * 申请单号
+     */
+    @ExcelProperty(value = "申请单号")
+    private String applyNo;
+
+    /**
+     * 月采购额
+     */
+    @ExcelProperty(value = "月采购额")
+    private BigDecimal monthPurchase;
+
+    /**
+     * 年采购额
+     */
+    @ExcelProperty(value = "年采购额")
+    private BigDecimal yearPurchase;
+
+    /**
+     * 申请额度(单位:元)
+     */
+    @ExcelProperty(value = "申请额度", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(readConverterExp = "单=位:元")
+    private BigDecimal applyAmount;
+
+    /**
+     * 额度有效期(如:6个月、12个月)
+     */
+    @ExcelProperty(value = "额度有效期", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(readConverterExp = "如=:6个月、12个月")
+    private Integer amountPeriod;
+
+    /**
+     * 主要采购产品
+     */
+    @ExcelProperty(value = "主要采购产品")
+    private String mainPurchase;
+
+    /**
+     * 其他采购产品
+     */
+    @ExcelProperty(value = "其他采购产品")
+    private String otherPurchase;
+
+    /**
+     * 合作证明图片路径
+     */
+    @ExcelProperty(value = "合作证明图片路径")
+    private String cooperationImage;
+
+    /**
+     * 合作证明图片路径Url
+     */
+    @Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "cooperationImage")
+    private String cooperationImageUrl;
+    /**
+     * 审批状态(0-待审核, 1-通过, 2-拒绝)
+     */
+    @ExcelProperty(value = "审批状态", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(readConverterExp = "0=-待审核,,1=-通过,,2=-拒绝")
+    private String approvalStatus;
+
+    /**
+     * 审批意见
+     */
+    @ExcelProperty(value = "审批意见")
+    private String approvalComment;
+
+    /**
+     * 原有额度
+     */
+    @ExcelProperty(value = "原有额度")
+    private BigDecimal oldAmount;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+    private Date createTime;
+}

+ 76 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerExpenseTypeVo.java

@@ -0,0 +1,76 @@
+package org.dromara.customer.domain.vo;
+
+import org.dromara.customer.domain.CustomerExpenseType;
+import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
+import cn.idev.excel.annotation.ExcelProperty;
+import org.dromara.common.excel.annotation.ExcelDictFormat;
+import org.dromara.common.excel.convert.ExcelDictConvert;
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+import java.util.Date;
+
+
+
+/**
+ * 客户费用类型视图对象 customer_expense_type
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = CustomerExpenseType.class)
+public class CustomerExpenseTypeVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @ExcelProperty(value = "主键ID")
+    private Long id;
+
+    /**
+     * 客户编号
+     */
+    @ExcelProperty(value = "客户编号")
+    private Long customerId;
+
+    /**
+     * 客户编号
+     */
+    @ExcelProperty(value = "客户编号")
+    private String customerNo;
+
+    /**
+     * 费用名称
+     */
+    @ExcelProperty(value = "费用名称")
+    private String expenseName;
+
+    /**
+     * 费用类型(业务自定义)
+     */
+    @ExcelProperty(value = "费用类型", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(readConverterExp = "业=务自定义")
+    private String type;
+
+    /**
+     * 状态(0正常 1停用)
+     */
+    @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
+    @ExcelDictFormat(readConverterExp = "0=正常,1=停用")
+    private String status;
+
+    /**
+     * 备注
+     */
+    @ExcelProperty(value = "备注")
+    private String remark;
+
+
+}

+ 15 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/mapper/CreditApplyMapper.java

@@ -0,0 +1,15 @@
+package org.dromara.customer.mapper;
+
+import org.dromara.customer.domain.CreditApply;
+import org.dromara.customer.domain.vo.CreditApplyVo;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+/**
+ * 信用额度申请Mapper接口
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+public interface CreditApplyMapper extends BaseMapperPlus<CreditApply, CreditApplyVo> {
+
+}

+ 15 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/mapper/CustomerExpenseTypeMapper.java

@@ -0,0 +1,15 @@
+package org.dromara.customer.mapper;
+
+import org.dromara.customer.domain.CustomerExpenseType;
+import org.dromara.customer.domain.vo.CustomerExpenseTypeVo;
+import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
+
+/**
+ * 客户费用类型Mapper接口
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+public interface CustomerExpenseTypeMapper extends BaseMapperPlus<CustomerExpenseType, CustomerExpenseTypeVo> {
+
+}

+ 70 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICreditApplyService.java

@@ -0,0 +1,70 @@
+package org.dromara.customer.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.dromara.customer.domain.CreditApply;
+import org.dromara.customer.domain.vo.CreditApplyVo;
+import org.dromara.customer.domain.bo.CreditApplyBo;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 信用额度申请Service接口
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+public interface ICreditApplyService extends IService<CreditApply>{
+
+    /**
+     * 查询信用额度申请
+     *
+     * @param id 主键
+     * @return 信用额度申请
+     */
+    CreditApplyVo queryById(Long id);
+
+    /**
+     * 分页查询信用额度申请列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 信用额度申请分页列表
+     */
+    TableDataInfo<CreditApplyVo> queryPageList(CreditApplyBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的信用额度申请列表
+     *
+     * @param bo 查询条件
+     * @return 信用额度申请列表
+     */
+    List<CreditApplyVo> queryList(CreditApplyBo bo);
+
+    /**
+     * 新增信用额度申请
+     *
+     * @param bo 信用额度申请
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(CreditApplyBo bo);
+
+    /**
+     * 修改信用额度申请
+     *
+     * @param bo 信用额度申请
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(CreditApplyBo bo);
+
+    /**
+     * 校验并批量删除信用额度申请信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 70 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICustomerExpenseTypeService.java

@@ -0,0 +1,70 @@
+package org.dromara.customer.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.dromara.customer.domain.CustomerExpenseType;
+import org.dromara.customer.domain.vo.CustomerExpenseTypeVo;
+import org.dromara.customer.domain.bo.CustomerExpenseTypeBo;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 客户费用类型Service接口
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+public interface ICustomerExpenseTypeService extends IService<CustomerExpenseType>{
+
+    /**
+     * 查询客户费用类型
+     *
+     * @param id 主键
+     * @return 客户费用类型
+     */
+    CustomerExpenseTypeVo queryById(Long id);
+
+    /**
+     * 分页查询客户费用类型列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 客户费用类型分页列表
+     */
+    TableDataInfo<CustomerExpenseTypeVo> queryPageList(CustomerExpenseTypeBo bo, PageQuery pageQuery);
+
+    /**
+     * 查询符合条件的客户费用类型列表
+     *
+     * @param bo 查询条件
+     * @return 客户费用类型列表
+     */
+    List<CustomerExpenseTypeVo> queryList(CustomerExpenseTypeBo bo);
+
+    /**
+     * 新增客户费用类型
+     *
+     * @param bo 客户费用类型
+     * @return 是否新增成功
+     */
+    Boolean insertByBo(CustomerExpenseTypeBo bo);
+
+    /**
+     * 修改客户费用类型
+     *
+     * @param bo 客户费用类型
+     * @return 是否修改成功
+     */
+    Boolean updateByBo(CustomerExpenseTypeBo bo);
+
+    /**
+     * 校验并批量删除客户费用类型信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 160 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CreditApplyServiceImpl.java

@@ -0,0 +1,160 @@
+package org.dromara.customer.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.redis.utils.SequenceUtils;
+import org.dromara.customer.domain.CreditApply;
+import org.dromara.customer.domain.CustomerSalesInfo;
+import org.dromara.customer.domain.bo.CreditApplyBo;
+import org.dromara.customer.domain.vo.CreditApplyVo;
+import org.dromara.customer.domain.vo.CustomerSalesInfoVo;
+import org.dromara.customer.mapper.CreditApplyMapper;
+import org.dromara.customer.mapper.CustomerSalesInfoMapper;
+import org.dromara.customer.service.ICreditApplyService;
+import org.springframework.stereotype.Service;
+
+import java.time.Duration;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 信用额度申请Service业务层处理
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class CreditApplyServiceImpl extends ServiceImpl<CreditApplyMapper, CreditApply> implements ICreditApplyService {
+
+    private static final String APPLY_NO_KEY = "credit_apply:apply_no";
+
+    private final CreditApplyMapper baseMapper;
+
+    private final CustomerSalesInfoMapper customerSalesInfoMapper;
+
+    /**
+     * 查询信用额度申请
+     *
+     * @param id 主键
+     * @return 信用额度申请
+     */
+    @Override
+    public CreditApplyVo queryById(Long id) {
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 分页查询信用额度申请列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 信用额度申请分页列表
+     */
+    @Override
+    public TableDataInfo<CreditApplyVo> queryPageList(CreditApplyBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<CreditApply> lqw = buildQueryWrapper(bo);
+        Page<CreditApplyVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的信用额度申请列表
+     *
+     * @param bo 查询条件
+     * @return 信用额度申请列表
+     */
+    @Override
+    public List<CreditApplyVo> queryList(CreditApplyBo bo) {
+        LambdaQueryWrapper<CreditApply> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<CreditApply> buildQueryWrapper(CreditApplyBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<CreditApply> lqw = Wrappers.lambdaQuery();
+        lqw.orderByAsc(CreditApply::getId);
+        lqw.eq(bo.getCustomerId() != null, CreditApply::getCustomerId, bo.getCustomerId());
+        lqw.eq(StringUtils.isNotBlank(bo.getCustomerNo()), CreditApply::getCustomerNo, bo.getCustomerNo());
+        lqw.eq(StringUtils.isNotBlank(bo.getApplyNo()), CreditApply::getApplyNo, bo.getApplyNo());
+        lqw.eq(bo.getMonthPurchase() != null, CreditApply::getMonthPurchase, bo.getMonthPurchase());
+        lqw.eq(bo.getYearPurchase() != null, CreditApply::getYearPurchase, bo.getYearPurchase());
+        lqw.eq(bo.getApplyAmount() != null, CreditApply::getApplyAmount, bo.getApplyAmount());
+        lqw.eq(bo.getAmountPeriod() != null, CreditApply::getAmountPeriod, bo.getAmountPeriod());
+        lqw.eq(StringUtils.isNotBlank(bo.getMainPurchase()), CreditApply::getMainPurchase, bo.getMainPurchase());
+        lqw.eq(StringUtils.isNotBlank(bo.getOtherPurchase()), CreditApply::getOtherPurchase, bo.getOtherPurchase());
+        lqw.eq(StringUtils.isNotBlank(bo.getCooperationImage()), CreditApply::getCooperationImage, bo.getCooperationImage());
+        lqw.eq(StringUtils.isNotBlank(bo.getApprovalStatus()), CreditApply::getApprovalStatus, bo.getApprovalStatus());
+        lqw.eq(StringUtils.isNotBlank(bo.getApprovalComment()), CreditApply::getApprovalComment, bo.getApprovalComment());
+        lqw.eq(bo.getOldAmount() != null, CreditApply::getOldAmount, bo.getOldAmount());
+        lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), CreditApply::getPlatformCode, bo.getPlatformCode());
+        return lqw;
+    }
+
+    /**
+     * 新增信用额度申请
+     *
+     * @param bo 信用额度申请
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(CreditApplyBo bo) {
+        bo.setApplyNo(SequenceUtils.nextPaddedIdStr(APPLY_NO_KEY, Duration.ofDays(3650), 6));
+        CustomerSalesInfoVo salesInfoVo = customerSalesInfoMapper.selectVoOne(new LambdaQueryWrapper<CustomerSalesInfo>().eq(CustomerSalesInfo::getCustomerId, bo.getCustomerId()).last("LIMIT 1"));
+        if (salesInfoVo != null) {
+            bo.setOldAmount(salesInfoVo.getCreditAmount());
+        }
+        CreditApply add = MapstructUtils.convert(bo, CreditApply.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改信用额度申请
+     *
+     * @param bo 信用额度申请
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(CreditApplyBo bo) {
+        CreditApply update = MapstructUtils.convert(bo, CreditApply.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(CreditApply entity) {
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除信用额度申请信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if (isValid) {
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

+ 138 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerExpenseTypeServiceImpl.java

@@ -0,0 +1,138 @@
+package org.dromara.customer.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.dromara.customer.domain.bo.CustomerExpenseTypeBo;
+import org.dromara.customer.domain.vo.CustomerExpenseTypeVo;
+import org.dromara.customer.domain.CustomerExpenseType;
+import org.dromara.customer.mapper.CustomerExpenseTypeMapper;
+import org.dromara.customer.service.ICustomerExpenseTypeService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * 客户费用类型Service业务层处理
+ *
+ * @author LionLi
+ * @date 2026-02-24
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class CustomerExpenseTypeServiceImpl  extends ServiceImpl<CustomerExpenseTypeMapper, CustomerExpenseType> implements ICustomerExpenseTypeService {
+
+    private final CustomerExpenseTypeMapper baseMapper;
+
+    /**
+     * 查询客户费用类型
+     *
+     * @param id 主键
+     * @return 客户费用类型
+     */
+    @Override
+    public CustomerExpenseTypeVo queryById(Long id){
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 分页查询客户费用类型列表
+     *
+     * @param bo        查询条件
+     * @param pageQuery 分页参数
+     * @return 客户费用类型分页列表
+     */
+    @Override
+    public TableDataInfo<CustomerExpenseTypeVo> queryPageList(CustomerExpenseTypeBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<CustomerExpenseType> lqw = buildQueryWrapper(bo);
+        Page<CustomerExpenseTypeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 查询符合条件的客户费用类型列表
+     *
+     * @param bo 查询条件
+     * @return 客户费用类型列表
+     */
+    @Override
+    public List<CustomerExpenseTypeVo> queryList(CustomerExpenseTypeBo bo) {
+        LambdaQueryWrapper<CustomerExpenseType> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<CustomerExpenseType> buildQueryWrapper(CustomerExpenseTypeBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<CustomerExpenseType> lqw = Wrappers.lambdaQuery();
+        lqw.orderByAsc(CustomerExpenseType::getId);
+        lqw.eq(bo.getCustomerId() != null, CustomerExpenseType::getCustomerId, bo.getCustomerId());
+        lqw.eq(StringUtils.isNotBlank(bo.getCustomerNo()), CustomerExpenseType::getCustomerNo, bo.getCustomerNo());
+        lqw.like(StringUtils.isNotBlank(bo.getExpenseName()), CustomerExpenseType::getExpenseName, bo.getExpenseName());
+        lqw.eq(StringUtils.isNotBlank(bo.getType()), CustomerExpenseType::getType, bo.getType());
+        lqw.eq(StringUtils.isNotBlank(bo.getStatus()), CustomerExpenseType::getStatus, bo.getStatus());
+        lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), CustomerExpenseType::getPlatformCode, bo.getPlatformCode());
+        return lqw;
+    }
+
+    /**
+     * 新增客户费用类型
+     *
+     * @param bo 客户费用类型
+     * @return 是否新增成功
+     */
+    @Override
+    public Boolean insertByBo(CustomerExpenseTypeBo bo) {
+        CustomerExpenseType add = MapstructUtils.convert(bo, CustomerExpenseType.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 修改客户费用类型
+     *
+     * @param bo 客户费用类型
+     * @return 是否修改成功
+     */
+    @Override
+    public Boolean updateByBo(CustomerExpenseTypeBo bo) {
+        CustomerExpenseType update = MapstructUtils.convert(bo, CustomerExpenseType.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 保存前的数据校验
+     */
+    private void validEntityBeforeSave(CustomerExpenseType entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    /**
+     * 校验并批量删除客户费用类型信息
+     *
+     * @param ids     待删除的主键集合
+     * @param isValid 是否进行有效性校验
+     * @return 是否删除成功
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

+ 7 - 0
ruoyi-modules/ruoyi-customer/src/main/resources/mapper/customer/CustomerExpenseTypeMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.dromara.customer.mapper.CustomerExpenseTypeMapper">
+
+</mapper>

+ 100 - 12
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/pc/PcOrderController.java

@@ -1,5 +1,8 @@
 package org.dromara.order.controller.pc;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import jakarta.validation.constraints.NotNull;
 import lombok.RequiredArgsConstructor;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.dromara.common.core.domain.R;
@@ -13,13 +16,14 @@ import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.web.core.BaseController;
 import org.dromara.customer.api.RemoteCustomerService;
 import org.dromara.customer.api.domain.CustomerApiVo;
-import org.dromara.order.domain.bo.OrderMainBo;
-import org.dromara.order.domain.bo.OrderProductBo;
-import org.dromara.order.domain.bo.PcSubmitOrderBo;
+import org.dromara.order.domain.OrderCustomerFlowLink;
+import org.dromara.order.domain.bo.*;
 import org.dromara.order.domain.dto.OrderPayDto;
 import org.dromara.order.domain.vo.OrderMainVo;
 import org.dromara.order.domain.vo.OrderProductVo;
 import org.dromara.order.domain.vo.OrderStatusStats;
+import org.dromara.order.service.IOrderCustomerFlowLinkService;
+import org.dromara.order.service.IOrderCustomerFlowService;
 import org.dromara.order.service.IOrderMainService;
 import org.dromara.product.api.RemoteProductService;
 import org.dromara.product.api.RemoteProductShoppingCartService;
@@ -28,8 +32,6 @@ import org.dromara.product.api.domain.RemoteProductShoppingCartVo;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import jakarta.validation.constraints.NotNull;
-
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.ZoneOffset;
@@ -61,6 +63,11 @@ public class PcOrderController extends BaseController {
     @DubboReference
     private RemoteProductShoppingCartService remoteProductShoppingCartService;
 
+    //客户订单流程
+    private final IOrderCustomerFlowService orderCustomerFlowService;
+
+    private final IOrderCustomerFlowLinkService orderCustomerFlowLinkService;
+
     private final IOrderMainService orderMainService;
 
     /**
@@ -142,6 +149,32 @@ public class PcOrderController extends BaseController {
         return orderMainService.getCustomerOrderProductList(uniqueOrderIds);
     }
 
+    @GetMapping("/productsWithAvailableQty")
+    public TableDataInfo<OrderProductVo> getOrderProductsWithAvailableQty(@RequestParam("orderIds") List<Long> orderIds) {
+        if (orderIds == null || orderIds.isEmpty()) {
+            throw new IllegalArgumentException("订单ID列表不能为空");
+        }
+        if (orderIds.size() > 1000) {
+            throw new IllegalArgumentException("订单ID数量不能超过1000个");
+        }
+
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+
+        // 验证所有订单是否都属于当前用户的企业
+        for (Long orderId : orderIds) {
+            OrderMainVo order = orderMainService.queryById(orderId);
+            if (order == null) {
+                throw new IllegalArgumentException("订单ID " + orderId + " 不存在");
+            }
+            if (!customerId.equals(order.getCustomerId())) {
+                throw new IllegalArgumentException("无权访问订单ID " + orderId);
+            }
+        }
+
+        return orderMainService.getOrderProductsWithAvailableQty(orderIds.get(0));
+    }
+
     /**
      * 取消订单
      * PC端用户只能取消自己企业的订单
@@ -237,10 +270,10 @@ public class PcOrderController extends BaseController {
             mainBo.setWarehouseId(1L); // TODO: 后续可配置或根据客户动态获取
 
 
-            // 设置订单状态为待审核
+            // 设置订单状态为待支付
             mainBo.setOrderStatus(OrderStatus.PENDING_PAYMENT.getCode());
 
-            // 设置检查状态为待审核
+            // 设置审核状态为待审核
             mainBo.setCheckStatus("0");
 
             mainBo.setOrderSource(OrderSourceEnum.BEFORE_ADD.getCode());
@@ -306,9 +339,9 @@ public class PcOrderController extends BaseController {
                     orderProductBo.setProductUnitId(Long.valueOf(productVo.getUnitId()));
                     orderProductBo.setProductUnit(productVo.getUnitName());
                     orderProductBo.setProductImage(productVo.getProductImageUrl());
-                    orderProductBo.setOrderPrice(productVo.getMarketPrice());
+                    orderProductBo.setOrderPrice(productVo.getMemberPrice());
                     orderProductBo.setOrderQuantity(quantity);
-                    orderProductBo.setSubtotal(productVo.getMarketPrice().multiply(BigDecimal.valueOf(quantity)));
+                    orderProductBo.setSubtotal(productVo.getMemberPrice().multiply(BigDecimal.valueOf(quantity)));
                     return orderProductBo;
                 })
                 .filter(Objects::nonNull)
@@ -322,9 +355,13 @@ public class PcOrderController extends BaseController {
 
             // 5. 保存订单(关键:成功后再删除购物车)
             Long orderId = orderMainService.insertByBo(mainBo);
-            if (orderId != null && orderId > 0 && bo.getPlaceOrderType() == 1) {
-                // 成功下单后,删除对应的购物车项
-                remoteProductShoppingCartService.deleteWithValidByIds(bo.getProductShoppingCartId());
+            if (orderId != null && orderId > 0) {
+                //初始化审批流程
+                orderCustomerFlowService.initOrderFlow(orderId);
+                if(bo.getPlaceOrderType() == 1){
+                    // 成功下单后,删除对应的购物车项
+                    remoteProductShoppingCartService.deleteWithValidByIds(productShoppingCartIds);
+                }
             } else {
                 throw new RuntimeException("订单创建失败");
             }
@@ -353,4 +390,55 @@ public class PcOrderController extends BaseController {
 
         return R.ok(orderPayResult);
     }
+
+    @GetMapping("/batchConfirmation")
+    public R<Void> batchConfirmation(@RequestParam("orderIds") List<Long> orderIds) {
+        if (orderIds == null || orderIds.isEmpty()) {
+            throw new IllegalArgumentException("订单ID列表不能为空");
+        }
+        if (orderIds.size() > 1000) {
+            throw new IllegalArgumentException("订单ID数量不能超过1000个");
+        }
+
+        // 获取当前登录用户的企业ID
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+
+        // 验证所有订单是否都属于当前用户的企业
+        for (Long orderId : orderIds) {
+            OrderMainVo order = orderMainService.queryById(orderId);
+            if (order == null) {
+                throw new IllegalArgumentException("订单ID " + orderId + " 不存在");
+            }
+            if (!customerId.equals(order.getCustomerId())) {
+                throw new IllegalArgumentException("无权访问订单ID " + orderId);
+            }
+        }
+
+        Set<Long> uniqueOrderIds = new HashSet<>(orderIds);
+        return toAjax(orderMainService.batchConfirmation(uniqueOrderIds));
+    }
+
+    /**
+     * 订单审核(PC端审核)
+     */
+    @Log(title = "PC端-订单审核", businessType = BusinessType.UPDATE)
+    @PostMapping("/checkOrder")
+    public R<?> checkOrder(@RequestBody @Validated PcCheckOrderBo checkOrderBo) {
+//        Long customerId = LoginHelper.getLoginUser().getCustomerId();
+//
+//        Long userId = LoginHelper.getLoginUser().getUserId();
+
+        OrderCustomerFlowLinkBo bo = new OrderCustomerFlowLinkBo();
+        List<OrderCustomerFlowLink> flowLinks = orderCustomerFlowLinkService.list(new LambdaQueryWrapper<OrderCustomerFlowLink>().eq(OrderCustomerFlowLink::getOrderId, checkOrderBo.getOrderId()));
+        if (CollUtil.isNotEmpty(flowLinks)) {
+            bo.setNodeId(flowLinks.get(0).getNodeId());
+        }
+        bo.setOrderId(checkOrderBo.getOrderId());
+        bo.setReviewStatus(Long.valueOf(checkOrderBo.getCheckStatus()));
+        bo.setReason(checkOrderBo.getCheckRemark());
+        bo.setReason(checkOrderBo.getCheckRemark());
+        orderCustomerFlowService.auditOrderFlow(bo);
+
+        return R.ok();
+    }
 }

+ 5 - 5
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/pc/PcOrderReturnController.java

@@ -44,7 +44,7 @@ public class PcOrderReturnController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<OrderReturnVo> list(OrderReturnBo bo, PageQuery pageQuery) {
         // 获取当前登录用户的企业ID
-        Long customerId = LoginHelper.getUserId();
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
         // 强制设置企业ID,防止越权访问
         bo.setCustomerId(customerId);
 
@@ -65,7 +65,7 @@ public class PcOrderReturnController extends BaseController {
 
         // 验证售后记录是否属于当前用户的企业
         if (vo != null) {
-            Long customerId = LoginHelper.getUserId();
+            Long customerId = LoginHelper.getLoginUser().getCustomerId();
             if (!customerId.equals(vo.getCustomerId())) {
                 return R.fail("无权访问该售后记录");
             }
@@ -83,7 +83,7 @@ public class PcOrderReturnController extends BaseController {
     @PostMapping()
     public R<Void> add(@Validated(AddGroup.class) @RequestBody OrderReturnBo bo) {
         // 获取当前登录用户的企业ID
-        Long customerId = LoginHelper.getUserId();
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
         // 强制设置企业ID,防止为其他企业创建售后申请
         bo.setCustomerId(customerId);
 
@@ -99,7 +99,7 @@ public class PcOrderReturnController extends BaseController {
     @PutMapping()
     public R<Void> edit(@Validated(EditGroup.class) @RequestBody OrderReturnBo bo) {
         // 获取当前登录用户的企业ID
-        Long customerId = LoginHelper.getUserId();
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
 
         // 验证售后记录是否属于当前用户的企业
         OrderReturnVo existingReturn = orderReturnService.queryById(bo.getId());
@@ -127,7 +127,7 @@ public class PcOrderReturnController extends BaseController {
     public R<Void> remove(@NotEmpty(message = "主键不能为空")
                           @PathVariable("ids") Long[] ids) {
         // 获取当前登录用户的企业ID
-        Long customerId = LoginHelper.getUserId();
+        Long customerId = LoginHelper.getLoginUser().getCustomerId();
 
         // 验证所有售后记录是否都属于当前用户的企业
         for (Long id : ids) {

+ 3 - 1
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/OrderReturn.java

@@ -4,8 +4,10 @@ import org.dromara.common.tenant.core.TenantEntity;
 import com.baomidou.mybatisplus.annotation.*;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+
 import java.math.BigDecimal;
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 
 import java.io.Serial;
@@ -73,7 +75,7 @@ public class OrderReturn extends TenantEntity {
     /**
      * 售后金额
      */
-    private Long afterSaleAmount;
+    private BigDecimal afterSaleAmount;
 
     /**
      * 退货订单状态

+ 21 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/OrderReturnItem.java

@@ -4,6 +4,7 @@ import org.dromara.common.tenant.core.TenantEntity;
 import com.baomidou.mybatisplus.annotation.*;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+
 import java.math.BigDecimal;
 
 import java.io.Serial;
@@ -43,6 +44,26 @@ public class OrderReturnItem extends TenantEntity {
      */
     private String productSku;
 
+    /**
+     * 商品ID
+     */
+    private Long productId;
+
+    /**
+     * 商品编号
+     */
+    private String productNo;
+
+    /**
+     * 商品单位
+     */
+    private String productUnit;
+
+    /**
+     * 商品图片
+     */
+    private String productImage;
+
     /**
      * 商品名称
      */

+ 1 - 1
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/bo/OrderReturnBo.java

@@ -74,7 +74,7 @@ public class OrderReturnBo extends BaseEntity {
     /**
      * 售后金额
      */
-    private Long afterSaleAmount;
+    private BigDecimal afterSaleAmount;
 
     /**
      * 退货订单状态

+ 21 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/bo/OrderReturnItemBo.java

@@ -8,6 +8,7 @@ import io.github.linpeilie.annotations.AutoMapper;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import jakarta.validation.constraints.*;
+
 import java.math.BigDecimal;
 
 /**
@@ -41,6 +42,26 @@ public class OrderReturnItemBo extends BaseEntity {
      */
     private String productSku;
 
+    /**
+     * 商品ID
+     */
+    private Long productId;
+
+    /**
+     * 商品编号
+     */
+    private String productNo;
+
+    /**
+     * 商品单位
+     */
+    private String productUnit;
+
+    /**
+     * 商品图片
+     */
+    private String productImage;
+
     /**
      * 商品名称
      */

+ 23 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/bo/PcCheckOrderBo.java

@@ -0,0 +1,23 @@
+package org.dromara.order.domain.bo;
+
+import lombok.Data;
+
+@Data
+public class PcCheckOrderBo {
+
+    /**
+     * 订单ID
+     */
+    private Long orderId;
+
+    /**
+     * 审核状态
+     */
+    private String checkStatus;
+
+    /**
+     * 审核备注
+     */
+    private String checkRemark;
+
+}

+ 5 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/vo/OrderProductVo.java

@@ -198,6 +198,11 @@ public class OrderProductVo implements Serializable {
     @ExcelProperty(value = "售后申请数量")
     private Long afterSaleQuantity;
 
+    /**
+     * 未退数量
+     */
+    private Integer availableQty;
+
     /**
      * 退款金额(元)
      */

+ 15 - 2
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/vo/OrderReturnItemVo.java

@@ -1,6 +1,7 @@
 package org.dromara.order.domain.vo;
 
 import java.math.BigDecimal;
+
 import org.dromara.order.domain.OrderReturnItem;
 import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
 import cn.idev.excel.annotation.ExcelProperty;
@@ -14,7 +15,6 @@ import java.io.Serializable;
 import java.util.Date;
 
 
-
 /**
  * 退货商品明细视图对象 order_return_item
  *
@@ -53,6 +53,20 @@ public class OrderReturnItemVo implements Serializable {
     @ExcelProperty(value = "商品SKU编码")
     private String productSku;
 
+    @ExcelProperty(value = "商品ID")
+    private Long productId;
+
+    @ExcelProperty(value = "商品编号")
+    private String productNo;
+
+    @ExcelProperty(value = "商品单位")
+    private String productUnit;
+
+    /**
+     * 商品图片
+     */
+    private String productImage;
+
     /**
      * 商品名称
      */
@@ -96,5 +110,4 @@ public class OrderReturnItemVo implements Serializable {
     @ExcelProperty(value = "备注")
     private String remark;
 
-
 }

+ 1 - 1
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/vo/OrderReturnVo.java

@@ -92,7 +92,7 @@ public class OrderReturnVo implements Serializable {
      * 售后金额
      */
     @ExcelProperty(value = "售后金额")
-    private Long afterSaleAmount;
+    private BigDecimal afterSaleAmount;
 
     /**
      * 退货订单状态

+ 2 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/mapper/OrderProductMapper.java

@@ -23,6 +23,8 @@ public interface OrderProductMapper extends BaseMapperPlus<OrderProduct, OrderPr
     /*查询订单关联的商品列表--并且查询商品已发货数量与未发货数量*/
     List<OrderProductVo> selectProductsWithDelivered(@Param("orderId") Long orderId);
 
+    List<OrderProductVo> selectProductsWithAvailableQty(@Param("orderId") Long orderId);
+
     OrderQuantitySummary selectOrderAndDeliveredQuantity(@Param("orderId") Long orderId);
 
     void updatePlatformAndStatusByOrderIds(

+ 7 - 4
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/IOrderMainService.java

@@ -1,13 +1,12 @@
 package org.dromara.order.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.order.domain.OrderMain;
-import org.dromara.order.domain.OrderProduct;
+import org.dromara.order.domain.bo.OrderMainBo;
 import org.dromara.order.domain.bo.OrderProductBo;
 import org.dromara.order.domain.vo.OrderMainVo;
-import org.dromara.order.domain.bo.OrderMainBo;
-import org.dromara.common.mybatis.core.page.TableDataInfo;
-import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.order.domain.vo.OrderProductVo;
 import org.dromara.order.domain.vo.OrderStatusStats;
 
@@ -50,6 +49,8 @@ public interface IOrderMainService extends IService<OrderMain> {
 
     TableDataInfo<OrderProductVo> getCustomerOrderProductList(Set<Long> orderIdList);
 
+    TableDataInfo<OrderProductVo> getOrderProductsWithAvailableQty(Long orderId);
+
     OrderStatusStats queryOrderStatusStats();
 
     /**
@@ -98,5 +99,7 @@ public interface IOrderMainService extends IService<OrderMain> {
      */
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
+    Boolean batchConfirmation(Set<Long> ids);
+
     Boolean closeOrderByIds(Collection<Long> ids, Boolean isValid);
 }

+ 22 - 14
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderCustomerFlowServiceImpl.java

@@ -2,6 +2,7 @@ package org.dromara.order.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import org.dromara.common.core.utils.MapstructUtils;
@@ -12,9 +13,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.extern.slf4j.Slf4j;
-import org.dromara.order.domain.OrderCustomerFlowLink;
-import org.dromara.order.domain.OrderCustomerFlowNodeLink;
+import org.dromara.order.domain.*;
 import org.dromara.order.domain.bo.OrderCustomerFlowLinkBo;
+import org.dromara.order.mapper.OrderMainMapper;
 import org.dromara.order.service.IOrderCustomerFlowLinkService;
 import org.dromara.order.service.IOrderCustomerFlowNodeLinkService;
 import org.springframework.stereotype.Service;
@@ -23,8 +24,6 @@ import org.dromara.order.domain.bo.OrderCustomerFlowSaveBo;
 import org.dromara.order.domain.bo.OrderCustomerFlowNodeBo;
 import org.dromara.order.domain.bo.OrderCustomerFlowNodeLinkBo;
 import org.dromara.order.domain.vo.OrderCustomerFlowVo;
-import org.dromara.order.domain.OrderCustomerFlow;
-import org.dromara.order.domain.OrderCustomerFlowNode;
 import org.dromara.order.domain.OrderCustomerFlowLink;
 import org.dromara.order.domain.OrderCustomerFlowNodeLink;
 import org.dromara.order.mapper.OrderCustomerFlowMapper;
@@ -45,10 +44,12 @@ import org.springframework.transaction.annotation.Transactional;
 @Slf4j
 @RequiredArgsConstructor
 @Service
-public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlowMapper, OrderCustomerFlow> implements IOrderCustomerFlowService {
+public class OrderCustomerFlowServiceImpl extends ServiceImpl<OrderCustomerFlowMapper, OrderCustomerFlow> implements IOrderCustomerFlowService {
 
     private final OrderCustomerFlowMapper baseMapper;
 
+    private final OrderMainMapper orderMainMapper;
+
     private final IOrderCustomerFlowNodeService nodeService;
 
     private final IOrderCustomerFlowLinkService linkService;
@@ -56,8 +57,6 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
     private final IOrderCustomerFlowNodeLinkService nodeLinkService;
 
 
-
-
     /**
      * 查询客户订单流程
      *
@@ -65,7 +64,7 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
      * @return 客户订单流程
      */
     @Override
-    public OrderCustomerFlowVo queryById(Long id){
+    public OrderCustomerFlowVo queryById(Long id) {
         OrderCustomerFlowVo orderCustomerFlowVo = baseMapper.selectVoById(id);
         List<OrderCustomerFlowNode> orderCustomerFlowNodes = nodeService.list(Wrappers.lambdaQuery(OrderCustomerFlowNode.class).eq(OrderCustomerFlowNode::getFlowId, orderCustomerFlowVo.getId()));
         orderCustomerFlowVo.setFlowNodes(orderCustomerFlowNodes);
@@ -143,7 +142,7 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
     /**
      * 保存前的数据校验
      */
-    private void validEntityBeforeSave(OrderCustomerFlow entity){
+    private void validEntityBeforeSave(OrderCustomerFlow entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
@@ -218,7 +217,7 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
      */
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return baseMapper.deleteByIds(ids) > 0;
@@ -244,7 +243,7 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
         List<OrderCustomerFlowNode> orderCustomerFlowNodes = nodeService.list(
             new LambdaQueryWrapper<OrderCustomerFlowNode>().eq(OrderCustomerFlowNode::getFlowId, flow.getId())
         );
-        if (ObjectUtil.isEmpty(orderCustomerFlowNodes)){
+        if (ObjectUtil.isEmpty(orderCustomerFlowNodes)) {
             return;
         }
         //
@@ -345,7 +344,6 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
         );
 
 
-
         if (ObjectUtil.isEmpty(flowNodes)) {
             throw new RuntimeException("流程节点配置异常");
         }
@@ -388,7 +386,10 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
             updateLink.setId(currentLink.getId());
             updateLink.setReviewStatus(1L); // 流程完成
 
-            linkService.updateById(updateLink);
+            boolean b = linkService.updateById(updateLink);
+            if (b) {
+                updateMainOrderStatus(orderId, updateLink.getReviewStatus().toString());
+            }
         }
     }
 
@@ -414,6 +415,13 @@ public class OrderCustomerFlowServiceImpl  extends ServiceImpl<OrderCustomerFlow
         // 比如:驳回到指定节点、重新提交等
 
         log.info("订单{}的节点{}被驳回,驳回原因:{}",
-                 currentLink.getOrderId(), currentLink.getNodeId(), bo.getReason());
+            currentLink.getOrderId(), currentLink.getNodeId(), bo.getReason());
+    }
+
+    private void updateMainOrderStatus(Long orderId, String status) {
+        LambdaUpdateWrapper<OrderMain> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.eq(OrderMain::getId, orderId)
+            .set(OrderMain::getCheckStatus, status);
+        orderMainMapper.update(null, updateWrapper);
     }
 }

+ 35 - 4
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderMainServiceImpl.java

@@ -28,10 +28,7 @@ import org.dromara.order.domain.dto.AssignmentStatsDto;
 import org.dromara.order.domain.vo.OrderMainVo;
 import org.dromara.order.domain.vo.OrderProductVo;
 import org.dromara.order.domain.vo.OrderStatusStats;
-import org.dromara.order.mapper.OrderDeliverMapper;
-import org.dromara.order.mapper.OrderDeliverProductMapper;
-import org.dromara.order.mapper.OrderMainMapper;
-import org.dromara.order.mapper.OrderProductMapper;
+import org.dromara.order.mapper.*;
 import org.dromara.order.service.IOrderMainService;
 import org.dromara.system.api.RemoteDeptService;
 import org.dromara.system.api.RemoteUserService;
@@ -74,6 +71,10 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
 
     private final OrderDeliverProductMapper orderDeliverProductMapper;
 
+    private final OrderCustomerFlowLinkMapper orderCustomerFlowLinkMapper;
+
+    private final OrderCustomerFlowNodeMapper orderCustomerFlowNodeMapper;
+
     /**
      * 查询订单主信息
      *
@@ -159,6 +160,13 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
         return TableDataInfo.build(orderProductVoList);
     }
 
+    @Override
+    public TableDataInfo<OrderProductVo> getOrderProductsWithAvailableQty(Long orderId) {
+
+        List<OrderProductVo> orderProductVoList = orderProductMapper.selectProductsWithAvailableQty(orderId);
+        return TableDataInfo.build(orderProductVoList);
+    }
+
     @Override
     public OrderStatusStats queryOrderStatusStats() {
         return baseMapper.selectOrderStatusCounts();
@@ -264,6 +272,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
 
             BigDecimal totalAmount = orderProductBos.stream().map(OrderProductBo::getSubtotal).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
 
+            Long productQuantity = orderProductBos.stream().mapToLong(OrderProductBo::getOrderQuantity).sum();
+
             // 应付总额 = 商品总价 + 运费
             BigDecimal payableAmount = totalAmount.add(bo.getShippingFee());
 
@@ -271,6 +281,8 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
             String orderNo = SequenceUtils.generateOrderCode("RS");
             bo.setOrderNo(orderNo);
 
+            bo.setProductQuantity(productQuantity);
+
             bo.setTotalAmount(totalAmount);
 
             bo.setPayableAmount(payableAmount);
@@ -617,4 +629,23 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
         int affectedRows = baseMapper.update(null, wrapper);
         return affectedRows > 0;
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean batchConfirmation(Set<Long> ids) {
+        // 2. 参数校验
+        if (CollectionUtils.isEmpty(ids)) {
+            return true;
+        }
+
+        LambdaUpdateWrapper<OrderMain> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.in(OrderMain::getId, ids)
+            .eq(OrderMain::getOrderStatus, OrderStatus.SHIPPED.getCode()) // 只有已发货的订单才能确认收货
+            .set(OrderMain::getOrderStatus, OrderStatus.COMPLETED.getCode());
+
+        // 执行更新
+        boolean updateSuccess = this.update(updateWrapper);
+
+        return updateSuccess;
+    }
 }

+ 19 - 6
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderReturnServiceImpl.java

@@ -1,16 +1,19 @@
 package org.dromara.order.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.redis.utils.SequenceUtils;
+import org.dromara.customer.api.RemoteCustomerService;
 import org.dromara.order.domain.OrderReturn;
 import org.dromara.order.domain.OrderReturnItem;
 import org.dromara.order.domain.bo.OrderReturnBo;
@@ -22,10 +25,8 @@ import org.dromara.order.service.IOrderReturnService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.math.BigDecimal;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -39,6 +40,9 @@ import java.util.stream.Collectors;
 @Service
 public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, OrderReturn> implements IOrderReturnService {
 
+    @DubboReference
+    private RemoteCustomerService remoteCustomerService;
+
     private final OrderReturnMapper baseMapper;
 
     private final OrderReturnItemMapper orderReturnItemMapper;
@@ -54,7 +58,7 @@ public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, Order
         OrderReturnVo orderReturnVo = baseMapper.selectVoById(id);
         orderReturnVo.setOrderReturnItemList(orderReturnItemMapper.selectVoList(new LambdaQueryWrapper<OrderReturnItem>()
             .eq(OrderReturnItem::getReturnId, orderReturnVo.getId())));
-        return baseMapper.selectVoById(id);
+        return orderReturnVo;
     }
 
     /**
@@ -68,6 +72,14 @@ public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, Order
     public TableDataInfo<OrderReturnVo> queryPageList(OrderReturnBo bo, PageQuery pageQuery) {
         LambdaQueryWrapper<OrderReturn> lqw = buildQueryWrapper(bo);
         Page<OrderReturnVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        List<OrderReturnVo> records = result.getRecords();
+        if (CollUtil.isNotEmpty(records)) {
+            Set<Long> customerIds = records.stream().map(OrderReturnVo::getCustomerId).collect(Collectors.toSet());
+            Map<Long, String> customerMap = remoteCustomerService.selectCustomerNameByIds(customerIds);
+            records.forEach(vo -> {
+                vo.setCustomerName(customerMap.get(vo.getCustomerId()));
+            });
+        }
         return TableDataInfo.build(result);
     }
 
@@ -146,7 +158,7 @@ public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, Order
 
         // 生成单号
         bo.setReturnNo(SequenceUtils.generateOrderCode("OR"));
-
+        bo.setReturnTime(new Date());
         // 转换并校验
         OrderReturn entity = MapstructUtils.convert(bo, OrderReturn.class);
         validEntityBeforeSave(entity);
@@ -227,6 +239,7 @@ public class OrderReturnServiceImpl extends ServiceImpl<OrderReturnMapper, Order
         List<OrderReturnItem> items = itemList.stream()
             .filter(Objects::nonNull) // 防止空元素
             .map(bo -> {
+                bo.setTotalAmount(bo.getUnitPrice().multiply(new BigDecimal(bo.getReturnQuantity())));
                 OrderReturnItem item = MapstructUtils.convert(bo, OrderReturnItem.class);
                 item.setReturnId(orderReturnId);
                 return item;

+ 11 - 9
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMainMapper.xml

@@ -37,15 +37,17 @@
         o.customer_id = #{customerId}
         AND o.order_status = '5'
         AND o.del_flag = '0'
-        <if test="evaluationStatus != null and evaluationStatus == '0'">
-            AND oe.max_type IS NULL
-        </if>
-        <if test="evaluationStatus != null and evaluationStatus == '1'">
-            AND oe.max_type = 1
-        </if>
-        <if test="evaluationStatus != null and evaluationStatus == '2'">
-            AND oe.max_type = 2
-        </if>
+        <choose>
+            <when test="evaluationStatus != null and evaluationStatus == '0'">
+                AND oe.max_type IS NULL
+            </when>
+            <when test="evaluationStatus != null and evaluationStatus == '1'">
+                AND oe.max_type = 1
+            </when>
+            <when test="evaluationStatus != null and evaluationStatus == '2'">
+                AND oe.max_type = 2
+            </when>
+        </choose>
         ORDER BY o.order_time DESC
     </select>
 </mapper>

+ 56 - 1
ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderProductMapper.xml

@@ -79,7 +79,7 @@
         FROM order_product
         WHERE order_id = #{orderId}
           AND assignment_status != '1'
-      AND del_flag = '0'
+       AND del_flag = '0'
     </select>
 
     <select id="getAssignmentStats" resultType="org.dromara.order.domain.dto.AssignmentStatsDto">
@@ -116,4 +116,59 @@
         AND del_flag = '0'
     </select>
 
+    <select id="selectProductsWithAvailableQty" resultType="org.dromara.order.domain.vo.OrderProductVo">
+        SELECT
+        op.id,
+        op.order_id AS orderId,
+        op.order_no AS orderNo,
+        op.shipment_no AS shipmentNo,
+        op.product_id AS productId,
+        op.product_no AS productNo,
+        op.product_name AS productName,
+        op.product_unit AS productUnit,
+        op.product_image AS productImage,
+        op.platform_price AS platformPrice,
+        op.min_order_quantity AS minOrderQuantity,
+        op.order_price AS orderPrice,
+        op.order_quantity AS orderQuantity,
+        op.subtotal AS subtotal,
+        op.min_selling_price AS minSellingPrice,
+        op.signed_quantity AS signedQuantity,
+
+        op.is_after_sale AS isAfterSale,
+        op.after_sale_quantity AS afterSaleQuantity,
+        op.return_amount AS returnAmount,
+        op.pre_delivery_date AS preDeliveryDate,
+        op.assignment_status AS assignmentStatus,
+        op.status AS status,
+        op.del_flag AS delFlag,
+        op.remark AS remark,
+
+        <!-- 【核心修正】计算未退数量 (availableQty) -->
+        <!-- 逻辑:订购数量 - (有效退货单中的退货数量之和) -->
+        GREATEST(
+        0,
+        COALESCE(op.order_quantity, 0) - COALESCE(SUM(ori.return_quantity), 0)
+        ) AS availableQty
+
+        FROM order_product op
+
+        <!-- 【核心修正】关联退货明细 -->
+        LEFT JOIN order_return_item ori ON ori.order_product_id = op.id
+        AND ori.del_flag = '0'  <!-- 过滤已删除的明细 -->
+        <!-- 【关键】只关联状态有效的退货单 (排除已取消、已拒绝) -->
+        AND ori.return_id IN (
+        SELECT orm.id
+        FROM order_return orm
+        WHERE orm.order_id = op.order_id
+        AND orm.del_flag = '0'
+        AND orm.return_status NOT IN ('2','4')
+        )
+
+        WHERE op.order_id = #{orderId}
+        AND op.del_flag = '0'
+
+        GROUP BY op.id
+        ORDER BY op.id
+    </select>
 </mapper>

+ 27 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/pc/PcOrderReturnReasonController.java

@@ -0,0 +1,27 @@
+package org.dromara.system.controller.pc;
+
+import lombok.RequiredArgsConstructor;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.web.core.BaseController;
+import org.dromara.system.domain.bo.OrderReturnReasonBo;
+import org.dromara.system.domain.vo.OrderReturnReasonVo;
+import org.dromara.system.service.IOrderReturnReasonService;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/pcOrderReturnReason")
+public class PcOrderReturnReasonController extends BaseController {
+
+    private final IOrderReturnReasonService orderReturnReasonService;
+
+    @GetMapping("/list")
+    public TableDataInfo<OrderReturnReasonVo> list(PageQuery pageQuery) {
+        return orderReturnReasonService.queryPageList(new OrderReturnReasonBo(), pageQuery);
+    }
+}