Browse Source

2022.11.15 17:58

wangzhuo 2 years ago
parent
commit
7e8dc89538

+ 5 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java

@@ -1,5 +1,6 @@
 package com.ruoyi.framework.config;
 
+import com.ruoyi.framework.interceptor.SignInterceptor;
 import com.ruoyi.framework.interceptor.TSeapriceQueryLogInterceptor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
@@ -28,6 +29,9 @@ public class ResourcesConfig implements WebMvcConfigurer
     @Autowired
     private TSeapriceQueryLogInterceptor tSeapriceQueryLogInterceptor;
 
+    @Autowired
+    private SignInterceptor signInterceptor;
+
     @Override
     public void addResourceHandlers(ResourceHandlerRegistry registry)
     {
@@ -47,6 +51,7 @@ public class ResourcesConfig implements WebMvcConfigurer
     {
         registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
         registry.addInterceptor(tSeapriceQueryLogInterceptor).addPathPatterns("/**");
+        registry.addInterceptor(signInterceptor).addPathPatterns("/open/wms/**");
     }
 
     /**

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -115,6 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
                 .antMatchers("/api/**").anonymous()
+                .antMatchers("/open/wms/**").anonymous()
 //                .antMatchers("/ccb/**").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()

+ 49 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/SignInterceptor.java

@@ -0,0 +1,49 @@
+package com.ruoyi.framework.interceptor;
+
+import org.springframework.stereotype.Component;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.HandlerInterceptor;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.nio.charset.StandardCharsets;
+import org.springframework.util.DigestUtils;
+
+/**
+ * WMS接口拦截器
+ */
+@Component
+public class SignInterceptor implements HandlerInterceptor {
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+
+        if (handler instanceof HandlerMethod)
+        {
+            System.out.println("请求头======>"+request);
+            String appKey = request.getHeader("appKey");
+            String timestamp = request.getHeader("timestamp");
+            String uri = request.getHeader("uri");
+            String sign = request.getHeader("sign");
+
+            String mdUrl = "appKey="+appKey+"&timestamp="+timestamp+"&uri="+uri+"&appSecret=irf6DdRkEdR6whj4";
+            System.out.println("MD5加密======>"+mdUrl);
+            String md5Upper = this.encrypt3ToMD5(mdUrl);
+            System.out.println("加密后======>"+md5Upper);
+            if (md5Upper.equals(sign)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * MD5加密
+     * @explain springboot自带MD5加密
+     * @param str
+     */
+    public String encrypt3ToMD5(String str) {
+        String md5Upper = DigestUtils.md5DigestAsHex(str.getBytes(StandardCharsets.UTF_8));
+        md5Upper = md5Upper.toUpperCase();
+        return md5Upper;
+    }
+}

+ 1 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -998,7 +998,7 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         } else if ("2".equals(mode)) {
             Collections.addAll(names, "入库重量", "出库重量");
         } else if("5".equals(mode)) {
-            Collections.addAll(names, "入库净重", "库净重");
+            Collections.addAll(names, "入库净重", "库净重");
         }else {
             mode = "1";
             Collections.addAll(names, "入库件数", "出库件数");

+ 1 - 6
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

@@ -1037,12 +1037,7 @@
             <if test="mode != null and mode != ''">
                 case #{mode}
                     when '3' then round(ifnull(sum(ts.f_volumn), 0))
-                    when '2' then round(ifnull(sum(
-                        case tb.f_billingway
-                            when 3 then ts.f_netweight
-                            else ts.f_grossweight
-                        end
-                    ) / 1000, 0))
+                    when '2' then round(ifnull(sum(ts.f_grossweight) / 1000, 0))
                     when '5' then round(ifnull(sum(ts.f_netweight) / 1000, 0))
                     else ifnull(sum(ts.f_qty), 0)
                 end as total