xuhy
2025-01-09 712f70b2936079a131ecb1e63c6d337171618cad
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
package com.stylefeng.guns.modular.system.controller.general;
import com.stylefeng.guns.modular.system.util.ExcelExportUtil;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.util.*;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ResultUtil;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
 
/**
* 车辆售卖
* @author pzb
* @Date 2022/5/30 19:31
*/
@Controller
@RequestMapping("/sellingCar")
public class SellingCarController {
 
    private String PREFIX = "/system/sellingCar/";
 
    @Autowired
    private ITCarBrandService carBrandService;
 
    @Autowired
    private ISellingCarService sellingCarService;
 
    @Autowired
    private ITRegionService regionService;
 
    @Autowired
    private ITUserService userService;
 
    @Autowired
    private ITDriverService driverService;
 
    @Autowired
    private ITCompanyService companyService;
 
 
    /**
     * 跳转到列表页
     * @return
     */
    @GetMapping("/showSellingCarList")
    public String showSellingCarList(Model model){
        List<TCarBrand> state = carBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("carBrand", state);
        model.addAttribute("userType", ShiroKit.getUser().getRoleType());
        return PREFIX + "sellingCar.html";
    }
 
    /**
     * 跳转到添加页
     * @param model
     * @return
     */
    @GetMapping("/sellingCar_add")
    public String sellingCar_add(Model model){
        model.addAttribute("push", ShiroKit.getUser().getRoleType() == 1 ? true : false);
        List<TCarBrand> state = carBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("carBrand", state);
        List<TRegion> regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
        model.addAttribute("regions", regions);
        regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", regions.get(0).getId()));
        model.addAttribute("city", regions);
        return PREFIX + "sellingCar_add.html";
    }
 
    /**
     * 跳转到编辑页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/sellingCar_update")
    public String sellingCar_update(Model model, Integer id){
        SellingCar sellingCar = sellingCarService.selectById(id);
        model.addAttribute("item", sellingCar);
        model.addAttribute("imgs", sellingCar.getImgUrl().split(","));
        model.addAttribute("videos", sellingCar.getVideoUrl().split(","));
        model.addAttribute("describeImgs", sellingCar.getDescribeImgUrl().split(","));
        model.addAttribute("push", ShiroKit.getUser().getRoleType() == 1 ? true : false);
        List<TCarBrand> state = carBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("carBrand", state);
        List<TRegion> regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
        model.addAttribute("regions", regions);
        regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", regionService.selectOne(new EntityWrapper<TRegion>().eq("code", sellingCar.getProvinceCode())).getId()));
        model.addAttribute("city", regions);
        List<String> list = Arrays.asList("GPS导航", "倒车影像", "定速巡航", "多媒体控制", "前雷达", "全景摄像头", "胎压监测", "氙气大灯", "车内氛围灯", "车载电视", "铝合金轮圈", "车载冰箱", "行车显示屏", "运动座椅");
        List<Map<String, Object>> data = new ArrayList<>();
        String[] split = sellingCar.getInstallationConfiguration().split(",");
        for (String s : list) {
            Map<String, Object> map = new HashMap<>();
            map.put("name", s);
            map.put("selected", false);
            for (String s1 : split) {
                if(s.equals(s1)){
                    map.put("selected", true);
                    break;
                }
            }
            data.add(map);
        }
        model.addAttribute("installationConfiguration", data);
        return PREFIX + "sellingCar_edit.html";
    }
 
    /**
     * 跳转到详情页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/showSellingCarInfo")
    public String showSellingCarInfo(Model model, Integer id){
        SellingCar sellingCar = sellingCarService.selectById(id);
        model.addAttribute("item", sellingCar);
        model.addAttribute("imgs", ToolUtil.isNotEmpty(sellingCar.getImgUrl()) ? sellingCar.getImgUrl().split(",") : 0);
        model.addAttribute("videos", ToolUtil.isNotEmpty(sellingCar.getVideoUrl()) ? sellingCar.getVideoUrl().split(",") : "");
        model.addAttribute("describeImgs", ToolUtil.isNotEmpty(sellingCar.getDescribeImgUrl()) ? sellingCar.getDescribeImgUrl().split(",") : "");
        List<TCarBrand> state = carBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("carBrand", state);
        List<TRegion> regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
        model.addAttribute("regions", regions);
        regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", regions.get(0).getId()));
        model.addAttribute("city", regions);
        List<String> list = Arrays.asList("GPS导航", "倒车影像", "定速巡航", "多媒体控制", "前雷达", "全景摄像头", "胎压监测", "氙气大灯", "车内氛围灯", "车载电视", "铝合金轮圈", "车载冰箱", "行车显示屏", "运动座椅");
        List<Map<String, Object>> data = new ArrayList<>();
        String[] split = sellingCar.getInstallationConfiguration().split(",");
        for (String s : list) {
            Map<String, Object> map = new HashMap<>();
            map.put("name", s);
            map.put("selected", false);
            for (String s1 : split) {
                if(s.equals(s1)){
                    map.put("selected", true);
                    break;
                }
            }
            data.add(map);
        }
        model.addAttribute("installationConfiguration", data);
        if(sellingCar.getUserType() == 1){
            TUser tUser = userService.selectById(sellingCar.getUserId());
            model.addAttribute("pushUser", tUser.getName());
            model.addAttribute("pushUserPhone", tUser.getPhone());
        }
        if(sellingCar.getUserType() == 2){
            TDriver tDriver = driverService.selectById(sellingCar.getUserId());
            model.addAttribute("pushUser", tDriver.getName());
            model.addAttribute("pushUserPhone", tDriver.getPhone());
        }
        if(sellingCar.getUserType() == 3){
            TCompany tCompany = companyService.selectById(sellingCar.getUserId());
            model.addAttribute("pushUser", tCompany.getName());
            model.addAttribute("pushUserPhone", tCompany.getPrincipalPhone());
        }
        return PREFIX + "sellingCar_info.html";
    }
 
 
    /**
     * 跳转到审核页面
     * @return
     */
    @GetMapping("/showAuditSellingCar")
    public String showAuditSellingCar(Model model){
        List<TCarBrand> state = carBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("carBrand", state);
        return PREFIX + "auditSellingCar.html";
    }
 
 
    /**
     * 跳转到审核详情页
     * @param model
     * @param id
     * @return
     */
    @GetMapping("/showAuditSellingCar_info")
    public String showAuditSellingCar_info(Model model, Integer id){
        SellingCar sellingCar = sellingCarService.selectById(id);
        model.addAttribute("item", sellingCar);
        model.addAttribute("imgs", ToolUtil.isNotEmpty(sellingCar.getImgUrl()) ? sellingCar.getImgUrl().split(",") : 0);
        model.addAttribute("videos", ToolUtil.isNotEmpty(sellingCar.getVideoUrl()) ? sellingCar.getVideoUrl().split(",") : "");
        model.addAttribute("describeImgs", ToolUtil.isNotEmpty(sellingCar.getDescribeImgUrl()) ? sellingCar.getDescribeImgUrl().split(",") : "");
        List<TCarBrand> state = carBrandService.selectList(new EntityWrapper<TCarBrand>().eq("state", 1));
        model.addAttribute("carBrand", state);
        List<TRegion> regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0));
        model.addAttribute("regions", regions);
        regions = regionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", regions.get(0).getId()));
        model.addAttribute("city", regions);
        List<String> list = Arrays.asList("GPS导航", "倒车影像", "定速巡航", "多媒体控制", "前雷达", "全景摄像头", "胎压监测", "氙气大灯", "车内氛围灯", "车载电视", "铝合金轮圈", "车载冰箱", "行车显示屏", "运动座椅");
        List<Map<String, Object>> data = new ArrayList<>();
        String[] split = sellingCar.getInstallationConfiguration().split(",");
        for (String s : list) {
            Map<String, Object> map = new HashMap<>();
            map.put("name", s);
            map.put("selected", false);
            for (String s1 : split) {
                if(s.equals(s1)){
                    map.put("selected", true);
                    break;
                }
            }
            data.add(map);
        }
        model.addAttribute("installationConfiguration", data);
        if(sellingCar.getUserType() == 1){
            TUser tUser = userService.selectById(sellingCar.getUserId());
            model.addAttribute("pushUser", tUser.getName());
            model.addAttribute("pushUserPhone", tUser.getPhone());
        }
        if(sellingCar.getUserType() == 2){
            TDriver tDriver = driverService.selectById(sellingCar.getUserId());
            model.addAttribute("pushUser", tDriver.getName());
            model.addAttribute("pushUserPhone", tDriver.getPhone());
        }
        if(sellingCar.getUserType() == 3){
            TCompany tCompany = companyService.selectById(sellingCar.getUserId());
            model.addAttribute("pushUser", tCompany.getName());
            model.addAttribute("pushUserPhone", tCompany.getPrincipalPhone());
        }
        return PREFIX + "auditSellingCar_info.html";
    }
 
 
 
    /**
     * 获取列表数据
     * @param createTime
     * @param title
     * @param brandId
     * @param insertUser
     * @param status
     * @param userType
     * @param offset
     * @param limit
     * @return
     */
    @ResponseBody
    @PostMapping("/list")
    public Object list(String createTime, String carLicensePlate, Integer brandId, String insertUser, Integer status, Integer userType, Integer offset, Integer limit){
        try {
            List<Integer> state = Arrays.asList(2, 3, 4);
            if(null != status){
                state = Arrays.asList(status);
            }
            return sellingCarService.list(createTime, carLicensePlate, brandId, insertUser, state, userType, offset, limit);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 添加数据
     * @param sellingCar
     * @return
     */
    @ResponseBody
    @PostMapping("/addSellingCar")
    public ResultUtil addSellingCar(SellingCar sellingCar){
        try {
            return sellingCarService.addSellingCar(sellingCar);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 修改数据
     * @param sellingCar
     * @return
     */
    @ResponseBody
    @PostMapping("/updateSellingCar")
    public ResultUtil updateSellingCar(SellingCar sellingCar){
        try {
            return sellingCarService.updateSellingCar(sellingCar);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 删除数据
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/deleteSellingCar")
    public ResultUtil deleteSellingCar(Integer id){
        try {
            SellingCar sellingCar = sellingCarService.selectById(id);
            sellingCar.setStatus(6);
            sellingCarService.updateById(sellingCar);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 上架操作
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/onlineSellingCar")
    public ResultUtil onlineSellingCar(Integer id){
        try {
            SellingCar sellingCar = sellingCarService.selectById(id);
            if(sellingCar.getStatus() == 1){
                return ResultUtil.error("该数据还未审核");
            }
            if(sellingCar.getStatus() == 2){
                return ResultUtil.error("不允许重复操作");
            }
            sellingCar.setStatus(2);
            sellingCarService.updateById(sellingCar);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 下架操作
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/offlineSellingCar")
    public ResultUtil offlineSellingCar(Integer id){
        try {
            SellingCar sellingCar = sellingCarService.selectById(id);
            if(sellingCar.getStatus() == 1){
                return ResultUtil.error("该数据还未审核");
            }
            if(sellingCar.getStatus() == 3){
                return ResultUtil.error("不允许重复操作");
            }
            sellingCar.setStatus(3);
            sellingCarService.updateById(sellingCar);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 设置首页推荐
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/homeSellingCar")
    public ResultUtil homeSellingCar(Integer id){
        try {
            SellingCar sellingCar = sellingCarService.selectById(id);
            if(sellingCar.getStatus() == 1){
                return ResultUtil.error("该数据还未审核");
            }
            if(sellingCar.getStatus() == 3){
                return ResultUtil.error("该数据已下架");
            }
            if(sellingCar.getStatus() == 4){
                return ResultUtil.error("该数据还未上架");
            }
            if(sellingCar.getFirstPageShow() == 1){
                return ResultUtil.error("不允许重复操作");
            }
            int i = sellingCarService.selectCount(new EntityWrapper<SellingCar>().in("status", Arrays.asList(2, 3)).eq("firstPageShow", 1));
            if(i >= 6){
                return ResultUtil.error("首页推荐最多设置6个");
            }
            sellingCar.setFirstPageShow(1);
            sellingCarService.updateById(sellingCar);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    /**
     * 取消首页推荐
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/cancelHomeSellingCar")
    public ResultUtil cancelHomeSellingCar(Integer id){
        try {
            SellingCar sellingCar = sellingCarService.selectById(id);
            if(sellingCar.getStatus() == 1){
                return ResultUtil.error("该数据还未审核");
            }
            if(sellingCar.getStatus() == 3){
                return ResultUtil.error("该数据已下架");
            }
            if(sellingCar.getStatus() == 4){
                return ResultUtil.error("该数据还未上架");
            }
            if(sellingCar.getFirstPageShow() == 2){
                return ResultUtil.error("不允许重复操作");
            }
            sellingCar.setFirstPageShow(2);
            sellingCarService.updateById(sellingCar);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 下载导入模板
     * @param request
     * @param response
     */
    @RequestMapping(value = "/uploadSellingCarModel")
    public void uploadSellingCarModel(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("上牌时间[2020-01-01]");
        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("变速箱");
        shellList.add("等级[微型车/小型车/紧凑型车/中型车/大中型车/大型车/小型SUV/紧凑型SUV/中型SUV/大中型SUV/大型SUV/紧凑型MVP/中型MVP/大中型MVP/大型MVP/跑车/皮卡/微面/轻客/微卡]");
        shellList.add("车辆售价[20.5]");
        shellList.add("是否包含过户费[是/否]");
        shellList.add("新车价格[20.5]");
        shellList.add("交强险到期时间[2020-01-01]");
        shellList.add("年检到期时间[2020-01-01]");
        shellList.add("商业险到期时间[2020-01-01]");
        shellList.add("是否有抵押(是/否)");
        shellList.add("加装配置[GPS导航,倒车影像,定速巡航,多媒体控制,前雷达,全景摄像头,胎压监测,氙气大灯,车内氛围灯,车载电视,铝合金轮圈,车载冰箱,行车显示屏,运动座椅]");
        shellList.add("剩余营运时间[2020-01-01]");
        shellList.add("营运更新时间[2020-01-01]");
        dataList.add(shellList);
 
        try {
            // 调用工具类进行导出
            ExcelExportUtil.easySheet("车辆出售导入模板"+ DateUtil.formatDate(new Date(), "YYYYMMddHHmmss"), "车辆出售导入模板", dataList, request, response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
    /**
     * 导入数据
     * @param request
     * @return
     */
    @ResponseBody
    @PostMapping("/importSellingCar")
    public ResultUtil importSellingCar(HttpServletRequest request){
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        MultipartFile file = (MultipartFile) multipartRequest.getFile("file");
        try {
            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(6);  //车牌号
                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(9);  //行驶里程
                String nine = null;
                if (SinataUtil.isNotEmpty(cell9)){
                    nine = String.valueOf(cell9.getStringCellValue()).trim();
                }
 
                Cell cell10 = row.getCell(10);  //描述
                String ten = null;
                if (SinataUtil.isNotEmpty(cell10)){
                    ten = String.valueOf(cell10.getStringCellValue()).trim();
                }
 
                Cell cell11 = row.getCell(11);  //描述图片地址
                String eleven = null;
                if (SinataUtil.isNotEmpty(cell11)){
                    eleven = String.valueOf(cell11.getStringCellValue()).trim();
                }
 
                Cell cell12 = row.getCell(12);  //联系人
                String twelve = null;
                if (SinataUtil.isNotEmpty(cell12)){
                    twelve = String.valueOf(cell12.getStringCellValue()).trim();
                }
 
                Cell cell13 = row.getCell(13);  //联系人电话
                String thirteen = null;
                if (SinataUtil.isNotEmpty(cell13)){
                    thirteen = String.valueOf(cell13.getStringCellValue()).trim();
                }
 
                Cell cell14 = row.getCell(14);  //省
                String fourteen = null;
                if (SinataUtil.isNotEmpty(cell14)){
                    fourteen = String.valueOf(cell14.getStringCellValue()).trim();
                }
 
                Cell cell15 = row.getCell(15);  //市
                String fifteen = null;
                if (SinataUtil.isNotEmpty(cell15)){
                    fifteen = String.valueOf(cell15.getStringCellValue()).trim();
                }
 
                Cell cell16 = row.getCell(16);  //详细地址
                String sixteen = null;
                if (SinataUtil.isNotEmpty(cell16)){
                    sixteen = String.valueOf(cell16.getStringCellValue()).trim();
                }
 
                Cell cell17 = row.getCell(17);  //车辆图片地址
                String seventeen = null;
                if (SinataUtil.isNotEmpty(cell17)){
                    seventeen = String.valueOf(cell17.getStringCellValue()).trim();
                }
 
                Cell cell18 = row.getCell(18);  //车辆视频地址
                String eighteen = null;
                if (SinataUtil.isNotEmpty(cell18)){
                    eighteen = String.valueOf(cell18.getStringCellValue()).trim();
                }
 
                Cell cell19 = row.getCell(19);  //牌照所在地
                String nineteen = null;
                if (SinataUtil.isNotEmpty(cell19)){
                    nineteen = String.valueOf(cell19.getStringCellValue()).trim();
                }
 
                Cell cell20 = row.getCell(20);  //过户次数
                String twenty = null;
                if (SinataUtil.isNotEmpty(cell20)){
                    twenty = String.valueOf(cell20.getStringCellValue()).trim();
                }
 
                Cell cell21 = row.getCell(21);  //排量
                String twentyOne = null;
                if (SinataUtil.isNotEmpty(cell21)){
                    twentyOne = String.valueOf(cell21.getStringCellValue()).trim();
                }
 
                Cell cell22 = row.getCell(22);  //变速箱
                String twentyTwo = null;
                if (SinataUtil.isNotEmpty(cell22)){
                    twentyTwo = String.valueOf(cell22.getStringCellValue()).trim();
                }
 
                Cell cell23 = row.getCell(23);  //等级
                String twentyThree = null;
                if (SinataUtil.isNotEmpty(cell23)){
                    twentyThree = String.valueOf(cell23.getStringCellValue()).trim();
                }
 
                Cell cell24 = row.getCell(24);  //车辆售价
                String twentyFour = null;
                if (SinataUtil.isNotEmpty(cell24)){
                    twentyFour = String.valueOf(cell24.getStringCellValue()).trim();
                }
 
                Cell cell25 = row.getCell(25);  //是否包含过户费(1=是,2=否)
                String twentyFive = null;
                if (SinataUtil.isNotEmpty(cell25)){
                    twentyFive = String.valueOf(cell25.getStringCellValue()).trim();
                }
 
                Cell cell26 = row.getCell(26);  //新车价格
                String twentySix = null;
                if (SinataUtil.isNotEmpty(cell26)){
                    twentySix = String.valueOf(cell26.getStringCellValue()).trim();
                }
 
                Cell cell27 = row.getCell(27);  //交强险到期时间
                String twentySeven = null;
                if (SinataUtil.isNotEmpty(cell27)){
                    twentySeven = String.valueOf(cell27.getStringCellValue()).trim();
                }
 
                Cell cell28 = row.getCell(28);  //年检到期时间
                String twentyEight = null;
                if (SinataUtil.isNotEmpty(cell28)){
                    twentyEight = String.valueOf(cell28.getStringCellValue()).trim();
                }
 
                Cell cell29 = row.getCell(29);  //商业险到期时间
                String twentyNine = null;
                if (SinataUtil.isNotEmpty(cell29)){
                    twentyNine = String.valueOf(cell29.getStringCellValue()).trim();
                }
 
                Cell cell30 = row.getCell(30);  //是否有抵押
                String thirty = null;
                if (SinataUtil.isNotEmpty(cell30)){
                    thirty = String.valueOf(cell30.getStringCellValue()).trim();
                }
 
                Cell cell31 = row.getCell(31);  //加装配置
                String thirtyOne = null;
                if (SinataUtil.isNotEmpty(cell31)){
                    thirtyOne = String.valueOf(cell31.getStringCellValue()).trim();
                }
 
                Cell cell32 = row.getCell(32);  //剩余营运时间
                String thirtyTwo = null;
                if (SinataUtil.isNotEmpty(cell32)){
                    thirtyTwo = String.valueOf(cell32.getStringCellValue()).trim();
                }
 
                Cell cell33 = row.getCell(33);  //营运更新时间
                String thirtyThree = null;
                if (SinataUtil.isNotEmpty(cell33)){
                    thirtyThree = String.valueOf(cell33.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) || SinataUtil.isEmpty(sixteen)
                        || SinataUtil.isEmpty(seventeen) || SinataUtil.isEmpty(eighteen) || SinataUtil.isEmpty(nineteen)
                        || SinataUtil.isEmpty(twenty) || SinataUtil.isEmpty(twentyOne) || SinataUtil.isEmpty(twentyTwo)
                        || SinataUtil.isEmpty(twentyThree) || SinataUtil.isEmpty(twentyFour) || SinataUtil.isEmpty(twentyFive)
                        || SinataUtil.isEmpty(twentySix) || SinataUtil.isEmpty(twentySeven) || SinataUtil.isEmpty(twentyEight)
                        || SinataUtil.isEmpty(twentyNine) || SinataUtil.isEmpty(thirty)){
                    return ResultUtil.error("单元格不能为空");
                }else{
                    //判断所属机构
                    if (!zero.equals("用户") && !zero.equals("司机") && !zero.equals("企业")){
                        return ResultUtil.error("用户类型不正确");
                    }
 
                    Integer userType = 0;
                    Integer userId = null;
                    if("用户".equals(zero)){
                        TUser tUser = userService.selectOne(new EntityWrapper<TUser>().eq("phone", one).eq("flag", 1));
                        if(null == tUser){
                            return ResultUtil.error("用户手机号不正确");
                        }
                        userType = 1;
                        userId = tUser.getId();
                    }
                    if("司机".equals(zero)){
                        TDriver tDriver = driverService.selectOne(new EntityWrapper<TDriver>().eq("phone", one).eq("flag", 1));
                        if(null == tDriver){
                            return ResultUtil.error("司机手机号不正确");
                        }
                        userType = 2;
                        userId = tDriver.getId();
                    }
                    if("企业".equals(zero)){
                        TCompany tCompany = companyService.selectOne(new EntityWrapper<TCompany>().eq("name", one).eq("flag", 1));
                        if(null == tCompany){
                            return ResultUtil.error("企业名称不正确");
                        }
                        userType = 3;
                        userId = tCompany.getId();
                    }
 
                    TCarBrand tCarBrand = carBrandService.selectOne(new EntityWrapper<TCarBrand>().eq("name", three).eq("state", 1));
                    if(null == tCarBrand){
                        return ResultUtil.error("品牌名称不正确");
                    }
                    TRegion province = regionService.selectOne(new EntityWrapper<TRegion>().eq("name", fifteen));
                    if(null == province){
                        return ResultUtil.error("省名称不正确");
                    }
                    TRegion city = regionService.selectOne(new EntityWrapper<TRegion>().eq("name", sixteen));
                    if(null == city){
                        return ResultUtil.error("市名称不正确");
                    }
 
                    if(!"是".equals(twentyFive) && !"否".equals(twentyFive)){
                        return ResultUtil.error("是否包含过户费内容不正确");
                    }
                    if(!"是".equals(thirty) && !"否".equals(thirty)){
                        return ResultUtil.error("是否包含过户费内容不正确");
                    }
 
                    if("营运".equals(four)){
                        if(SinataUtil.isEmpty(thirtyTwo)){
                            return ResultUtil.error("剩余营运时间不能为空");
                        }
                        if(SinataUtil.isEmpty(thirtyThree)){
                            return ResultUtil.error("营运更新时间不能为空");
                        }
                    }
 
                    SellingCar sellingCar = new SellingCar();
                    sellingCar.setUserType(userType);
                    sellingCar.setUserId(userId);
                    sellingCar.setTitle(two);
                    sellingCar.setBrandId(tCarBrand.getId());
                    sellingCar.setBrandName(three);
                    sellingCar.setCategory("非营运".equals(four) ? 1 : 2);
                    sellingCar.setCarIdentificationCode(five);
                    sellingCar.setCarLicensePlate(six);
                    sellingCar.setCarColor(seven);
                    sellingCar.setLicensingTime(eight);
                    sellingCar.setMileage(nine);
                    sellingCar.setDescribe(ten);
                    sellingCar.setDescribeImgUrl(eleven);
                    sellingCar.setContactsPhone(thirteen);
                    sellingCar.setContactsName(twelve);
                    sellingCar.setProvinceCode(province.getCode());
                    sellingCar.setCityCode(city.getCode());
                    sellingCar.setProvinceName(province.getName());
                    sellingCar.setCityName(city.getName());
                    sellingCar.setCreateTime(new Date());
                    sellingCar.setStatus(1);
                    sellingCar.setAddres(sixteen);
                    sellingCar.setImgUrl(seventeen);
                    sellingCar.setVideoUrl(eighteen);
                    sellingCar.setLocationOfLicensePlate(nineteen);
                    sellingCar.setTransferTimes(twenty);
                    sellingCar.setDisplacement(twentyOne);
                    sellingCar.setTransmissionCase(twentyTwo);
                    sellingCar.setLevel(twentyThree);
                    sellingCar.setTransferPrice(Double.valueOf(twentyFour));
                    sellingCar.setIncludingTransferFee("是".equals(twentyFive) ? 1 : 2);
                    sellingCar.setNewCarPrice(Double.valueOf(twentySix));
                    sellingCar.setDueTimeOfCompulsoryInsurance(twentySeven);
                    sellingCar.setExpirationTimeOfAnnualInspection(twentyEight);
                    sellingCar.setMaturityTimeOfCommercialInsurance(twentyNine);
                    sellingCar.setMortgage("是".equals(thirty) ? 1 : 2);
                    sellingCar.setInstallationConfiguration(thirtyOne);
                    sellingCar.setRemainingOperationTime(thirtyTwo);
                    sellingCar.setOperationUpdateTime(thirtyThree);
                    sellingCar.setFirstPageShow(2);
                    sellingCarService.insert(sellingCar);
                }
            }
            return ResultUtil.success();
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
 
    /**
     * 获取车辆出租审核列表
     * @param createTime
     * @param title
     * @param brandId
     * @param insertUser
     * @param status
     * @param userType
     * @param offset
     * @param limit
     * @return
     */
    @ResponseBody
    @PostMapping("/listAuditSellingCar")
    public Object listAuditSellingCar(String createTime, String carLicensePlate, Integer brandId, String insertUser, Integer status, Integer userType, Integer offset, Integer limit){
        try {
            List<Integer> state = Arrays.asList(1, 5);
            if(null != status){
                state = Arrays.asList(status);
            }
            return sellingCarService.list(createTime, carLicensePlate, brandId, insertUser, state, userType, offset, limit);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    /**
     * 审核操作
     * @param id
     * @param status
     * @param authRemark
     * @return
     */
    @ResponseBody
    @PostMapping("/auditSellingCar")
    public ResultUtil auditSellingCar(Integer id, Integer status, String authRemark){
        try {
            return sellingCarService.auditSellingCar(id, status, authRemark);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
}