puzhibing
2022-09-29 e28d33c09405e246a2d75fcb1f69a9e8e9d911b8
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCarController.java
@@ -13,10 +13,8 @@
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.PushMinistryOfTransportUtil;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import org.apache.commons.lang.time.DateUtils;
import org.apache.poi.hdf.extractor.TC;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
@@ -78,9 +76,6 @@
    @Autowired
    private ITServerCarmodelService itServerCarmodelService;
    @Autowired
    private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
    @Resource
    private CarInsuranceMapper carInsuranceMapper;
@@ -318,24 +313,8 @@
    public ResultUtil saveCarInsurance(CarInsurance carInsurance){
        if(carInsurance.getId() == null){
            carInsuranceMapper.insert(carInsurance);
            new Thread(new Runnable() {
                @Override
                public void run() {
                    if(pushMinistryOfTransport){//上传数据
                        pushMinistryOfTransportUtil.baseInfoVehicleInsurance(carInsurance.getId(), 1);
                    }
                }
            }).start();
        }else{
            carInsuranceMapper.updateById(carInsurance);
            new Thread(new Runnable() {
                @Override
                public void run() {
                    if(pushMinistryOfTransport){//上传数据
                        pushMinistryOfTransportUtil.baseInfoVehicleInsurance(carInsurance.getId(), 2);
                    }
                }
            }).start();
        }
        return ResultUtil.success();
@@ -386,14 +365,6 @@
    @RequestMapping(value = "/delCarInsurance", method = RequestMethod.POST)
    public ResultUtil delCarInsurance(Integer id){
        carInsuranceMapper.deleteById(id);
        new Thread(new Runnable() {
            @Override
            public void run() {
                if(pushMinistryOfTransport){//上传数据
                    pushMinistryOfTransportUtil.baseInfoVehicleInsurance(id, 3);
                }
            }
        }).start();
        return ResultUtil.success();
    }
@@ -512,16 +483,6 @@
            }
            tCarServiceService.insert(service);
        }
        new Thread(new Runnable() {
            @Override
            public void run() {
                if(pushMinistryOfTransport){//上传数据
                    pushMinistryOfTransportUtil.baseInfoCompanyStat();
                    pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId());
                }
            }
        }).start();
        return SUCCESS_TIP;
    }
@@ -541,16 +502,6 @@
            obj.setCarId(null);
            tDriverService.updateById(obj);
        }
        new Thread(new Runnable() {
            @Override
            public void run() {
                if(pushMinistryOfTransport){//上传数据
                    pushMinistryOfTransportUtil.baseInfoCompanyStat();
                    pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId());
                }
            }
        }).start();
        return SUCCESS_TIP;
    }
@@ -608,14 +559,6 @@
        }
        tCarService.updateById(tCar);
        new Thread(new Runnable() {
            @Override
            public void run() {
                if(pushMinistryOfTransport){
                    pushMinistryOfTransportUtil.baseInfoVehicle(tCar.getId());
                }
            }
        }).start();
        return SUCCESS_TIP;
    }
    @RequestMapping(value = "/updateAuth")
@@ -663,16 +606,16 @@
        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("车辆类型");
        shellList.add("车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]");
        shellList.add("车牌号");
        shellList.add("行驶证编号");
        shellList.add("roadworthiness sticker");
        shellList.add("年检到期时间[例如 2020-02-02]");
        shellList.add("商业保险到期时间[例如 2020-02-02]");
        dataList.add(shellList);
@@ -732,81 +675,81 @@
                    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 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 cell5 = row.getCell(5);  //服务模式:跨城出行[是/否]
                String five = null;
                if (SinataUtil.isNotEmpty(cell5)){
                    five = String.valueOf(cell5.getStringCellValue()).trim();
                }
                Cell cell6 = row.getCell(6);  //服务模式:小件跨城物流[是/否]
                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 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 cell8 = row.getCell(8);  //服务模式:包车[是/否]
                String eight = null;
                if (SinataUtil.isNotEmpty(cell8)){
                    eight = String.valueOf(cell8.getStringCellValue()).trim();
                }
                Cell cell9 = row.getCell(9);  //车辆品牌
                Cell cell9 = row.getCell(5);  //车辆品牌
                String nine = null;
                if (SinataUtil.isNotEmpty(cell9)){
                    nine = String.valueOf(cell9.getStringCellValue()).trim();
                }
                Cell cell10 = row.getCell(10);  //车辆类型
                Cell cell10 = row.getCell(6);  //车辆类型
                String ten = null;
                if (SinataUtil.isNotEmpty(cell10)){
                    ten = String.valueOf(cell10.getStringCellValue()).trim();
                }
                Cell cell11 = row.getCell(11);  //车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]
                Cell cell11 = row.getCell(7);  //车辆颜色[黑色/银色/白色/红色/黄色/橙色/蓝色]
                String eleven = null;
                if (SinataUtil.isNotEmpty(cell11)){
                    eleven = String.valueOf(cell11.getStringCellValue()).trim();
                }
                Cell cell12 = row.getCell(12);  //车牌号
                Cell cell12 = row.getCell(8);  //车牌号
                String twelve = null;
                if (SinataUtil.isNotEmpty(cell12)){
                    twelve = String.valueOf(cell12.getStringCellValue()).trim();
                }
                Cell cell13 = row.getCell(13);  //行驶证编号
                Cell cell13 = row.getCell(9);  //行驶证编号
                String thirteen = null;
                if (SinataUtil.isNotEmpty(cell13)){
                    thirteen = String.valueOf(cell13.getStringCellValue()).trim();
                }
                Cell cell14 = row.getCell(14);  //年检到期时间
                Cell cell14 = row.getCell(10);  //年检到期时间
                String fourteen = null;
                if (SinataUtil.isNotEmpty(cell14)){
                    fourteen = String.valueOf(cell14.getStringCellValue()).trim();
                }
                Cell cell15 = row.getCell(15);  //商业保险到期时间
                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)
                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, "单元格不能为空");
@@ -819,26 +762,26 @@
                    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 (!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 (!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, "车辆颜色内容不正确");
@@ -934,20 +877,20 @@
                        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(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();
@@ -955,20 +898,20 @@
                        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);
                    }
//                    //添加小件跨城物流服务模式
//                    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) {
@@ -1038,7 +981,7 @@
        shellList.add("颜色");
        shellList.add("服务模式");
        shellList.add("车牌号");
        shellList.add("行驶证号码");
        shellList.add("roadworthiness sticker");
        shellList.add("座位数");
        shellList.add("关联司机");
        shellList.add("年检到期时间");