From 587a30326ef446ba4e2d150401323eef7f21b3de Mon Sep 17 00:00:00 2001
From: mrzcc <121184950@qq.com>
Date: 星期一, 17 二月 2020 18:30:23 +0800
Subject: [PATCH] 巡检计划xml

---
 java110-service/src/main/java/com/java110/service/api/BusinessApi.java |  124 ++++++++++++++++++++++------------------
 1 files changed, 68 insertions(+), 56 deletions(-)

diff --git a/java110-service/src/main/java/com/java110/service/api/BusinessApi.java b/java110-service/src/main/java/com/java110/service/api/BusinessApi.java
index a6dae40..9a6910d 100644
--- a/java110-service/src/main/java/com/java110/service/api/BusinessApi.java
+++ b/java110-service/src/main/java/com/java110/service/api/BusinessApi.java
@@ -1,16 +1,18 @@
 package com.java110.service.api;
 
-import com.java110.common.constant.CommonConstant;
-import com.java110.common.constant.ResponseConstant;
-import com.java110.common.util.Assert;
-import com.java110.core.factory.DataQueryFactory;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.util.Assert;
+import com.java110.service.context.DataQueryFactory;
 import com.java110.core.factory.DataTransactionFactory;
 import com.java110.core.base.controller.BaseController;
-import com.java110.entity.service.DataQuery;
+import com.java110.service.context.DataQuery;
 import com.java110.service.smo.IQueryServiceSMO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -25,59 +27,65 @@
 
 /**
  * 鏌ヨ鏈嶅姟
- * Created by wuxw on 2018/4/20.
+ * add by wuxw on 2018/4/20.
+ * modify by wuxw on 2019/4/20.
+ *
+ * @version 1.1
  */
 @RestController
 @Api(value = "鏌ヨ涓氬姟缁熶竴鎻愪緵鏈嶅姟")
 public class BusinessApi extends BaseController {
 
+    private final static Logger logger = LoggerFactory.getLogger(BusinessApi.class);
+
     @Autowired
     private IQueryServiceSMO queryServiceSMOImpl;
 
 
-    @RequestMapping(path = "/businessApi/query",method= RequestMethod.GET)
-    @ApiOperation(value="涓氬姟鏌ヨget璇锋眰", notes="test: 杩斿洖 2XX 琛ㄧず鏈嶅姟姝e父")
-    @ApiImplicitParam(paramType="query", name = "method", value = "鐢ㄦ埛缂栧彿", required = true, dataType = "String")
+    @RequestMapping(path = "/businessApi/query", method = RequestMethod.GET)
+    @ApiOperation(value = "涓氬姟鏌ヨget璇锋眰", notes = "test: 杩斿洖 2XX 琛ㄧず鏈嶅姟姝e父")
+    @ApiImplicitParam(paramType = "query", name = "method", value = "鐢ㄦ埛缂栧彿", required = true, dataType = "String")
     @Deprecated
     public ResponseEntity<String> service(HttpServletRequest request) {
         try {
             Map<String, Object> headers = new HashMap<String, Object>();
             this.getRequestInfo(request, headers);
-            Assert.isNotNull(headers, CommonConstant.HTTP_SERVICE.toLowerCase(),"璇锋眰淇℃伅涓病鏈夊寘鍚玸ervice淇℃伅");
+            Assert.isNotNull(headers, CommonConstant.HTTP_SERVICE.toLowerCase(), "璇锋眰淇℃伅涓病鏈夊寘鍚玸ervice淇℃伅");
             //Assert.isNotNull(headers, CommonConstant.HTTP_PARAM,"璇锋眰淇℃伅涓病鏈夊寘鍚弬鏁帮紙params锛変俊鎭�");
             Map readOnlyMap = super.getParameterStringMap(request);
-            headers.put("params",readOnlyMap);
+            headers.put("params", readOnlyMap);
             DataQuery dataQuery = DataQueryFactory.newInstance().builder(headers);
             initConfig(dataQuery);
             queryServiceSMOImpl.commonQueryService(dataQuery);
             return dataQuery.getResponseEntity();
-        }catch (Exception e){
-            logger.error("璇锋眰璁㈠崟寮傚父",e);
+        } catch (Exception e) {
+            logger.error("璇锋眰璁㈠崟寮傚父", e);
             //DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e).toJSONString();
-            return new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�"+e.getMessage()+e, HttpStatus.INTERNAL_SERVER_ERROR);
+            return new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage() + e, HttpStatus.INTERNAL_SERVER_ERROR);
 
         }
     }
 
     /**
      * {
-     "bId":"12345678",
-     "serviceCode": "querycustinfo",
-     "serviceName": "鏌ヨ瀹㈡埛",
-     "remark": "澶囨敞",
-     "datas": {
-     "params": {
-     //杩欎釜鍋氭煡璇㈡椂鐨勫弬鏁�
-     }
-     //杩欓噷鏄叿浣撲笟鍔�
-     }
-     }
+     * "bId":"12345678",
+     * "serviceCode": "querycustinfo",
+     * "serviceName": "鏌ヨ瀹㈡埛",
+     * "remark": "澶囨敞",
+     * "datas": {
+     * "params": {
+     * //杩欎釜鍋氭煡璇㈡椂鐨勫弬鏁�
+     * }
+     * //杩欓噷鏄叿浣撲笟鍔�
+     * }
+     * }
+     *
      * @param businessInfo
      * @return
      */
-    @RequestMapping(path = "/businessApi/query",method= RequestMethod.POST)
-    @ApiOperation(value="涓氬姟鏌ヨpost璇锋眰", notes="test: 杩斿洖 2XX 琛ㄧず鏈嶅姟姝e父")
-    @ApiImplicitParam(paramType="query", name = "method", value = "鐢ㄦ埛缂栧彿", required = true, dataType = "String")
+    @RequestMapping(path = "/businessApi/query", method = RequestMethod.POST)
+    @ApiOperation(value = "涓氬姟鏌ヨpost璇锋眰", notes = "test: 杩斿洖 2XX 琛ㄧず鏈嶅姟姝e父")
+    @ApiImplicitParam(paramType = "query", name = "method", value = "鐢ㄦ埛缂栧彿", required = true, dataType = "String")
     @Deprecated
     public ResponseEntity<String> queryPost(@RequestBody String businessInfo) {
         try {
@@ -85,37 +93,39 @@
             initConfig(dataQuery);
             queryServiceSMOImpl.commonQueryService(dataQuery);
             return dataQuery.getResponseEntity();
-        }catch (Exception e){
-            logger.error("璇锋眰璁㈠崟寮傚父",e);
-             //DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e).toJSONString();
-            return new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�"+e.getMessage()+e, HttpStatus.INTERNAL_SERVER_ERROR);
+        } catch (Exception e) {
+            logger.error("璇锋眰璁㈠崟寮傚父", e);
+            //DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e).toJSONString();
+            return new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�" + e.getMessage() + e, HttpStatus.INTERNAL_SERVER_ERROR);
 
         }
     }
+
     @Deprecated
-    @RequestMapping(path = "/businessApi/do",method= RequestMethod.GET)
+    @RequestMapping(path = "/businessApi/do", method = RequestMethod.GET)
     public String doGet(HttpServletRequest request) {
-        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,"涓嶆敮鎸丟et鏂规硶璇锋眰").toJSONString();
+        return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR, "涓嶆敮鎸丟et鏂规硶璇锋眰").toJSONString();
     }
 
     /**
      * {
-     "bId":"12345678",
-     "serviceCode": "querycustinfo",
-     "serviceName": "鏌ヨ瀹㈡埛",
-     "remark": "澶囨敞",
-     "datas": {
-     "params": {
-     //杩欎釜鍋氭煡璇㈡椂鐨勫弬鏁�
-     }
-     //杩欓噷鏄叿浣撲笟鍔�
-     }
-     }
+     * "bId":"12345678",
+     * "serviceCode": "querycustinfo",
+     * "serviceName": "鏌ヨ瀹㈡埛",
+     * "remark": "澶囨敞",
+     * "datas": {
+     * "params": {
+     * //杩欎釜鍋氭煡璇㈡椂鐨勫弬鏁�
+     * }
+     * //杩欓噷鏄叿浣撲笟鍔�
+     * }
+     * }
+     *
      * @param businessInfo
      * @return
      */
     @Deprecated
-    @RequestMapping(path = "/businessApi/do",method= RequestMethod.POST)
+    @RequestMapping(path = "/businessApi/do", method = RequestMethod.POST)
     public String doPost(@RequestBody String businessInfo) {
         try {
             DataQuery dataQuery = DataQueryFactory.newInstance().builder(businessInfo);
@@ -123,33 +133,35 @@
             //杩欓噷搴旇娣诲姞 鍙湁閰嶇疆绫绘暟鎹墠鑳藉鐞嗘暟鎹紝涓氬姟绫绘暟鎹笉鑳芥搷浣� 閫昏緫
             queryServiceSMOImpl.commonDoService(dataQuery);
             return dataQuery.getResponseInfo().toJSONString();
-        }catch (Exception e){
-            logger.error("璇锋眰璁㈠崟寮傚父",e);
-            return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e).toJSONString();
+        } catch (Exception e) {
+            logger.error("璇锋眰璁㈠崟寮傚父", e);
+            return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR, e.getMessage() + e).toJSONString();
         }
     }
 
     /**
      * 鍒濆鍖栭厤缃�
+     *
      * @param dataQuery
      */
-    private void initConfig(DataQuery dataQuery){
+    private void initConfig(DataQuery dataQuery) {
         dataQuery.setServiceSql(DataQueryFactory.getServiceSql(dataQuery));
     }
 
 
     /**
      * 鑾峰彇璇锋眰淇℃伅
+     *
      * @param request
      * @param headers
      * @throws RuntimeException
      */
-    private void getRequestInfo(HttpServletRequest request,Map headers) throws Exception{
-        try{
-            super.initHeadParam(request,headers);
-            super.initUrlParam(request,headers);
-        }catch (Exception e){
-            logger.error("鍔犺浇澶翠俊鎭け璐�",e);
+    private void getRequestInfo(HttpServletRequest request, Map headers) throws Exception {
+        try {
+            super.initHeadParam(request, headers);
+            super.initUrlParam(request, headers);
+        } catch (Exception e) {
+            logger.error("鍔犺浇澶翠俊鎭け璐�", e);
             throw e;
         }
     }

--
Gitblit v1.8.0