jialh
1 天以前 dd6687b118561100e1677e88a9c2f5842a54c531
service-job/src/main/java/com/java110/job/importData/adapt/ImportOwnerCarQueueV2DataAdapt.java
@@ -121,11 +121,11 @@
                OwnerCarDto ownerCarDto = null;
                doImportData(assetImportLogDetailDto,ownerCarDto);
                updateImportLogDetailState(assetImportLogDetailDto.getDetailId());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
//                try {
//                    Thread.sleep(500);
//                } catch (InterruptedException e) {
//                    throw new RuntimeException(e);
//                }
            } catch (Exception e) {
                e.printStackTrace();
@@ -158,14 +158,14 @@
        String otherItem = data.getString("otherItem");
        data.put("otherItem", null);
        ownerCarDto = BeanConvertUtil.covertBean(data, OwnerCarDto.class);
        if (ownerCarDto.getOwnerName() == null || "".equals(ownerCarDto.getOwnerName())) {
        {
            RoomDto roomDto = new RoomDto();
            roomDto.setRoadName(ownerCarDto.getRoadName());
            roomDto.setFloorNum(ownerCarDto.getFloorNum());
            roomDto.setCommunityId(ownerCarDto.getCommunityId());
            roomDto.setUnitNum(ownerCarDto.getUnitNum());
            roomDto.setRoomNum(ownerCarDto.getRoomNum());
            if (Vtil.defaultValue(roomDto.getRoomNum()).equals("")){
            if (Vtil.defaultValue(roomDto.getRoomNum()) == null){
                roomDto.setPropertyType("商铺");
            }
            List<RoomDto> roomDtos = iroomInnerServiceSMOImpl.queryRooms(roomDto);
@@ -195,18 +195,6 @@
                    }
                }
            }
        } else {
            OwnerDto ownerDto = new OwnerDto();
            ownerDto.setName(ownerCarDto.getOwnerName());
            ownerDto.setCommunityId(ownerCarDto.getCommunityId());
            List<OwnerDto> ownerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto);
            if (ownerDtos.isEmpty()) {
                ownerCarDto.setRemark("未查询到业主:" + ownerCarDto.getOwnerName());
            } else if (ownerDtos.size() > 1) {
                ownerCarDto.setRemark("存在多个业主:" + ownerCarDto.getOwnerName());
            } else {
                ownerCarDto.setOwnerId(ownerDtos.get(0).getOwnerId());
            }
        }
        ownerCarDto.setOtherItem(o);
        ownerCarDto.setLeaseType("H");
@@ -235,7 +223,7 @@
        carDto.setCarNum(ownerCarDto.getCarNum());
        communityDto.setCommunityCode(defaultValue(os[1]));
        communityDto.setName(defaultValue(os[2]));
        if (communityDto.getCommunityCode().equals("") && communityDto.getName().equals("")) {
        if (communityDto.getCommunityCode() == null && communityDto.getName() == null) {
            throw new IllegalArgumentException("导入失败:小区编码和小区名称都为空");
        }
        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
@@ -288,10 +276,10 @@
//        }
        ownerCarPo.setCarTypeCd("1001"); //默认主车辆
        int i1 = ownerCarInnerServiceSMOImpl.queryOwnerCarsCount(carDto);
        if (i1 > 0) {
            carDto.setOwnerId(ownerCarDto.getOwnerId());
            carDto.setCommunityId(ownerCarDto.getCommunityId());
            carDto.setParkingType(Vtil.defaultValue(os[13]));
            carDto.setCarNum(null);
            carDto.setCarNumLikeRight_(ownerCarDto.getCarNum());
@@ -302,11 +290,7 @@
            carDto.setCarTypeCd(ownerCarPo.getCarTypeCd());
            carDto.setUnitPricePerMonth(defaultValue(os[18]));
            int i2 = ownerCarInnerServiceSMOImpl.queryOwnerCarsCount(carDto);
            if (i2 > 0) {
                throw new IllegalArgumentException("重复的车辆:" + ownerCarDto.getCarNum());
            } else {
                ownerCarDto.setCarNum(ownerCarDto.getCarNum() + "_" + i1);
            }
            ownerCarPo.setCarNum(ownerCarDto.getCarNum() + "_" + (i2 + 1));
        }
@@ -598,7 +582,11 @@
        //导入车辆
        saveFee(ownerCarPo, os, ownerCarDto, assetImportLogDetailDto);
        if (Vtil.processCount(ownerCarPo.getUnitPricePerMonth(), 2, null) == null) {
            ownerCarPo.setRemark(Vtil.defaultValue(ownerCarPo.getRemark(), "") + "\n未传入收费单价");
        }else {
            saveFee(ownerCarPo, os, ownerCarDto, assetImportLogDetailDto);
        }
        ownerCarPo.setParkingType(Vtil.defaultValue(os[12]));
        ownerCarPo.setRoadName(defaultValue(os[3]));
@@ -606,7 +594,30 @@
        ownerCarPo.setUnitNum(defaultValue(os[5]));
        ownerCarPo.setRoomNum(defaultValue(os[6]));
        ownerCarPo.setParkingLocation(defaultValue(os[12]));
        ownerCarV1InnerServiceSMOImpl.saveOwnerCar(ownerCarPo);
        try {
            ownerCarV1InnerServiceSMOImpl.saveOwnerCar(ownerCarPo);
        } catch (Exception e) {
            if (e.getMessage().contains("for column 'end_time' at row 1")){
                ownerCarPo.setRemark(Vtil.defaultValue(ownerCarPo.getRemark(), "") + "\n注销日期:" + ownerCarPo.getEndTime() + "格式错误");
                ownerCarPo.setEndTime(null);
                try {
                    ownerCarV1InnerServiceSMOImpl.saveOwnerCar(ownerCarPo);
                } catch (Exception e2) {
                    if (e2.getMessage().contains("for column 'start_time' at row 1")) {
                        ownerCarPo.setRemark(Vtil.defaultValue(ownerCarPo.getRemark(), "") + "\n启用日期:" + ownerCarPo.getStartTime() + "格式错误");
                        ownerCarPo.setStartTime(null);
                        ownerCarV1InnerServiceSMOImpl.saveOwnerCar(ownerCarPo);
                    }
                }
            }
            else if (e.getMessage().contains("for column 'start_time' at row 1")){
                ownerCarPo.setRemark(Vtil.defaultValue(ownerCarPo.getRemark(), "") + "\n启用日期:" + ownerCarPo.getStartTime() + "格式错误");
                ownerCarPo.setStartTime(null);
                ownerCarV1InnerServiceSMOImpl.saveOwnerCar(ownerCarPo);
            }
        }
        ParkingSpacePo parkingSpacePo = new ParkingSpacePo();
        parkingSpacePo.setPsId(psId); //车位id
        parkingSpacePo.setState(ownerCarDto.getSpaceSate());
@@ -621,11 +632,12 @@
            feeConfigDto.setSquarePrice(Vtil.processCount(ownerCarPo.getUnitPricePerMonth(), 2, null));
            feeConfigDto.setFeeTypeCds(new String[]{"630000003","630000004","630000005"});
            if (feeConfigDto.getSquarePrice() == null) {
                throw new IllegalArgumentException("未传入收费单价");
                throw new IllegalArgumentException(Vtil.defaultValue(ownerCarPo.getRemark(), "") + "未传入收费单价");
            }
            feeDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
            if (feeDtos.isEmpty()) {
                throw new IllegalArgumentException("单价`"+ownerCarPo.getUnitPricePerMonth()+"`未查询到收费项");
                ownerCarPo.setRemark("单价`"+ownerCarPo.getUnitPricePerMonth()+"`未查询到收费项");
                return;
            } else if (feeDtos.size() > 1) {
                switch (Vtil.defaultValue(os[12])) {
                    case "地面停车": feeConfigDto.setFeeTypeCd("630000003");break;
@@ -635,7 +647,11 @@
                feeDtos.removeIf(feeConfigDto1 -> !feeConfigDto1.getFeeTypeCd().equals(feeConfigDto.getFeeTypeCd()));
            }
            if (feeDtos.size() > 1) {
            if (feeDtos.isEmpty()) {
                ownerCarPo.setRemark("单价`"+ownerCarPo.getUnitPricePerMonth()+"`未查询到收费项");
                return;
            }
            else if (feeDtos.size() > 1) {
                throw new IllegalArgumentException("系统错误,查询到的费用项超过一个");
            }
        }