liujie
2023-08-15 434088b7d4ee12c1206cfb194da2b600f4815f94
src/main/java/com/stylefeng/guns/modular/system/controller/RatesController.java
@@ -3,7 +3,9 @@
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.*;
@@ -241,26 +243,29 @@
            @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);
    }
@@ -311,7 +316,7 @@
        }else {
            map.put("lonlat",new ArrayList<>());
        }
        return new SuccessTip(map);
        return new SuccessTip(tCompanyBasic);
    }
    @ApiOperation(value = "卡车公司- 添加点对点/范围/距离",notes="卡车公司-添加点对点/范围/距离")
@@ -371,7 +376,11 @@
    @PostMapping(value = "/addFee")
    @ResponseBody
    public Object addFee(@RequestBody List<TCompanyFeeSetting> feeSettings) {
        if(feeSettings.get(0).getId()==null){
        tCompanyFeeSettingMapper.insertBatch(feeSettings);
        }else {
            tCompanyFeeSettingMapper.updateBatchById(feeSettings);
        }
        return new SuccessTip();
    }