| | |
| | | @ResponseBody |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public Object addDemand(@RequestBody DemandDto demandDto) throws Exception { |
| | | Integer userId1 = demandDto.getUserId(); |
| | | |
| | | TUser tUser1 = userService.selectById(userId1); |
| | | if(tUser1.getPhone()==null){ |
| | | return new ErrorTip(5008,"It is necessary to complete the information before issuing the quotation demand"); |
| | | } |
| | | |
| | | |
| | | int breakNum=0; |
| | | // 计数 |
| | |
| | | tQuote.setUserId(demandDto.getUserId()); |
| | | quoteService.insert(tQuote); |
| | | |
| | | List<TUserFeeSetting> tUserFeeSettings=null; |
| | | //获取当前用户的sale |
| | | Integer userId = demandDto.getUserId(); |
| | | TUser tUser = userService.selectById(userId); |
| | | if(tUser.getGroupId()!=null){ |
| | | TGroup tGroup = groupService.selectById(tUser.getGroupId()); |
| | | tUserFeeSettings = userFeeSettingService.selectList(new EntityWrapper<TUserFeeSetting>().eq("user_id",tGroup.getSalesId())); |
| | | |
| | | } |
| | | // List<TUserFeeSetting> tUserFeeSettings=null; |
| | | // //获取当前用户的sale |
| | | // Integer userId = demandDto.getUserId(); |
| | | // TUser tUser = userService.selectById(userId); |
| | | // if(tUser.getGroupId()!=null){ |
| | | // TGroup tGroup = groupService.selectById(tUser.getGroupId()); |
| | | // tUserFeeSettings = userFeeSettingService.selectList(new EntityWrapper<TUserFeeSetting>().eq("user_id",tGroup.getSalesId())); |
| | | // |
| | | // } |
| | | |
| | | |
| | | String accessorialStr = demandDto.getAccessorialStr(); |
| | |
| | | } |
| | | |
| | | List<TCompanyService> companyServiceList = new ArrayList<>(); |
| | | |
| | | String accessorialStr1 = getStr(demandDto.getAccessorialStr()); |
| | | |
| | | |
| | | |
| | | |
| | | // |
| | | if(ToolUtil.isNotEmpty(demandDto.getAccessorialStr())){ |
| | | if(ToolUtil.isNotEmpty(accessorialStr1) && !"".equals(accessorialStr1)){ |
| | | for (Map.Entry<String, String> entry : map.entrySet()) { |
| | | if(!entry.getKey().equals("CTF")&& !entry.getKey().equals("URGENT FEE")&&!entry.getKey().equals("PIPERPASS")) { |
| | | companyServiceList.addAll(tCompanyServiceService.selectList(new EntityWrapper<TCompanyService>() |
| | |
| | | |
| | | List<TCompany> tCompanyList = new ArrayList<>(); |
| | | for (Integer companyId : companyIds) { |
| | | List<TCompanyService> collect = companyServiceList.stream().filter(company -> company.getCompanyId().equals(companyId)).collect(Collectors.toList()); |
| | | if(map.size() == collect.size()){ |
| | | // 找出符合规则的公司 |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("status", 1) |
| | | .eq("id",companyId).eq("work",1)); |
| | | if(Objects.nonNull(company)){ |
| | | tCompanyList.add(company); |
| | | } |
| | | // List<TCompanyService> collect = companyServiceList.stream().filter(company -> company.getCompanyId().equals(companyId)).collect(Collectors.toList()); |
| | | // if(map.size() == collect.size()){ |
| | | // 找出符合规则的公司 |
| | | TCompany company = tCompanyService.selectOne(new EntityWrapper<TCompany>().eq("status", 1) |
| | | .eq("id",companyId).eq("work",1)); |
| | | if(Objects.nonNull(company)){ |
| | | tCompanyList.add(company); |
| | | } |
| | | // } |
| | | } |
| | | |
| | | // 符合规则的公司id集合 |
| | |
| | | Integer portId = demandDto.getPortId(); |
| | | TPort tPort = itPortService.selectById(portId); |
| | | |
| | | GeocodeVo geocode = googleMapUtil.getGeocode(tPort.getAddress()); |
| | | |
| | | |
| | | // 获取码头上级id |
| | | TCountry city = countryService.selectById(tPort.getCity()); |
| | | TCountry state = countryService.selectById(city.getParentId()); |
| | |
| | | // 没有满足公司 |
| | | if(CollectionUtils.isEmpty(set)){ |
| | | quoteService.deleteById(tQuote.getId()); |
| | | return new ErrorTip(5001,"No truck company was matched to meet the demand"); |
| | | return new com.stylefeng.guns.modular.system.utils.tips.ErrorTip(5001,"No truck company was matched to meet the demand"); |
| | | }else { |
| | | List<TCompany> companies = companyService.selectList(new EntityWrapper<TCompany>().in("id", set)); |
| | | for (TCompany company : companies) { |
| | |
| | | if(tRates1!=null){ |
| | | ratesId=tRates1.getId(); |
| | | }else { |
| | | ratesId=tCountry.getId(); |
| | | tRates1 = ratesService.selectOne(new EntityWrapper<TRates>().eq("metro_id", tCountry.getId()).eq("type", 1).eq("company_id", company.getId())); |
| | | if(tRates1!=null){ |
| | | ratesId=tRates1.getId(); |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (GoodsListDto goodsListDto : list1) { |
| | |
| | | break; |
| | | } |
| | | ArrayList<TPrice> tPrices = new ArrayList<>(); |
| | | // 生成订单 |
| | | // TOrder tOrder = new TOrder(); |
| | | // tOrder.setUserId(demandDto.getUserId()); |
| | | // tOrder.setAccessorial(demandDto.getAccessorial()); |
| | | // tOrder.setAccessorialStr(demandDto.getAccessorialStr()); |
| | | // tOrder.setPort(demandDto.getPortId()); |
| | | // tOrder.setShipmentDate(demandDto.getShipmentDate()); |
| | | // tOrder.setDeliveryDate(demandDto.getDeliveryDate()); |
| | | // tOrder.seteZipZ(s1); |
| | | // tOrder.setCreateTime(new Date()); |
| | | // tOrder.setStartLat("1"); |
| | | // tOrder.setStartLon("1"); |
| | | // tOrder.setDeliveryStr(demandDto.getDelivery()); |
| | | // tOrder.setType(demandDto.getType()); |
| | | // tOrder.setZipCode(demandDto.getZipCode()); |
| | | // tOrder.setWarehouse(demandDto.getWarehouse()); |
| | | // tOrder.setStatus("0"); |
| | | // tOrder.setInvoiceNumber(s2); |
| | | // tOrder.setCompanyId(company.getId()); |
| | | // tOrder.setCreateTime(new Date()); |
| | | // orderService.insert(tOrder); |
| | | // tOrders.add(tOrder); |
| | | |
| | | List<GoodsDto> list = goodsListDto.getList(); |
| | | ArrayList<TGoods> tGoods1 = new ArrayList<>(); |
| | |
| | | TCompanyResp tCompanyResp = new TCompanyResp(); |
| | | if("0".equals(demandDto.getWarehouse())){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", demandDto.getDelivery())).getSetValue(); |
| | | tCompanyResp.setName(demandDto.getDelivery()); |
| | | tCompanyResp.setPrice(setValue1); |
| | | objects.add(tCompanyResp); |
| | | TCompanyFeeSetting feeSetting = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", demandDto.getDelivery())); |
| | | if(feeSetting==null){ |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | }else { |
| | | tCompanyResp.setName(demandDto.getDelivery()); |
| | | tCompanyResp.setPrice(feeSetting.getSetValue()); |
| | | objects.add(tCompanyResp); |
| | | } |
| | | |
| | | // 基础价格 |
| | | String zipCode = demandDto.getZipCode(); |
| | | // 地址信息 |
| | | String address1 = AddressLookup.getAddress(zipCode); |
| | | |
| | | if(address1==null){ |
| | | return new com.stylefeng.guns.modular.system.utils.tips.ErrorTip(5001,"Please enter the correct zipcode"); |
| | | } |
| | | |
| | | List<TCompanyBasic> tCompanyBasic = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("port_id",ratesId).eq("zip_code", zipCode).eq("type", 1)); |
| | | if(tCompanyBasic.size()>0){ |
| | |
| | | // 画圈 拿到的zipcode集合 去对比当前zipcode是否在集合中 |
| | | List<TCompanyBasic> type = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 2).eq("port_id",ratesId).orderBy("fee",true)); |
| | | if(type.size()>0){ |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(zipCode); |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(address1 ); |
| | | for (TCompanyBasic companyBasic : type) { |
| | | boolean inPolygon = PointInPolygon.isInPolygon(geocode1.getLat(), geocode1.getLng(), companyBasic.getLonLat()); |
| | | if(inPolygon){ |
| | |
| | | // 是否超重 |
| | | Integer weight = goodsDto.getWeight(); |
| | | long between = DateUtil.between(demandDto.getShipmentDate(), demandDto.getDeliveryDate(), DateUnit.DAY); |
| | | String arg1 = tPort.getName(); |
| | | String arg2=""; |
| | | if(!"0".equals(demandDto.getWarehouse())){ |
| | | TWarehouse tWarehouse = warehouseService.selectOne(new EntityWrapper<TWarehouse>().eq("company_id", company.getId()).eq("code", demandDto.getWarehouse()).eq("port_id",ratesId)); |
| | | arg2=tWarehouse.getCity(); |
| | | }else { |
| | | arg2 = AddressLookup.getAddress(demandDto.getZipCode()); |
| | | } |
| | | // DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(tPort.getAddress(), arg2); |
| | | // String arg3=String.valueOf(distancematrix.getDistance()); |
| | | // String arg4= demandDto.getList().get(0).getShippingLine(); |
| | | // String arg5 = demandDto.getType(); |
| | | // GoodsDto goodsDto1 = demandDto.getList().get(0).getList().get(0); |
| | | // String arg6 =goodsDto1.getType(); |
| | | // String arg7="None"; |
| | | // String arg8 = goodsDto1.getKg(); |
| | | // BigDecimal days = new BigDecimal(ChassisRentalDaysUtil.chassisRentalDays(1, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); |
| | | if(between==0){ |
| | | between=1; |
| | | } |
| | | if(weight==1){ |
| | | TCompanyFeeSetting feeSetting = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.OVERWEIGHT.getDesc())); |
| | | tCompanyResp.setName(UserFeeSettingEnum.OVERWEIGHT.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting.getSetValue()); |
| | | objects.add(tCompanyResp); |
| | | if(feeSetting==null){ |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | }else { |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.OVERWEIGHT.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting.getSetValue()); |
| | | objects.add(tCompanyResp); |
| | | } |
| | | TCompanyFeeSetting feeSetting1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", "trl-axle chassis")); |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.CHASSIS_FEE.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue().multiply(new BigDecimal(between))); |
| | | objects.add(tCompanyResp); |
| | | if(feeSetting1==null){ |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | }else { |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.CHASSIS_FEE.getDesc()); |
| | | // tCompanyResp.setPrice(feeSetting1.getSetValue().multiply(days)); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue().multiply(new BigDecimal(between))); |
| | | objects.add(tCompanyResp); |
| | | } |
| | | }else { |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.CHASSIS_FEE.getDesc()); |
| | | TCompanyFeeSetting feeSetting = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", "Pool chassis")); |
| | | if(feeSetting==null){ |
| | | |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | }else { |
| | | // tCompanyResp.setPrice(feeSetting.getSetValue().multiply(days)); |
| | | tCompanyResp.setPrice(feeSetting.getSetValue().multiply(new BigDecimal(between))); |
| | | } |
| | | objects.add(tCompanyResp); |
| | |
| | | if ("Live Unload".equals(demandDto.getType())) { |
| | | // 计算当前公司的价格 |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.PREPULL.getDesc())).getSetValue(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.PREPULL.getDesc()); |
| | | tCompanyResp.setPrice(setValue); |
| | | TCompanyFeeSetting feeSetting = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.PREPULL.getDesc())); |
| | | if(feeSetting==null){ |
| | | tCompanyResp.setName(UserFeeSettingEnum.PREPULL.getDesc()); |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | }else { |
| | | BigDecimal setValue = feeSetting.getSetValue(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.PREPULL.getDesc()); |
| | | tCompanyResp.setPrice(setValue); |
| | | } |
| | | // BigDecimal setValue = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.PREPULL.getDesc())).getSetValue(); |
| | | |
| | | objects.add(tCompanyResp); |
| | | } |
| | | // 滞留费 |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.DETENTION_CONGESTION.getDesc())).getSetValue(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.DETENTION_CONGESTION.getDesc()); |
| | | tCompanyResp.setPrice(setValue); |
| | | TCompanyFeeSetting feeSetting = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.DETENTION_CONGESTION.getDesc())); |
| | | if(feeSetting!=null){ |
| | | tCompanyResp.setName(UserFeeSettingEnum.DETENTION_CONGESTION.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting.getSetValue()); |
| | | }else { |
| | | tCompanyResp.setName(UserFeeSettingEnum.DETENTION_CONGESTION.getDesc()); |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | } |
| | | // BigDecimal setValue = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.DETENTION_CONGESTION.getDesc())).getSetValue(); |
| | | |
| | | objects.add(tCompanyResp); |
| | | |
| | | // 仓储费 |
| | | // tCompanyResp=new TCompanyResp(); |
| | | // days = new BigDecimal(ChassisRentalDaysUtil.chassisRentalDays(3, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); |
| | | // TCompanyFeeSetting storage = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.STORAGE.getDesc())); |
| | | // if(storage!=null){ |
| | | // tCompanyResp.setName(UserFeeSettingEnum.STORAGE.getDesc()); |
| | | // tCompanyResp.setPrice(feeSetting.getSetValue().multiply(days)); |
| | | // }else { |
| | | // tCompanyResp.setName(UserFeeSettingEnum.STORAGE.getDesc()); |
| | | // tCompanyResp.setPrice(new BigDecimal(0)); |
| | | // } |
| | | |
| | | if(goodsDto.getDanger()==1){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.HAZMAT.getDesc())).getSetValue(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.HAZMAT.getDesc()); |
| | | tCompanyResp.setPrice(setValue1); |
| | | objects.add(tCompanyResp); |
| | | TCompanyFeeSetting feeSetting1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.HAZMAT.getDesc())); |
| | | if(feeSetting1!=null){ |
| | | tCompanyResp.setName(UserFeeSettingEnum.HAZMAT.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue()); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | } |
| | | // BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.HAZMAT.getDesc())).getSetValue(); |
| | | |
| | | } |
| | | if(demandDto.getUrgent()==1){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.URGENT_SEE.getDesc())).getSetValue(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.URGENT_SEE.getDesc()); |
| | | tCompanyResp.setPrice(setValue1); |
| | | objects.add(tCompanyResp); |
| | | TCompanyFeeSetting feeSetting1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.URGENT_SEE.getDesc())); |
| | | if(feeSetting1!=null){ |
| | | tCompanyResp.setName(UserFeeSettingEnum.URGENT_SEE.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue()); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | } |
| | | // BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.URGENT_SEE.getDesc())).getSetValue(); |
| | | |
| | | } |
| | | if(demandDto.getPiperpass()==1){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.PIERPASS.getDesc())).getSetValue(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.PIERPASS.getDesc()); |
| | | tCompanyResp.setPrice(setValue1); |
| | | objects.add(tCompanyResp); |
| | | TCompanyFeeSetting feeSetting1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.PIERPASS.getDesc())); |
| | | if(feeSetting1!=null){ |
| | | tCompanyResp.setName(UserFeeSettingEnum.PIERPASS.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue()); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | } |
| | | // BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.PIERPASS.getDesc())).getSetValue(); |
| | | } |
| | | if(demandDto.getCTF()==1){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.CTF.getDesc())).getSetValue(); |
| | | tCompanyResp.setName(UserFeeSettingEnum.CTF.getDesc()); |
| | | tCompanyResp.setPrice(setValue1); |
| | | objects.add(tCompanyResp); |
| | | TCompanyFeeSetting feeSetting1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.CTF.getDesc())); |
| | | if(feeSetting1!=null){ |
| | | tCompanyResp.setName(UserFeeSettingEnum.CTF.getDesc()); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue()); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | breakNum=1; |
| | | count++; |
| | | break; |
| | | } |
| | | // BigDecimal setValue1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id",ratesId).eq("set_name", UserFeeSettingEnum.CTF.getDesc())).getSetValue(); |
| | | // tCompanyResp.setName(UserFeeSettingEnum.CTF.getDesc()); |
| | | // tCompanyResp.setPrice(setValue1); |
| | | // objects.add(tCompanyResp); |
| | | } |
| | | |
| | | |
| | |
| | | tOrder.setDeliveryDate(demandDto.getDeliveryDate()); |
| | | tOrder.seteZipZ(s1); |
| | | tOrder.setCreateTime(new Date()); |
| | | tOrder.setStartLat("1"); |
| | | tOrder.setStartLon("1"); |
| | | |
| | | tOrder.setStartLat(String.valueOf(geocode.getLat())); |
| | | tOrder.setStartLon(String.valueOf(geocode.getLng())); |
| | | tOrder.setDeliveryStr(demandDto.getDelivery()); |
| | | tOrder.setType(demandDto.getType()); |
| | | tOrder.setZipCode(demandDto.getZipCode()); |
| | |
| | | tGoods.setLineStr(goodsDto.getLineStr()); |
| | | tGoods1.add(tGoods); |
| | | } |
| | | goodsService.insertBatch(tGoods1); |
| | | if(tGoods1.size()>0){ |
| | | |
| | | goodsService.insertBatch(tGoods1); |
| | | } |
| | | |
| | | |
| | | String randomNumber = getRandomNumber(10); |
| | | String randomNumber = ToolUtil.getRandomNumber(10); |
| | | for (TCompanyResp object : objects) { |
| | | TPrice tPrice = new TPrice(); |
| | | tPrice.setCreateTime(new Date()); |
| | |
| | | tPrice.setNumber(randomNumber); |
| | | tPrices.add(tPrice); |
| | | } |
| | | priceService.insertBatch(tPrices); |
| | | if(tPrices.size()>0){ |
| | | priceService.insertBatch(tPrices); |
| | | } |
| | | } |
| | | |
| | | tCompanyCalculationResp.setOrderList(tOrders); |
| | |
| | | tCompanyCalculationResp.setStartLat(String.valueOf(1)); |
| | | |
| | | // 目的地经纬度 |
| | | if("0".equals(demandDto.getWarehouse())){ |
| | | if(!"0".equals(demandDto.getWarehouse())){ |
| | | TWarehouse tWarehouse = warehouseService.selectOne(new EntityWrapper<TWarehouse>().eq("company_id", company.getId()).eq("code", demandDto.getWarehouse()).eq("port_id",ratesId)); |
| | | System.out.println(company.getId()); |
| | | System.out.println(ratesId); |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(tWarehouse.getAddress()); |
| | | tCompanyCalculationResp.setEndLon(String.valueOf(geocode1.getLng())); |
| | | tCompanyCalculationResp.setEndLat(String.valueOf(geocode1.getLat())); |
| | | tCompanyCalculationRespList.add(tCompanyCalculationResp); |
| | | }else { |
| | | String zipCode = demandDto.getZipCode(); |
| | | // GeocodeVo geocode1 = googleMapUtil.getGeocode(zipCode); |
| | | // tCompanyCalculationResp.setEndLat(String.valueOf(geocode1.getLat())); |
| | | // tCompanyCalculationResp.setEndLon(String.valueOf(geocode1.getLng())); |
| | | tCompanyCalculationResp.setEndLat(String.valueOf(1)); |
| | | tCompanyCalculationResp.setEndLon(String.valueOf(1)); |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(AddressLookup.getAddress(zipCode)); |
| | | tCompanyCalculationResp.setEndLon(String.valueOf(geocode1.getLng())); |
| | | tCompanyCalculationResp.setEndLat(String.valueOf(geocode1.getLat())); |
| | | // tCompanyCalculationResp.setEndLon(String.valueOf(1)); |
| | | // tCompanyCalculationResp.setEndLat(String.valueOf(1)); |
| | | tCompanyCalculationRespList.add(tCompanyCalculationResp); |
| | | } |
| | | |
| | | |
| | | } |
| | | if(count==companies.size()){ |
| | | return new ErrorTip(5001,"No truck company was matched to meet the demand"); |
| | | return new com.stylefeng.guns.modular.system.utils.tips.ErrorTip(5001,"No truck company was matched to meet the demand"); |
| | | } |
| | | |
| | | } |
| | | for (TCompanyCalculationResp tCompanyCalculationResp : tCompanyCalculationRespList) { |
| | | tCompanyCalculationResp.setQuoteId(tQuote.getId()); |
| | | } |
| | | if(0==tCompanyCalculationRespList.size()){ |
| | | return new com.stylefeng.guns.modular.system.utils.tips.ErrorTip(5001,"No truck company was matched to meet the demand"); |
| | | } |
| | | return new SuccessTip(tCompanyCalculationRespList); |
| | | } |
| | | |
| | | |
| | | private String getStr(String str){ |
| | | String s = ""; |
| | | String[] split = str.split(","); |
| | | if(split.length==1){ |
| | | if(split[0].equals("CTF") || split[0].equals("URGENT FEE") || split[0].equals("PIPERPASS")){ |
| | | return s; |
| | | }else { |
| | | s=split[0]; |
| | | return s; |
| | | } |
| | | }else { |
| | | for (int i = 0; i < split.length; i++) { |
| | | if(!split[i].equals("CTF")&&!split[i].equals("URGENT FEE") && !split[i].equals("CTF")){ |
| | | if(i==split.length-1){ |
| | | s+=split[i]; |
| | | }else { |
| | | s+=split[i]+","; |
| | | } |
| | | } |
| | | } |
| | | return s; |
| | | } |
| | | } |
| | | |
| | | public static String getRandomNumber(int length) { |
| | | String base = "0123456789"; |
| | |
| | | Page<TWarehouse> tWarehousePage = new Page<>(pageNumber, pageSize); |
| | | |
| | | EntityWrapper<TWarehouse> tWarehouseEntityWrapper = new EntityWrapper<>(); |
| | | tWarehouseEntityWrapper.eq("company_id",1); |
| | | tWarehouseEntityWrapper.eq("company_id",0); |
| | | if(Objects.nonNull(address)){ |
| | | tWarehouseEntityWrapper.like("address",address); |
| | | tWarehouseEntityWrapper.like("code",address); |
| | | } |
| | | Page<TWarehouse> tWarehousePage1 = warehouseService.selectPage(tWarehousePage, tWarehouseEntityWrapper); |
| | | |