6个文件已修改
122 ■■■■■ 已修改文件
src/main/java/com/webmanage/controller/OrderController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/webmanage/mapper/OrderInfoMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/webmanage/service/OrderInfoService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/webmanage/service/impl/OrderInfoServiceImpl.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/OrderInfoMapper.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/webmanage/controller/OrderController.java
@@ -157,6 +157,17 @@
        }
    }
    @PostMapping("/approval/page/with-product-conditions")
    @ApiOperation("分页查询待审批订单列表(支持产品条件)")
    public Result<Object> getPendingApprovalOrderPageWithProductConditions(@Valid @RequestBody OrderQueryDTO queryDTO) {
        try {
            return Result.success(orderInfoService.getPendingApprovalOrderPageWithProductConditions(queryDTO));
        } catch (Exception e) {
            log.error("查询待审批订单列表失败", e);
            return Result.error("查询待审批订单列表失败:" + e.getMessage());
        }
    }
    @GetMapping("/detail/{orderId}")
    @ApiOperation("获取订单详情")
    public Result<OrderDetailVO> getOrderDetail(
src/main/java/com/webmanage/mapper/OrderInfoMapper.java
@@ -45,6 +45,15 @@
                                                   @Param("orderDirection") String orderDirection);
    /**
     * 分页查询待审批订单列表(支持产品条件)
     */
    IPage<OrderInfo> selectPendingApprovalOrderPageWithProductConditions(Page<OrderInfo> page, @Param("orderStatus") String orderStatus,
                                                   @Param("productName") String productName, @Param("providerName") String providerName,
                                                   @Param("orderId") String orderId, @Param("applyTimeStart") String applyTimeStart,
                                                   @Param("applyTimeEnd") String applyTimeEnd, @Param("orderBy") String orderBy,
                                                   @Param("orderDirection") String orderDirection, @Param("productIds") java.util.List<String> productIds);
    /**
     * 分页查询买家订单列表(支持产品条件)
     */
    IPage<OrderInfo> selectBuyerOrderPageWithProductConditions(Page<OrderInfo> page, @Param("userId") String userId,
src/main/java/com/webmanage/service/OrderInfoService.java
@@ -41,6 +41,11 @@
    PageResult<OrderInfo> getPendingApprovalOrderPage(OrderQueryDTO queryDTO);
    /**
     * 分页查询待审批订单列表(支持产品条件)
     */
    PageResult<OrderInfo> getPendingApprovalOrderPageWithProductConditions(OrderQueryDTO queryDTO);
    /**
     * 获取订单详情
     */
    OrderDetailVO getOrderDetail(String orderId);
src/main/java/com/webmanage/service/impl/OrderInfoServiceImpl.java
@@ -186,6 +186,51 @@
    }
    @Override
    public PageResult<OrderInfo> getPendingApprovalOrderPageWithProductConditions(OrderQueryDTO queryDTO) {
        // 根据产品条件查询产品ID列表
        List<String> productIds = null;
        if (StringUtils.hasText(queryDTO.getIndustryId()) || StringUtils.hasText(queryDTO.getUnitProjectId()) ||
            StringUtils.hasText(queryDTO.getProductTypeId()) || StringUtils.hasText(queryDTO.getProductSubTypeId())) {
            productIds = reportResultSubmissionMapper.selectProductIdsByConditions(
                queryDTO.getIndustryId(), queryDTO.getUnitProjectId(),
                queryDTO.getProductTypeId(), queryDTO.getProductSubTypeId()
            );
            // 如果没有找到匹配的产品,直接返回空结果
            if (CollectionUtils.isEmpty(productIds)) {
                return new PageResult<OrderInfo>(
                    java.util.Collections.emptyList(),
                    0L,
                    queryDTO.getPageNum().longValue(),
                    queryDTO.getPageSize().longValue(),
                    0L
                );
            }
        }
        // 创建分页对象
        Page<OrderInfo> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize());
        // 执行分页查询
        IPage<OrderInfo> result = baseMapper.selectPendingApprovalOrderPageWithProductConditions(
            page, queryDTO.getOrderStatus(), queryDTO.getProductName(), queryDTO.getProviderName(),
            queryDTO.getOrderId(),
            queryDTO.getApplyTimeStart() != null ? queryDTO.getApplyTimeStart().toString() : null,
            queryDTO.getApplyTimeEnd() != null ? queryDTO.getApplyTimeEnd().toString() : null,
            queryDTO.getOrderBy(), queryDTO.getOrderDirection(), productIds
        );
        // 构建返回结果
        return new PageResult<OrderInfo>(
            result.getRecords(),
            result.getTotal(),
            queryDTO.getPageNum().longValue(),
            queryDTO.getPageSize().longValue(),
            result.getPages()
        );
    }
    @Override
    public PageResult<OrderDetailVO> getBuyerOrderPageWithProductConditions(OrderQueryDTO queryDTO) {
        // 参数校验
        if (queryDTO.getUserId() == null) {
src/main/resources/application-dev.yml
@@ -5,7 +5,7 @@
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://localhost:5432/web_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
    username: postgres
    password: postgres
    password: zkyxpostgres
    druid:
      # 初始连接数
      initial-size: 5
src/main/resources/mapper/OrderInfoMapper.xml
@@ -190,6 +190,56 @@
        </choose>
    </select>
    <!-- 分页查询待审批订单列表(支持产品条件) -->
    <select id="selectPendingApprovalOrderPageWithProductConditions" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM tb_order_info
        WHERE deleted = 0
        AND order_status IN ('待上传文件', '待授权', '待交易确认', '已完成', '已评价')
        <if test="orderStatus != null and orderStatus != ''">
            AND order_status = #{orderStatus}
        </if>
        <if test="productName != null and productName != ''">
            AND product_name LIKE CONCAT('%', #{productName}, '%')
        </if>
        <if test="providerName != null and providerName != ''">
            AND provider_name LIKE CONCAT('%', #{providerName}, '%')
        </if>
        <if test="orderId != null and orderId != ''">
            AND order_id LIKE CONCAT('%', #{orderId}, '%')
        </if>
        <if test="applyTimeStart != null and applyTimeStart != ''">
            AND apply_time >= #{applyTimeStart}::timestamp
        </if>
        <if test="applyTimeEnd != null and applyTimeEnd != ''">
            AND apply_time &lt;= #{applyTimeEnd}::timestamp
        </if>
        <if test="productIds != null and productIds.size() > 0">
            AND product_id IN
            <foreach collection="productIds" item="productId" open="(" separator="," close=")">
                #{productId}
            </foreach>
        </if>
        ORDER BY
        <choose>
            <when test="orderBy != null and orderBy != ''">
                ${orderBy}
            </when>
            <otherwise>
                created_at
            </otherwise>
        </choose>
        <choose>
            <when test="orderDirection != null and orderDirection == 'asc'">
                ASC
            </when>
            <otherwise>
                DESC
            </otherwise>
        </choose>
    </select>
    <!-- 分页查询买家订单列表(支持产品条件) -->
    <select id="selectBuyerOrderPageWithProductConditions" resultMap="BaseResultMap">
        SELECT