|
|
@@ -1,16 +1,19 @@
|
|
|
package com.java110.fee.api;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.java110.utils.constant.ResponseConstant;
|
|
|
-import com.java110.utils.exception.InitConfigDataException;
|
|
|
-import com.java110.utils.exception.InitDataFlowContextException;
|
|
|
import com.java110.core.base.controller.BaseController;
|
|
|
import com.java110.core.context.BusinessServiceDataFlow;
|
|
|
import com.java110.core.factory.DataTransactionFactory;
|
|
|
+import com.java110.fee.bmo.IQueryParkspaceFee;
|
|
|
import com.java110.fee.smo.IFeeServiceSMO;
|
|
|
+import com.java110.utils.constant.ResponseConstant;
|
|
|
+import com.java110.utils.exception.InitConfigDataException;
|
|
|
+import com.java110.utils.exception.InitDataFlowContextException;
|
|
|
+import com.java110.utils.util.Assert;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
@@ -25,24 +28,29 @@ import java.util.Map;
|
|
|
* Created by wuxw on 2018/5/14.
|
|
|
*/
|
|
|
@RestController
|
|
|
+@RequestMapping(value = "/feeApi")
|
|
|
public class FeeApi extends BaseController {
|
|
|
private final static Logger logger = LoggerFactory.getLogger(FeeApi.class);
|
|
|
|
|
|
@Autowired
|
|
|
IFeeServiceSMO feeServiceSMOImpl;
|
|
|
|
|
|
- @RequestMapping(path = "/feeApi/service",method= RequestMethod.GET)
|
|
|
+ @Autowired
|
|
|
+ private IQueryParkspaceFee queryParkspaceFeeImpl;
|
|
|
+
|
|
|
+ @RequestMapping(path = "/service", method = RequestMethod.GET)
|
|
|
public String serviceGet(HttpServletRequest request) {
|
|
|
- return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR,"不支持Get方法请求").toJSONString();
|
|
|
+ return DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_ERROR, "不支持Get方法请求").toJSONString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 用户服务统一处理接口
|
|
|
+ *
|
|
|
* @param orderInfo
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
- @RequestMapping(path = "/feeApi/service",method= RequestMethod.POST)
|
|
|
+ @RequestMapping(path = "/service", method = RequestMethod.POST)
|
|
|
public String servicePost(@RequestBody String orderInfo, HttpServletRequest request) {
|
|
|
BusinessServiceDataFlow businessServiceDataFlow = null;
|
|
|
JSONObject responseJson = null;
|
|
|
@@ -53,23 +61,24 @@ public class FeeApi extends BaseController {
|
|
|
preValiateOrderInfo(orderInfo);
|
|
|
businessServiceDataFlow = this.writeDataToDataFlowContext(orderInfo, headers);
|
|
|
responseJson = feeServiceSMOImpl.service(businessServiceDataFlow);
|
|
|
- }catch (InitDataFlowContextException e){
|
|
|
- logger.error("请求报文错误,初始化 BusinessServiceDataFlow失败"+orderInfo,e);
|
|
|
- responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
|
|
|
- }catch (InitConfigDataException e){
|
|
|
- logger.error("请求报文错误,加载配置信息失败"+orderInfo,e);
|
|
|
- responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo,ResponseConstant.RESULT_PARAM_ERROR,e.getMessage(),null);
|
|
|
- }catch (Exception e){
|
|
|
- logger.error("请求订单异常",e);
|
|
|
- responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow,ResponseConstant.RESULT_CODE_ERROR,e.getMessage()+e,
|
|
|
+ } catch (InitDataFlowContextException e) {
|
|
|
+ logger.error("请求报文错误,初始化 BusinessServiceDataFlow失败" + orderInfo, e);
|
|
|
+ responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo, ResponseConstant.RESULT_PARAM_ERROR, e.getMessage(), null);
|
|
|
+ } catch (InitConfigDataException e) {
|
|
|
+ logger.error("请求报文错误,加载配置信息失败" + orderInfo, e);
|
|
|
+ responseJson = DataTransactionFactory.createNoBusinessTypeBusinessResponseJson(orderInfo, ResponseConstant.RESULT_PARAM_ERROR, e.getMessage(), null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("请求订单异常", e);
|
|
|
+ responseJson = DataTransactionFactory.createBusinessResponseJson(businessServiceDataFlow, ResponseConstant.RESULT_CODE_ERROR, e.getMessage() + e,
|
|
|
null);
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
return responseJson.toJSONString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 这里预校验,请求报文中不能有 dataFlowId
|
|
|
+ *
|
|
|
* @param orderInfo
|
|
|
*/
|
|
|
private void preValiateOrderInfo(String orderInfo) {
|
|
|
@@ -80,17 +89,18 @@ public class FeeApi extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 获取请求信息
|
|
|
+ *
|
|
|
* @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);
|
|
|
- throw new InitConfigDataException(ResponseConstant.RESULT_PARAM_ERROR,"加载头信息失败");
|
|
|
+ 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 new InitConfigDataException(ResponseConstant.RESULT_PARAM_ERROR, "加载头信息失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -101,4 +111,17 @@ public class FeeApi extends BaseController {
|
|
|
public void setFeeServiceSMOImpl(IFeeServiceSMO feeServiceSMOImpl) {
|
|
|
this.feeServiceSMOImpl = feeServiceSMOImpl;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 停车费查询
|
|
|
+ *
|
|
|
+ * @param reqJson
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/parkSpaceFee", method = RequestMethod.POST)
|
|
|
+ public ResponseEntity<String> parkSpaceFee(@RequestBody JSONObject reqJson) {
|
|
|
+ Assert.hasKeyAndValue(reqJson, "code", "未包含小区编码");
|
|
|
+ return queryParkspaceFeeImpl.query(reqJson);
|
|
|
+ }
|
|
|
}
|