Sha256: 420e4943f5ce01a03681668f38634e051cbe1c1653e31b089e051b8d5148079b
Contents?: true
Size: 1.75 KB
Versions: 61
Compression:
Stored size: 1.75 KB
Contents
x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id json.data do json.array! @customers do |d| business_ids = EducodeSales::Business.where(school_id: d.id).ids follow_ups = EducodeSales::FollowUp.where(business_id: business_ids) customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id) a_last_follow_time = follow_ups.last&.created_at&.to_s b_last_follow_time = customer_follows.last&.created_at&.to_s if a_last_follow_time.present? && b_last_follow_time.present? json.last_follow_time a_last_follow_time < b_last_follow_time ? b_last_follow_time : a_last_follow_time else json.last_follow_time a_last_follow_time || b_last_follow_time end json.id d.id json.name d.name json.area d.province school_property = d.school_property property = [] if school_property.present? property << '985工程' if school_property.project_985 property << '211工程' if school_property.project_211 property << '本科院校' if school_property.regular_college property << '大专院校' if school_property.junior_college property << '中专学校' if school_property.secondary_school property << '军事院校' if school_property.military_school property << '企业' if school_property.enterprise end json.property property.join("、") json.department d.departments.size json.business EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_businesses.school_id = ?", d.id).size json.follow follow_ups.size + customer_follows.size json.staff EducodeSales::CustomerExtension.find_by(school_id: d.id)&.customer_staff&.user&.real_name end end json.code 0 json.count @customers.total_count
Version data entries
61 entries across 61 versions & 1 rubygems