From 558bcfeefa8cf76f37ab4c7005237ee42b87633f Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 7 May 2025 08:45:04 +0800 Subject: [PATCH 01/31] fixed add users phone index --- db/migrate/202505071325549_add_user_index_phone.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/202505071325549_add_user_index_phone.rb diff --git a/db/migrate/202505071325549_add_user_index_phone.rb b/db/migrate/202505071325549_add_user_index_phone.rb new file mode 100644 index 000000000..5ccae98b8 --- /dev/null +++ b/db/migrate/202505071325549_add_user_index_phone.rb @@ -0,0 +1,5 @@ +class AddUserIndexPhone < ActiveRecord::Migration[5.2] + def change + add_index :users, :phone + end +end From 5c916bc4e8eebe30c04b5af321a4d84ea282bc19 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 9 May 2025 09:38:57 +0800 Subject: [PATCH 02/31] =?UTF-8?q?fixed=20settings=20=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/laboratory_helper.rb | 12 +--- app/controllers/settings_controller.rb | 3 +- app/views/settings/show.json.jbuilder | 55 +++++-------------- 3 files changed, 15 insertions(+), 55 deletions(-) diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index ea6e00558..4744929e0 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -32,18 +32,8 @@ module LaboratoryHelper end def default_course_links - # my_projects: "/users/#{current_user.try(:login)}/projects", - # my_projects: "https://www.trustie.net/users/#{current_user.try(:login)}/user_projectlist", { - new_syllabuses: "https://www.trustie.net/syllabuses/new", - new_course: "https://www.trustie.net/courses/new", - edit_account: "https://www.trustie.net/my/account", - my_courses: "https://www.trustie.net/users/#{current_user.try(:login)}/user_courselist", - my_projects: "/users/#{current_user.try(:login)}/projects", - my_organ: "https://www.trustie.net/users/#{current_user.try(:login)}/user_organizations", - default_url: Rails.application.config_for(:configuration)['platform_url'], - tiding_url: "https://www.trustie.net/users/#{current_user.try(:login)}/user_messages", - register_url: "https://www.trustie.net/login?login=false" + default_url: Rails.application.config_for(:configuration)['platform_url'] } end end diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index c95ad0bcd..1facea1c4 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -1,13 +1,12 @@ class SettingsController < ApplicationController def show - @old_projects_url = nil get_navbar site_page_deploy_domain get_add_menu get_common_menu get_sub_competitions get_personal_menu - get_third_party + # get_third_party get_third_party_new get_top_system_notification end diff --git a/app/views/settings/show.json.jbuilder b/app/views/settings/show.json.jbuilder index 2b622f678..0aa0d4326 100644 --- a/app/views/settings/show.json.jbuilder +++ b/app/views/settings/show.json.jbuilder @@ -1,33 +1,4 @@ json.setting do - # if @laboratory.present? - # setting = @laboratory.laboratory_setting - # json.name setting.name || default_setting.name - # json.nav_logo_url (setting.nav_logo_url || default_setting.nav_logo_url)&.[](1..-1) - # json.login_logo_url (setting.login_logo_url || default_setting.login_logo_url)&.[](1..-1) - # json.tab_logo_url (setting.tab_logo_url || default_setting.tab_logo_url)&.[](1..-1) - # - # json.subject_banner_url (setting.subject_banner_url || default_setting.subject_banner_url)&.[](1..-1) - # json.course_banner_url (setting.course_banner_url || default_setting.course_banner_url)&.[](1..-1) - # json.competition_banner_url (setting.competition_banner_url || default_setting.competition_banner_url)&.[](1..-1) - # json.moop_cases_banner_url (setting.moop_cases_banner_url || default_setting.moop_cases_banner_url)&.[](1..-1) - # json.oj_banner_url (setting.oj_banner_url || default_setting.oj_banner_url)&.[](1..-1) - # - # json.navbar setting.navbar || default_setting.navbar - # - # json.footer setting.footer || default_setting.footer - # - # end - - # nav_bar = default_setting.navbar - - # if User.current.logged? - # nav_bar[2]["link"] = "https://forgeplus.trustie.net/users/#{current_user.login}/projects" - # nav_bar[2]["hidden"] = false - # else - # nav_bar[2]["link"] = "" - # nav_bar[2]["hidden"] = true - # end - json.name default_setting.name json.nav_logo_url default_setting.nav_logo_url&.[](1..-1) json.login_logo_url default_setting.login_logo_url&.[](1..-1) @@ -35,18 +6,18 @@ json.setting do json.site_page_deploy_domain @deploy_domain json.subject_banner_url default_setting.subject_banner_url&.[](1..-1) - json.course_banner_url default_setting.course_banner_url&.[](1..-1) + # json.course_banner_url default_setting.course_banner_url&.[](1..-1) json.competition_banner_url EduSetting.get("competition_banner_url").to_s json.competition_banner_href EduSetting.get("competition_banner_href").to_s - json.moop_cases_banner_url default_setting.moop_cases_banner_url&.[](1..-1) - json.oj_banner_url default_setting.oj_banner_url&.[](1..-1) + # json.moop_cases_banner_url default_setting.moop_cases_banner_url&.[](1..-1) + # json.oj_banner_url default_setting.oj_banner_url&.[](1..-1) json.navbar @navbar json.footer default_setting.footer json.main_site current_laboratory.main_site? - json.new_course default_course_links + # json.new_course default_course_links json.is_local EduSetting.get("is_local") == "true" json.add do @@ -62,15 +33,15 @@ json.setting do end json.common @common - json.third_party @third_party + # json.third_party @third_party json.third_party_new @third_party_new - if @top_system_notification.present? - json.system_notification do - json.(@top_system_notification, :id, :subject, :sub_subject, :content) - json.is_read @top_system_notification.read_member?(current_user&.id) - end - else - json.system_notification nil - end + # if @top_system_notification.present? + # json.system_notification do + # json.(@top_system_notification, :id, :subject, :sub_subject, :content) + # json.is_read @top_system_notification.read_member?(current_user&.id) + # end + # else + # json.system_notification nil + # end end From 56212f453664d5cea88ca6e3a8066373a4c8e34e Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 9 May 2025 09:44:40 +0800 Subject: [PATCH 03/31] =?UTF-8?q?fixed=20settings=20=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/settings/show.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/settings/show.json.jbuilder b/app/views/settings/show.json.jbuilder index 0aa0d4326..1701103da 100644 --- a/app/views/settings/show.json.jbuilder +++ b/app/views/settings/show.json.jbuilder @@ -17,7 +17,7 @@ json.setting do json.footer default_setting.footer json.main_site current_laboratory.main_site? - # json.new_course default_course_links + json.new_course default_course_links json.is_local EduSetting.get("is_local") == "true" json.add do From ab576fdba531124a8f5e0dc54b03aadd76008b16 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 12 May 2025 16:00:23 +0800 Subject: [PATCH 04/31] =?UTF-8?q?fixed=20readme=E8=B7=AF=E5=BE=84=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/repositories_helper.rb | 4 +++- app/models/commit_log.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 24eb7c5bb..3ad563e0e 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -161,6 +161,7 @@ module RepositoriesHelper s_content = s_content.starts_with?("/") ? s_content[1..-1] : s_content[0..-1] s_content = File.expand_path(s_content, file_path) s_content = s_content.split("#{Rails.root}/")[1] + next if s_content.blank? # content = content.gsub(s[0], "/#{s_content}") join_xxx = s_content.include?("?") ? "&" : "?" s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}#{join_xxx}ref=#{ref}"].join @@ -190,6 +191,7 @@ module RepositoriesHelper path = [owner&.login, repo&.identifier, 'tree', ref, file_path].join("/") s_content = File.expand_path(s_content, path) s_content = s_content.split("#{Rails.root}")[1] + next if s_content.blank? case k.to_s when 'ss_src' content = content.gsub("src=\"#{s[0]}\"", "src=\"/#{s_content}\"") @@ -202,7 +204,7 @@ module RepositoriesHelper when 'ss_href_1' content = content.gsub("href=\'#{s[0]}\'", "href=\'#{s_content}\'") else - content = content.gsub("(#{s[0]})", "(/#{s_content})") + content = content.gsub("(#{s[0]})", "(#{s_content})") end end rescue diff --git a/app/models/commit_log.rb b/app/models/commit_log.rb index d351e6f48..5f9b6c3f8 100644 --- a/app/models/commit_log.rb +++ b/app/models/commit_log.rb @@ -24,7 +24,7 @@ class CommitLog < ApplicationRecord belongs_to :user belongs_to :project - belongs_to :repository + # belongs_to :repository has_many :project_trends, as: :trend, dependent: :destroy From 79863995d69c312de07859b61052b3fc4a8576fc Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 15 May 2025 14:06:22 +0800 Subject: [PATCH 05/31] =?UTF-8?q?fixed=20issue=E7=8A=B6=E6=80=81=E5=B7=B2?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=A2=9E=E5=8A=A0=E4=BF=A1=E6=81=AF=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/issues_controller.rb | 1 + app/services/api/pm/issues/update_service.rb | 10 ++++++++-- app/views/api/pm/issues/journals/_detail.json.jbuilder | 1 + db/migrate/202505152345541_add_journal_detail_msg.rb | 5 +++++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 db/migrate/202505152345541_add_journal_detail_msg.rb diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index 49cb5295c..d8c849d53 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -327,6 +327,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController :branch_name, :start_date, :due_date, :time_scale, :subject, :description, :blockchain_token_num, :root_subject, :pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id, :project_id, + :status_msg, issue_tag_ids: [], assigner_ids: [], attachment_ids: [], diff --git a/app/services/api/pm/issues/update_service.rb b/app/services/api/pm/issues/update_service.rb index 2f1816446..1c5487f91 100644 --- a/app/services/api/pm/issues/update_service.rb +++ b/app/services/api/pm/issues/update_service.rb @@ -4,7 +4,7 @@ class Api::Pm::Issues::UpdateService < ApplicationService include Api::V1::Issues::Concerns::Loadable attr_reader :project, :issue, :current_user, :operate_by - attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num + attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num,:status_msg attr_reader :target_pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :time_scale attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :before_issue_tag_ids, :before_assigner_ids, :project_id attr_accessor :add_assigner_ids, :previous_issue_changes, :updated_issue, :atme_receivers @@ -18,6 +18,7 @@ class Api::Pm::Issues::UpdateService < ApplicationService @current_user = current_user @operate_by = operate_by @status_id = params[:status_id] + @status_msg = params[:status_msg] @priority_id = params[:priority_id] @milestone_id = params[:milestone_id] @branch_name = params[:branch_name] @@ -201,7 +202,12 @@ class Api::Pm::Issues::UpdateService < ApplicationService # 修改状态 if @updated_issue.previous_changes["status_id"].present? journal = @updated_issue.journals.create!({user_id: current_user.id, operate_by: @operate_by}) - journal.journal_details.create!({property: @updated_issue.pm_issue_type_string, prop_key: "status_id", old_value: @updated_issue.previous_changes["status_id"][0], value: @updated_issue.previous_changes["status_id"][1]}) + journal.journal_details.create!({property: @updated_issue.pm_issue_type_string, + prop_key: "status_id", + old_value: @updated_issue.previous_changes["status_id"][0], + value: @updated_issue.previous_changes["status_id"][1]}, + status_msg: @status_msg + ) end # 修改优先级 diff --git a/app/views/api/pm/issues/journals/_detail.json.jbuilder b/app/views/api/pm/issues/journals/_detail.json.jbuilder index fdf4bc716..876a1a921 100644 --- a/app/views/api/pm/issues/journals/_detail.json.jbuilder +++ b/app/views/api/pm/issues/journals/_detail.json.jbuilder @@ -13,6 +13,7 @@ if journal.is_journal_detail? detail = journal.journal_details.take json.operate_category journal.pm_operate_category json.operate_content journal.is_journal_detail? ? journal.pm_operate_content : nil + json.status_msg detail.status_msg else json.notes journal.notes json.comments_count journal.comments_count diff --git a/db/migrate/202505152345541_add_journal_detail_msg.rb b/db/migrate/202505152345541_add_journal_detail_msg.rb new file mode 100644 index 000000000..69172aec9 --- /dev/null +++ b/db/migrate/202505152345541_add_journal_detail_msg.rb @@ -0,0 +1,5 @@ +class AddJournalDetailMsg < ActiveRecord::Migration[5.2] + def change + add_column :journal_details, :status_msg, :string + end +end From 6ca55f0f61723ac2303ea204b6fc2f41c31104a5 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 15 May 2025 18:13:29 +0800 Subject: [PATCH 06/31] =?UTF-8?q?fixed=20issue=E7=8A=B6=E6=80=81=E5=B7=B2?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=A2=9E=E5=8A=A0=E4=BF=A1=E6=81=AF=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/pm/issues/update_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/api/pm/issues/update_service.rb b/app/services/api/pm/issues/update_service.rb index 1c5487f91..a678cc788 100644 --- a/app/services/api/pm/issues/update_service.rb +++ b/app/services/api/pm/issues/update_service.rb @@ -204,9 +204,9 @@ class Api::Pm::Issues::UpdateService < ApplicationService journal = @updated_issue.journals.create!({user_id: current_user.id, operate_by: @operate_by}) journal.journal_details.create!({property: @updated_issue.pm_issue_type_string, prop_key: "status_id", + status_msg: @status_msg, old_value: @updated_issue.previous_changes["status_id"][0], - value: @updated_issue.previous_changes["status_id"][1]}, - status_msg: @status_msg + value: @updated_issue.previous_changes["status_id"][1]} ) end From 70089d06cc022ec85ac77420122fe15550fcf5a0 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 19 May 2025 20:28:09 +0800 Subject: [PATCH 07/31] =?UTF-8?q?fixed=20=E5=88=A0=E9=99=A4user=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E6=96=B9=E6=B3=95=E4=B8=8D=E8=83=BD=E6=94=BE=E5=9C=A8?= =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/users/delete_user_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/v1/users/delete_user_service.rb b/app/services/api/v1/users/delete_user_service.rb index 12775eac3..f5d93f88d 100644 --- a/app/services/api/v1/users/delete_user_service.rb +++ b/app/services/api/v1/users/delete_user_service.rb @@ -23,8 +23,8 @@ class Api::V1::Users::DeleteUserService < ApplicationService end @user.destroy! del_user_data_by_sql(@user.id) - Gitea::User::DeleteService.call(@user.login, true) end + Gitea::User::DeleteService.call(@user.login, true) return true rescue raise Error, "服务器错误,请联系系统管理员!" From 870eacacedfb4c2d95c95560dc6d3a5430158cfa Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 21 May 2025 09:33:00 +0800 Subject: [PATCH 08/31] =?UTF-8?q?fixed=20issue=E5=A2=9E=E5=8A=A0=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/issues_controller.rb | 9 +++++- app/models/issue.rb | 32 +++++++++++++++++++ app/services/api/pm/issues/create_service.rb | 4 ++- .../202505216348545_add_issue_enterprise.rb | 7 ++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 db/migrate/202505216348545_add_issue_enterprise.rb diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index d8c849d53..b143405d2 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -289,6 +289,13 @@ class Api::Pm::IssuesController < Api::Pm::BaseController render_not_found('疑修不存在!') if @issue.blank? end + # def load_issue_by_index + # return render_parameter_missing if params[:pm_project_id].blank? || params[:pm_issue_type].blank? || params[:enterprise_identifier].blank? + # @issue = Issue.find_issues_by_pm(params[:enterprise_identifier], params[:pm_issue_type]) + # .find_by(pm_issue_type_index3: params[:index]) + # render_not_found('疑修不存在!') if @issue.blank? + # end + def load_issues return render_error('请输入正确的ID数组!') unless params[:ids].is_a?(Array) params[:ids].each do |id| @@ -327,7 +334,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController :branch_name, :start_date, :due_date, :time_scale, :subject, :description, :blockchain_token_num, :root_subject, :pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id, :project_id, - :status_msg, + :status_msg, :enterprise_identifier, issue_tag_ids: [], assigner_ids: [], attachment_ids: [], diff --git a/app/models/issue.rb b/app/models/issue.rb index c28c49bb1..e6d5a5e4d 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -298,6 +298,38 @@ class Issue < ApplicationRecord self.project.decrement!(:closed_issues_count) if self.status_id == 5 && self.project.present? end + # def self.find_issues_by_pm(enterprise_identifier, pm_issue_type) + # case pm_issue_type.to_i + # when 1 + # Issue.issue_issue.where(enterprise_identifier: enterprise_identifier) + # .where(pm_issue_type: pm_issue_type) + # .where(pm_issue_type_index1: index) + # when 2 + # Issue.issue_issue.where(enterprise_identifier: enterprise_identifier) + # .where(pm_issue_type: pm_issue_type) + # .where(pm_issue_type_index2: index) + # when 3 + # Issue.issue_issue.where(enterprise_identifier: enterprise_identifier) + # .where(pm_issue_type: pm_issue_type) + # .where(pm_issue_type_index3: index) + # end + # end + # + # def self.build_pm_index(enterprise_identifier, pm_issue_type) + # last_issue = Issue.find_issues_by_pm(enterprise_identifier, pm_issue_type).order("pm_issue_type_index#{pm_issue_type.to_i} asc").last + # deleted_issue_count = ($redis_cache.hget("pm_issue_cache_delete_count", enterprise_identifier) || 0).to_i + # + # last_issue.send("pm_issue_type_index#{pm_issue_type.to_i}").present? ? last_issue.send("pm_issue_type_index#{pm_issue_type.to_i}") + deleted_issue_count : 0 + # end + # + # def incre_pm_issue_cache_delete_count(count=1) + # $redis_cache.hincrby("pm_issue_cache_delete_count", self.enterprise_identifier, count) + # end + # + # def del_pm_issue_cache_delete_count + # $redis_cache.hdel("pm_issue_cache_delete_count", self.enterprise_identifier) + # end + def send_update_message_to_notice_system SendTemplateMessageJob.perform_later('IssueExpire', self.id) if Site.has_notice_menu? && self.due_date == Date.today + 1.days end diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index 5412fe17d..f527f6302 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -5,7 +5,7 @@ class Api::Pm::Issues::CreateService < ApplicationService attr_reader :project, :current_user attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num, :root_subject - attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login + attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :enterprise_identifier, :pm_issue_type attr_accessor :created_issue validates :subject, presence: true @@ -36,6 +36,7 @@ class Api::Pm::Issues::CreateService < ApplicationService @time_scale = params[:time_scale] @linkable_id = params[:link_able_id] @root_subject = params[:root_subject] + @enterprise_identifier = params[:enterprise_identifier] end def call @@ -74,6 +75,7 @@ class Api::Pm::Issues::CreateService < ApplicationService @created_issue.attachments = @attachments unless attachment_ids.blank? @created_issue.issue_tags = @issue_tags unless issue_tag_ids.blank? @created_issue.pm_project_id = @pm_project_id + @created_issue.enterprise_identifier = @enterprise_identifier @created_issue.pm_sprint_id = @pm_sprint_id @created_issue.time_scale = @time_scale @created_issue.issue_tags_value = @issue_tags.order('id asc').pluck(:id).join(',') unless issue_tag_ids.blank? diff --git a/db/migrate/202505216348545_add_issue_enterprise.rb b/db/migrate/202505216348545_add_issue_enterprise.rb new file mode 100644 index 000000000..f3de9635f --- /dev/null +++ b/db/migrate/202505216348545_add_issue_enterprise.rb @@ -0,0 +1,7 @@ +class AddIssueEnterprise < ActiveRecord::Migration[5.2] + def change + add_column :issues, :enterprise_identifier, :string + add_index :issues, :enterprise_identifier + end + +end From 330ab008a88bd188c3beac328e7a88dbd61ebfb0 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 21 May 2025 09:54:58 +0800 Subject: [PATCH 09/31] =?UTF-8?q?fixed=20memos=E8=A1=A8=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/users/delete_user_service.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/services/api/v1/users/delete_user_service.rb b/app/services/api/v1/users/delete_user_service.rb index f5d93f88d..9f6cb4a7f 100644 --- a/app/services/api/v1/users/delete_user_service.rb +++ b/app/services/api/v1/users/delete_user_service.rb @@ -32,7 +32,11 @@ class Api::V1::Users::DeleteUserService < ApplicationService end def del_user_data_by_sql(user_id) - sql1 = "delete from memos where author_id=#{user_id}" - ActiveRecord::Base.connection.execute(sql1) + if ActiveRecord::Base.connection.table_exists?("memos") + sql1 = "delete from memos where author_id=#{user_id}" + ActiveRecord::Base.connection.execute(sql1) + else + Rails.logger.info "memos table does not exist" + end end end \ No newline at end of file From 1af19175792089967bc6485f32ec218742518372 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 21 May 2025 16:14:08 +0800 Subject: [PATCH 10/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=94=9F=E6=88=90=E5=91=A8=E6=8A=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/pm/weekly_issues_controller.rb | 47 +++++++++++++++++++ .../pm/weekly_issues/personal.json.jbuilder | 16 +++++++ config/routes/api.rb | 6 +++ 3 files changed, 69 insertions(+) create mode 100644 app/controllers/api/pm/weekly_issues_controller.rb create mode 100644 app/views/api/pm/weekly_issues/personal.json.jbuilder diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb new file mode 100644 index 000000000..e31869fbf --- /dev/null +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -0,0 +1,47 @@ +class Api::Pm::WeeklyIssuesController < ApplicationController + + def personal + @enterprise_identifier = params[:enterprise_identifier] || '' + @all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) + @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') + @next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s) + @next_week_all_issues = @next_week_all_issues.order('created_on desc') + @this_week_requirement_issues = @this_week_all_issues.where(pm_issue_type: 1) + @this_week_task_issues = @this_week_all_issues.where(pm_issue_type: 2) + @this_week_bug_issues = @this_week_all_issues.where(pm_issue_type: 3) + @close_requirement_issues = @this_week_requirement_issues.where(status_id: [3,5]) + @close_task_issues = @this_week_task_issues.where(status_id: [3,5]) + @close_bug_issues = @this_week_bug_issues.where(status_id: [3,5]) + end + + def group + @enterprise_identifier = params[:enterprise_identifier] || '' + @all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) + @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_group_count = @this_week_all_issues.group(:pm_project_id).count + data = {} + @this_week_all_issues_group_count.keys.each do |pm_project_id| + this_project_id_requirements = @this_week_all_issues.where(pm_project_id: pm_project_id, pm_issue_type: 1) + this_project_id_tasks = @this_week_all_issues.where(pm_project_id: pm_project_id, pm_issue_type: 2) + this_project_id_bugs = @this_week_all_issues.where(pm_project_id: pm_project_id, pm_issue_type: 3) + this_project_id_close_requirements = this_project_id_requirements.where(status_id: [3,5]) + this_project_id_close_tasks = this_project_id_tasks.where(status_id: [3,5]) + this_project_id_close_bugs = this_project_id_bugs.where(status_id: [3,5]) + data[pm_project_id] = { + this_week_requirement_issues_count: this_project_id_requirements.count, + this_week_task_issues_count: this_project_id_tasks.count, + this_week_bug_issues_count: this_project_id_bugs.count, + close_requirement_issues_count: this_project_id_close_requirements.count, + close_task_issues_count: this_project_id_close_tasks.count, + close_bug_issues_count: this_project_id_close_bugs.count, + this_week_task_issues: this_project_id_tasks + } + + + end + + render :json => data + end + +end \ No newline at end of file diff --git a/app/views/api/pm/weekly_issues/personal.json.jbuilder b/app/views/api/pm/weekly_issues/personal.json.jbuilder new file mode 100644 index 000000000..6b3d532aa --- /dev/null +++ b/app/views/api/pm/weekly_issues/personal.json.jbuilder @@ -0,0 +1,16 @@ +json.this_week_all_issues @this_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.next_week_all_issues @next_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.this_week_requirement_issues_count @this_week_requirement_issues.count +json.this_week_task_issues_count @this_week_task_issues.count +json.this_week_bug_issues_count @this_week_bug_issues.count +json.close_requirement_issues_count @close_requirement_issues.count +json.close_task_issues_count @close_task_issues.count +json.close_bug_issues_count @close_bug_issues.count +json.unclose_count @this_week_all_issues.count - @close_requirement_issues.count - @close_task_issues.count - @close_bug_issues.count +json.close_task_issues @close_task_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 be80bac3f..e63473624 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -1,6 +1,12 @@ defaults format: :json do namespace :api do namespace :pm do + resources :weekly_issues, only: [:index] do + collection do + get :personal + get :group + end + end resources :dashboards,only: [:index] do collection do get :todo From 1c325f412f22f0ca69401e7332951bcb4930b5cb Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 22 May 2025 08:48:44 +0800 Subject: [PATCH 11/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/weekly_issues_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index e31869fbf..da71a8f7d 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -2,7 +2,9 @@ class Api::Pm::WeeklyIssuesController < ApplicationController def personal @enterprise_identifier = params[:enterprise_identifier] || '' - @all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) + return render_error('请输入正确的用户ID.') if params[:user_id].blank? + @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) + @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) @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') @next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s) @@ -18,6 +20,7 @@ class Api::Pm::WeeklyIssuesController < ApplicationController def group @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? @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_group_count = @this_week_all_issues.group(:pm_project_id).count data = {} From bf32f58813e9531cd88758f80c077ee4e7113b35 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 22 May 2025 09:35:14 +0800 Subject: [PATCH 12/31] =?UTF-8?q?fixed=20=E4=B8=AA=E4=BA=BA=E6=89=80?= =?UTF-8?q?=E6=9C=89=E9=A1=B9=E7=9B=AE=E5=8C=85=E5=90=AB=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/queries/projects/list_my_query.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/queries/projects/list_my_query.rb b/app/queries/projects/list_my_query.rb index 32a9ee787..43dfad5e1 100644 --- a/app/queries/projects/list_my_query.rb +++ b/app/queries/projects/list_my_query.rb @@ -20,7 +20,8 @@ class Projects::ListMyQuery < ApplicationQuery if params[:category].blank? normal_projects = projects.members_projects(user.id).to_sql org_projects = projects.joins(team_projects: [team: :team_users]).where(team_users: {user_id: user.id}).to_sql - projects = Project.from("( #{ normal_projects} UNION #{ org_projects } ) AS projects")#.distinct + watched_projects = projects.where.not(user_id: user.id).joins(:watchers).where(watchers: {watchable_type: "Project", user_id: user.id}).to_sql + projects = Project.from("( #{ normal_projects} UNION #{ org_projects } UNION #{ watched_projects } ) AS projects")#.distinct elsif params[:category].to_s == "join" normal_projects = projects.where.not(user_id: user.id).members_projects(user.id).to_sql org_projects = projects.joins(team_projects: [team: :team_users]).where(team_users: {user_id: user.id}).to_sql From 3fe528359e4ebaaa2a1e9fec53cfd41e9dfd26e5 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 22 May 2025 10:50:49 +0800 Subject: [PATCH 13/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=AE=BE=E7=BD=AE=E7=BB=93=E6=9D=9F=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/update_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/v1/issues/update_service.rb b/app/services/api/v1/issues/update_service.rb index d92513ec5..98c50b224 100644 --- a/app/services/api/v1/issues/update_service.rb +++ b/app/services/api/v1/issues/update_service.rb @@ -92,7 +92,7 @@ class Api::V1::Issues::UpdateService < ApplicationService @updated_issue.project_id = @project_id unless @project_id.nil? @updated_issue.updated_on = Time.now @updated_issue.changer_id = @current_user.id - @updated_issue.due_date = Time.now if @due_date.blank? + # @updated_issue.due_date = Time.now if @due_date.blank? @updated_issue.save! build_after_issue_journal_details if @updated_issue.previous_changes.present? # 操作记录 From 6574ee5270213b5db9de0b56d9747e7790d85f21 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 22 May 2025 13:52:03 +0800 Subject: [PATCH 14/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9Aissue=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E4=BC=81=E4=B8=9A=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E7=A7=BB=E9=99=A4pm=5Fproject=5Fid=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/base_controller.rb | 2 +- app/controllers/api/pm/issues_controller.rb | 2 +- app/services/api/v1/issues/list_service.rb | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/pm/base_controller.rb b/app/controllers/api/pm/base_controller.rb index f9754f33d..e3d744364 100644 --- a/app/controllers/api/pm/base_controller.rb +++ b/app/controllers/api/pm/base_controller.rb @@ -30,7 +30,7 @@ class Api::Pm::BaseController < ApplicationController end def load_issue - return render_parameter_missing if params[:pm_project_id].blank? + # return render_parameter_missing if params[:pm_project_id].blank? @issue = Issue.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:issue_id]) render_not_found('疑修不存在!') if @issue.blank? end diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index b143405d2..5bb18991a 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -322,7 +322,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController :update_begin_date, :update_end_date, :sort_by, :sort_direction, :root_id, :issue_tag_ids, :pm_project_id, :pm_sprint_id, :pm_issue_type, :pm_project_ids, - :status_ids, :ids, :exclude_ids, :pm_issue_types, :participator_id + :status_ids, :ids, :exclude_ids, :pm_issue_types, :participator_id, :enterprise_identifier ) end diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index a86b6d875..1dcde236f 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -3,7 +3,7 @@ class Api::V1::Issues::ListService < ApplicationService attr_reader :project, :only_name, :category, :participant_category, :keyword, :author_id, :issue_tag_ids attr_reader :begin_date, :end_date, :update_begin_date, :update_end_date - attr_reader :milestone_id, :assigner_id, :status_id, :priority_id, :sort_by, :sort_direction, :current_user + attr_reader :milestone_id, :assigner_id, :status_id, :priority_id, :sort_by, :sort_direction, :current_user, :enterprise_identifier attr_reader :pm_project_id, :pm_project_ids, :pm_sprint_id, :root_id, :pm_issue_type, :status_ids, :ids, :exclude_ids, :pm_issue_types attr_accessor :queried_issues, :total_issues_count, :closed_issues_count, :opened_issues_count, :complete_issues_count, :participator @@ -30,6 +30,7 @@ class Api::V1::Issues::ListService < ApplicationService @update_begin_date = params[:update_begin_date] @update_end_date = params[:update_end_date] @sort_by = params[:sort_by].present? ? params[:sort_by] : 'issues.updated_on' + @enterprise_identifier = params[:enterprise_identifier] @pm_project_id = params[:pm_project_id] @pm_project_ids = params[:pm_project_ids] @pm_sprint_id = params[:pm_sprint_id] @@ -96,6 +97,7 @@ class Api::V1::Issues::ListService < ApplicationService end end + issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? #pm相关 # root_id# -1 查一级目录 issues = if root_id.to_i == -1 From bf3540c2507d9474aa60cae30cfa50fe8145bee9 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 22 May 2025 13:59:39 +0800 Subject: [PATCH 15/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=91=A8=E6=8A=A5=E7=88=B6=E5=91=A8=E6=8A=A5=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E4=BC=81=E4=B8=9A=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/pm/issues/create_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index f527f6302..caaee3892 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -58,9 +58,9 @@ class Api::Pm::Issues::CreateService < ApplicationService @created_issue = Issue.new(issue_attributes) @created_issue.pm_issue_type = @pm_issue_type if @root_subject.present? && @pm_issue_type.to_i == 4 - @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id) + @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) unless @root_issue.present? - @root_issue = Issue.create(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) + @root_issue = Issue.create(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) end @created_issue.root_id = @root_issue.id else From 78c5458bb854d0c6daeb9346b8a33acc4222ae79 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 22 May 2025 14:11:09 +0800 Subject: [PATCH 16/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/issues_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index 5bb18991a..50d75fc15 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -284,7 +284,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController end def load_issue - return render_parameter_missing if params[:pm_project_id].blank? + # return render_parameter_missing if params[:pm_project_id].blank? @issue = Issue.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:id]) render_not_found('疑修不存在!') if @issue.blank? end From ce5d5a88ba7debf1d51769e0a4981bc89a94ca00 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 22 May 2025 14:13:50 +0800 Subject: [PATCH 17/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=96=91?= =?UTF-8?q?=E4=BF=AE=E4=B8=8D=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/base_controller.rb | 2 +- app/controllers/api/pm/issues_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/pm/base_controller.rb b/app/controllers/api/pm/base_controller.rb index e3d744364..e0ebd1aca 100644 --- a/app/controllers/api/pm/base_controller.rb +++ b/app/controllers/api/pm/base_controller.rb @@ -31,7 +31,7 @@ class Api::Pm::BaseController < ApplicationController def load_issue # return render_parameter_missing if params[:pm_project_id].blank? - @issue = Issue.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:issue_id]) + @issue = Issue.issue_issue.find_by_id(params[:issue_id]) render_not_found('疑修不存在!') if @issue.blank? end # 具有对仓库的管理权限 diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index 50d75fc15..eef8015e0 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -285,7 +285,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController def load_issue # return render_parameter_missing if params[:pm_project_id].blank? - @issue = Issue.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:id]) + @issue = Issue.issue_issue.find_by_id(params[:id]) render_not_found('疑修不存在!') if @issue.blank? end From 298aec58860b37aa7d9b84ef4031a573e802aa7c Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 22 May 2025 15:32:38 +0800 Subject: [PATCH 18/31] =?UTF-8?q?fixed=20issue=E5=85=B3=E9=97=AD=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=88=B0=E6=9C=9F=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/update_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/v1/issues/update_service.rb b/app/services/api/v1/issues/update_service.rb index d92513ec5..dbdebf932 100644 --- a/app/services/api/v1/issues/update_service.rb +++ b/app/services/api/v1/issues/update_service.rb @@ -92,7 +92,7 @@ class Api::V1::Issues::UpdateService < ApplicationService @updated_issue.project_id = @project_id unless @project_id.nil? @updated_issue.updated_on = Time.now @updated_issue.changer_id = @current_user.id - @updated_issue.due_date = Time.now if @due_date.blank? + @updated_issue.due_date = Time.now if @updated_issue.status_id == 5 && @due_date.blank? @updated_issue.save! build_after_issue_journal_details if @updated_issue.previous_changes.present? # 操作记录 From d91b7da82cc019494ab023363e019a1f18229192 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 23 May 2025 10:20:16 +0800 Subject: [PATCH 19/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=BB=84=E6=9C=AC=E5=91=A8=E5=B7=A5=E4=BD=9C=E9=A1=B9?= =?UTF-8?q?=E6=8E=A5=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 From afc87f1393e2d851bea37224ccfe43fd4b717621 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 09:08:29 +0800 Subject: [PATCH 20/31] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E5=91=A8=E6=8A=A5=E6=96=B0=E5=A2=9E=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E9=A1=B9=E7=9B=AE=E7=BB=84=E5=91=A8=E6=8A=A5?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=92=8C=E4=B8=AA=E4=BA=BA=E5=91=A8=E6=8A=A5?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/weekly_issues_controller.rb | 8 +++++++- app/services/api/pm/issues/create_service.rb | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index 261c6218d..4ef402b79 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -1,4 +1,4 @@ -class Api::Pm::WeeklyIssuesController < ApplicationController +class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController def personal @enterprise_identifier = params[:enterprise_identifier] || '' @@ -15,6 +15,12 @@ class Api::Pm::WeeklyIssuesController < ApplicationController @close_requirement_issues = @this_week_requirement_issues.where(status_id: [3,5]) @close_task_issues = @this_week_task_issues.where(status_id: [3,5]) @close_bug_issues = @this_week_bug_issues.where(status_id: [3,5]) + this_week_page = params[:this_week_page] || 1 + this_week_limit = params[:this_week_limit] || 15 + @this_week_all_issues = @this_week_all_issues.page(this_week_page).per(this_week_limit) + next_week_page = params[:next_week_page] || 1 + next_week_limit = params[:next_week_limit] || 15 + @next_week_all_issues = @next_week_all_issues.page(next_week_page).per(next_week_limit) end def group diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index caaee3892..ac0e33c0a 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -57,10 +57,10 @@ class Api::Pm::Issues::CreateService < ApplicationService try_lock("Api::Pm::Issues::CreateService:#{project.id}") # 开始写数据,加锁 @created_issue = Issue.new(issue_attributes) @created_issue.pm_issue_type = @pm_issue_type - if @root_subject.present? && @pm_issue_type.to_i == 4 - @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) + if @root_subject.present? && [4, 5].include?(@pm_issue_type.to_i) + @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) unless @root_issue.present? - @root_issue = Issue.create(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) + @root_issue = Issue.create(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) end @created_issue.root_id = @root_issue.id else From 97ed99f0042f7ba213e053d759fc0ed55b641275 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 14:02:08 +0800 Subject: [PATCH 21/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/api/pm/weekly_issues/personal.json.jbuilder | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/api/pm/weekly_issues/personal.json.jbuilder b/app/views/api/pm/weekly_issues/personal.json.jbuilder index 6b3d532aa..475dc19ad 100644 --- a/app/views/api/pm/weekly_issues/personal.json.jbuilder +++ b/app/views/api/pm/weekly_issues/personal.json.jbuilder @@ -1,9 +1,11 @@ json.this_week_all_issues @this_week_all_issues.each do |issue| json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} end +json.this_week_total_count @this_week_all_issues.total_count json.next_week_all_issues @next_week_all_issues.each do |issue| json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} end +json.next_week_all_issues @next_week_all_issues.total_count json.this_week_requirement_issues_count @this_week_requirement_issues.count json.this_week_task_issues_count @this_week_task_issues.count json.this_week_bug_issues_count @this_week_bug_issues.count From 66e7959434e3c53f7651b40c3627a162653956d4 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 14:18:37 +0800 Subject: [PATCH 22/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/api/pm/weekly_issues/personal.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/api/pm/weekly_issues/personal.json.jbuilder b/app/views/api/pm/weekly_issues/personal.json.jbuilder index 475dc19ad..f468445e0 100644 --- a/app/views/api/pm/weekly_issues/personal.json.jbuilder +++ b/app/views/api/pm/weekly_issues/personal.json.jbuilder @@ -5,7 +5,7 @@ json.this_week_total_count @this_week_all_issues.total_count json.next_week_all_issues @next_week_all_issues.each do |issue| json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} end -json.next_week_all_issues @next_week_all_issues.total_count +json.next_week_total_count @next_week_all_issues.total_count json.this_week_requirement_issues_count @this_week_requirement_issues.count json.this_week_task_issues_count @this_week_task_issues.count json.this_week_bug_issues_count @this_week_bug_issues.count From c967684b3cb1d4efb1577011fb0e8bbc19830d67 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 15:00:48 +0800 Subject: [PATCH 23/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=8E=BB?= =?UTF-8?q?=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/weekly_issues_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index 4ef402b79..dad170780 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -5,9 +5,9 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController return render_error('请输入正确的用户ID.') if params[:user_id].blank? @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) - @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 = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s).distinct @this_week_all_issues = @this_week_all_issues.order('created_on desc') - @next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s) + @next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s).distinct @next_week_all_issues = @next_week_all_issues.order('created_on desc') @this_week_requirement_issues = @this_week_all_issues.where(pm_issue_type: 1) @this_week_task_issues = @this_week_all_issues.where(pm_issue_type: 2) From 63ff4306d44451dbb28441e442add7c4cfd24337 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 15:40:28 +0800 Subject: [PATCH 24/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=88=B6=E5=91=A8=E6=8A=A5=E6=97=B6=E5=90=88=E5=B9=B6?= =?UTF-8?q?issue=5Ftype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/pm/issues/create_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index ac0e33c0a..20c5a1219 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -58,9 +58,9 @@ class Api::Pm::Issues::CreateService < ApplicationService @created_issue = Issue.new(issue_attributes) @created_issue.pm_issue_type = @pm_issue_type if @root_subject.present? && [4, 5].include?(@pm_issue_type.to_i) - @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) + @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) unless @root_issue.present? - @root_issue = Issue.create(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) + @root_issue = Issue.create(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) end @created_issue.root_id = @root_issue.id else From fcedae86cb34f46d8db1c710b7b80b42b2322a57 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 17:05:13 +0800 Subject: [PATCH 25/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9Apersonal=5Fiss?= =?UTF-8?q?ues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/pm/weekly_issues_controller.rb | 20 +++++++++++++++++-- config/routes/api.rb | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index dad170780..8f7b0b8b6 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -62,5 +62,21 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController @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 + def personal_issues + @enterprise_identifier = params[:enterprise_identifier] || '' + return render_error('请输入正确的用户ID.') if params[:user_id].blank? + @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) + @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) + @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).distinct + @this_week_all_issues = @this_week_all_issues.order('created_on desc') + @next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s).distinct + @next_week_all_issues = @next_week_all_issues.order('created_on desc') + this_week_page = params[:this_week_page] || 1 + this_week_limit = params[:this_week_limit] || 15 + @this_week_all_issues = @this_week_all_issues.page(this_week_page).per(this_week_limit) + next_week_page = params[:next_week_page] || 1 + next_week_limit = params[:next_week_limit] || 15 + @next_week_all_issues = @next_week_all_issues.page(next_week_page).per(next_week_limit) + end +end + diff --git a/config/routes/api.rb b/config/routes/api.rb index 25f3b0ad8..09cc2f065 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -6,6 +6,7 @@ defaults format: :json do get :personal get :group get :group_issues + get :personal_issues end end resources :dashboards,only: [:index] do From a3e156005f254bd22b7144d890207073176b0d5d Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 26 May 2025 17:07:44 +0800 Subject: [PATCH 26/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2json=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/pm/weekly_issues/personal_issues.json.jbuilder | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 app/views/api/pm/weekly_issues/personal_issues.json.jbuilder diff --git a/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder b/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder new file mode 100644 index 000000000..0e0006226 --- /dev/null +++ b/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder @@ -0,0 +1,8 @@ +json.this_week_all_issues @this_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.this_week_total_count @this_week_all_issues.total_count +json.next_week_all_issues @next_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.next_week_total_count @next_week_all_issues.total_count \ No newline at end of file From a5cf0ce14e122aa9080bd08064b84a4eac4c00de Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 11:22:56 +0800 Subject: [PATCH 27/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Aissue=5Ftype?= =?UTF-8?q?=E4=B8=BAnil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/pm/issues/create_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index 20c5a1219..3003869ea 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -60,7 +60,7 @@ class Api::Pm::Issues::CreateService < ApplicationService if @root_subject.present? && [4, 5].include?(@pm_issue_type.to_i) @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier) unless @root_issue.present? - @root_issue = Issue.create(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) + @root_issue = Issue.create(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id) end @created_issue.root_id = @root_issue.id else From bff009d67394d491da2e9e2053f5d21dabed3fcf Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 11:35:39 +0800 Subject: [PATCH 28/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=80=9A=E8=BF=87=E4=BC=81=E4=B8=9A=E6=A0=87=E8=AF=86?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=91=A8=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/list_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 6f9be57c0..8075f06f1 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -97,8 +97,8 @@ class Api::V1::Issues::ListService < ApplicationService end end - issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && [4,5].include?(pm_issue_type.to_i) - + issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && ([4,5].include?(pm_issue_type.to_i) || pm_issue_types.present?) + #pm相关 # root_id# -1 查一级目录 issues = if root_id.to_i == -1 From 3038f3bfb9b08fb40eb213cc31c6bc1676398ad5 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 14:45:00 +0800 Subject: [PATCH 29/31] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E5=B1=95?= =?UTF-8?q?=E7=A4=BAissue=E4=BB=85=E5=8C=85=E6=8B=AC=E6=88=91=E8=B4=9F?= =?UTF-8?q?=E8=B4=A3=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/pm/weekly_issues_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index 8f7b0b8b6..dac4d65d3 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -3,7 +3,7 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController def personal @enterprise_identifier = params[:enterprise_identifier] || '' return render_error('请输入正确的用户ID.') if params[:user_id].blank? - @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) + @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']}) @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) @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).distinct @this_week_all_issues = @this_week_all_issues.order('created_on desc') @@ -65,7 +65,7 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController def personal_issues @enterprise_identifier = params[:enterprise_identifier] || '' return render_error('请输入正确的用户ID.') if params[:user_id].blank? - @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['authored', 'assigned']}) + @all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']}) @all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3]) @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).distinct @this_week_all_issues = @this_week_all_issues.order('created_on desc') From a3f3d3ec18d48261c4e068aa766608e820c2f120 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 16:16:51 +0800 Subject: [PATCH 30/31] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=80=BB=E6=95=B0=E4=B8=8D=E8=AE=A1=E5=85=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=BB=84=E5=91=A8=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/api/v1/issues/_simple_detail.json.jbuilder | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/api/v1/issues/_simple_detail.json.jbuilder b/app/views/api/v1/issues/_simple_detail.json.jbuilder index 2c05acf7f..e361d136b 100644 --- a/app/views/api/v1/issues/_simple_detail.json.jbuilder +++ b/app/views/api/v1/issues/_simple_detail.json.jbuilder @@ -30,7 +30,11 @@ json.pm_issue_type issue.pm_issue_type json.pm_sprint_id issue.pm_sprint_id json.pm_project_id issue.pm_project_id json.time_scale issue.time_scale -json.child_count issue.child_count +if params[:pm_issue_types].present? + json.child_count issue.children_issues.where(pm_issue_type: 4).count +else + json.child_count issue.child_count +end json.author do json.partial! "api/v1/users/simple_user", locals: {user: issue.user} From c57482042dde3aae2b7e123987a183a2f18cb995 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 27 May 2025 16:57:36 +0800 Subject: [PATCH 31/31] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=97=B6=E9=97=B4=E4=B8=8D=E5=9C=A8=E8=8C=83=E5=9B=B4?= =?UTF-8?q?=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/list_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 8075f06f1..0ceac0ee4 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -151,7 +151,7 @@ class Api::V1::Issues::ListService < ApplicationService end if update_begin_date&.present? || update_end_date&.present? - issues = issues.where('issues.updated_on between ? and ?', update_begin_date&.present? ? update_begin_date.to_time : Time.now.beginning_of_day, update_end_date&.present? ? update_end_date.to_time.end_of_day : Time.now.end_of_day) + issues = issues.where('issues.updated_on between ? and ?', update_begin_date&.present? ? update_begin_date.to_time.beginning_of_week : Time.now.beginning_of_week, update_end_date&.present? ? update_end_date.to_time.end_of_week : Time.now.end_of_week) end # keyword