不需要产品经理分流版

来源:互联网 发布:php发送qq邮件源码 编辑:程序博客网 时间:2024/04/28 10:10
 def project_workflow_21
  sleep 2
  result ={}
  options={:expand => "transitions"}
  issue = @jira_client.Issue.find(params["issue.key"], options) #获得所有的jira字段信息
  project_type = issue.attrs["fields"]["issuetype"]["id"] #获取问题类型
  copy_data=issue.attrs["fields"]["customfield_10118"]
  copy_data_total=[]
  options_user=issue.attrs["fields"]["reporter"]["name"]+"&expand=groups"
  user=@jira_client.User.find(options_user)
  departments_arr= user.groups["items"]
  is_customer = false
  departments_arr.each do |u|
    if u["name"]=="市场部" or u["name"]=="客服部" or u["name"]=="客服部-400" or u["name"]=="客服部-2楼" or u["name"]=="客服审核组"
      is_customer=true
    end
  end
  if copy_data.to_s!=""
    copy_data.each do |u|
      tmp_hash = Hash.new
      tmp_hash["name"]=u["name"]
      tmp_hash["key"]=u["key"]
      copy_data_total<<tmp_hash
    end
  end
  if (is_customer and project_type=="10623") #客服提的问题类型为:国内(10623)、海外萤石云(10624)时,经办人设置为陈兴旺,判断判断客户端类型是否选择了“安卓客户端”、“IOS客户端”,若是抄送给邓世华
    transition_data = {"name" => "chenxingwang", "key" => "chenxingwang"}
    issue.theurl=issue.url + "/assignee"
    issue.set_http_method="put"
    logger.info("[project_workflow_21] :  " +"经办人设置成功"+ issue.save(transition_data).to_s)
  else
    issue = @jira_client.Issue.find(params["issue.key"], options)
    issue.transitions.each do |transition|
      logger.info('[project_workflow_21]   :'+transition.to_s)
      if transition.attrs["name"] == "是问题"
        transition_data = {
            :transition => transition.attrs,
            "fields" => {"customfield_11332" => {"name" => issue.attrs["fields"]["assignee"]["name"], "key" => issue.attrs["fields"]["assignee"]["key"]}}
        }
        transition.save(transition_data)
      end
    end
  end
  if issue.attrs["fields"]["customfield_11078"].to_s.include? "安卓客户端" or issue.attrs["fields"]["customfield_11078"].to_s.include? "IOS客户端"
    copy_data_new_dengshihua=[{"name" => "dengshihua", "key" => "dengshihua"}]
    copy_data_total= copy_data_total|copy_data_new_dengshihua
  end
  if project_type=="10623" or project_type=="10624"
    copy_data_new_zhangxin=[{"name" => "zhangxinyf2", "key" => "zhangxinyf2"}]
    copy_data_total= copy_data_total|copy_data_new_zhangxin
    copy_data = {
        "fields" => {
            "customfield_10118" => copy_data_total
        }
    }
    logger.info('[project_workflow_21]   :'+"抄送给"+issue.save(copy_data).to_s)
  end
  logger.info('[project_workflow_21]   :'+"函数结束")
  result['msg'] = 'project_workflow_21 return success!'
  render :text => result.to_json, :layout => false
end
0 0