liujie
2023-05-26 26fa723daeccb1e731ed24034ac66aa5c56c4269
src/main/java/com/stylefeng/guns/modular/system/controller/DemandController.java
@@ -228,7 +228,12 @@
                        tOrder.setInvoiceNumber(s2);
                        tOrder.setCompanyId(company.getId());
                        tOrder.setCreateTime(new Date());
                        if("0".equals(demandDto.getWarehouse())){
                        tOrder.seteAddress(demandDto.getEAddress());
                        }else {
                            TWarehouse tWarehouse = warehouseService.selectOne(new EntityWrapper<TWarehouse>().eq("company_id", company.getId()).eq("code", demandDto.getWarehouse()).eq("port_id",ratesId));
                            tOrder.seteAddress(tWarehouse.getAddress());
                        }
                        tOrder.setOrderType(1);
                        orderService.insert(tOrder);
                        tOrders.add(tOrder);
@@ -564,6 +569,7 @@
    }
    @ApiOperation(value = "需求列表",notes="需求列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
@@ -715,14 +721,35 @@
            @ApiImplicitParam(name = "address", value = "address", required = false, dataType = "String"),
            @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "String"),
            @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "String"),
            @ApiImplicitParam(name = "portId", value = "portId", required = true, dataType = "int"),
            @ApiImplicitParam(name = "companyId", value = "companyId", required = true, dataType = "int"),
    })
    @GetMapping(value = "/getWarehouse")
    @ResponseBody
    public Object getWarehouse( String address,int pageNumber,int pageSize) {
    public Object getWarehouse( String address,int pageNumber,int pageSize,int portId,int companyId) {
        TRates tRates1 = ratesService.selectOne(new EntityWrapper<TRates>().eq("metro_id", portId).eq("type", 2).eq("company_id", companyId));
        int ratesId=0;
        if(tRates1!=null){
            ratesId=tRates1.getId();
        }else {
            // 找出city
            TPort tPort = portService.selectById(portId);
            TCountry tCountry = countryService.selectById(tPort.getCity());
            // 是否是符合的港区
            tRates1 = ratesService.selectOne(new EntityWrapper<TRates>().eq("metro_id", tCountry.getId()).eq("type", 1).eq("company_id", companyId));
            if(tRates1!=null){
                ratesId=tRates1.getId();
            }else {
                ratesId=-1;
            }
//                    ratesId=tCountry.getId();
        }
        Page<TWarehouse> tWarehousePage = new Page<>(pageNumber, pageSize);
        EntityWrapper<TWarehouse> tWarehouseEntityWrapper = new EntityWrapper<>();
        tWarehouseEntityWrapper.eq("company_id",0);
        tWarehouseEntityWrapper.eq("company_id",companyId);
        tWarehouseEntityWrapper.eq("port_id",ratesId);
        if(Objects.nonNull(address)){
            tWarehouseEntityWrapper.like("address",address);
        }