| | |
| | | |
| | | |
| | | 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.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.modular.system.dao.TCompanyFeeSettingMapper; |
| | | 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.*; |
| | | import com.stylefeng.guns.modular.system.utils.UserInfoUtil; |
| | | import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.concurrent.Executor; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Controller |
| | | @Api(tags = "费用设置") |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "id", value = "当前公司id", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/metroList") |
| | | @ResponseBody |
| | | public Object metroList(int pageNumber,int pageSize) { |
| | | public Object metroList(int pageNumber,int pageSize,int id) { |
| | | Page<TRates> tRatesPage = new Page<>(pageNumber, pageSize); |
| | | Integer id = UserInfoUtil.getId(); |
| | | Page<TRates> tRates = ratesService.selectPage(tRatesPage,new EntityWrapper<TRates>().eq("company_id", id).eq("type", 1)); |
| | | Page<TRatesVo> tRatesVoPage = new Page<>(); |
| | | BeanUtil.copyProperties(tRates,tRatesVoPage); |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "id", value = "当前公司id", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/specialPortList") |
| | | @ResponseBody |
| | | public Object specialPortList(int pageNumber,int pageSize) { |
| | | public Object specialPortList(int pageNumber,int pageSize,int id) { |
| | | Page<TRates> tRatesPage = new Page<>(pageNumber, pageSize); |
| | | Integer id = UserInfoUtil.getId(); |
| | | Page<TRates> tRates = ratesService.selectPage(tRatesPage,new EntityWrapper<TRates>().eq("company_id", id).eq("type", 2)); |
| | | Page<TRatesVoOne> tRatesVoPage = new Page<>(); |
| | | BeanUtil.copyProperties(tRates,tRatesVoPage); |
| | |
| | | TPort tPort = tPortMapper.selectById(record.getMetroId()); |
| | | tRatesVo.setAddress(tPort.getAddress()); |
| | | tRatesVo.setZipCode(tPort.getZipCode()); |
| | | tRatesVo.setPortName(tPort.getName()); |
| | | TCountry tCountry = countryService.selectById(tPort.getCity()); |
| | | tRatesVo.setMetro(tCountry.getName()); |
| | | // state |
| | |
| | | ratesService.insert(tRates); |
| | | List<TWarehouse> tWarehouses = warehouseService.selectList(new EntityWrapper<TWarehouse>().eq("company_id", 0)); |
| | | tWarehouses.stream().forEach(e->{ |
| | | e.setCompanyId(UserInfoUtil.getId()); |
| | | e.setPortId(tRates.getId()); |
| | | e.setPortId(tRates.getId()); |
| | | }); |
| | | ExecutorService executorService = Executors.newCachedThreadPool(); |
| | | executorService.submit(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | tWarehouses.forEach(e->e.setCompanyId(tRates.getCompanyId())); |
| | | warehouseService.insertBatch(tWarehouses); |
| | | } |
| | | }); |
| | |
| | | @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); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "卡车公司- 点对点/范围/距离详情",notes="卡车公司-点对点/范围/距离详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @PostMapping(value = "/laneInfo") |
| | | @ResponseBody |
| | | public Object laneInfo( int id) { |
| | | TCompanyBasic tCompanyBasic = basicService.selectById(id); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("data",tCompanyBasic); |
| | | |
| | | if(tCompanyBasic.getType()==2){ |
| | | String lonLat = tCompanyBasic.getLonLat(); |
| | | String[] split = lonLat.split("_"); |
| | | ArrayList<LonLat> lonLats = new ArrayList<>(); |
| | | for (String s : split) { |
| | | String[] split1 = s.split(","); |
| | | LonLat lonLat1 = new LonLat(); |
| | | lonLat1.setLat(split1[0]); |
| | | lonLat1.setLng(split1[1]); |
| | | lonLats.add(lonLat1); |
| | | } |
| | | map.put("lonlat",lonLats); |
| | | }else { |
| | | map.put("lonlat",new ArrayList<>()); |
| | | } |
| | | return new SuccessTip(tCompanyBasic); |
| | | } |
| | | @ApiOperation(value = "卡车公司- 添加点对点/范围/距离",notes="卡车公司-添加点对点/范围/距离") |
| | | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "int",paramType = "query"), |
| | | @ApiImplicitParam(name = "companyId", value = "当前公司id", required = true, dataType = "int",paramType = "query"), |
| | | }) |
| | | @GetMapping(value = "/getFee") |
| | | @ResponseBody |
| | | public Object getFee( int id) { |
| | | Integer id1 = UserInfoUtil.getId(); |
| | | List<TCompanyFeeSetting> feeSettings = tCompanyFeeSettingMapper.selectList(new EntityWrapper<TCompanyFeeSetting>().eq("rates_id", id).eq("company_id", id1)); |
| | | public Object getFee( int id,int companyId) { |
| | | List<TCompanyFeeSetting> feeSettings = tCompanyFeeSettingMapper.selectList(new EntityWrapper<TCompanyFeeSetting>().eq("rates_id", id).eq("company_id", companyId)); |
| | | return new SuccessTip(feeSettings); |
| | | } |
| | | |
| | |
| | | @PostMapping(value = "/addFee") |
| | | @ResponseBody |
| | | public Object addFee(@RequestBody List<TCompanyFeeSetting> feeSettings) { |
| | | Integer id1 = UserInfoUtil.getId(); |
| | | feeSettings.forEach(e->e.setCompanyId(id1)); |
| | | tCompanyFeeSettingMapper.insertBatch(feeSettings); |
| | | if(feeSettings.get(0).getId()==null){ |
| | | tCompanyFeeSettingMapper.insertBatch(feeSettings); |
| | | }else { |
| | | tCompanyFeeSettingMapper.updateBatchById(feeSettings); |
| | | } |
| | | return new SuccessTip(); |
| | | } |
| | | |