From d91b7da82cc019494ab023363e019a1f18229192 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 23 May 2025 10:20:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=84=E6=9C=AC=E5=91=A8=E5=B7=A5=E4=BD=9C=E9=A1=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/weekly_issues_controller.rb | 10 ++++++++++ app/services/api/v1/issues/list_service.rb | 3 ++- .../api/pm/weekly_issues/group_issues.json.jbuilder | 4 ++++ config/routes/api.rb | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 app/views/api/pm/weekly_issues/group_issues.json.jbuilder diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index da71a8f7d..261c6218d 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -47,4 +47,14 @@ class Api::Pm::WeeklyIssuesController < ApplicationController render :json => data end + def group_issues + @enterprise_identifier = params[:enterprise_identifier] || '' + @all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) + @all_issues = @all_issues.where(pm_project_id: params[:pm_project_ids].split(",")) if params[:pm_project_ids].present? + @all_issues = @all_issues.where(pm_issue_type: params[:pm_issue_type].to_i) if params[:pm_issue_type].present? + @this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s) + @this_week_all_issues = @this_week_all_issues.order('created_on desc') + @this_week_all_issues = kaminari_paginate(@this_week_all_issues) + end + end \ No newline at end of file diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 1dcde236f..6f9be57c0 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -97,7 +97,8 @@ class Api::V1::Issues::ListService < ApplicationService end end - issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? + issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && [4,5].include?(pm_issue_type.to_i) + #pm相关 # root_id# -1 查一级目录 issues = if root_id.to_i == -1 diff --git a/app/views/api/pm/weekly_issues/group_issues.json.jbuilder b/app/views/api/pm/weekly_issues/group_issues.json.jbuilder new file mode 100644 index 000000000..b6c2a55b9 --- /dev/null +++ b/app/views/api/pm/weekly_issues/group_issues.json.jbuilder @@ -0,0 +1,4 @@ +json.total_count @this_week_all_issues.total_count +json.issues @this_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end \ No newline at end of file diff --git a/config/routes/api.rb b/config/routes/api.rb index e63473624..25f3b0ad8 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -5,6 +5,7 @@ defaults format: :json do collection do get :personal get :group + get :group_issues end end resources :dashboards,only: [:index] do