Browse Source

Merge branch 'master' of https://gitee.com/antai-wuliu/ANTAI-API

yourName 1 năm trước cách đây
mục cha
commit
92be4169c6

+ 21 - 0
src/main/java/com/steerinfo/dil/config/MyFeignRequestInterceptor.java

@@ -0,0 +1,21 @@
+package com.steerinfo.dil.config;
+
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author wzb
+ * @version V1.0.0
+ * @desciption feign请求全局添加Token
+ * @date 2021/4/15 19:15
+ * @className MyFeignRequestInterceptor
+ */
+@Configuration
+public class MyFeignRequestInterceptor  implements RequestInterceptor {
+    @Override
+    public void apply(RequestTemplate requestTemplate) {
+        requestTemplate.header("userId", "lb");
+        requestTemplate.header("userName","lb");
+    }
+}

+ 1 - 0
src/main/java/com/steerinfo/dil/config/RequestFilter.java

@@ -26,6 +26,7 @@ public class RequestFilter implements Filter {
     public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain) throws IOException, ServletException {
        try{
            HttpServletRequest httpRequest = (HttpServletRequest) request;
+
            String url = httpRequest.getRequestURL().toString();
            //获取参数,并校验
            Cookie[] cookies = httpRequest.getCookies();

+ 33 - 0
src/main/java/com/steerinfo/dil/controller/RMScontroller.java

@@ -677,6 +677,39 @@ public class RMScontroller extends BaseRESTfulController {
         return rmsFeign.getCapacityList(mapValue == null ? new HashMap<>() : mapValue, pageNum, pageSize, apiId, con, carrierSSOId);
     }
 
+    @ApiOperation("导入车辆")
+    @PostMapping("/importCapacity")
+    public Map<String, Object> importCapacity(@RequestBody MultipartFile file,
+                                              String userId,
+                                              String userName) throws Exception {
+        Map<String, Object> map = new HashMap<>();
+        //获取Excel中包含的对象数组
+        List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
+        map.put("list", list);
+        Set<String> set = new HashSet<>();
+        for (Map<String, Object> item : list) {
+            //校验行
+            if(
+                    item.get("车号")==null || item.get("车号").equals("")
+            ){
+                throw new Exception("单元格数据异常,请检查模板或数据是否正确!");
+            }
+            //隔开用于查询是否数据库存在
+            set.add(item.get("车号").toString());
+            //key-value结构方便数据库去重后获取值
+            map.put(item.get("车号").toString(),item);
+        }
+        //去重
+        String[] setList = set.toArray(new String[0]);
+        if (setList.length != list.size()) {
+            throw new Exception("车号不允许重复!");
+        }
+        map.put("setList",setList);
+        map.put("userId",userId);
+        map.put("userName",userName);
+        return rmsFeign.importCapacity(map);
+    }
+
 
     @ApiOperation(value = "删除", notes = "根据rmsCarrier对象创建")
     @ApiImplicitParam(name = "仓库id", value = "id", required = true, dataType = "int")

+ 2 - 1
src/main/java/com/steerinfo/dil/feign/AmsFeign.java

@@ -1,5 +1,6 @@
 package com.steerinfo.dil.feign;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.steerinfo.dil.config.MyFeignRequestInterceptor;
 import com.steerinfo.framework.controller.RESTfulResult;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -17,7 +18,7 @@ import java.util.List;
 import java.util.Map;
 
 
-@FeignClient(value = "ANTAI-AMS-API", url = "${openfeign.AmsFeign.url}")
+@FeignClient(value = "ANTAI-AMS-API", url = "${openfeign.AmsFeign.url}",configuration = MyFeignRequestInterceptor.class)
 public interface AmsFeign {
 
     @PostMapping(value = "api/v1/ams/amsorders/purchaseOrderSync")

+ 3 - 0
src/main/java/com/steerinfo/dil/feign/RmsFeign.java

@@ -276,6 +276,9 @@ public interface RmsFeign {
     @PostMapping(value = "api/v1/rms/rmscapacity/getCapacityById")
     Map<String, Object> getCapacityById(@RequestBody Map<String, Object> map);
 
+    @PostMapping(value = "api/v1/rms/rmscapacity/importCapacity")
+    Map<String, Object> importCapacity(Map<String, Object> map);
+
     //==============仓库
     //新增仓库
     @PostMapping(value = "api/v1/rms/rmswarehouse/insertWarehouse")

+ 9 - 9
src/main/resources/application-prod.yml

@@ -24,23 +24,23 @@ eureka:
 
 openfeign:
   ColumnDataFeign:
-    url: ${COLUMNDATAFEIGN_URL:172.16.90.202:80}
+    url: ${COLUMNDATAFEIGN_URL:172.16.90.202:8083}
   AmsFeign:
-    url: ${AMSFEIGN_URL:172.16.90.202:80}
+    url: ${AMSFEIGN_URL:172.16.90.202:8079}
   TmsFeign:
-    url: ${TMSFEIGN_URL:172.16.90.202:80}
+    url: ${TMSFEIGN_URL:172.16.90.202:8086}
   WMSFeign:
-    url: ${WMSFEIGN_URL:172.16.90.202:80}
+    url: ${WMSFEIGN_URL:172.16.90.202:8093}
   RmsFeign:
-    url: ${RMSFEIGN_URL:172.16.90.202:80}
+    url: ${RMSFEIGN_URL:172.16.90.202:8060}
   EmsFeign:
-    url: ${TMSFEIGN_URL:172.16.90.202:80}
+    url: ${TMSFEIGN_URL:172.16.90.202:8096}
   SSOFeign:
-    url: ${SSOFEIGN_URL:172.16.90.202:80}
+    url: ${SSOFEIGN_URL:172.16.90.202:9001}
   WebSocketFeign:
-    url: ${WEBSOCKETFEIGN_URL:172.16.90.202:80}
+    url: ${WEBSOCKETFEIGN_URL:172.16.90.202:8000}
   REPORTFeign:
-    url: ${REPORTFEIGN_URL:172.16.90.202:80}
+    url: ${REPORTFEIGN_URL:172.16.90.202:8055}
 
 
 #远程调用