| | |
| | | tCompanyCalculationRespOne.setPickupStr(tOrder.getAccessorialStr()); |
| | | tCompanyCalculationRespOne.setDestinationStr(tOrder.getDeliveryStr()); |
| | | tCompanyCalculationRespOne.setCustomer(user.getCompanyName()); |
| | | |
| | | |
| | | System.out.println(quote.getCreateId()); |
| | | if(quote.getCreateId()!=null){ |
| | | User user1 = userMapper.selectById(quote.getCreateId()); |
| | | tCompanyCalculationRespOne.setCreateUser(user1.getName()); |
| | | }else { |
| | | tCompanyCalculationRespOne.setCreateUser(user.getCompanyName()); |
| | | TCompany company = companyMapper.selectById(quote.getCreateId()); |
| | | tCompanyCalculationRespOne.setCreateUser(company.getName()); |
| | | } |
| | | |
| | | Integer port = tOrder.getPort(); |
| | | TPort tPort = tPortMapper.selectById(port); |
| | | TCountry tCountry = tCountryMapper.selectById(tPort.getCity()); |
| | |
| | | |
| | | 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<>(); |
| | |
| | | |
| | | ArrayList<CompanyInfo> companyInfos = new ArrayList<>(); |
| | | for (TOrder order : orders) { |
| | | |
| | | Integer port1 = order.getPort(); |
| | | // 获取码头的上级id |
| | | TPort tPort1 = tPortMapper.selectById(port1); |
| | | TCountry tCountry2 = tCountryMapper.selectById(tPort1.getCity()); |
| | | |
| | | |
| | | CompanyInfo tCompanyCalculationResp = new CompanyInfo(); |
| | | // 查询公司 |
| | | TCompany company = companyMapper.selectById(order.getCompanyId()); |
| | |
| | | tCompanyCalculationResp.setExpirationDate(company.getExpirationTime()); |
| | | |
| | | // 查询公司下的价格集合 |
| | | List<TPrice> prices = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())); |
| | | List<TPrice> prices = priceMapper.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId()).eq("status",1)); |
| | | List<TCompanyResp> tCompanyRespList = new ArrayList<>(); |
| | | for (TPrice price : prices) { |
| | | TCompanyResp tCompanyResp = new TCompanyResp(); |
| | | tCompanyResp.setOrderId(order.getId()); |
| | | tCompanyResp.setName(price.getType()); |
| | | tCompanyResp.setPrice(price.getPrice()); |
| | | tCompanyResp.setAdminPrice(price.getPrice()); |
| | | 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(TCompanyResp::getAdminPrice).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 port2 = tOrder2.getPort(); |
| | | TPort tPort2 = tPortMapper.selectById(port2); |
| | | TCountry tCountry3 = tCountryMapper.selectById(tPort2.getCity()); |
| | | tOrder2.setCity(tCountry3.getId()); |
| | | TCountry tCountry4 = tCountryMapper.selectById(tCountry3.getParentId()); |
| | | tOrder2.setState(tCountry4.getId()); |
| | | } |
| | | tCompanyCalculationResp.setOrderList(orderList); |
| | | |
| | | companyInfos.add(tCompanyCalculationResp); |
| | | } |
| | | ArrayList<CompanyInfo> collect = companyInfos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CompanyInfo::getCompanyId))), ArrayList::new)); |
| | | for (CompanyInfo companyInfo : collect) { |
| | | Map<String, BigDecimal> map = new HashMap<>(); |
| | | List<CompanyInfo> collect1 = companyInfos.stream().filter(e -> e.getCompanyId().equals(companyInfo.getCompanyId())).collect(Collectors.toList()); |
| | | BigDecimal bigDecimal1 = collect1.stream().map(CompanyInfo::getAllTotal).reduce(BigDecimal::add).get(); |
| | | companyInfo.setAllTotal(bigDecimal1); |
| | | for (CompanyInfo info : collect1) { |
| | | List<TCompanyResp> list = info.getList(); |
| | | for (TCompanyResp tCompanyResp : list) { |
| | | Object o = map.get(tCompanyResp.getName()); |
| | | if(o!=null){ |
| | | map.put(tCompanyResp.getName(),new BigDecimal(o.toString()).add(tCompanyResp.getAdminPrice())); |
| | | }else { |
| | | map.put(tCompanyResp.getName(),tCompanyResp.getAdminPrice()); |
| | | } |
| | | } |
| | | } |
| | | List<TCompanyResp> list = companyInfo.getList(); |
| | | for (TCompanyResp tCompanyResp : list) { |
| | | tCompanyResp.setAdminPrice(map.get(tCompanyResp.getName())); |
| | | } |
| | | } |
| | | tCompanyCalculationRespOne.setCompanyInfos(collect); |
| | | return tCompanyCalculationRespOne; |
| | | } |
| | | |
| | | @Override |
| | | public TCompanyCalculationRespOne getQuotaFromIdAndCompanyId(Long id, Integer companyIds) { |
| | | TQuote quote = quoteService.selectById(id); |
| | |
| | | tCompanyResp.setOrderId(order.getId()); |
| | | tCompanyResp.setName(price.getType()); |
| | | tCompanyResp.setPrice(price.getPrice()); |
| | | tCompanyResp.setAdminPrice(price.getPrice()); |
| | | tCompanyRespList.add(tCompanyResp); |
| | | } |
| | | BigDecimal bigDecimal = tCompanyRespList.stream().map(TCompanyResp::getPrice).reduce(BigDecimal::add).orElse(new BigDecimal(0.00)); |
| | | BigDecimal bigDecimal = tCompanyRespList.stream().map(TCompanyResp::getAdminPrice).reduce(BigDecimal::add).orElse(new BigDecimal(0.00)); |
| | | tCompanyCalculationResp.setAllTotal(bigDecimal); |
| | | tCompanyCalculationResp.setList(tCompanyRespList); |
| | | // 过滤订单 |