educode_sales 0.9.96 → 0.9.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63f1a9066c14a86f9c577ae32986fe5f6887b9a24eff3ceb84eee0bd1f35e645
4
- data.tar.gz: 8caaf272560cd43c59c86747910f4f398ee49be736f0b0b00190636d13ddf6b2
3
+ metadata.gz: 312c157ed210ab8e0ada99a141e3ba4565e87d164cfa03efb3448b90227a113e
4
+ data.tar.gz: afd966def27af48056c7ece566a3fc6b87f47430ccbe848785d0d44303edbea8
5
5
  SHA512:
6
- metadata.gz: 48235ecc3dbdec34879a9c4e07bcf0ec2c7e9673308e7ff32f878efda9c88305b405d8c3f38848565e5e5a53e8f97d8579fe229c9dd943f15574b3c57f97f477
7
- data.tar.gz: dc623573607a70e5ade7dfc55aa4e7f1c18f73d9170d04741ada0c6e2f7e27187978587a3ee068a3a9a2946855082fb680c48e30c8914824fcb0d4617685b189
6
+ metadata.gz: 9d88c0be318d3a494a792722ec2cc820f05d4ed9354a81da2e969f57194eebec448b779518f3911c5d4c102902f2cf995edfc2c0fb0781b69d360b460d4e22ff
7
+ data.tar.gz: 02f8787c4223c8e6950f7d7b8cc1f30ab914ed110bd2fb4186f56601b81e6d44ca0b5be4a7b05253a4de6d590d06a97a2c5d7a5f2a75c7abb3fb503188058d80
@@ -173,7 +173,7 @@ module EducodeSales
173
173
  def sales_analysis
174
174
  respond_to do |format|
175
175
  format.html do
176
-
176
+
177
177
  end
178
178
  format.js do
179
179
  x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
@@ -455,8 +455,8 @@ module EducodeSales
455
455
  format.js do
456
456
  user_stat = EducodeSales::UserStatService.new
457
457
  gon.table_1 = user_stat.table_1
458
- gon.table_2 = user_stat.table_2(0)
459
- gon.table_3 = user_stat.table_2(1)
458
+ gon.table_2 = user_stat.table_2(1)
459
+ gon.table_3 = user_stat.table_2(0)
460
460
  end
461
461
  end
462
462
  end
@@ -511,7 +511,7 @@ module EducodeSales
511
511
  if params[:property].present?
512
512
  # 客户类型
513
513
  business = business.joins(department: [school: :school_tags]).where("school_tags.id = ?", params[:property])
514
- end
514
+ end
515
515
 
516
516
  data_1 = business.
517
517
  where("educode_sales_follow_ups.clazz_id != ?", x).
@@ -12,23 +12,23 @@ module EducodeSales
12
12
 
13
13
  def table_1
14
14
  # 公有云
15
- user_years_1 = year_users(1)
15
+ user_years_1 = public_user
16
16
  # 私有云
17
- user_years_2 = year_users(2)
18
- school_years_1 = school_users(1)
19
- school_years_2 = school_users(2)
20
- department_years_1 = department_users(1)
21
- department_years_2 = department_users(2)
17
+ user_years_2 = {} #year_users(2)
18
+ school_years_1 = public_school
19
+ school_years_2 = {}# school_users(2)
20
+ department_years_1 = public_department
21
+ department_years_2 = {} #department_users(2)
22
22
 
23
23
  years = {}
24
24
  (2018..Time.current.year).each do |d|
25
25
  years[d] = {
26
26
  'year' => d,
27
- 'user_1' => user_years_1[d.to_s] || 0,
27
+ 'user_1' => (user_years_1[d.to_s] || 0) + (years[d-1] && years[d-1]['user_1']).to_i,
28
28
  'user_2' => user_years_2[d.to_s] || 0,
29
- 'school_1' => school_years_1[d.to_s] || 0,
29
+ 'school_1' => (school_years_1[d.to_s] || 0) + (years[d-1] && years[d-1]['school_1']).to_i,
30
30
  'school_2' => school_years_2[d.to_s] || 0,
31
- 'department_1' => department_years_1[d.to_s] || 0,
31
+ 'department_1' => (department_years_1[d.to_s] || 0) + (years[d-1] && years[d-1]['department_1']).to_i,
32
32
  'department_2' => department_years_2[d.to_s] || 0
33
33
  }
34
34
  end
@@ -94,7 +94,7 @@ module EducodeSales
94
94
  signed_users['10000-49999'][1] += 1
95
95
  end
96
96
  end
97
-
97
+
98
98
 
99
99
  ['1-9', '10-99', '100-999', '1000-9999', '10000-49999'].map do |d|
100
100
  {
@@ -109,10 +109,30 @@ module EducodeSales
109
109
  end
110
110
  end
111
111
 
112
+
113
+ def public_user
114
+ UserExtension.where(school_id: @school_ids).
115
+ group("DATE_FORMAT(user_extensions.created_at, '%Y')").
116
+ select("count(*) as count, DATE_FORMAT(user_extensions.created_at, '%Y') as year").count("*")
117
+ end
118
+
119
+ def public_school
120
+ School.where(id: @school_ids).
121
+ group("DATE_FORMAT(schools.created_at, '%Y')").
122
+ select("count(*) as count, DATE_FORMAT(schools.created_at, '%Y') as year").count("*")
123
+ end
124
+
125
+ def public_department
126
+ Department.where(school_id: @school_ids).
127
+ group("DATE_FORMAT(departments.created_at, '%Y')").
128
+ select("count(*) as count, DATE_FORMAT(departments.created_at, '%Y') as year").count("*")
129
+ end
130
+
112
131
  def year_users(clazz)
113
132
  EducodeSales::Business.joins(:last_follow_up).
114
133
  joins("join user_extensions ON user_extensions.department_id = educode_sales_businesses.department_id").
115
134
  where("educode_sales_follow_ups.o_business_deployment = #{clazz}").
135
+ where(school_id: @school_ids).
116
136
  group("DATE_FORMAT(user_extensions.created_at, '%Y')").
117
137
  select("count(*) as count, DATE_FORMAT(user_extensions.created_at, '%Y') as year").
118
138
  distinct.count("user_extensions.id")
@@ -122,6 +142,7 @@ module EducodeSales
122
142
  EducodeSales::Business.joins(:last_follow_up).
123
143
  joins("join schools ON schools.id = educode_sales_businesses.school_id").
124
144
  where("educode_sales_follow_ups.o_business_deployment = #{clazz}").
145
+ where(school_id: @school_ids).
125
146
  group("DATE_FORMAT(schools.created_at, '%Y')").
126
147
  select("count(*) as count, DATE_FORMAT(schools.created_at, '%Y') as year").
127
148
  distinct.count("school_id")
@@ -131,6 +152,7 @@ module EducodeSales
131
152
  EducodeSales::Business.joins(:last_follow_up).
132
153
  joins("join departments ON departments.id = educode_sales_businesses.department_id").
133
154
  where("educode_sales_follow_ups.o_business_deployment = #{clazz}").
155
+ where(school_id: @school_ids).
134
156
  group("DATE_FORMAT(departments.created_at, '%Y')").
135
157
  select("count(*) as count, DATE_FORMAT(departments.created_at, '%Y') as year").
136
158
  distinct.count("school_id")
@@ -57,7 +57,7 @@
57
57
  <%= select_tag "business_year", options_for_select((2015..Time.now.year).to_a.reverse, params[:business_year]), { include_blank: true } %>
58
58
  </div>
59
59
  </div>
60
-
60
+
61
61
  <div class="layui-inline show_item_contract" style="<%= params[:name] || params[:type] ? '' : 'display:none;' %>">
62
62
  <label class="layui-form-label">中标时间</label>
63
63
  <div class="layui-input-inline">
@@ -349,6 +349,12 @@
349
349
  title: '部署类型',
350
350
  sort: true,
351
351
  },
352
+ {
353
+ field: 'p_deploy_time',
354
+ width: 150,
355
+ title: '部署时间',
356
+ sort: true,
357
+ },
352
358
  {
353
359
  field: 'budget_amount',
354
360
  width: 105,
@@ -25,7 +25,7 @@ json.data do
25
25
  json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
26
26
  json.created_at d.created_at.to_s
27
27
  json.no_followup_days (d['latest_time'] ? DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d['latest_time'].strftime("%Y-%m-%d")) : DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d.created_at.strftime("%Y-%m-%d"))).to_i
28
-
28
+
29
29
  json.staff_manages d.last_follow_up&.assign_follow_ups.present? ? (d.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.staff&.user&.real_name
30
30
  json.divide_rate d.divide_rate
31
31
  json.divide_money d.divide_amount.to_f.round(2)
@@ -3,10 +3,10 @@
3
3
  <div class="" style="padding-right: 50px">
4
4
  <table class="layui-hide" id="table_7_year"></table>
5
5
  </div>
6
- <div class="" style="padding-right: 50px">
6
+ <div class="" style="padding-right: 50px;margin-top:30px;">
7
7
  <table class="layui-hide" id="table_7_school"></table>
8
8
  </div>
9
- <div class="" style="padding-right: 50px">
9
+ <div class="" style="padding-right: 50px;margin-top:30px;">
10
10
  <table class="layui-hide" id="table_7_signed"></table>
11
11
  </div>
12
12
  </div>
@@ -24,13 +24,18 @@
24
24
  title: '年份',
25
25
  align: 'center',
26
26
  width: 150,
27
- rowspan: 2
28
- }
27
+ rowspan: 2,
28
+ totalRowText:'合计',
29
+ }
29
30
  , {
30
31
  title: '公有云',
31
32
  align: 'center',
32
33
  width: 220,
33
34
  colspan: 3
35
+ }, {
36
+ align: 'center',
37
+ title: '混合云',
38
+ colspan: 3
34
39
  }, {
35
40
  align: 'center',
36
41
  title: '私有云',
@@ -41,40 +46,66 @@
41
46
  field: 'user_1',
42
47
  title: '用户数',
43
48
  align: 'center',
44
- width: 150
49
+ width: 110,
50
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
45
51
  }, {
46
52
  field: 'school_1',
47
53
  title: '学校数',
48
54
  align: 'center',
49
- width: 150
55
+ width: 110,
56
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
50
57
  }, {
51
58
  field: 'department_1',
52
59
  title: '学院数',
53
60
  align: 'center',
54
- width: 150
61
+ width: 110,
62
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
55
63
  },{
56
64
  field: 'user_2',
57
65
  title: '用户数',
58
66
  align: 'center',
59
- width: 150
67
+ width: 110,
68
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
60
69
  }, {
61
70
  field: 'school_2',
62
71
  title: '学校数',
63
72
  align: 'center',
64
- width: 150
73
+ width: 110,
74
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
65
75
  }, {
66
76
  field: 'department_2',
67
77
  align: 'center',
68
78
  title: '学院数',
69
- width: 150
79
+ width: 110,
80
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
81
+ },{
82
+ field: 'user_2',
83
+ title: '用户数',
84
+ align: 'center',
85
+ width: 110,
86
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
87
+ }, {
88
+ field: 'school_2',
89
+ title: '学校数',
90
+ align: 'center',
91
+ width: 110,
92
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
93
+ }, {
94
+ field: 'department_2',
95
+ align: 'center',
96
+ title: '学院数',
97
+ width: 110,
98
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
70
99
  }]
71
100
  ],
72
101
  data: gon.table_1,
102
+ totalRow: true,
73
103
  page: false
74
104
  });
75
105
 
76
106
  table.render({
77
107
  elem: '#table_7_school',
108
+ totalRow: true,
78
109
  cols: [
79
110
  [
80
111
  {
@@ -82,8 +113,9 @@
82
113
  title: '用户数分布',
83
114
  align: 'center',
84
115
  width: 150,
85
- rowspan: 2
86
- }
116
+ rowspan: 2,
117
+ totalRowText:'合计',
118
+ }
87
119
  , {
88
120
  title: '客户数',
89
121
  align: 'center',
@@ -98,32 +130,38 @@
98
130
  field: 'schools',
99
131
  title: '学校数',
100
132
  align: 'center',
101
- width: 150
133
+ width: 150,
134
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
102
135
  }, {
103
136
  field: 'departments',
104
137
  title: '学院数',
105
138
  align: 'center',
106
- width: 150
139
+ width: 150,
140
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
107
141
  }, {
108
142
  field: 'majors',
109
143
  title: '专业数',
110
144
  align: 'center',
111
- width: 150
145
+ width: 150,
146
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
112
147
  },{
113
148
  field: 'signed_schools',
114
149
  title: '学校数',
115
150
  align: 'center',
116
- width: 150
151
+ width: 150,
152
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
117
153
  }, {
118
154
  field: 'signed_departments',
119
155
  title: '学院数',
120
156
  align: 'center',
121
- width: 150
157
+ width: 150,
158
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
122
159
  }, {
123
160
  field: 'signed_majors',
124
161
  align: 'center',
125
162
  title: '专业数',
126
- width: 150
163
+ width: 150,
164
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
127
165
  }]
128
166
  ],
129
167
  data: gon.table_2,
@@ -132,15 +170,17 @@
132
170
 
133
171
  table.render({
134
172
  elem: '#table_7_signed',
173
+ totalRow: true,
135
174
  cols: [
136
175
  [
137
176
  {
138
177
  field: 'num',
139
- title: '用户数分布',
178
+ title: '教师数分布',
140
179
  align: 'center',
141
180
  width: 150,
142
- rowspan: 2
143
- }
181
+ rowspan: 2,
182
+ totalRowText:'合计',
183
+ }
144
184
  , {
145
185
  title: '客户数',
146
186
  align: 'center',
@@ -155,32 +195,38 @@
155
195
  field: 'schools',
156
196
  title: '学校数',
157
197
  align: 'center',
158
- width: 150
198
+ width: 150,
199
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
159
200
  }, {
160
201
  field: 'departments',
161
202
  title: '学院数',
162
203
  align: 'center',
163
- width: 150
204
+ width: 150,
205
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
164
206
  }, {
165
207
  field: 'majors',
166
208
  title: '专业数',
167
209
  align: 'center',
168
- width: 150
210
+ width: 150,
211
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
169
212
  },{
170
213
  field: 'signed_schools',
171
214
  title: '学校数',
172
215
  align: 'center',
173
- width: 150
216
+ width: 150,
217
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
174
218
  }, {
175
219
  field: 'signed_departments',
176
220
  title: '学院数',
177
221
  align: 'center',
178
- width: 150
222
+ width: 150,
223
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
179
224
  }, {
180
225
  field: 'signed_majors',
181
226
  align: 'center',
182
227
  title: '专业数',
183
- width: 150
228
+ width: 150,
229
+ totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
184
230
  }]
185
231
  ],
186
232
  data: gon.table_3,
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.96'
2
+ VERSION = '0.9.97'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: educode_sales
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.96
4
+ version: 0.9.97
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-18 00:00:00.000000000 Z
11
+ date: 2023-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails