| | |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | result.put("token", JwtTokenUtil.generateToken(String.valueOf(company.getId()))); |
| | | result.put("company", company); |
| | | return result; |
| | | return new SuccessTip(result); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.utils.AddressLookup; |
| | | import com.stylefeng.guns.modular.system.utils.ChassisRentalDaysUtil; |
| | | import com.stylefeng.guns.modular.system.utils.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.GeocodeVo; |
| | |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | }) |
| | | @PostMapping(value = "/addDemand") |
| | | @ResponseBody |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public Object addDemand(@RequestBody DemandDto demandDto) throws Exception { |
| | | Integer id = demandDto.getId(); |
| | | String s1 = System.currentTimeMillis() + ToolUtil.getRandomString(5); |
| | |
| | | |
| | | String accessorialStr = demandDto.getAccessorialStr(); |
| | | String[] split = accessorialStr.split(","); |
| | | // Map<String,String> map = new HashMap<>(split.length); |
| | | // for (String s :split){ |
| | | // map.put(s,s); |
| | | // } |
| | | // |
| | | // List<TCompanyService> companyServiceList = new ArrayList<>(); |
| | | // // |
| | | // for (Map.Entry<String, String> entry : map.entrySet()) { |
| | | // companyServiceList.addAll(tCompanyServiceService.selectList(new EntityWrapper<TCompanyService>() |
| | | // .eq("service_name", entry.getKey()).ne("service_value", 0))); |
| | | // } |
| | | // |
| | | // // TODO size 是否包含 收费 收费站、收费基础 |
| | | // |
| | | // // 根据公司id去重 |
| | | // List<TCompanyService> companyServices = companyServiceList.stream().collect(Collectors. |
| | | // collectingAndThen(Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(TCompanyService::getCompanyId))),ArrayList::new)); |
| | | // // 拿出符合规则的公司id |
| | | // List<Integer> companyIds = companyServices.stream().map(TCompanyService::getCompanyId).collect(Collectors.toList()); |
| | | // |
| | | // 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)); |
| | | // if(Objects.nonNull(company)){ |
| | | // tCompanyList.add(company); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // // 符合规则的公司id集合 |
| | | // List<Integer> companyIdList = tCompanyList.stream().map(TCompany::getId).collect(Collectors.toList()); |
| | | // |
| | | // HashSet<Integer> set = new HashSet<>(); |
| | | // |
| | | // // 找出目前公司是否符合添加的码头 |
| | | // // 看当前码头是否为特殊码头 |
| | | // // 找出当前码头所在的cityid |
| | | TPort tPort1 = portService.selectById(demandDto.getPortId()); |
| | | TCountry tCountry = countryService.selectById(tPort1.getCity()); |
| | | // List<Integer> integers = Arrays.asList(demandDto.getPortId(), tCountry.getId()); |
| | | // List<TRates> tRates = ratesService.selectList(new EntityWrapper<TRates>().in("metro_id", integers)); |
| | | // // 满足码头的公司 |
| | | // companyIdList.stream().forEach(t->{ |
| | | // for (TRates tRate : tRates) { |
| | | // if(tRate.getCompanyId().equals(t)){ |
| | | // set.add(t); |
| | | // } |
| | | // } |
| | | // }); |
| | | |
| | | Integer portId = demandDto.getPortId(); |
| | | TPort tPort = itPortService.selectById(portId); |
| | | String address = tPort.getAddress(); |
| | | // GeocodeVo geocode = googleMapUtil.getGeocode(address); |
| | | GeocodeVo geocode = googleMapUtil.getGeocode(address); |
| | | |
| | | List<TCompanyCalculationResp> tCompanyCalculationRespList = new ArrayList<>(); |
| | | // List<Integer> collect1 = set.stream().filter(e -> e.equals(demandDto.getId())).collect(Collectors.toList()); |
| | |
| | | // 判断是否特殊码头 |
| | | TRates tRates1 = ratesService.selectOne(new EntityWrapper<TRates>().eq("metro_id", demandDto.getPortId()).eq("type", 2).eq("company_id", company.getId())); |
| | | int ratesId=0; |
| | | if(tRates1!=null){ |
| | | ratesId=tRates1.getId(); |
| | | }else { |
| | | ratesId=tCountry.getId(); |
| | | if(tRates1!=null){ |
| | | ratesId=tRates1.getId(); |
| | | }else { |
| | | TRates t = ratesService.selectOne(new EntityWrapper<TRates>().eq("metro_id", tCountry.getId()).eq("type", 1).eq("company_id", company.getId())); |
| | | ratesId=t.getId(); |
| | | } |
| | | for (GoodsListDto goodsListDto : list1) { |
| | | ArrayList<TPrice> tPrices = new ArrayList<>(); |
| | | |
| | | |
| | | List<TGoods> list = goodsListDto.getList(); |
| | | for (TGoods e : list) { |
| | | e.setShippingLine(goodsListDto.getShippingLine()); |
| | | e.setCustRef(goodsListDto.getCustRef()); |
| | | e.setEntry(goodsListDto.getEntry()); |
| | | e.setOurRef(goodsListDto.getOurRef()); |
| | | e.setPo(goodsListDto.getPo()); |
| | | e.setSb(goodsListDto.getSb()); |
| | | TOrder tOrder = new TOrder(); |
| | | tOrder.setUserId(demandDto.getUserId()); |
| | | tOrder.setAccessorial(demandDto.getAccessorial()); |
| | |
| | | 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()); |
| | |
| | | tOrder.setInvoiceNumber(s2); |
| | | tOrder.setCompanyId(company.getId()); |
| | | tOrder.setCreateTime(new Date()); |
| | | tOrder.setsName(demandDto.getContactName()); |
| | | tOrder.setsEmail(demandDto.getContactEmail()); |
| | | tOrder.setsPhone(demandDto.getContactPhone()); |
| | | tOrder.seteCompanyName(demandDto.getECompanyName()); |
| | | tOrder.seteName(demandDto.getEContactName()); |
| | | tOrder.seteEmail(demandDto.getEContactEmail()); |
| | | tOrder.setePhone(demandDto.getEContactPhone()); |
| | | if("0".equals(demandDto.getWarehouse())){ |
| | | tOrder.seteAddress(demandDto.getEAddress()); |
| | | }else { |
| | |
| | | TCompanyResp tCompanyResp = new TCompanyResp(); |
| | | // 是否超重 |
| | | Integer weight = goodsListDto.getWeight(); |
| | | // 相差天数 |
| | | long between = DateUtil.between(demandDto.getShipmentDate(), demandDto.getDeliveryDate(), DateUnit.DAY); |
| | | if(between==0){ |
| | | between=1; |
| | | String arg1 = tPort.getName(); |
| | | String arg2=""; |
| | | if(!"0".equals(demandDto.getWarehouse())){ |
| | | System.out.println("公司id:"+company.getId()); |
| | | System.out.println("公司ratesId:"+ratesId); |
| | | TWarehouse tWarehouse = warehouseService.selectOne(new EntityWrapper<TWarehouse>().eq("company_id", company.getId()).eq("code", demandDto.getWarehouse()).eq("port_id",ratesId)); |
| | | if(tWarehouse==null){ |
| | | return "Please set the relevant price first"; |
| | | } |
| | | arg2=tWarehouse.getZipCode(); |
| | | }else { |
| | | arg2 = demandDto.getZipCode(); |
| | | } |
| | | System.out.println("arg2:"+arg2); |
| | | DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(tPort.getAddress(), arg2); |
| | | String arg3=String.valueOf(distancematrix.getDistance()/1609); |
| | | String arg4= demandDto.getList().get(0).getShippingLine(); |
| | | String arg5 = demandDto.getType(); |
| | | TGoods goodsDto1 = demandDto.getList().get(0).getList().get(0); |
| | | String arg6 =goodsDto1.getSize()+"ft"; |
| | | String arg7="None"; |
| | | String arg8 = goodsDto1.getKg(); |
| | | System.out.println("参数:"+arg1+"|"+arg2+"|"+arg3+"|"+arg4+"|"+arg5+"|"+arg6+"|"+arg7+"|"+arg8); |
| | | BigDecimal days = new BigDecimal(ChassisRentalDaysUtil.chassisRentalDays(1, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)).setScale(0, RoundingMode.HALF_UP); |
| | | // 相差天数 |
| | | // long between = DateUtil.between(demandDto.getShipmentDate(), demandDto.getDeliveryDate(), DateUnit.DAY); |
| | | |
| | | 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()); |
| | | if(feeSetting==null){ |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | |
| | | if(feeSetting1==null){ |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | }else { |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue().multiply(new BigDecimal(between))); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue().multiply(days)); |
| | | tCompanyResp.setDay(days.toString()); |
| | | } |
| | | |
| | | objects.add(tCompanyResp); |
| | |
| | | if(feeSetting==null){ |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | }else { |
| | | tCompanyResp.setPrice(feeSetting.getSetValue().multiply(new BigDecimal(between))); |
| | | tCompanyResp.setPrice(feeSetting.getSetValue().multiply(days)); |
| | | tCompanyResp.setDay(days.toString()); |
| | | } |
| | | |
| | | objects.add(tCompanyResp); |
| | |
| | | if(feeSetting==null){ |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | }else { |
| | | tCompanyResp.setPrice(feeSetting.getSetValue()); |
| | | days = new BigDecimal(ChassisRentalDaysUtil.chassisRentalDays(4, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)).setScale(0, RoundingMode.HALF_UP); |
| | | tCompanyResp.setPrice(feeSetting.getSetValue().multiply(days)); |
| | | tCompanyResp.setDay(days.toString()); |
| | | } |
| | | |
| | | objects.add(tCompanyResp); |
| | | |
| | | |
| | | // 仓储费 |
| | | tCompanyResp=new TCompanyResp(); |
| | | days = new BigDecimal(ChassisRentalDaysUtil.chassisRentalDays(2, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)).add(new BigDecimal(ChassisRentalDaysUtil.chassisRentalDays(3, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8))).setScale(0, RoundingMode.HALF_UP); |
| | | System.out.println("仓储费"+days); |
| | | TCompanyFeeSetting storage = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", UserFeeSettingEnum.STORAGE.getDesc())); |
| | | System.out.println(storage); |
| | | if(storage!=null){ |
| | | tCompanyResp.setName(UserFeeSettingEnum.STORAGE.getDesc()); |
| | | tCompanyResp.setPrice(storage.getSetValue().multiply(days)); |
| | | tCompanyResp.setDay(days.toString()); |
| | | objects.add(tCompanyResp); |
| | | }else { |
| | | tCompanyResp.setName(UserFeeSettingEnum.STORAGE.getDesc()); |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | objects.add(tCompanyResp); |
| | | } |
| | | |
| | | if(goodsListDto.getDanger()==1){ |
| | | 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); |
| | | TCompanyFeeSetting feeSetting1 = companyFeeSettingService.selectOne(new EntityWrapper<TCompanyFeeSetting>().eq("company_id", company.getId()).eq("rates_id", ratesId).eq("set_name", demandDto.getDelivery())); |
| | | if(feeSetting1!=null){ |
| | | tCompanyResp.setName(demandDto.getDelivery()); |
| | | tCompanyResp.setPrice(feeSetting1.getSetValue()); |
| | | }else { |
| | | tCompanyResp.setName(demandDto.getDelivery()); |
| | | tCompanyResp.setPrice(new BigDecimal(0)); |
| | | } |
| | | objects.add(tCompanyResp); |
| | | |
| | | // 基础价格 |
| | |
| | | boolean inPolygon = PointInPolygon.isInPolygon(geocode1.getLat(), geocode1.getLng(), companyBasic.getLonLat()); |
| | | if(inPolygon){ |
| | | tCompanyResp=new TCompanyResp(); |
| | | tCompanyResp.setPrice(type.get(0).getFee()); |
| | | tCompanyResp.setPrice(companyBasic.getFee()); |
| | | tCompanyResp.setName("LH+FSC"); |
| | | objects.add(tCompanyResp); |
| | | break; |
| | |
| | | // 距离 |
| | | tCompanyResp=new TCompanyResp(); |
| | | // 1条数据 不需要zipcode |
| | | DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(address, address1); |
| | | double distance = distancematrix.getDistance().doubleValue(); |
| | | DistancematrixVo distancematrix2 = googleMapUtil.getDistancematrix(address, address1); |
| | | double distance = distancematrix2.getDistance().doubleValue(); |
| | | BigDecimal bigDecimal = new BigDecimal(distance * 0.0006214); |
| | | List<TCompanyBasic> type1 = companyBasicService.selectList(new EntityWrapper<TCompanyBasic>().eq("type", 3).eq("port_id",ratesId).le("start",bigDecimal.doubleValue()).orderBy("start",true)); |
| | | if(type1.size()>0) { |
| | |
| | | // 1条数据 不需要zipcode |
| | | TCompanyBasic type1 = companyBasicService.selectOne(new EntityWrapper<TCompanyBasic>().eq("type", 3).eq("port_id",ratesId)); |
| | | if(type1!=null) { |
| | | DistancematrixVo distancematrix = googleMapUtil.getDistancematrix(address, type1.getAddress()); |
| | | double distance = distancematrix.getDistance().doubleValue(); |
| | | DistancematrixVo distancematrix1 = googleMapUtil.getDistancematrix(address, type1.getAddress()); |
| | | double distance = distancematrix1.getDistance().doubleValue(); |
| | | BigDecimal bigDecimal = new BigDecimal(distance * 0.0006214); |
| | | BigDecimal multiply = type1.getFee().multiply(bigDecimal); |
| | | tCompanyResp.setPrice(multiply); |
| | |
| | | } |
| | | BigDecimal bigDecimal = objects.stream().map(e1 -> e1.getPrice()).reduce(BigDecimal::add).get(); |
| | | tOrder.setAllTotal(bigDecimal); |
| | | tOrder.setPayMoney(bigDecimal); |
| | | orderService.updateById(tOrder); |
| | | objects.stream().forEach(e2->e2.setOrderId(tOrder.getId())); |
| | | |
| | |
| | | tPrice.setOrderId(object.getOrderId()); |
| | | tPrice.setState("1"); |
| | | tPrice.setPrice(object.getPrice()); |
| | | tPrice.setCarPrice(object.getPrice()); |
| | | tPrice.setType(object.getName()); |
| | | tPrice.setDay(object.getDay()); |
| | | tPrices.add(tPrice); |
| | | } |
| | | priceService.insertBatch(tPrices); |
| | |
| | | |
| | | |
| | | // 目的地经纬度 |
| | | 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)); |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(tWarehouse.getAddress()); |
| | | tCompanyCalculationResp.setEndLon(String.valueOf(geocode1.getLng())); |
| | | tCompanyCalculationResp.setEndLat(String.valueOf(geocode1.getLat())); |
| | | tCompanyCalculationRespList.add(tCompanyCalculationResp); |
| | | }else { |
| | | // TODO |
| | | String zipCode = demandDto.getZipCode(); |
| | | // GeocodeVo geocode1 = googleMapUtil.getGeocode(zipCode); |
| | | tCompanyCalculationResp.setEndLon(String.valueOf(1)); |
| | | tCompanyCalculationResp.setEndLat(String.valueOf(1)); |
| | | GeocodeVo geocode1 = googleMapUtil.getGeocode(AddressLookup.getAddress(zipCode)); |
| | | tCompanyCalculationResp.setEndLon(String.valueOf(geocode1.getLng())); |
| | | tCompanyCalculationResp.setEndLat(String.valueOf(geocode1.getLat())); |
| | | tCompanyCalculationRespList.add(tCompanyCalculationResp); |
| | | } |
| | | |
| | |
| | | EntityWrapper<TWarehouse> tWarehouseEntityWrapper = new EntityWrapper<>(); |
| | | tWarehouseEntityWrapper.eq("company_id",companyId); |
| | | tWarehouseEntityWrapper.eq("port_id",ratesId); |
| | | tWarehouseEntityWrapper.gt("ware_price",0); |
| | | if(Objects.nonNull(address)){ |
| | | tWarehouseEntityWrapper.like("address",address); |
| | | tWarehouseEntityWrapper.like("code",address); |
| | | } |
| | | Page<TWarehouse> tWarehousePage1 = warehouseService.selectPage(tWarehousePage, tWarehouseEntityWrapper); |
| | | |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | |
| | | @ResponseBody |
| | | public Object driverAdd(@RequestBody TDriver driver) { |
| | | try { |
| | | List<TDriver> tDrivers = driverService.selectList(new EntityWrapper<TDriver>().eq("account", driver.getAccount())); |
| | | if(tDrivers.size()>0){ |
| | | return new ErrorTip(500, "Account already exists"); |
| | | } |
| | | driver.setPassword(SecureUtil.md5(driver.getPassword())); |
| | | driver.setCreateTime(new Date()); |
| | | driverService.insert(driver); |
| | | return new SuccessTip(); |
| | |
| | | @ResponseBody |
| | | public Object driverUpdate(@RequestBody TDriver driver) { |
| | | try { |
| | | List<TDriver> tDrivers = driverService.selectList(new EntityWrapper<TDriver>().eq("account", driver.getAccount()).ne("id",driver.getId())); |
| | | if(tDrivers.size()>0){ |
| | | return new ErrorTip(500, "Account already exists"); |
| | | } |
| | | if(driver.getPassword()!=null){ |
| | | driver.setPassword(SecureUtil.md5(driver.getPassword())); |
| | | } |
| | | driverService.updateById(driver); |
| | | return new SuccessTip(); |
| | | } catch (Exception e) { |
| | |
| | | }) |
| | | @GetMapping(value = "/exportQuickBook") |
| | | @ResponseBody |
| | | public Object exportQuickBooks(){ |
| | | redisUtil.setStrValue("quick","3"); |
| | | public Object exportQuickBooks(int company){ |
| | | redisUtil.setStrValue("quick","3"+"_"+company ); |
| | | try { |
| | | View view = InvoicesDataUploadUtil.connectToQuickBooks(); |
| | | log.info("view:{}",view); |
| | | return new SuccessTip(view); |
| | | } catch (InvalidRequestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new com.stylefeng.guns.core.base.tips.SuccessTip(); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | |
| | | }) |
| | | @GetMapping(value = "/exportQuickBookBill") |
| | | @ResponseBody |
| | | public Object exportQuickBookBill(){ |
| | | redisUtil.setStrValue("quick","4"); |
| | | public Object exportQuickBookBill(int company){ |
| | | redisUtil.setStrValue("quick","4"+"_"+company); |
| | | try { |
| | | View view = InvoicesDataUploadUtil.connectToQuickBooks(); |
| | | log.info("view:{}",view); |
| | | return new SuccessTip(view); |
| | | } catch (InvalidRequestException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new com.stylefeng.guns.core.base.tips.SuccessTip(); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | |
| | | priceService.insertBatch(prices); |
| | | Long orderId = prices.get(0).getOrderId(); |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | tOrder.setChange(1); |
| | | tOrder.setNote(note); |
| | | return new SuccessTip(); |
| | | } |
| | |
| | | package com.stylefeng.guns.modular.system.controller; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.modular.system.enums.FacilityCodeEnum; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.net.FileNameMap; |
| | | import java.net.URLConnection; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | @Controller |
| | | @Api(tags = "订单") |
| | |
| | | @GetMapping(value = "/getOrderInfo") |
| | | @ResponseBody |
| | | public Object getOrderInfo( Long orderId) { |
| | | OrderInfo orderInfo = orderService.getOrderInfo(orderId); |
| | | HashMap<String, Object> orderInfo = orderService.getOrderInfo(orderId); |
| | | return new SuccessTip(orderInfo); |
| | | } |
| | | |
| | |
| | | if(driverIdOne!=null){ |
| | | driverIds.add(driverIdOne); |
| | | } |
| | | TGoods tGoods = goodsService.selectOne(new EntityWrapper<TGoods>().eq("order_id", tOrder.getId())); |
| | | List<TTransportation> tTransportations = tTransportationService.selectList(new EntityWrapper<TTransportation>().eq("order_id", orderId).in("driver_id", driverIds)); |
| | | TerminaleDataWarpper terminalStatus = TerminalInterfaceAcquisitionUtil.getTerminalStatus("WFHU5080179", FacilityCodeEnum.USLAX.getMsg()); |
| | | TerminaleDataWarpper terminalStatus =new TerminaleDataWarpper(); |
| | | try { |
| | | terminalStatus = TerminalInterfaceAcquisitionUtil.getTerminalStatus(tGoods.getContainerNumber(), FacilityCodeEnum.USLAX.getMsg()); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | terminalStatus =new TerminaleDataWarpper(); |
| | | } |
| | | |
| | | for (TTransportation tDriver : tTransportations) { |
| | | OrderDriverInfo orderDriverInfo = new OrderDriverInfo(); |
| | | orderDriverInfo.setId(tDriver.getId()); |
| | | orderDriverInfo.setDriverId(tDriver.getDriverId()); |
| | | if(tDriver.getId().equals(sDriverIdOne)&&tDriver.getType()==2){ |
| | | orderDriverInfo.setPickUp(tDriver.getPickDate()); |
| | | } |
| | |
| | | orderDriverInfo.setTPowerUnits(powerUnitsService.selectById(tDriver.getPowerUnit())); |
| | | orderDriverInfo.setChassiess(powerUnitsService.selectById(tDriver.getChassises())); |
| | | |
| | | // TODO 第三方 目前不知道对接那个 |
| | | orderDriverInfo.setAppointmentNumber(terminalStatus.getAppointmentNumber()); |
| | | |
| | | orderDriverInfos.add(orderDriverInfo); |
| | |
| | | BigDecimal subtract = price.getPrice().subtract(multiply); |
| | | priceInfo.setCarrierCost(subtract); |
| | | priceInfo.setSalesProfit(new BigDecimal(commission)); |
| | | priceInfo.setMargin(multiply); |
| | | priceInfo.setMargin(multiply.setScale(2, RoundingMode.HALF_UP)); |
| | | }else { |
| | | priceInfo.setMargin(new BigDecimal(0)); |
| | | priceInfo.setSalesProfit(new BigDecimal(commission)); |
| | |
| | | return new SuccessTip(page); |
| | | } |
| | | |
| | | @ApiOperation(value = "卡车公司--save time",notes="卡车公司--save time") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "orderId", value = "orderId", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "time", value = "time", required = true, dataType = "String"), |
| | | |
| | | }) |
| | | @PostMapping(value = "/updateSaveTime") |
| | | @ResponseBody |
| | | public Object updateSaveTime( Long orderId,String time){ |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | Date date = DateUtil.parse(time).toJdkDate(); |
| | | tOrder.setShipmentDate(date); |
| | | orderService.updateById(tOrder); |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司--安排司机",notes="卡车公司--安排司机") |
| | |
| | | } |
| | | record.setType(type); |
| | | } |
| | | orderFilePage.setRecords(records); |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | |
| | | if("9".equals(tOrder.getStatus()) || "18".equals(tOrder.getStatus())){ |
| | | ArrayList<TOrderFile> tOrderFiles = new ArrayList<>(); |
| | | TOrderFile tOrderFile = new TOrderFile(); |
| | | tOrderFile.setName("Bill of lading.pdf"); |
| | | tOrderFile.setId(0); |
| | | tOrderFile.setType("file"); |
| | | tOrderFiles.add(tOrderFile); |
| | | tOrderFiles.addAll(records); |
| | | orderFilePage.setRecords(tOrderFiles); |
| | | }else { |
| | | |
| | | orderFilePage.setRecords(records); |
| | | } |
| | | return new SuccessTip(orderFilePage); |
| | | } |
| | | |
| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.TPortMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | |
| | | @ApiImplicitParam(name = "id", value = "港区id/特殊码头id", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "code", value = "code", required = false, dataType = "String",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/getWarehouseFromId") |
| | | @ResponseBody |
| | | public Object getWarehouseFromId(int id,int pageNumber,int pageSize) { |
| | | public Object getWarehouseFromId(int id,int pageNumber,int pageSize,String code) { |
| | | Page<TWarehouse> tWarehousePage = new Page<>(pageNumber, pageSize); |
| | | Page<TWarehouse> tWarehouses = warehouseService.selectPage(tWarehousePage,new EntityWrapper<TWarehouse>().eq("port_id", id)); |
| | | Wrapper<TWarehouse> warehouseWrapper = new EntityWrapper<TWarehouse>().eq("port_id", id); |
| | | if(ToolUtil.isNotEmpty(code)){ |
| | | warehouseWrapper.like("code",code).or().like("state",code); |
| | | } |
| | | Page<TWarehouse> tWarehouses = warehouseService.selectPage(tWarehousePage,warehouseWrapper); |
| | | return new SuccessTip(tWarehouses); |
| | | } |
| | | |
| | | @ApiOperation(value = "卡车公司- 根据id统一设置亚马逊价格",notes="卡车公司-根据id统一设置亚马逊价格") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "港区id/特殊码头id", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "money", value = "money", required = true, dataType = "double",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/setWarehousePrice") |
| | | @PostMapping(value = "/setWarehousePrice") |
| | | @ResponseBody |
| | | public Object setWarehousePrice(int id,double money) { |
| | | List<TWarehouse> tWarehouses = warehouseService.selectList(new EntityWrapper<TWarehouse>().eq("port_id", id)); |
| | | tWarehouses.stream().forEach(e->e.setWarePrice(new BigDecimal(money))); |
| | | public Object setWarehousePrice(@RequestBody SetWarehouseDto dto) { |
| | | List<TWarehouse> tWarehouses = warehouseService.selectList(new EntityWrapper<TWarehouse>().in("id", dto.getId())); |
| | | tWarehouses.stream().forEach(e->e.setWarePrice(new BigDecimal(dto.getMoney()))); |
| | | warehouseService.updateBatchById(tWarehouses); |
| | | return new SuccessTip(tWarehouses); |
| | | } |
| | |
| | | }else { |
| | | map.put("lonlat",new ArrayList<>()); |
| | | } |
| | | return new SuccessTip(map); |
| | | return new SuccessTip(tCompanyBasic); |
| | | } |
| | | @ApiOperation(value = "卡车公司- 添加点对点/范围/距离",notes="卡车公司-添加点对点/范围/距离") |
| | | |
| | |
| | | @PostMapping(value = "/addFee") |
| | | @ResponseBody |
| | | public Object addFee(@RequestBody List<TCompanyFeeSetting> feeSettings) { |
| | | tCompanyFeeSettingMapper.insertBatch(feeSettings); |
| | | if(feeSettings.get(0).getId()==null){ |
| | | tCompanyFeeSettingMapper.insertBatch(feeSettings); |
| | | }else { |
| | | tCompanyFeeSettingMapper.updateBatchById(feeSettings); |
| | | } |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | |
| | | package com.stylefeng.guns.modular.system.controller; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | 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.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.TCarriers; |
| | | import com.stylefeng.guns.modular.system.service.TCarriersService; |
| | | import com.stylefeng.guns.modular.system.utils.CargoQueryInteraceUtil; |
| | | import com.stylefeng.guns.modular.system.utils.InsertCargoDetailsWarpper; |
| | | import com.stylefeng.guns.modular.system.utils.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.utils.WoUtil; |
| | | import com.stylefeng.guns.modular.system.utils.tips.ErrorTip; |
| | | import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; |
| | |
| | | |
| | | @Autowired |
| | | private TCarriersService carriersService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | private String CARGO_LIST = "cargo_list:"; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司-添加承运商",notes="卡车公司-添加承运商") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | } |
| | | |
| | | |
| | | // 根据输入框的输入信息,调用第三方接口获取数据 |
| | | @ApiOperation(value = "查询卡车公司",notes="查询卡车公司") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | @PostMapping(value = "/query") |
| | | @ResponseBody |
| | | public Object queryCargoData(String MCNumber,String USdot){ |
| | | if(ToolUtil.isEmpty(MCNumber)&&ToolUtil.isEmpty(USdot)){ |
| | | return new SuccessTip(); |
| | | } |
| | | String value = ""; |
| | | InsertCargoDetailsWarpper insertCargoDetailsWarpper = new InsertCargoDetailsWarpper(); |
| | | try { |
| | | |
| | | InsertCargoDetailsWarpper data = CargoQueryInteraceUtil.getData(MCNumber,USdot); |
| | | value = JSON.toJSONString(data); |
| | | JSONObject o = JSONObject.parseObject(value); |
| | | if (ToolUtil.isNotEmpty(o)){ |
| | | insertCargoDetailsWarpper.setUSDot(o.get("uSDot").toString()); |
| | | insertCargoDetailsWarpper.setAddress(o.get("address").toString()); |
| | | insertCargoDetailsWarpper.setDrivers(o.get("drivers").toString().equals("null")?"0":o.get("drivers").toString()); |
| | | insertCargoDetailsWarpper.setCompanyName(o.get("companyName").toString()); |
| | | insertCargoDetailsWarpper.setPowerUnits(o.get("powerUnits").toString()); |
| | | insertCargoDetailsWarpper.setInspection(o.get("inspection").toString()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ERROR; |
| | | } |
| | | return new SuccessTip(insertCargoDetailsWarpper); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司-承运商详情",notes="卡车公司-承运商详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import jodd.madvoc.meta.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @ApiImplicitParam(name = "status", value = "status", required = false, dataType = "String",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "companyId", value = "companyId", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/list") |
| | | @ResponseBody |
| | | public Object list(String makeModel,Integer powerUnitNumber,String ownership, String status ,int pageNumber,int pageSize) { |
| | | public Object list(String makeModel,Integer powerUnitNumber,String ownership, String status ,int pageNumber,int pageSize,Integer companyId) { |
| | | Page<TPowerUnits> tPowerUnitsPage = new Page<>(pageNumber, pageSize); |
| | | EntityWrapper<TPowerUnits> tPowerUnitsEntityWrapper = new EntityWrapper<>(); |
| | | tPowerUnitsEntityWrapper.eq("type",1); |
| | | tPowerUnitsEntityWrapper.eq("company_id",companyId); |
| | | if(ToolUtil.isNotEmpty(status)){ |
| | | tPowerUnitsEntityWrapper.eq("status",status); |
| | | } |
| | |
| | | @ApiImplicitParam(name = "status", value = "status", required = false, dataType = "String",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "companyId", value = "companyId", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/listChassises") |
| | | @ResponseBody |
| | | public Object listChassises(String makeModel,String vehicleIdNumber,String ownership, String status ,int pageNumber,int pageSize) { |
| | | public Object listChassises(String makeModel, String vehicleIdNumber, String ownership, String status , int pageNumber, int pageSize, Integer companyId) { |
| | | Page<TPowerUnits> tPowerUnitsPage = new Page<>(pageNumber, pageSize); |
| | | EntityWrapper<TPowerUnits> tPowerUnitsEntityWrapper = new EntityWrapper<>(); |
| | | tPowerUnitsEntityWrapper.eq("type",2); |
| | | tPowerUnitsEntityWrapper.eq("company_id",companyId); |
| | | if(ToolUtil.isNotEmpty(status)){ |
| | | tPowerUnitsEntityWrapper.eq("status",status); |
| | | } |
| | |
| | | |
| | | public enum UserFeeSettingEnum { |
| | | |
| | | LH_FSH(1, "LH-FSH"), |
| | | LH_FSH(1, "LH+FSC"), |
| | | CHASSIS_FEE(2, "Chassis fee"), |
| | | PREPULL(3, "Prepull"), |
| | | CHASSIS_SPLIT(4, "Chassis split"), |
| | |
| | | private Integer danger; |
| | | @ApiModelProperty("是否超重 0否 1是") |
| | | private Integer weight; |
| | | |
| | | |
| | | |
| | | private List<TGoods> list; |
| | | |
| | | private String custRef; |
| | | private String entry; |
| | | private String ourRef; |
| | | private String po; |
| | | private String sb; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 订单详情 |
| | |
| | | |
| | | private Integer goodsId; |
| | | |
| | | private String status; |
| | | |
| | | |
| | | private String driverLat; |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | @Data |
| | | public class SetWarehouseDto { |
| | | private List<Integer> id; |
| | | private double money; |
| | | } |
| | |
| | | @ApiModelProperty(value = "计算出的价格") |
| | | private BigDecimal price; |
| | | |
| | | private String day; |
| | | |
| | | } |
| | |
| | | @TableField("company_bill") |
| | | private Integer companyBill; |
| | | |
| | | private Integer change; |
| | | |
| | | public Integer getChange() { |
| | | return change; |
| | | } |
| | | |
| | | public void setChange(Integer change) { |
| | | this.change = change; |
| | | } |
| | | |
| | | public Date getOrderOkTime() { |
| | | return orderOkTime; |
| | | } |
| | |
| | | */ |
| | | private String state; |
| | | |
| | | private String day; |
| | | |
| | | public String getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(String day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public BigDecimal getCarPrice() { |
| | | return carPrice; |
| | | } |
| | |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | List<GoodsInfoVo> getGoodsInfo(Long orderId); |
| | | |
| | | OrderInfo getOrderInfo(Long orderId); |
| | | HashMap<String, Object> getOrderInfo(Long orderId); |
| | | |
| | | Boolean addOrderFile(Long orderId, String url, String name); |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.GeocodeVo; |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.GoogleMapUtil; |
| | | import io.swagger.annotations.ApiModel; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Override |
| | | public TCompanyCalculationRespOne getQuotaFromId(Long id) { |
| | | TQuote quote = quoteService.selectById(id); |
| | | TOrder tOrder1 = orderService.selectById(id); |
| | | |
| | | TQuote quote = quoteService.selectOne(new EntityWrapper<TQuote>().eq("order_id",tOrder1.geteZipZ())); |
| | | TCompanyCalculationRespOne tCompanyCalculationRespOne = new TCompanyCalculationRespOne(); |
| | | tCompanyCalculationRespOne.setQuoteId(quote.getId()); |
| | | |
| | |
| | | |
| | | ArrayList<LonLat> lonLats = new ArrayList<>(); |
| | | LonLat latLng = new LonLat(); |
| | | latLng.setLat("-113.6510249618184"); |
| | | latLng.setLng("37.8924429618184"); |
| | | latLng.setLat(orders1.get(0).getStartLat()); |
| | | latLng.setLng(orders1.get(0).getStartLon()); |
| | | lonLats.add(latLng); |
| | | latLng=new LonLat(); |
| | | latLng.setLat("-113.066919618184"); |
| | | latLng.setLng("37.684389618184"); |
| | | GeocodeVo geocode = googleMapUtil.getGeocode(orders1.get(0).geteAddress()); |
| | | latLng.setLat(String.valueOf(geocode.getLat())); |
| | | latLng.setLng(String.valueOf(geocode.getLng())); |
| | | lonLats.add(latLng); |
| | | tCompanyCalculationRespOne.setLonLats(lonLats); |
| | | ArrayList<TGoods> tGoods = new ArrayList<>(); |
| | |
| | | tCompanyResp.setOrderId(order.getId()); |
| | | tCompanyResp.setName(price.getType()); |
| | | tCompanyResp.setPrice(price.getCarPrice()); |
| | | tCompanyResp.setDay(price.getDay()); |
| | | tCompanyRespList.add(tCompanyResp); |
| | | } |
| | | BigDecimal bigDecimal = tCompanyRespList.stream().map(TCompanyResp::getPrice).reduce(BigDecimal::add).orElse(new BigDecimal(0.00)); |
| | | BigDecimal bigDecimal = tCompanyRespList.stream().map(e->e.getPrice()==null?new BigDecimal(0):e.getPrice()).reduce(BigDecimal::add).orElse(new BigDecimal(0.00)); |
| | | tCompanyCalculationResp.setAllTotal(bigDecimal); |
| | | tCompanyCalculationResp.setList(tCompanyRespList); |
| | | // 过滤订单 |
| | | List<TOrder> orderList = orders.stream().filter(o -> o.getCompanyId().equals(company.getId())).collect(Collectors.toList()); |
| | | for (TOrder tOrder2 : orderList) { |
| | | Integer port1 = tOrder2.getPort(); |
| | | TPort tPort1 = tPortMapper.selectById(port1); |
| | | TCountry tCountry2 = tCountryMapper.selectById(tPort1.getCity()); |
| | | tOrder2.setCity(tCountry2.getId()); |
| | | TCountry tCountry3 = tCountryMapper.selectById(tCountry2.getParentId()); |
| | | tOrder2.setState(tCountry3.getId()); |
| | | } |
| | | tCompanyCalculationResp.setOrderList(orderList); |
| | | |
| | | companyInfos.add(tCompanyCalculationResp); |
| | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ITBoxSizeService; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverService; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.GeocodeVo; |
| | | import com.stylefeng.guns.modular.system.utils.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.utils.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | return goodsInfoVos; |
| | | } |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | private TTransportationService tTransportationService; |
| | | |
| | | @Autowired |
| | | private ITExamSiteService examSiteService; |
| | | |
| | | @Autowired |
| | | private TYardService yardService; |
| | | |
| | | private HashMap<String, String> getLat(String a){ |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | try { |
| | | GeocodeVo geocode = googleMapUtil.getGeocode(a); |
| | | map.put("lon",String.valueOf(geocode.getLng())); |
| | | map.put("lat",String.valueOf(geocode.getLat())); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | map.put("lon",null); |
| | | map.put("lat",null); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | @Override |
| | | public OrderInfo getOrderInfo(Long orderId) { |
| | | public HashMap<String, Object> getOrderInfo(Long orderId) { |
| | | OrderInfo orderInfo = new OrderInfo(); |
| | | ArrayList<LonLat> lonLats = new ArrayList<>(); |
| | | |
| | | TOrder tOrder = this.baseMapper.selectById(orderId); |
| | | |
| | | String value = redisUtil.getValue(String.valueOf(orderId)); |
| | | orderInfo.setDriverLat(value); |
| | | ArrayList<Map<String,String>> maps = new ArrayList<>(); |
| | | TPort tPort1 = portMapper.selectById(tOrder.getPort()); |
| | | maps.add(getLat(tPort1.getAddress())); |
| | | |
| | | if(tOrder.getExamSite()!=null){ |
| | | Integer examSite = tOrder.getExamSite(); |
| | | TExamSite tExamSite = examSiteService.selectById(examSite); |
| | | // 第二个检查站 |
| | | maps.add(getLat(tExamSite.getAddress())); |
| | | } |
| | | |
| | | TTransportation tTransportations1 = tTransportationService.selectOne(new EntityWrapper<TTransportation>().eq("order_id", orderId).eq("type",2)); |
| | | if(tTransportations1!=null){ |
| | | Integer yardId = tTransportations1.getYardId(); |
| | | if(yardId!=null){ |
| | | TYard tYard = yardService.selectById(yardId); |
| | | maps.add(getLat(tYard.getStreetAddress())); |
| | | } |
| | | } |
| | | |
| | | |
| | | if(tOrder.geteAddress()!=null){ |
| | | maps.add(getLat(tOrder.geteAddress())); |
| | | } |
| | | |
| | | |
| | | orderInfo.setSlat(tOrder.getStartLat()); |
| | | orderInfo.setSlon(tOrder.getStartLon()); |
| | | orderInfo.setStatus(tOrder.getStatus()); |
| | | LonLat lonLat = new LonLat(); |
| | | lonLat.setLat(tOrder.getStartLat()); |
| | | lonLat.setLng(tOrder.getStartLon()); |
| | | lonLats.add(lonLat); |
| | | String s = tOrder.geteAddress(); |
| | | // GeocodeVo geocode = googleMapUtil.getGeocode(s); |
| | | // orderInfo.setElat(String.valueOf(geocode.getLat())); |
| | | // orderInfo.setElon(String.valueOf(geocode.getLng())); |
| | | String s = tOrder.geteAddress(); |
| | | GeocodeVo geocode = googleMapUtil.getGeocode(s); |
| | | orderInfo.setElat(String.valueOf(geocode.getLat())); |
| | | orderInfo.setElon(String.valueOf(geocode.getLng())); |
| | | lonLat=new LonLat(); |
| | | lonLat.setLng("-113.066919618184"); |
| | | lonLat.setLat("37.684389618184"); |
| | | lonLat.setLng(tOrder.getStartLon()); |
| | | lonLat.setLat(tOrder.getStartLat()); |
| | | lonLats.add(lonLat); |
| | | orderInfo.setElat("37.684389618184"); |
| | | orderInfo.setElon("-113.066919618184"); |
| | | orderInfo.setElat(String.valueOf(geocode.getLat())); |
| | | orderInfo.setElon(String.valueOf(geocode.getLng())); |
| | | |
| | | orderInfo.setLonLats(lonLats); |
| | | Long quoteId = tQuoteMapper.selectList(new EntityWrapper<TQuote>().eq("order_id", tOrder.geteZipZ())).get(0).getId(); |
| | |
| | | // 获取码头id 获取码头地址 pickup信息 |
| | | Integer portId = tOrder.getPort(); |
| | | TPort tPort = portMapper.selectById(portId); |
| | | orderInfo.setAddress(tOrder.geteAddress()); |
| | | orderInfo.setAddress(tPort.getAddress()); |
| | | orderInfo.setContactName(tOrder.getsName()); |
| | | orderInfo.setContactPhone(tOrder.getsPhone()); |
| | | orderInfo.setContactEmail(tOrder.getsEmail()); |
| | |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | goods.forEach(e->{ |
| | | strings.add(e.getContainerNumber()); |
| | | strings.add(String.valueOf(e.getOrderId())); |
| | | orderInfo.setGoodsId(e.getId()); |
| | | orderInfo.setBl(e.getBillNumber()); |
| | | }); |
| | |
| | | orderInfo.setNote(driverNoteVos); |
| | | orderInfo.setTrouble(driverNoteVos1); |
| | | orderInfo.setState(tOrder.getState()); |
| | | return orderInfo; |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("lonlat",maps); |
| | | map.put("data",orderInfo); |
| | | return map; |
| | | |
| | | |
| | | } |
| | |
| | | public class AddressLookup { |
| | | |
| | | public static String getAddress(String administrativeCode) { |
| | | String apiKey = "AIzaSyBBW0XxW1FK7IXmmS7KFtAjX3o99eFPsss"; |
| | | |
| | | // 创建GeoApiContext实例 |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey("AIzaSyBBW0XxW1FK7IXmmS7KFtAjX3o99eFPsss") // REPLACE WITH YOUR API KEY |
| | | .build(); |
| | | |
| | | GeocodingResult[] results = GeocodingApi.geocode(context, "EN " + administrativeCode).awaitIgnoreError(); |
| | | |
| | | if (results == null || results.length == 0) { |
| | | return null; |
| | | .apiKey(apiKey) |
| | | .build(); |
| | | |
| | | // 设置邮政编码 |
| | | String zipcode = administrativeCode; |
| | | |
| | | try { |
| | | // 发起逆地理编码请求 |
| | | GeocodingResult[] results = GeocodingApi.geocode(context, zipcode).await(); |
| | | |
| | | // 提取结果 |
| | | if (results.length > 0) { |
| | | String formattedAddress = results[0].formattedAddress; |
| | | System.out.println("地址:" + formattedAddress); |
| | | return formattedAddress; |
| | | } else { |
| | | System.out.println("未找到地址"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | AddressComponent[] components = results[0].addressComponents; |
| | | String province = getComponent(components, "administrative_area_level_1"); |
| | | String city = getComponent(components, "locality"); |
| | | String district = getComponent(components, "administrative_area_level_3"); |
| | | String street = getComponent(components, "route"); |
| | | String number = getComponent(components, "street_number"); |
| | | |
| | | StringBuilder builder = new StringBuilder(); |
| | | |
| | | if (province != null) { |
| | | builder.append(province); |
| | | } |
| | | |
| | | if (city != null && !city.equals(province)) { |
| | | builder.append(city); |
| | | } |
| | | |
| | | if (district != null && !district.equals(city)) { |
| | | builder.append(district); |
| | | } |
| | | |
| | | if (street != null) { |
| | | builder.append(street); |
| | | } |
| | | |
| | | if (number != null) { |
| | | builder.append(number); |
| | | } |
| | | |
| | | return builder.toString(); |
| | | return null; |
| | | } |
| | | |
| | | private static String getComponent(AddressComponent[] components, String type) { |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.utils; |
| | | |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import cn.hutool.http.HttpRequest; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * 第三方卡车公司列表数据 |
| | | * </p> |
| | | * |
| | | * @Author: lisy |
| | | * @date: 2023-05-19 16:01 |
| | | * @Description: |
| | | */ |
| | | |
| | | |
| | | public class CargoQueryInteraceUtil { |
| | | |
| | | private static final String dotUrl = "https://mobile.fmcsa.dot.gov/qc/services/carriers/"; |
| | | private static final String mcUrl = "https://mobile.fmcsa.dot.gov/qc/services/carriers/docket-number/"; |
| | | |
| | | private static final String API_WEB_KEY = "59ed4972942476ba86e3272d892ef1628cf86003"; |
| | | |
| | | public static InsertCargoDetailsWarpper getData(String mcNumber, String dotNumber) throws Exception{ |
| | | InsertCargoDetailsWarpper insertCargoDetailsWarpper = new InsertCargoDetailsWarpper(); |
| | | String us = ""; |
| | | String body = ""; |
| | | if (ToolUtil.isNotEmpty(mcNumber) && ToolUtil.isNotEmpty(dotNumber)){ |
| | | us = dotUrl+ mcNumber+"?webKey="+API_WEB_KEY; |
| | | body = HttpRequest.get(us) |
| | | .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36") |
| | | .header("Cookie", "AWSALB=WAH8+geD5YgGqse36enwBDh/DaRTHQ+VjfiaxK2lr9cX20CMl3LyjRlLxptADtdfOEtBea28f+TCXFdo3atMsA97tAitTIAObN5KgsbdgHv65YM1ww40sS2/2LJ6; AWSALBCORS=WAH8+geD5YgGqse36enwBDh/DaRTHQ+VjfiaxK2lr9cX20CMl3LyjRlLxptADtdfOEtBea28f+TCXFdo3atMsA97tAitTIAObN5KgsbdgHv65YM1ww40sS2/2LJ6") |
| | | .header("path", "/qc/services/carriers/"+mcNumber+"?webKey="+API_WEB_KEY) |
| | | .header("Scheme", "https") |
| | | .header("Accept","*/*") |
| | | .header("Accept-Encoding","gzip, deflate, br") |
| | | .header("Connection","keep-alive") |
| | | .header("Referer","same-origin") |
| | | .execute().body(); |
| | | } |
| | | if (ToolUtil.isNotEmpty(mcNumber) && ToolUtil.isEmpty(dotNumber) ){ |
| | | us = dotUrl+ mcNumber+"?webKey="+API_WEB_KEY; |
| | | body = HttpRequest.get(us) |
| | | .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36") |
| | | .header("Cookie", "AWSALB=WAH8+geD5YgGqse36enwBDh/DaRTHQ+VjfiaxK2lr9cX20CMl3LyjRlLxptADtdfOEtBea28f+TCXFdo3atMsA97tAitTIAObN5KgsbdgHv65YM1ww40sS2/2LJ6; AWSALBCORS=WAH8+geD5YgGqse36enwBDh/DaRTHQ+VjfiaxK2lr9cX20CMl3LyjRlLxptADtdfOEtBea28f+TCXFdo3atMsA97tAitTIAObN5KgsbdgHv65YM1ww40sS2/2LJ6") |
| | | .header("path", "/qc/services/carriers/"+dotNumber+"?webKey="+API_WEB_KEY) |
| | | .header("Scheme", "https") |
| | | .header("Accept","*/*") |
| | | .header("Accept-Encoding","gzip, deflate, br") |
| | | .header("Connection","keep-alive") |
| | | .header("Referer","same-origin") |
| | | .execute().body(); |
| | | } |
| | | if (ToolUtil.isNotEmpty(dotNumber) && ToolUtil.isEmpty(mcNumber)){ |
| | | us = mcUrl+ dotNumber+"?webKey="+API_WEB_KEY; |
| | | body = HttpRequest.get(us) |
| | | .header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36") |
| | | .header("Cookie", "AWSALB=WAH8+geD5YgGqse36enwBDh/DaRTHQ+VjfiaxK2lr9cX20CMl3LyjRlLxptADtdfOEtBea28f+TCXFdo3atMsA97tAitTIAObN5KgsbdgHv65YM1ww40sS2/2LJ6; AWSALBCORS=WAH8+geD5YgGqse36enwBDh/DaRTHQ+VjfiaxK2lr9cX20CMl3LyjRlLxptADtdfOEtBea28f+TCXFdo3atMsA97tAitTIAObN5KgsbdgHv65YM1ww40sS2/2LJ6") |
| | | .header("path", "/qc/services/carriers/docket-number/"+dotNumber+"?webKey="+API_WEB_KEY) |
| | | .header("Scheme", "https") |
| | | .header("Accept","*/*") |
| | | .header("Accept-Encoding","gzip, deflate, br") |
| | | .header("Connection","keep-alive") |
| | | .header("Referer","same-origin") |
| | | .execute().body(); |
| | | } |
| | | |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | |
| | | System.out.println(body); |
| | | |
| | | JsonNode jsonNode = mapper.readTree(body); |
| | | JsonNode carrierJson; |
| | | if(ToolUtil.isEmpty(dotNumber)){ |
| | | carrierJson= jsonNode.get("content").get("carrier"); |
| | | }else { |
| | | carrierJson= jsonNode.get("content").get(0).get("carrier"); |
| | | } |
| | | String dotNumber1 = carrierJson.get("dotNumber").asText(); |
| | | insertCargoDetailsWarpper.setUSDot(dotNumber1); |
| | | |
| | | |
| | | String s = carrierJson.get("legalName").asText(); |
| | | insertCargoDetailsWarpper.setCompanyName(s); |
| | | |
| | | |
| | | String phyStreet = carrierJson.get("phyStreet").asText(); |
| | | String phyZipcode = carrierJson.get("phyZipcode").asText(); |
| | | String phyCountry = carrierJson.get("phyCountry").asText(); |
| | | String phyCity = carrierJson.get("phyCity").asText(); |
| | | String phyState = carrierJson.get("phyState").asText(); |
| | | String address = phyCity + " " + phyState + " " + phyZipcode; |
| | | insertCargoDetailsWarpper.setAddress(address); |
| | | |
| | | |
| | | String totalDrivers = carrierJson.get("totalDrivers").asText(); |
| | | insertCargoDetailsWarpper.setDrivers(totalDrivers); |
| | | |
| | | String vehicleOosInsp = carrierJson.get("vehicleOosInsp").asText(); |
| | | insertCargoDetailsWarpper.setInspection(vehicleOosInsp); |
| | | |
| | | String totalPowerUnits = carrierJson.get("totalPowerUnits").asText(); |
| | | insertCargoDetailsWarpper.setPowerUnits(totalPowerUnits); |
| | | |
| | | |
| | | return insertCargoDetailsWarpper; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.utils; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | |
| | | public class ChassisRentalDaysUtil { |
| | | // TODO 线上替换linux路径 |
| | | private static final String CHAISS="/usr/python/chassis_rental_days.py"; |
| | | private static final String EMPTY="/usr/python/empty_storage_days.py"; |
| | | private static final String PREPULL="/usr/python/prepull_storage_days.py"; |
| | | private static final String UNLOADING="/usr/python/unloading_time.py"; |
| | | public static String chassisRentalDays(int type,String arg1,String arg2,String arg3,String agr4,String agr5,String arg6,String arg7,String arg8){ |
| | | try { |
| | | String[] arg; |
| | | if(type==1){ |
| | | arg = new String[] { "python", CHAISS,arg1,arg2,arg3,agr4,agr5,arg6,arg7,arg8}; |
| | | }else if(type==2){ |
| | | arg = new String[] { "python", EMPTY,arg1,arg2,arg3,agr4,agr5,arg6,arg7,arg8}; |
| | | }else if(type==3){ |
| | | arg = new String[] { "python", PREPULL,arg1,arg2,arg3,agr4,agr5,arg6,arg7,arg8}; |
| | | }else { |
| | | arg = new String[] { "python", UNLOADING,arg1,arg2,arg3,agr4,agr5,arg6,arg7,arg8}; |
| | | } |
| | | |
| | | Process exec = Runtime.getRuntime().exec(arg); |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(exec.getInputStream())); |
| | | String line = null; |
| | | String day=null; |
| | | while ((line = in.readLine()) != null) { |
| | | day=line; |
| | | } |
| | | String substring = day.substring(day.indexOf("[")+1, day.lastIndexOf(".")); |
| | | System.out.println(substring); |
| | | in.close(); |
| | | return substring; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | @Component |
| | | public class GoogleMapUtil { |
| | | |
| | | private static final String key = "AIzaSyBBW0XxW1FK7IXmmS7KFtAjX3o99eFPsss"; |
| | | // private final String key = "AIzaSyBBW0XxW1FK7IXmmS7KFtAjX3o99eFPsss"; |
| | | private final String key = "AIzaSyBBW0XxW1FK7IXmmS7KFtAjX3o99eFPsss"; |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | |
| | | * @param address 地址信息 |
| | | * @throws Exception |
| | | */ |
| | | public static GeocodeVo getGeocode(String address){ |
| | | public GeocodeVo getGeocode(String address){ |
| | | log.info("谷歌地图 根据地址获取经纬度:"+address); |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | |
| | | */ |
| | | public ReverseGeocodeVo getReverseGeocode(double lat, double lng) throws Exception{ |
| | | // TODO: 2022/10/22 临时用IGO跳转 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("lat", lat); |
| | | map.put("lng", lng); |
| | | map.put("key", key); |
| | | HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", "http://182.160.16.251:1010/base/googleMap/getReverseGeocode", map, null, "form"); |
| | | ReverseGeocodeVo reverseGeocode = JSON.parseObject(httpResult.getData(), ReverseGeocodeVo.class); |
| | | return reverseGeocode; |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("lat", lat); |
| | | // map.put("lng", lng); |
| | | // map.put("key", key); |
| | | // HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", "http://182.160.16.251:1010/base/googleMap/getReverseGeocode", map, null, "form"); |
| | | // ReverseGeocodeVo reverseGeocode = JSON.parseObject(httpResult.getData(), ReverseGeocodeVo.class); |
| | | // return reverseGeocode; |
| | | |
| | | // GeoApiContext context = new GeoApiContext.Builder() |
| | | // .apiKey(key) |
| | | // .build(); |
| | | // GeocodingApiRequest request = GeocodingApi.reverseGeocode(context, new LatLng(lat, lng)); |
| | | // GeocodingResult[] results = request.await(); |
| | | // ReverseGeocodeVo vo = null; |
| | | // if(results.length > 0){ |
| | | // Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | // System.out.println(gson.toJson(results[0].addressComponents)); |
| | | // |
| | | // |
| | | // vo = new ReverseGeocodeVo(); |
| | | // AddressComponent[] addressComponents = results[0].addressComponents; |
| | | // AddressComponentsVo[] addressComponentsVos = new AddressComponentsVo[addressComponents.length]; |
| | | // for (int i = 0; i < addressComponents.length; i++) { |
| | | // AddressComponentsVo addressComponentsVos1 = new AddressComponentsVo(); |
| | | // addressComponentsVos1.setLongName(addressComponents[i].longName); |
| | | // addressComponentsVos1.setShortName(addressComponents[i].shortName); |
| | | // addressComponentsVos[i] = addressComponentsVos1; |
| | | // } |
| | | // String address = results[0].formattedAddress; |
| | | // vo.setAddressComponentsVos(addressComponentsVos); |
| | | // vo.setAddress(address); |
| | | // } |
| | | // context.shutdown(); |
| | | // return vo; |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | GeocodingApiRequest request = GeocodingApi.reverseGeocode(context, new LatLng(lat, lng)); |
| | | GeocodingResult[] results = request.await(); |
| | | ReverseGeocodeVo vo = null; |
| | | if(results.length > 0){ |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(results[0].addressComponents)); |
| | | |
| | | |
| | | vo = new ReverseGeocodeVo(); |
| | | AddressComponent[] addressComponents = results[0].addressComponents; |
| | | AddressComponentsVo[] addressComponentsVos = new AddressComponentsVo[addressComponents.length]; |
| | | for (int i = 0; i < addressComponents.length; i++) { |
| | | AddressComponentsVo addressComponentsVos1 = new AddressComponentsVo(); |
| | | addressComponentsVos1.setLongName(addressComponents[i].longName); |
| | | addressComponentsVos1.setShortName(addressComponents[i].shortName); |
| | | addressComponentsVos[i] = addressComponentsVos1; |
| | | } |
| | | String address = results[0].formattedAddress; |
| | | vo.setAddressComponentsVos(addressComponentsVos); |
| | | vo.setAddress(address); |
| | | } |
| | | context.shutdown(); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public DistancematrixVo getDistancematrix(String origin, String destination) throws Exception{ |
| | | // TODO: 2022/10/22 临时用IGO跳转 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("origin", origin); |
| | | map.put("destination", destination); |
| | | map.put("key", key); |
| | | HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", "http://182.160.16.251:1010/base/googleMap/getDistancematrix", map, null, "form"); |
| | | DistancematrixVo reverseGeocode = JSON.parseObject(httpResult.getData(), DistancematrixVo.class); |
| | | return reverseGeocode; |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("origin", origin); |
| | | // map.put("destination", destination); |
| | | // map.put("key", key); |
| | | // HttpResult httpResult = httpClientUtil.pushHttpRequset("POST", "http://182.160.16.251:1010/base/googleMap/getDistancematrix", map, null, "form"); |
| | | // DistancematrixVo reverseGeocode = JSON.parseObject(httpResult.getData(), DistancematrixVo.class); |
| | | // return reverseGeocode; |
| | | |
| | | // GeoApiContext context = new GeoApiContext.Builder() |
| | | // .apiKey(key) |
| | | // .build(); |
| | | // DistanceMatrixApiRequest request = DistanceMatrixApi.getDistanceMatrix(context, new String[]{origin}, new String[]{destination}); |
| | | // request.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | // DistanceMatrix distanceMatrix = request.await(); |
| | | // Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | // System.out.println(gson.toJson(distanceMatrix)); |
| | | // context.shutdown(); |
| | | // |
| | | // DistanceMatrixElement elements = distanceMatrix.rows[0].elements[0]; |
| | | // DistancematrixVo vo = new DistancematrixVo(); |
| | | // vo.setDistance(elements.distance.inMeters); |
| | | // vo.setDuration(elements.duration.inSeconds); |
| | | // return vo; |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | DistanceMatrixApiRequest request = DistanceMatrixApi.getDistanceMatrix(context, new String[]{origin}, new String[]{destination}); |
| | | request.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | DistanceMatrix distanceMatrix = request.await(); |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(distanceMatrix)); |
| | | context.shutdown(); |
| | | |
| | | DistanceMatrixElement elements = distanceMatrix.rows[0].elements[0]; |
| | | DistancematrixVo vo = new DistancematrixVo(); |
| | | vo.setDistance(elements.distance.inMeters); |
| | | vo.setDuration(elements.duration.inSeconds); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public void main(String[] ages){ |
| | | try { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.utils; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @Author: lisy |
| | | * @date: 2023-05-19 17:55 |
| | | * @Description: |
| | | */ |
| | | |
| | | @Data |
| | | public class InsertCargoDetailsWarpper { |
| | | |
| | | private String MCNumber; |
| | | |
| | | private String uSDot; |
| | | |
| | | private String companyName; |
| | | |
| | | private String SCACCode; |
| | | |
| | | private String address; |
| | | |
| | | private String setUpTime; |
| | | |
| | | private String drivers; |
| | | |
| | | private String inspection; |
| | | |
| | | private String powerUnits; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | multipart: |
| | | max-request-size: 100MB |
| | | max-file-size: 100MB |
| | | location: /home/temp |
| | | |
| | | mybatis-plus: |
| | | typeAliasesPackage: com.stylefeng.guns.modular.system.model |
| | |
| | | spring: |
| | | profiles: local |
| | | datasource: |
| | | url: jdbc:mysql://127.0.0.1:3306/broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://54.67.44.33:3306/broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | #password: 7rco.Zt8wXv7 |
| | | password: 123456 |
| | | password: 7rco.Zt8wXv7 |
| | | # password: 123456 |
| | | db-name: broker #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |