From b9df7bf92ff83bc0ed7c28f54c892095ef276afc Mon Sep 17 00:00:00 2001
From: lishouyi <linlangsur163@163.com>
Date: 星期五, 26 五月 2023 10:25:38 +0800
Subject: [PATCH] 卡车公司:invoice数据回调接口端口的更改

---
 src/main/java/com/stylefeng/guns/modular/system/controller/RatesController.java |   63 ++++++++++++++++++++-----------
 1 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/src/main/java/com/stylefeng/guns/modular/system/controller/RatesController.java b/src/main/java/com/stylefeng/guns/modular/system/controller/RatesController.java
index 674c737..129b1ee 100644
--- a/src/main/java/com/stylefeng/guns/modular/system/controller/RatesController.java
+++ b/src/main/java/com/stylefeng/guns/modular/system/controller/RatesController.java
@@ -2,36 +2,26 @@
 
 
 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.plugins.Page;
-import com.stylefeng.guns.modular.system.dao.TCompanyFeeSettingMapper;
 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 = "费用设置")
@@ -55,12 +45,12 @@
             @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);
@@ -91,12 +81,12 @@
             @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);
@@ -109,6 +99,7 @@
             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
@@ -171,13 +162,13 @@
         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);
             }
         });
@@ -293,7 +284,37 @@
     }
 
 
+    @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(map);
+    }
     @ApiOperation(value = "卡车公司- 添加点对点/范围/距离",notes="卡车公司-添加点对点/范围/距离")
+
     @ApiImplicitParams({
             @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
     })
@@ -334,12 +355,12 @@
     @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);
     }
 
@@ -350,8 +371,6 @@
     @PostMapping(value = "/addFee")
     @ResponseBody
     public Object addFee(@RequestBody List<TCompanyFeeSetting> feeSettings) {
-        Integer id1 = UserInfoUtil.getId();
-        feeSettings.forEach(e->e.setCompanyId(id1));
         tCompanyFeeSettingMapper.insertBatch(feeSettings);
         return new SuccessTip();
     }

--
Gitblit v1.7.1