ReportController.php
40.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
<?php
namespace api\home\controller;
use app\portal\model\DiscussModel;
use cmf\controller\RestBaseController;
use think\Validate;
use think\Db;
/**
* @title 查看报表
*/
class ReportController extends RestBaseController
{
/**
* @title 获取项目标题列表
* @description 接口说明
* @author 开发者
* @url /api/home/report/getTitleList
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:project_id type:inter require:1 default: other desc:项目id(独立年检传-1)
* @param name:type type:inter require:1 default: other desc:类型(1:月检,2:年检,3:维修,4:改造,5:培训,6:演习,7:独立年检)
*
* @return title_a:字母排序['b','c']
* @return title_n:项目名称@
* @title_n acronym:字母 title_l:标题列表@
* @title_l id:列表标题id title:标题名称
*/
public function getTitleList(){
if($this->request->isGet()){
$project_id = $this->request->get('project_id');
$type = $this->request->get('type');
$rule = config('site.project_ids');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check(['project_id'=>$project_id,'type'=>$type])) {
$this->error($validate->getError());
}
$res = [];
$common = new CommonController();
if($type == 1){
//月检
$res = $common->getCheckTitleById($project_id);
}else if($type == 2){
//年检
$res = $common->getTitleById('pro_check',$project_id);
}else if($type == 3){
//维修
$res = $common->getTitleById('repair',$project_id);
}else if($type == 4){
//改造
$res = $common->getTitleById('reform',$project_id);
}else if($type == 5){
//培训
$res = $common->getTitleById('train',$project_id);
}else if($type == 6){
//演习
$res = $common->getTitleById('exercise',$project_id);
}else if($type == 7){
//独立年检
$res = $common->getYearsTitle();
}
$arr2 = [];
$arr2['title_a'] = [];
$arr2['title_n'] = [];
if($res){
$acronym = [];
foreach($res as $key=>$value){
$acronym[$key] = $common->getFirstCharter($value['title']);
}
$acronym =array_values(array_unique($acronym));
sort($acronym);
$arr1 = [];
foreach($acronym as $a_key=>$a_value){
$k = 0;
$arr1[$a_key]['acronym'] = $a_value;
foreach($res as $r_value){
$k+=0;
$first = $common->getFirstCharter($r_value['title']);
if($first == $a_value){
$arr1[$a_key]['title_l'][$k] = $r_value;
$k++;
}
}
}
if(in_array('#',$acronym)){
$count = count($acronym);
foreach ($arr1 as $key=>$a_value){
if($a_value['acronym'] == '#'){
$arr1[$count-1] = $a_value;
}else{
$arr1[$key-1] = $a_value;
}
}
foreach($acronym as $key1=>$a_value1){
if($a_value1 == '#'){
$acronym[$count-1] = $a_value1;
}else{
$acronym[$key1-1] = $a_value1;
}
}
}
$arr2['title_a'] = $acronym;
$arr2['title_n'] = $arr1;
}
$this->success('成功',$arr2);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 月检年检项目状态
* @description 接口说明
* @author 开发者
* @url /api/home/report/getCheckStatus
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @return data:列表@
* @data id:状态id status:状态名称
*/
public function getCheckStatus(){
if($this->request->isGet()){
$res = [
['id'=> -1,'status'=> '全部'],
['id'=> 0,'status'=> '待确认'],
['id'=> 1,'status'=> '已驳回'],
['id'=> 2,'status'=> '进行中'],
['id'=> 3,'status'=> '申请中'],
['id'=> 4,'status'=> '已完成'],
];
$this->success('成功',['data'=>$res]);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 报修改造项目状态
* @description 接口说明
* @author 开发者
* @url /api/home/report/getRepairStatus
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @return data:列表@
* @data id:状态id status:状态名称
*/
public function getRepairStatus(){
if($this->request->isGet()){
$res = [
['id'=> -1,'status'=> '全部'],
['id'=> 0,'status'=> '待确认'],
['id'=> 1,'status'=> '进行中'],
['id'=> 2,'status'=> '申请中'],
['id'=> 3,'status'=> '已完成'],
];
$this->success('成功',['data'=>$res]);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 培训演习项目状态
* @description 接口说明
* @author 开发者
* @url /api/home/report/getTrainStatus
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @return data:列表@
* @data id:状态id status:状态名称
*/
public function getTrainStatus(){
if($this->request->isGet()){
$res = [
['id'=> -1,'status'=> '全部'],
['id'=> 0,'status'=> '待确认'],
['id'=> 1,'status'=> '进行中'],
['id'=> 2,'status'=> '已完成'],
];
$this->success('成功',['data'=>$res]);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 消防日检报表列表
* @description 接口说明
* @author 开发者
* @url /api/home/report/inspectReportList
* @method GET
*
* @header name:token require:1 default: desc:header
* @param name:page type:inter require:1 default: other desc:分页页码
*
* @param name:company_id type:inter require:0 default: other desc:企业id(总领导传此字段)
* @param name:project_id type:inter require:0 default: other desc:项目id(检索)
* @param name:start_time type:inter require:0 default: other desc:开始日期(检索开始日期)
* @param name:end_time type:inter require:0 default: other desc:开始日期(检索结束日期)
*
* @return data:列表@
* @data id:列表id project_id:项目id project_name:项目名称 create_time:巡检时间 user_group:参与人员
* @return page:当前页数
* @return total_page:总页数
*/
public function inspectReportList(){
if($this->request->isGet()){
$data = $this->request->get();
$company_id = $this->request->get('company_id');
$rule = config('site.pages_report');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$common = new CommonController();
$user = $common->getUserIdentity();
//根据企业id查询项目id
$pIds = $common->getCheckStatus($user,$company_id);
$result = $common->getInspectReportList('inspect',$pIds,$data);
//查找项目组人员名称
foreach($result as &$value){
//显示拍照的日检人员
$ins_data = [
'project_id'=>$value['project_id'],
'create_time'=>$value['create_time']
];
$value['user_group'] = $common->getUserNameByProjectId($ins_data);;
}
$total_page = $common->getInspectReportCount('inspect',$pIds,$data);
$res['data'] = $result;
$res['page'] = intval($data['page']);
$res['total_page'] = $total_page;
$this->success('成功',$res);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 月检,年检报表列表
* @description 接口说明
* @author 开发者
* @url /api/home/report/checkReportList
* @method GET
*
* @header name:token require:1 default: desc:header
* @param name:page type:inter require:1 default: other desc:分页页码
* @param name:type type:inter require:1 default: other desc:类型(1:月检,2:年检)
*
* @param name:company_id type:inter require:0 default: other desc:企业id(总领导传此字段)
* @param name:project_id type:inter require:0 default: other desc:项目id(检索)
* @param name:title_id type:inter require:0 default: other desc:标题id(检索)
* @param name:status type:inter require:0 default: other desc:状态(检索状态:-1:全部,0:待确认,1:已驳回,2:进行中,3:申请中,4:已完成)
* @param name:start_time type:inter require:0 default: other desc:开始日期(检索开始日期)
* @param name:end_time type:inter require:0 default: other desc:开始日期(检索结束日期)
*
* @return data:列表@
* @data id:列表id project_id:项目id project_name:项目名称 title:表头信息(+日期格式) ins_m_time:(ins_m_time:月检时间,year_m_time:年检时间) user_group:参与人员 status:状态(0:待确认,1:甲方员工驳回,2:进行中,3:申请中,4:已完成)
* @return page:当前页数
* @return total_page:总页数
*/
public function checkReportList(){
if($this->request->isGet()){
$data = $this->request->get();
$company_id = $this->request->get('company_id');
$rule = config('site.pages_service');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$common = new CommonController();
$user = $common->getUserIdentity();
//根据企业id查询项目id
$pIds = $common->getCheckStatus($user,$company_id);
$service_id = $data['type'];
$result = [];
$total_page = 0;
if($service_id == 1){
//月检
$result = $common->getCheckReportList('check',$pIds,$data);
$total_page = $common->checkReportCount('check',$pIds,$data);
}else if($service_id == 2){
//年检
$result = $common->getCheckReportList('pro_check',$pIds,$data);
$total_page = $common->checkReportCount('pro_check',$pIds,$data);
}
$project = $common->getProjectName($data['project_id']);
foreach($result as &$value){
if($service_id == 1){
$value['title'] = $project['project_name'].'月检'.date('Y-m-d',$value['ins_m_time']);
}
//显示拍照的日检人员
if($service_id == 1){
$value['user_group'] = $common->getUserNameByServiceId($value['id'],1);
}else{
$value['user_group'] = $common->getUserNameByServiceId($value['id'],2);
}
}
$res['data'] = $result;
$res['page'] = intval($data['page']);
$res['total_page'] = $total_page;
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
/**
* @title 报修,改造报表列表
* @description 接口说明
* @author 开发者
* @url /api/home/report/repairReportList
* @method GET
*
* @header name:token require:1 default: desc:header
* @param name:page type:inter require:1 default: other desc:分页页码
* @param name:type type:inter require:1 default: other desc:类型(1:报修,2:改造)
*
* @param name:company_id type:inter require:0 default: other desc:企业id(总领导传此字段)
* @param name:project_id type:inter require:0 default: other desc:项目id(检索)
* @param name:title_id type:inter require:0 default: other desc:标题id(检索)
* @param name:status type:inter require:0 default: other desc:状态(检索状态:-1:全部,0:待确认,1:进行中,2:申请中,3:已完成)
* @param name:start_time type:inter require:0 default: other desc:开始日期(检索开始日期)
* @param name:end_time type:inter require:0 default: other desc:开始日期(检索结束日期)
*
* @return data:列表@
* @data id:列表id project_id:项目id project_name:项目名称 title:表头信息 create_time:(报修、改造时间) user_group:参与人员 status:状态(0:待确认,1:进行中,2:申请中,3:已完成)
* @return page:当前页数
* @return total_page:总页数
*/
public function repairReportList(){
if($this->request->isGet()){
$data = $this->request->get();
$company_id = $this->request->get('company_id');
$rule = config('site.pages_service');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$common = new CommonController();
$user = $common->getUserIdentity();
//根据企业id查询项目id
$pIds = $common->getCheckStatus($user,$company_id);
$service_id = $data['type'];
$result = [];
$total_page = 0;
if($service_id == 1){
//报修
$result = $common->getRepairReportList('repair',$pIds,$data);
$total_page = $common->repairReportCount('repair',$pIds,$data);
}else if($service_id == 2){
//改造
$result = $common->getRepairReportList('reform',$pIds,$data);
$total_page = $common->repairReportCount('reform',$pIds,$data);
}
foreach($result as &$value){
//显示拍照的日检人员
if($service_id == 1){
$value['user_group'] = $common->getUserNameByServiceId($value['id'],3);
}else{
$value['user_group'] = $common->getUserNameByServiceId($value['id'],4);
}
}
$res['data'] = $result;
$res['page'] = intval($data['page']);
$res['total_page'] = $total_page;
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
/**
* @title 培训,演习报表列表
* @description 接口说明
* @author 开发者
* @url /api/home/report/trainReportList
* @method GET
*
* @header name:token require:1 default: desc:header
* @param name:page type:inter require:1 default: other desc:分页页码
* @param name:type type:inter require:1 default: other desc:类型(1:培训,2:演习)
*
* @param name:company_id type:inter require:0 default: other desc:企业id(总领导传此字段)
* @param name:project_id type:inter require:0 default: other desc:项目id(检索)
* @param name:title_id type:inter require:0 default: other desc:标题id(检索)
* @param name:status type:inter require:0 default: other desc:状态(检索状态:-1:全部,0:待确认,1:进行中,2:已完成)
* @param name:start_time type:inter require:0 default: other desc:开始日期(检索开始日期)
* @param name:end_time type:inter require:0 default: other desc:开始日期(检索结束日期)
*
* @return data:列表@
* @data id:列表id project_id:项目id project_name:项目名称 title:表头信息 train_time:(train_time:培训时间,exercise_time:演习时间) user_group:参与人员 status:状态(0:待确认,1:进行中,2:已完成)
* @return page:当前页数
* @return total_page:总页数
*/
public function trainReportList(){
if($this->request->isGet()){
$data = $this->request->get();
$company_id = $this->request->get('company_id');
$rule = config('site.pages_service');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$common = new CommonController();
$user = $common->getUserIdentity();
//根据企业id查询项目id
$pIds = $common->getCheckStatus($user,$company_id);
$service_id = $data['type'];
$result = [];
$total_page = 0;
if($service_id == 1){
//培训
$result = $common->getTrainReportList('train',$pIds,$data);
$total_page = $common->trainReportCount('train',$pIds,$data);
}else if($service_id == 2){
//演习
$result = $common->getTrainReportList('exercise',$pIds,$data);
$total_page = $common->trainReportCount('exercise',$pIds,$data);
}
foreach($result as &$value){
//显示拍照的日检人员
if($service_id == 1){
$value['user_group'] = $common->getUserNameByServiceId($value['id'],5);
}else{
$value['user_group'] = $common->getUserNameByServiceId($value['id'],6);
}
}
$res['data'] = $result;
$res['page'] = intval($data['page']);
$res['total_page'] = $total_page;
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
/**
* @title 消防日检报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/inspectReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
* @return a_company:甲方公司@!
* @a_company company_name:甲方公司 logo:公司logo
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
* @return title:报表名称
* @return inspect_name:参与人员@
* @inspect_name id:用户id user_login:姓名
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return inspect_time:日检巡检时间
*
* @return inspect:日检@
* @inspect id:日检点id status:日检点状态(0:正常,1:故障,2:未检查) user_login:检查人姓名 point_name:日检点名称 images:日检图片@
* @images image_url:图片路径
*
* @return comment:评论内容
*
*/
public function inspectReportDetail(){
if($this->request->isGet()){
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('inspect')
->where(['id'=>$data['id']])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getInspectReportDetail($res,$data);
//人员浏览记录
$common->createReportUid($data['id']);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 月检报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/checkReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
* @return a_company:甲方公司@!
* @a_company company_name:甲方公司 logo:公司logo
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
*
* @return title:报表名称
* @return ins_m_time:月检时间
* @return user_login:乙方发起人
* @return number:月检单号
* @return a_staff_user:甲方员工确认人
* @return confirm_user:甲方验收人姓名
* @return finish_time:完成时间
* @return check_period:工期
* @return check_name:参与人员@
* @check_name id:用户id user_login:姓名
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return check_point:月检点@!
* @check_point id:月检点id point_name:月检点名称 status:月检状态(0:正常,1:故障,2:未检测) user_login:检测人员 images:月检图片@
* @images day:图片日期 image:图片路径@
* @image image_url:图片路径
*
* @return confirm_images:确认完成图片@!
* @confirm_images title:图片标题 c_images:完成图片@
* @c_images day:图片日期 image:图片路径@
*
* @return comment:评论内容
*
* @return address:月检地点
* @return remark:月检备注
*/
public function checkReportDetail(){
if($this->request->isGet()){
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('check')
->where(['id'=>$data['id']])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getCheckReportDetail('check',$res,$data);
//人员浏览记录
$common->createReportUid($data['id'],1);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 年检报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/yearReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
* @return a_company:甲方公司@!
* @a_company company_name:甲方公司 logo:公司logo
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
*
* @return title:报表名称
* @return year_m_time:年检时间
* @return user_login:乙方发起人
* @return number:年检单号
* @return a_staff_user:甲方员工确认人
* @return confirm_user:乙方验收人姓名
* @return finish_time:完成时间
* @return check_period:工期
* @return year_name:参与人员@
* @year_name id:用户id user_login:姓名
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return check_point:年检点@!
* @check_point id:年检点id point_name:年检点名称 status:年检状态(0:正常,1:故障,2:未检测) user_login:检测人员 images:年检图片@
* @images day:图片日期 image:图片路径@
* @image image_url:图片路径
*
* @return confirm_images:确认完成图片@!
* @confirm_images title:图片标题 c_images:完成图片@
* @c_images day:图片日期 image:图片路径@
*
* @return comment:评论内容
*
* @return address:年检地点
* @return remark:年检备注
*/
public function yearReportDetail(){
if($this->request->isGet()){
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('pro_check')
->where(['id'=>$data['id']])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getCheckReportDetail('pro_check',$res,$data);
//人员浏览记录
$common->createReportUid($data['id'],2);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 独立年检报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/testReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
*
* @return title:报表名称
* @return test_time:年检时间
* @return user_login:乙方发起人
* @return number:独立年检单号
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return test_point:独立年检点@!
* @test_point id:年检点id spot_name:独立年检点名称 status:年检状态(0:正常,1:故障,2:未检测) user_login:检测人员 images:年检图片@
* @images day:图片日期 image:图片路径@
* @image image_url:图片路径
*
* @return comment:评论内容
*
* @return address:年检地点
* @return remark:年检备注
*/
public function testReportDetail(){
if($this->request->isGet()){
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('test')
->where('id',$data['id'])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getTestReportDetail($res,$data);
//人员浏览记录
$common->createReportUid($data['id'],7);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 报修报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/repairReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
* @return a_company:甲方公司@!
* @a_company company_name:甲方公司 logo:公司logo
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
*
* @return title:报表名称
* @return number:报修单号
* @return create_time:报修时间
*
* @return user_login:发起人@!
* @user_login user:发起人姓名 party:发起人身份(0:甲方,1:乙方)
*
* @return h_user_login:确认人@!
* @h_user_login user:确认人姓名 party:确认人身份(0:甲方,乙方)
*
* @return confirm_user:验收人姓名
* @return finish_time:完成时间
* @return repair_period:工期
*
* @return repair_name:参与人员@
* @repair_name id:用户id user_login:姓名
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return images:报修图片@!
* @images title:图片标题 i_images:报修图片@
* @i_images day:图片日期 image:图片路径@
* @image image_url:图片路径
*
* @return repair_images:完善图片@!
* @repair_images title:图片标题 r_images:完善图片@
* @r_images day:图片日期 image:图片路径@
*
* @return confirm_images:确认完成图片@!
* @confirm_images title:图片标题 c_images:完成图片@
* @c_images day:图片日期 image:图片路径@
*
* @return comment:评论内容
*/
public function repairReportDetail(){
if($this->request->isGet()){
//列表id
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('repair')
->where(['id'=>$data['id']])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getRepairReportDetail($res,$data,'repair');
//人员浏览记录
$common->createReportUid($data['id'],3);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 改造报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/reformReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
* @return a_company:甲方公司@!
* @a_company company_name:甲方公司 logo:公司logo
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
*
* @return title:报表名称
* @return number:改造单号
* @return create_time:改造时间
*
* @return user_login:发起人@!
* @user_login user:发起人姓名 party:发起人身份(0:甲方,1:乙方)
*
* @return h_user_login:确认人@!
* @h_user_login user:确认人姓名 party:确认人身份(0:甲方,乙方)
*
* @return confirm_user:验收人姓名
* @return finish_time:完成时间
* @return reform_period:工期
*
* @return reform_name:参与人员@
* @reform_name id:用户id user_login:姓名
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return images:改造图片@!
* @images title:图片标题 i_images:改造图片@
* @i_images day:图片日期 image:图片路径@
* @image image_url:图片路径
*
* @return reform_images:完善图片@!
* @reform_images title:图片标题 r_images:完善图片@
* @r_images day:图片日期 image:图片路径@
*
* @return confirm_images:确认完成图片@!
* @confirm_images title:图片标题 c_images:完成图片@
* @c_images day:图片日期 image:图片路径@
*
* @return comment:评论内容
*/
public function reformReportDetail(){
if($this->request->isGet()){
//列表id
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('reform')
->where(['id'=>$data['id']])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getRepairReportDetail($res,$data,'reform');
//人员浏览记录
$common->createReportUid($data['id'],4);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 培训报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/trainReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
* @return a_company:甲方公司@!
* @a_company company_name:甲方公司 logo:公司logo
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
*
* @return title:报表名称
* @return number:培训单号
* @return train_time:培训时间
* @return user_login:甲方发起人
* @return b_staff_user:乙方员工确认人
* @return confirm_user_b:乙方验收人姓名
* @return finish_time:完成时间
* @return train_period:工期
*
* @return train_name:参与人员@
* @train_name id:用户id user_login:姓名
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return images:培训图片@!
* @images title:图片标题 i_images:培训图片@
* @i_images day:图片日期 image:图片路径@
* @image image_url:图片路径
*
* @return confirm_images:完成图片@!
* @confirm_images title:图片标题 c_images:完成图片@
* @c_images day:图片日期 image:图片路径@
*
* @return confirm_images_a:甲方验收人图片@
* @confirm_images_a user_login:验收人 c_images:图片@
*
* @return comment:评论内容
*
* @return address:培训地点
* @return remark:培训备注
*/
public function trainReportDetail(){
if($this->request->isGet()){
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('train')
->where(['id'=>$data['id']])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getTrainReportDetail($res,$data,'train');
//人员浏览记录
$common->createReportUid($data['id'],5);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 演习报表详情
* @description 接口说明
* @author 开发者
* @url /api/home/report/exerciseReportDetail
* @method GET
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
*
* @return a_company:甲方公司@!
* @a_company company_name:甲方公司 logo:公司logo
*
* @return b_company:乙方公司@!
* @b_company company_name:乙方公司 logo:公司logo
*
* @return title:报表名称
* @return number:演习单号
* @return exercise_time:演习时间
* @return user_login:甲方发起人
* @return b_staff_user:乙方领导确认人
* @return confirm_user_b:乙方验收人姓名
* @return finish_time:完成时间
* @return exercise_period:工期
*
* @return exercise_name:参与人员@
* @exercise_name id:用户id user_login:姓名
*
* @return browse_name:浏览报表人员@
* @browse_name id:用户id user_login:姓名
*
* @return images:演习图片@!
* @images title:图片标题 i_images:演习图片@
* @i_images day:图片日期 image:图片路径@
* @image image_url:图片路径
*
* @return confirm_images:完成图片@!
* @confirm_images title:图片标题 c_images:完成图片@
* @c_images day:图片日期 image:图片路径@
*
* @return confirm_images_a:甲方验收人图片@
* @confirm_images_a user_login:验收人 c_images:图片@
*
* @return comment:评论内容
*
* @return address:演习地点
* @return remark:演习备注
*/
public function exerciseReportDetail(){
if($this->request->isGet()){
$data = $this->request->get();
$rule = config('site.data');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$arr = [];
$res = Db::name('exercise')
->where(['id'=>$data['id']])
->find();
if($res){
//根据项目id获取项目名称,甲方公司名称,logo,乙方公司名称,logo
$common = new CommonController();
$arr = $common->getTrainReportDetail($res,$data,'exercise');
//人员浏览记录
$common->createReportUid($data['id'],6);
}
$this->success('成功',$arr);
}else{
$this->error('请求方式错误!');
}
}
/**
* @title 报表评价
* @description 接口说明
* @author 开发者
* @url /api/home/report/comment
* @method POST
*
* @header name:token require:1 default: desc:header
*
* @param name:id type:inter require:1 default: other desc:列表id
* @param name:service_id type:inter require:1 default: other desc:服务id(1:日检,2:月检,3:改造,4:报修跟进,5:培训,6:演习,7:年检,8:独立年检)
* @param name:comment type:string require:1 default: other desc:评论内容
*/
public function comment(){
if($this->request->isPost()){
$data = $this->request->post();
$common = new CommonController();
$user = $common->getIdentity();
//如果是员工,则没有权限操作
if($user['identity'] == config('site.a_staff') || $user['identity'] == config('site.b_staff')){
$this->error('无权操作');
}
$rule = config('site.comment');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$commentModel = new DiscussModel();
$arr = [];
$arr['type_id'] = $data['id'];
$arr['type'] = $data['service_id'];
$arr['discuss'] = $data['comment'];
$arr['uid'] = $this->userId;
$arr['create_time'] = time();
$res = $commentModel->create($arr);
if($res){
$this->success('成功');
}else{
$this->error('失败');
}
}else{
$this->error('请求方式错误!');
}
}
}