liujie
2023-08-15 434088b7d4ee12c1206cfb194da2b600f4815f94
src/main/java/com/stylefeng/guns/modular/system/service/impl/TCompanyServiceImpl.java
@@ -10,6 +10,7 @@
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;
@@ -72,7 +73,9 @@
    @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());
@@ -111,12 +114,13 @@
        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<>();
@@ -147,13 +151,22 @@
                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);