puzhibing
2023-12-13 302b40b8702f3b203223bacf71d44d76c5a598c0
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
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
package com.stylefeng.guns.modular.system.controller.general;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.base.tips.ErrorTip;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.core.util.ExcelExportUtil;
import com.stylefeng.guns.core.util.SinataUtil;
import com.stylefeng.guns.core.util.WoUtil;
import com.stylefeng.guns.modular.system.dao.CarInsuranceMapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.EmailUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import org.apache.commons.lang.time.DateUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.ui.Model;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
 
/**
 * 车辆管理控制器
 *
 * @author fengshuonan
 * @Date 2020-06-05 17:25:12
 */
@Controller
@RequestMapping("/tCar")
public class TCarController extends BaseController {
 
    private String PREFIX = "/system/tCar/";
 
    @Autowired
    private ITCarService tCarService;
 
    @Autowired
    private ITCompanyService tCompanyService;
 
    @Autowired
    private ITCarServiceService tCarServiceService;
 
    @Autowired
    private ITDriverLineService tDriverLineService;
 
    @Autowired
    private ITCarBrandService tCarBrandService;
 
    @Autowired
    private ITCarModelService tCarModelService;
 
    @Autowired
    private ITDriverService tDriverService;
 
    @Autowired
    private ITCompanyService itCompanyService;
 
    @Autowired
    private ITCarServiceService itCarServiceService;
 
    @Autowired
    private ITServerCarmodelService itServerCarmodelService;
 
    @Resource
    private CarInsuranceMapper carInsuranceMapper;
 
    @Autowired
    private ITCarColorService carColorService;
 
    @Value("${spring.mail.template-path}")
    private String templatePath;
 
 
 
 
    /**
     * 跳转到车辆管理首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "tCar.html";
    }
    @RequestMapping("auth")
    public String auth() {
        return PREFIX + "tCarAuth.html";
    }
 
    /**
     * 跳转到添加车辆管理
     */
    @RequestMapping("/tCar_add")
    public String tCarAdd(Model model) {
        List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2));
        model.addAttribute("companyList",companyList);
 
        Integer roleType = ShiroKit.getUser().getRoleType();
        model.addAttribute("roleType",roleType);
        if (2 == roleType){
            List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId()));
            model.addAttribute("franchiseeList",franchiseeList);
        }else{
            model.addAttribute("franchiseeList",null);
        }
        //查询当前用户所属分公司/加盟商
        model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName());
 
        //车辆品牌
        List<TCarBrand> brandList = tCarBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("brandList",brandList);
        //车辆类型
        /*List<TCarModel> modelList = tCarModelService.selectList(new EntityWrapper<TCarModel>().eq("state", 1));
        model.addAttribute("modelList",modelList);*/
 
        List<TServerCarmodel> zcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1));
        model.addAttribute("zcModelList",zcModelList);
        List<TServerCarmodel> kcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1));
        model.addAttribute("kcModelList",kcModelList);
        List<TCarColor> state = carColorService.selectList(new EntityWrapper<TCarColor>().eq("state", 1));
        model.addAttribute("color", state);
        return PREFIX + "tCar_add.html";
    }
 
    /**
     * 查询车辆类型
     * @param carBrandId
     * @return
     */
    @RequestMapping(value = "/brandChange")
    @ResponseBody
    public Object brandChange(@RequestParam Integer carBrandId) {
        List<TCarModel> list = new ArrayList<>();
        if (SinataUtil.isNotEmpty(carBrandId)){
            list = tCarModelService.selectList(new EntityWrapper<TCarModel>().eq("state",1).eq("brandId", carBrandId));
        }
        return list;
    }
 
    /**
     * 跳转到修改车辆管理
     */
    @RequestMapping("/tCar_update/{tCarId}")
    public String tCarUpdate(@PathVariable Integer tCarId, Model model) {
        TCar tCar = tCarService.selectById(tCarId);
        model.addAttribute("item",tCar);
        LogObjectHolder.me().set(tCar);
 
        Integer roleType = ShiroKit.getUser().getRoleType();
        model.addAttribute("roleType",roleType);
        model.addAttribute("objectName",tCompanyService.selectById(ShiroKit.getUser().getObjectId()).getName());
 
        if (1 == roleType){
            List<TCompany> companyList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 2));
            model.addAttribute("companyList",companyList);
            List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",tCar.getCompanyId()));
            model.addAttribute("franchiseeList",franchiseeList);
        }else if (2 == roleType){
            List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("type", 3).eq("superiorId",ShiroKit.getUser().getObjectId()));
            model.addAttribute("franchiseeList",franchiseeList);
        }
 
        //查询平台ID
        TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1));
        //判断是平台司机还是加盟司机
        if ((SinataUtil.isEmpty(tCar.getCompanyId()) || tCar.getCompanyId() == 0 || tCar.getCompanyId() == company.getId()) && (SinataUtil.isEmpty(tCar.getFranchiseeId()) || tCar.getFranchiseeId() == 0)){
            model.addAttribute("companyType",1);
        }else{
            model.addAttribute("companyType",2);
        }
 
        //获取经营业务
        List<TCarService> serviceList = tCarServiceService.selectList(new EntityWrapper<TCarService>().eq("carId", tCar.getId()));
        Integer one = 1;
        Integer two = 1;
        Integer three = 1;
        Integer four = 1;
        Integer five = 1;
        Integer six = 1;
        Integer zcModel = 0;
        Integer kcModel = 0;
        for (TCarService obj : serviceList){
            if (obj.getType() == 1){
                one = 2;
                zcModel = obj.getServerCarModelId();
            }
            if (obj.getType() == 2){
                two = 2;
            }
            if (obj.getType() == 3){
                three = 2;
                kcModel = obj.getServerCarModelId();
            }
            if (obj.getType() == 4){
                four = 2;
            }
            if (obj.getType() == 5){
                five = 2;
            }
            if (obj.getType() == 6){
                six = 2;
            }
        }
        model.addAttribute("one",one);
        model.addAttribute("two",two);
        model.addAttribute("three",three);
        model.addAttribute("four",four);
        model.addAttribute("five",five);
        model.addAttribute("six",six);
        model.addAttribute("zcModel",zcModel);
        model.addAttribute("kcModel",kcModel);
 
        List<TServerCarmodel> zcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1));
        model.addAttribute("zcModelList",zcModelList);
        List<TServerCarmodel> kcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 2).eq("state", 1));
        model.addAttribute("kcModelList",kcModelList);
 
        //车辆品牌
        List<TCarBrand> brandList = tCarBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("brandList",brandList);
        //车辆类型
        List<TCarModel> modelList = tCarModelService.selectList(new EntityWrapper<TCarModel>().eq("brandId",tCar.getCarBrandId()).eq("state", 1));
        model.addAttribute("modelList",modelList);
        List<TCarColor> state = carColorService.selectList(new EntityWrapper<TCarColor>().eq("state", 1));
        model.addAttribute("color", state);
        return PREFIX + "tCar_edit.html";
    }
    @RequestMapping("/tCar_auth/{tCarId}")
    public String tCarAuth(@PathVariable Integer tCarId, Model model) {
        TCar tCar = tCarService.selectById(tCarId);
        model.addAttribute("item",tCar);
        //获取经营业务
        List<TCarService> serviceList = tCarServiceService.selectList(new EntityWrapper<TCarService>().eq("carId", tCar.getId()));
        Integer one = 1;
        Integer two = 1;
        Integer three = 1;
        Integer four = 1;
        Integer five = 1;
        Integer six = 1;
        Integer zcModel = 0;
        Integer kcModel = 0;
        for (TCarService obj : serviceList){
            if (obj.getType() == 1){
                one = 2;
                zcModel = obj.getServerCarModelId();
            }
            if (obj.getType() == 1){
                four = 2;
                zcModel = obj.getServerCarModelId();
            }
        }
        model.addAttribute("one",one);
        model.addAttribute("four",four);
        model.addAttribute("zcModel",zcModel);
        List<TServerCarmodel> zcModelList = itServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1));
        model.addAttribute("zcModelList",zcModelList);
        LogObjectHolder.me().set(tCar);
        return PREFIX + "tCar_auth.html";
    }
 
    /**
     * 跳转到保险列表页
     * @param carId
     * @param model
     * @return
     */
    @RequestMapping("/carInsurance")
    public String carInsurance(Integer carId, Model model){
        model.addAttribute("carId", carId);
        return PREFIX + "carInsurance.html";
    }
 
    /**
     * 跳转到添加页面
     * @param carId
     * @param model
     * @return
     */
    @RequestMapping("/showAddCarInsurance")
    public String showAddCarInsurance(Integer carId, Model model){
        model.addAttribute("carId", carId);
        model.addAttribute("id", "");
        return PREFIX + "carInsuranceInfo.html";
    }
 
    /**
     * 跳转到编辑页
     * @param id
     * @param carId
     * @param model
     * @return
     */
    @RequestMapping("/showEditCarInsurance")
    public String showEditCarInsurance(Integer id, Integer carId, Model model){
        model.addAttribute("carId", carId);
        model.addAttribute("id", id);
        return PREFIX + "carInsuranceInfo.html";
    }
 
    /**
     * 添加保险数据
     * @param carInsurance
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/saveCarInsurance", method = RequestMethod.POST)
    public ResultUtil saveCarInsurance(CarInsurance carInsurance){
        if(carInsurance.getId() == null){
            carInsuranceMapper.insert(carInsurance);
        }else{
            carInsuranceMapper.updateById(carInsurance);
        }
 
        return ResultUtil.success();
    }
 
    /**
     * 获取保险详情
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/queryCarInsurance", method = RequestMethod.POST)
    public ResultUtil queryCarInsurance(Integer id){
        CarInsurance carInsurance = carInsuranceMapper.selectById(id);
        return ResultUtil.success(carInsurance);
    }
 
 
    /**
     * 获取保险列表
     * @param carId
     * @param offset
     * @param limit
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/queryInsuranceList", method = RequestMethod.POST)
    public Object queryInsuranceList(Integer carId, Integer offset,Integer limit){
        try {
            Map<String, Object> map = new HashMap<>();
            List<Map<String, Object>> list = carInsuranceMapper.queryInsuranceList(carId, offset, limit);
            int i = carInsuranceMapper.queryInsuranceListCount(carId);
            map.put("rows", list);
            map.put("total", i);
            return map;
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 删除保险
     * @param id
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/delCarInsurance", method = RequestMethod.POST)
    public ResultUtil delCarInsurance(Integer id){
        carInsuranceMapper.deleteById(id);
        return ResultUtil.success();
    }
 
 
    /**
     * 获取车辆管理列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String createTime,
                       String id,
                       String brandName,
                       String modelName,
                       String carColor,
                       String serverStr,
                       String carLicensePlate,
                       String driverName,
                       String companyName,
                       String franchiseeName) {
        String beginTime = null;
        String endTime = null;
        if (SinataUtil.isNotEmpty(createTime)){
            String[] timeArray = createTime.split(" - ");
            beginTime = timeArray[0];
            endTime = timeArray[1];
        }
        Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
        page.setRecords(tCarService.getCarList(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,id,brandName,modelName,carColor,serverStr,carLicensePlate,driverName,companyName,franchiseeName));
        return super.packForBT(page);
    }
 
 
    /**
     * 获取车辆管理列表
     */
    @RequestMapping(value = "/listAuth")
    @ResponseBody
    public Object listAuth(String createTime,
                       String id,
                       String brandName,
                       String modelName,
                       String carColor,
                       String serverStr,
                       String carLicensePlate,
                       String driverName,
                       String companyName,
                       String franchiseeName) {
        String beginTime = null;
        String endTime = null;
        if (SinataUtil.isNotEmpty(createTime)){
            String[] timeArray = createTime.split(" - ");
            beginTime = timeArray[0];
            endTime = timeArray[1];
        }
        Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
        page.setRecords(tCarService.getCarListAuth(page,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),beginTime,endTime,id,brandName,modelName,carColor,serverStr,carLicensePlate,driverName,companyName,franchiseeName));
        return super.packForBT(page);
    }
    /**
     * 新增车辆管理
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add(TCar tCar,@RequestParam String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId,String zcModel,String kcModel) throws Exception {
        TCar tCar1 = tCarService.selectOne(new EntityWrapper<TCar>().eq("state", 1).ne("authState", 4).eq("carLicensePlate", tCar.getCarLicensePlate()));
        if(null != tCar1){
            throw new Exception("车牌号重复");
        }
 
        if (1 == roleType){  //平台
            if (2 == companyType.intValue()){
                if (SinataUtil.isNotEmpty(oneId)){
                    tCar.setCompanyId(oneId);
                }
                if (SinataUtil.isNotEmpty(twoId)){
                    tCar.setFranchiseeId(twoId);
                }
            }else if (1 == companyType.intValue()){
                TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1));
                tCar.setCompanyId(company.getId());
                tCar.setFranchiseeId(0);
            }
            tCar.setAddType(2);
            tCar.setIsPlatCar(1);
        }else if (2 == roleType){  //分公司
            if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){
                tCar.setCompanyId(ShiroKit.getUser().getObjectId());
            }
            if (SinataUtil.isNotEmpty(franchiseeId)){
                tCar.setFranchiseeId(franchiseeId);
            }
            tCar.setIsPlatCar(2);
            tCar.setAddType(3);
            tCar.setAddObjectId(ShiroKit.getUser().getObjectId());
        }else if (3 == roleType){  //加盟商
            TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId());
            if (SinataUtil.isNotEmpty(tCompany)){
                tCar.setCompanyId(tCompany.getSuperiorId());
            }
            if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){
                tCar.setFranchiseeId(ShiroKit.getUser().getObjectId());
            }
            tCar.setIsPlatCar(2);
            tCar.setAddType(4);
            tCar.setAddObjectId(ShiroKit.getUser().getObjectId());
        }
        tCar.setInsertTime(new Date());
        tCar.setState(1);
        tCar.setAuthState(1);
        tCarService.insert(tCar);
 
        //添加经营业务
        String[] serverArray = serverBox.split(",");
        for (int i=0;i<serverArray.length;i++){
            TCarService service = new TCarService();
            service.setCarId(tCar.getId());
            service.setType(Integer.valueOf(serverArray[i]));
            if (1 == service.getType()){
                service.setServerCarModelId(Integer.valueOf(zcModel));
            }else if (3 == service.getType()){
                service.setServerCarModelId(Integer.valueOf(kcModel));
            }
            tCarServiceService.insert(service);
        }
        return SUCCESS_TIP;
    }
 
    /**
     * 删除车辆管理
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer tCarId) {
        TCar tCar = tCarService.selectById(tCarId);
        tCar.setState(2);
        tCarService.updateById(tCar);
 
        //清除相对应的司机关联车辆ID
        List<TDriver> list = tDriverService.selectList(new EntityWrapper<TDriver>().eq("carId", tCarId));
        for (TDriver obj : list){
            obj.setCarId(null);
            tDriverService.updateById(obj);
        }
        return SUCCESS_TIP;
    }
 
    /**
     * 修改车辆管理
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(TCar tCar,@RequestParam String serverBox,Integer roleType,Integer companyType,Integer oneId,Integer twoId,Integer franchiseeId,String zcModel,String kcModel)throws Exception {
        TCar tCar1 = tCarService.selectOne(new EntityWrapper<TCar>().eq("state", 1).ne("authState", 4).eq("carLicensePlate", tCar.getCarLicensePlate()));
        if(null != tCar1 && tCar.getId().compareTo(tCar1.getId()) != 0){
            throw new Exception("车牌号重复");
        }
 
        if (1 == roleType){  //平台
            if (2 == companyType.intValue()){
                if (SinataUtil.isNotEmpty(oneId)){
                    tCar.setCompanyId(oneId);
                }
                if (SinataUtil.isNotEmpty(twoId)){
                    tCar.setFranchiseeId(twoId);
                }
            }else if (1 == companyType.intValue()){
                TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1));
                tCar.setCompanyId(company.getId());
                tCar.setFranchiseeId(0);
            }
        }else if (2 == roleType){  //分公司
            if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){
                tCar.setCompanyId(ShiroKit.getUser().getObjectId());
            }
            if (SinataUtil.isNotEmpty(franchiseeId)){
                tCar.setFranchiseeId(franchiseeId);
            }
        }else if (3 == roleType){  //加盟商
            TCompany tCompany = tCompanyService.selectById(ShiroKit.getUser().getObjectId());
            if (SinataUtil.isNotEmpty(tCompany)){
                tCar.setCompanyId(tCompany.getSuperiorId());
            }
            if (SinataUtil.isNotEmpty(ShiroKit.getUser().getObjectId())){
                tCar.setFranchiseeId(ShiroKit.getUser().getObjectId());
            }
        }
 
        //删除业务
        tCarServiceService.delete(new EntityWrapper<TCarService>().eq("carId",tCar.getId()));
 
        //添加经营业务
        String[] serverArray = serverBox.split(",");
        for (int i=0;i<serverArray.length;i++){
            TCarService service = new TCarService();
            service.setCarId(tCar.getId());
            service.setType(Integer.valueOf(serverArray[i]));
            if (1 == service.getType()){
                service.setServerCarModelId(Integer.valueOf(zcModel));
            }else if (3 == service.getType()){
                service.setServerCarModelId(Integer.valueOf(kcModel));
            }
            tCarServiceService.insert(service);
        }
 
        tCarService.updateById(tCar);
        return SUCCESS_TIP;
    }
    @RequestMapping(value = "/updateAuth")
    @ResponseBody
    public Object updateAuth(TCar tCar,String zcModel,@RequestParam String serverBox) {
        //添加经营业务
        if(tCar.getAuthState()==2){
            String[] serverArray = serverBox.split(",");
            for (int i=0;i<serverArray.length;i++){
                TCarService tCarService = tCarServiceService.selectOne(new EntityWrapper<TCarService>().eq("carId", tCar.getId()).eq("type", Integer.valueOf(serverArray[i])));
                if(null == tCarService){
                    tCarService = new TCarService();
                    tCarService.setCarId(tCar.getId());
                    tCarService.setType(Integer.valueOf(serverArray[i]));
                    if (1 == tCarService.getType()){
                        tCarService.setServerCarModelId(Integer.valueOf(zcModel));
                    }
                    tCarServiceService.insert(tCarService);
                }else{
                    if (1 == tCarService.getType()){
                        tCarService.setServerCarModelId(Integer.valueOf(zcModel));
                    }
                    tCarServiceService.updateById(tCarService);
                }
 
 
            }
        }
        tCarService.updateById(tCar);
        tCar = tCarService.selectById(tCar.getId());
        TDriver tDriver = tDriverService.selectById(tCar.getDriverId());
 
        TCar finalTCar = tCar;
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    String path = templatePath +  "driver/index.html";
                    Document document = Jsoup.parse(new File(path), "UTF-8");
                    document.getElementById("chinese").remove();
                    document.getElementById("french").remove();
                    document.getElementById("invite1").remove();
                    document.getElementById("user1").remove();
                    document.getElementById("settle1").remove();
                    document.getElementById("pass1").remove();
                    document.getElementById("email1").remove();
                    document.getElementById("bill1").remove();
                    document.getElementById("reward1").remove();
                    document.getElementById("rewardToday1").remove();
                    document.getElementById("driverAudit1").remove();
 
                    document.getElementsByTag("title").get(0).text("Vehicle audit notice");
                    Element car_audit1_user = document.getElementById("car_audit1_user");
                    car_audit1_user.text("Hello " + tDriver.getFirstName() + " " + tDriver.getLastName() + ",");
                    Element car_audit1_content = document.getElementById("car_audit1_content");
                    if(2 == finalTCar.getAuthState()){
                        car_audit1_content.text("You vehicle application has been approved. See the I-GO platform for details.");
                    }else{
                        car_audit1_content.text("Sorry, your vehicle application was not approved. The reason for the failure is: incomplete filling of vehicle information.");
                    }
                    EmailUtil.send(tDriver.getEmail(), "Vehicle audit notice",  document.html());
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }).start();
 
        return SUCCESS_TIP;
    }
 
    /**
     * 车辆管理详情
     */
    @RequestMapping(value = "/detail/{tCarId}")
    @ResponseBody
    public Object detail(@PathVariable("tCarId") Integer tCarId) {
        return tCarService.selectById(tCarId);
    }
 
    /**
     * 下载模板
     * @param request
     * @param response
     */
    @RequestMapping(value = "/uploadCarModel")
    public void uploadCarModel(HttpServletRequest request, HttpServletResponse response) {
        // 表格数据【封装】
        List<List<String>> dataList = new ArrayList<List<String>>();
 
        // 首行【封装】
        List<String> shellList = new ArrayList<String>();
        shellList.add("所属机构[平台车辆/加盟车辆]");
        shellList.add("所属分公司[提示:加盟车辆选填]");
        shellList.add("所属加盟商[提示:加盟车辆选填]");
        shellList.add("服务模式:专车[是/否]");
//        shellList.add("服务模式:出租车[是/否]");
//        shellList.add("服务模式:跨城出行[是/否]");
        shellList.add("服务模式:市内小件物流[是/否]");
//        shellList.add("服务模式:小件跨城物流[是/否]");
//        shellList.add("服务模式:包车[是/否]");
        shellList.add("车辆品牌");
        shellList.add("车辆类型");
        shellList.add("车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]");
        shellList.add("车牌号");
        shellList.add("roadworthiness sticker");
        shellList.add("年检到期时间[例如 2020-02-02]");
        shellList.add("商业保险到期时间[例如 2020-02-02]");
        dataList.add(shellList);
 
        try {
            // 调用工具类进行导出
            ExcelExportUtil.easySheet("平台导入车辆模板"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "平台导入车辆模板", dataList, request, response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
 
    /**
     * 导入操作
     * @param request
     * @return
     */
    @RequestMapping(value="/exportCar",method = RequestMethod.POST)
    @ResponseBody
    public Object exportCar(HttpServletRequest request){
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        MultipartFile file = (MultipartFile) multipartRequest.getFile("myfile");
        try {
            //定时五秒后执行
            /*Map<String,Object> maps=new HashMap<>();
            Workbook book = WoUtil.ImportFile(file);
            maps.put("book",book);
            QuartzManager.addJob(AddContract.class, (AddContract.name+new Date().getTime()).toUpperCase(), TimeJobType.ADMIN,DateUtil.getDate_strYMdHms(new Date().getTime() + 1*1000) , maps);*/
 
            Workbook book = WoUtil.ImportFile(file);
            Sheet sh = book.getSheetAt(0);   //获取到第一个表
            for (int i = 1; i <= sh.getLastRowNum(); i++) {
                Row row = sh.getRow(i);
 
                Cell cell0 = row.getCell(0);  //所属机构[平台车辆/加盟车辆]
                String zero = null;
                if (SinataUtil.isNotEmpty(cell0)){
                    zero = String.valueOf(cell0.getStringCellValue()).trim();
                }
 
                Cell cell1 = row.getCell(1);  //所属分公司[提示:加盟车辆选填]
                String one = null;
                if (SinataUtil.isNotEmpty(cell1)){
                    one = String.valueOf(cell1.getStringCellValue()).trim();
                }
 
                Cell cell2 = row.getCell(2);  //所属加盟商[提示:加盟车辆选填]
                String two = null;
                if (SinataUtil.isNotEmpty(cell2)){
                    two = String.valueOf(cell2.getStringCellValue()).trim();
                }
 
                Cell cell3 = row.getCell(3);  //服务模式:专车[是/否]
                String three = null;
                if (SinataUtil.isNotEmpty(cell3)){
                    three = String.valueOf(cell3.getStringCellValue()).trim();
                }
 
//                Cell cell4 = row.getCell(4);  //服务模式:出租车[是/否]
//                String four = null;
//                if (SinataUtil.isNotEmpty(cell4)){
//                    four = String.valueOf(cell4.getStringCellValue()).trim();
//                }
//
//                Cell cell5 = row.getCell(5);  //服务模式:跨城出行[是/否]
//                String five = null;
//                if (SinataUtil.isNotEmpty(cell5)){
//                    five = String.valueOf(cell5.getStringCellValue()).trim();
//                }
 
                Cell cell6 = row.getCell(4);  //服务模式:小件跨城物流[是/否]
                String six = null;
                if (SinataUtil.isNotEmpty(cell6)){
                    six = String.valueOf(cell6.getStringCellValue()).trim();
                }
 
//                Cell cell7 = row.getCell(7);  //服务模式:小件跨城物流[是/否]
//                String seven = null;
//                if (SinataUtil.isNotEmpty(cell7)){
//                    seven = String.valueOf(cell7.getStringCellValue()).trim();
//                }
//
//                Cell cell8 = row.getCell(8);  //服务模式:包车[是/否]
//                String eight = null;
//                if (SinataUtil.isNotEmpty(cell8)){
//                    eight = String.valueOf(cell8.getStringCellValue()).trim();
//                }
 
                Cell cell9 = row.getCell(5);  //车辆品牌
                String nine = null;
                if (SinataUtil.isNotEmpty(cell9)){
                    nine = String.valueOf(cell9.getStringCellValue()).trim();
                }
 
                Cell cell10 = row.getCell(6);  //车辆类型
                String ten = null;
                if (SinataUtil.isNotEmpty(cell10)){
                    ten = String.valueOf(cell10.getStringCellValue()).trim();
                }
 
                Cell cell11 = row.getCell(7);  //车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]
                String eleven = null;
                if (SinataUtil.isNotEmpty(cell11)){
                    eleven = String.valueOf(cell11.getStringCellValue()).trim();
                }
 
                Cell cell12 = row.getCell(8);  //车牌号
                String twelve = null;
                if (SinataUtil.isNotEmpty(cell12)){
                    twelve = String.valueOf(cell12.getStringCellValue()).trim();
                }
 
                Cell cell13 = row.getCell(9);  //行驶证编号
                String thirteen = null;
                if (SinataUtil.isNotEmpty(cell13)){
                    thirteen = String.valueOf(cell13.getStringCellValue()).trim();
                }
 
                Cell cell14 = row.getCell(10);  //年检到期时间
                String fourteen = null;
                if (SinataUtil.isNotEmpty(cell14)){
                    fourteen = String.valueOf(cell14.getStringCellValue()).trim();
                }
 
                Cell cell15 = row.getCell(11);  //商业保险到期时间
                String fifteen = null;
                if (SinataUtil.isNotEmpty(cell15)){
                    fifteen = String.valueOf(cell15.getStringCellValue()).trim();
                }
 
                if (SinataUtil.isEmpty(zero) || SinataUtil.isEmpty(three) /*|| SinataUtil.isEmpty(four)
                        || SinataUtil.isEmpty(five) */|| SinataUtil.isEmpty(six) || /*SinataUtil.isEmpty(seven)
                        || SinataUtil.isEmpty(eight) || */SinataUtil.isEmpty(nine) || SinataUtil.isEmpty(ten)
                        || SinataUtil.isEmpty(eleven) || SinataUtil.isEmpty(twelve) || SinataUtil.isEmpty(thirteen)
                        || SinataUtil.isEmpty(fourteen) || SinataUtil.isEmpty(fifteen)){
                    return new ErrorTip(500, "单元格不能为空");
                }else{
                    //判断所属机构
                    if (!zero.equals("平台车辆") && !zero.equals("加盟车辆")){
                        return new ErrorTip(500, "所属机构内容不正确");
                    }
                    //判断服务模式【专车】
                    if (!three.equals("是") && !three.equals("否")){
                        return new ErrorTip(500, "服务模式【专车】内容不正确");
                    }
//                    //判断服务模式【出租车】
//                    if (!four.equals("是") && !four.equals("否")){
//                        return new ErrorTip(500, "服务模式【出租车】内容不正确");
//                    }
//                    //判断服务模式【跨城出行】
//                    if (!five.equals("是") && !five.equals("否")){
//                        return new ErrorTip(500, "服务模式【跨城出行】内容不正确");
//                    }
                    //判断服务模式【小件同城物流】
                    if (!six.equals("是") && !six.equals("否")){
                        return new ErrorTip(500, "服务模式【小件市内物流】内容不正确");
                    }
//                    //判断服务模式【小件跨城物流】
//                    if (!seven.equals("是") && !seven.equals("否")){
//                        return new ErrorTip(500, "服务模式【小件跨城物流】内容不正确");
//                    }
//                    //判断服务模式【包车】
//                    if (!eight.equals("是") && !eight.equals("否")){
//                        return new ErrorTip(500, "服务模式【包车】内容不正确");
//                    }
                    //判断车辆颜色
                    if (!eleven.equals("黑色") && !eleven.equals("银色") && !eleven.equals("白色") && !eleven.equals("红色") && !eleven.equals("黄色") && !eleven.equals("橙色") && !eleven.equals("蓝色")){
                        return new ErrorTip(500, "车辆颜色内容不正确");
                    }
                    //判断年检到期时间格式是否正确
                    try {
                        if (!isValidDate(fourteen)) {
                            fourteen = importByExcelForDate(fourteen);
                        }
                    }catch (Exception e){
                        return new ErrorTip(500, "年检到期时间格式不正确");
                    }
                    //判断商业保险到期时间格式是否正确
                    try {
                        if (!isValidDate(fifteen)) {
                            fifteen = importByExcelForDate(fifteen);
                        }
                    }catch (Exception e){
                        return new ErrorTip(500, "商业保险到期时间格式不正确");
                    }
 
                    //查找平台公司
                    TCompany platCompany = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("type", 1).notIn("flag", "3").last(" limit 1"));
                    Integer companyId = platCompany.getId();
                    Integer franchiseeId = 0;
                    if ("加盟车辆".equals(zero)){
                        //判断所属分公司是否存在
                        if (SinataUtil.isNotEmpty(one)){
                            TCompany company = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("name", one).eq("type", 2).notIn("flag", "3").last(" limit 1"));
                            if (SinataUtil.isNotEmpty(company)){
                                companyId = company.getId();
                                //判断加盟商是否存在
                                if (SinataUtil.isNotEmpty(two)){
                                    TCompany franchisee = itCompanyService.selectOne(new EntityWrapper<TCompany>().eq("superiorId",company.getId()).eq("name", two).eq("type", 3).notIn("flag", "3").last(" limit 1"));
                                    if (SinataUtil.isNotEmpty(franchisee)){
                                        franchiseeId = franchisee.getId();
                                    }
                                }
                            }
                        }
                    }
 
                    Integer carBrandId = null;
                    Integer carModelId = null;
                    //查找品牌
                    if (SinataUtil.isNotEmpty(nine)){
                        TCarBrand carBrand = tCarBrandService.selectOne(new EntityWrapper<TCarBrand>().eq("name", nine).eq("state", 1).last(" limit 1"));
                        if (SinataUtil.isNotEmpty(carBrand)){
                            carBrandId = carBrand.getId();
                            if (SinataUtil.isNotEmpty(ten)){
                                //查找类型
                                TCarModel carModel = tCarModelService.selectOne(new EntityWrapper<TCarModel>().eq("brandId", carBrand.getId()).eq("name", ten).eq("state", 1).last(" limit 1"));
                                if (SinataUtil.isNotEmpty(carModel)){
                                    carModelId = carModel.getId();
                                }
                            }
                        }
                    }
 
                    //添加车辆对象
                    TCar car = new TCar();
                    if ("平台车辆".equals(zero)){
                        car.setIsPlatCar(1);
                    }else if ("加盟车辆".equals(zero)){
                        car.setIsPlatCar(2);
                    }
                    car.setCompanyId(companyId);
                    car.setFranchiseeId(franchiseeId);
                    car.setCarColor(eleven);
                    car.setCarBrandId(carBrandId);
                    car.setCarModelId(carModelId);
                    car.setCarLicensePlate(twelve);
                    car.setDrivingLicenseNumber(thirteen);
                    car.setAnnualInspectionTime(DateUtil.parseDate(fourteen));
                    car.setCommercialInsuranceTime(DateUtil.parseDate(fifteen));
                    car.setInsertTime(new Date());
                    car.setState(1);
                    if (ShiroKit.getUser().getRoleType() == 1){
                        car.setAddType(2);
                    }else if (ShiroKit.getUser().getRoleType() == 2){
                        car.setAddType(3);
                        car.setAddObjectId(ShiroKit.getUser().getObjectId());
                    }else if (ShiroKit.getUser().getRoleType() == 3){
                        car.setAddType(4);
                        car.setAddObjectId(ShiroKit.getUser().getObjectId());
                    }
                    tCarService.insert(car);
 
                    //添加专车服务模式
                    if ("是".equals(three)){
                        TCarService service = new TCarService();
                        service.setCarId(car.getId());
                        service.setType(1);
                        tCarServiceService.insert(service);
                    }
//                    //添加出租车服务模式
//                    if ("是".equals(four)){
//                        TCarService service = new TCarService();
//                        service.setCarId(car.getId());
//                        service.setType(2);
//                        tCarServiceService.insert(service);
//                    }
//                    //添加跨城出行服务模式
//                    if ("是".equals(five)){
//                        TCarService service = new TCarService();
//                        service.setCarId(car.getId());
//                        service.setType(3);
//                        tCarServiceService.insert(service);
//                    }
                    //添加小件同城物流服务模式
                    if ("是".equals(six)){
                        TCarService service = new TCarService();
                        service.setCarId(car.getId());
                        service.setType(4);
                        tCarServiceService.insert(service);
                    }
//                    //添加小件跨城物流服务模式
//                    if ("是".equals(seven)){
//                        TCarService service = new TCarService();
//                        service.setCarId(car.getId());
//                        service.setType(5);
//                        tCarServiceService.insert(service);
//                    }
//                    //添加包车服务模式
//                    if ("是".equals(eight)){
//                        TCarService service = new TCarService();
//                        service.setCarId(car.getId());
//                        service.setType(6);
//                        tCarServiceService.insert(service);
//                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return SUCCESS_TIP;
    }
 
    /**
     * 判断日期是否满足yyyy-MM-dd格式
     * @param str
     * @return
     */
    public static boolean isValidDate(String str) {
        boolean convertSuccess=true;
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            format.setLenient(false);
            format.parse(str);
        } catch (Exception e) {
            convertSuccess=false;
        }
        return convertSuccess;
    }
 
 
    /**
     * 转换日期
     * @return
     */
    public static String importByExcelForDate(String value) {//value就是它的天数
        String currentCellValue = "";
        if(value != null && !value.equals("")){
            Calendar calendar = new GregorianCalendar(1900,0,-1);
            Date d = calendar.getTime();
            Date dd = DateUtils.addDays(d,Integer.valueOf(value));
            DateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
            currentCellValue = formater.format(dd);
        }
        return currentCellValue;
    }
 
    /**
     *  导出车辆信息
     */
    @RequestMapping(value = "/outCar")
    public void outCar(HttpServletRequest request, HttpServletResponse response) {
        List<Map<String,Object>> listMap = tCarService.getCarListNoPage(ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId());
 
        // 表格数据【封装】
        List<List<String>> dataList = new ArrayList<>();
 
        //第一行显示【封装】
        List<String> twoList = new ArrayList<String>();
        twoList.add("总计:");
        twoList.add(String.valueOf(listMap.size())+"条");
        dataList.add(twoList);
 
        // 列【封装】
        List<String> shellList = new ArrayList<String>();
        shellList.add("添加时间");
        shellList.add("车辆ID");
        shellList.add("所属分公司");
        shellList.add("所属加盟商");
        shellList.add("车辆品牌");
        shellList.add("车辆类型");
        shellList.add("颜色");
        shellList.add("服务模式");
        shellList.add("车牌号");
        shellList.add("roadworthiness sticker");
        shellList.add("座位数");
        shellList.add("关联司机");
        shellList.add("年检到期时间");
        shellList.add("商业保险到期时间");
        dataList.add(shellList);
 
        for (Map<String,Object> object : listMap){
            // 详细数据列【封装】
            shellList = new ArrayList<String>();
            if(SinataUtil.isNotEmpty(object.get("insertTime"))){
                shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("insertTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss"));
            }else{
                shellList.add("-");
            }
            shellList.add(String.valueOf(object.get("id")));
            if(SinataUtil.isNotEmpty(object.get("companyName"))){
                shellList.add(object.get("companyName").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("franchiseeName"))){
                shellList.add(object.get("franchiseeName").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("brandName"))){
                shellList.add(object.get("brandName").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("modelName"))){
                shellList.add(object.get("modelName").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("carColor"))){
                shellList.add(object.get("carColor").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("serverStr"))){
                shellList.add(object.get("serverStr").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("carLicensePlate"))){
                shellList.add(object.get("carLicensePlate").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("drivingLicenseNumber"))){
                shellList.add(object.get("drivingLicenseNumber").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("seat"))){
                shellList.add(object.get("seat").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("driverName"))){
                shellList.add(object.get("driverName").toString());
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("annualInspectionTime"))){
                shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("annualInspectionTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss"));
            }else{
                shellList.add("-");
            }
            if(SinataUtil.isNotEmpty(object.get("commercialInsuranceTime"))){
                shellList.add(DateUtil.formatDate(DateUtil.parse(object.get("commercialInsuranceTime").toString(),"YYYY-MM-dd HH:mm:ss.S"), "YYYY-MM-dd HH:mm:ss"));
            }else{
                shellList.add("-");
            }
            dataList.add(shellList);
        }
        try {
            // 调用工具类进行导出
            ExcelExportUtil.easySheet("车辆信息导出记录"+DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "车辆信息导出记录", dataList,request, response);
 
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
}