|
@@ -0,0 +1,48 @@
|
|
|
|
|
+package com.dderp.webcore.servlet;
|
|
|
|
|
+
|
|
|
|
|
+import com.dderp.common.entity.express.ExpressCallResult;
|
|
|
|
|
+import com.dderp.common.entity.site.ERPTokenUser;
|
|
|
|
|
+import com.sweetfish.net.WorkThread;
|
|
|
|
|
+import com.sweetfish.net.http.*;
|
|
|
|
|
+import com.sweetfish.util.AnyValue;
|
|
|
|
|
+import com.sweetfish.util.AutoLoad;
|
|
|
|
|
+import org.apache.logging.log4j.LogManager;
|
|
|
|
|
+import org.apache.logging.log4j.Logger;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
|
+import java.util.concurrent.ForkJoinPool;
|
|
|
|
|
+
|
|
|
|
|
+@AutoLoad(false)
|
|
|
|
|
+@WebServlet(name = "快递回调服务", value = {"/express/*"}, comment = "快递回调服务")
|
|
|
|
|
+@HttpUserType(ERPTokenUser.class)
|
|
|
|
|
+public class ExpressCallServlet extends HttpServlet {
|
|
|
|
|
+
|
|
|
|
|
+ private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName());
|
|
|
|
|
+
|
|
|
|
|
+ private ExecutorService getExecutor() {
|
|
|
|
|
+ Thread thread = Thread.currentThread();
|
|
|
|
|
+ if (thread instanceof WorkThread) {
|
|
|
|
|
+ return ((WorkThread) thread).getExecutor();
|
|
|
|
|
+ }
|
|
|
|
|
+ return ForkJoinPool.commonPool();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void init(HttpContext context, AnyValue config) {
|
|
|
|
|
+ super.init(context, config);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void destroy(HttpContext context, AnyValue config) {
|
|
|
|
|
+ super.destroy(context, config);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //当前查看顺丰的回调,没有字段体现出顺丰的接口,大概每个快递平台需要不同的地址提供回调,顺丰的回调可以通过url_index来判断回调的业务
|
|
|
|
|
+
|
|
|
|
|
+ @HttpMapping(url = "/express/sfCall", methods = {"POST", "GET"}, comment = "回调入口")
|
|
|
|
|
+ public void sfCall(HttpRequest request, HttpResponse response) {
|
|
|
|
|
+ //简单的入口,估计也没多少接口提供出去,这里多加一层方法包一下,是担心后续会修改
|
|
|
|
|
+ logger.info(request);
|
|
|
|
|
+ response.finish(ExpressCallResult.success());
|
|
|
|
|
+ }
|
|
|
|
|
+}
|