From e546f6e157e79e4074ca23f7e4e48a5c9aea4fdb Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 09 五月 2019 14:30:08 +0800
Subject: [PATCH] 房屋管理开发测试完成
---
java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java | 38 +++++++++++++++++++++++++++++++-------
1 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java b/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
index 1023db5..3f43c05 100644
--- a/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
+++ b/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
@@ -16,7 +16,12 @@
import com.java110.entity.service.ServiceSql;
import com.java110.service.dao.IQueryServiceDAO;
import com.java110.service.smo.IQueryServiceSMO;
+import org.apache.commons.lang3.StringUtils;
+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;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -32,12 +37,17 @@
@Transactional
public class QueryServiceSMOImpl extends LoggerEngine implements IQueryServiceSMO {
+
+ private final static Logger logger = LoggerFactory.getLogger(QueryServiceSMOImpl.class);
+
+
@Autowired
private IQueryServiceDAO queryServiceDAOImpl;
@Override
public void commonQueryService(DataQuery dataQuery) throws BusinessException {
//鏌ヨ缂撳瓨鏌ヨ 瀵瑰簲澶勭悊鐨凷erviceSql
+ ResponseEntity<String> responseEntity = null;
try {
ServiceSql currentServiceSql = ServiceSqlCache.getServiceSql(dataQuery.getServiceCode());
if (currentServiceSql == null) {
@@ -50,23 +60,29 @@
List<String> sysParams = currentServiceSql.getParamList();
for(String param : sysParams) {
if(!dataQuery.getRequestParams().containsKey(param)){
- throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR,"璇锋眰鍙傛暟閿欒锛岃姹傛姤鏂囦腑鏈寘鍚弬鏁� " + param + " 淇℃伅");
+ //2019-04-10 杩欓噷淇敼涓轰笉鎶涘嚭寮傚父鑰屾槸鍐欎负绌哄瓧绗︿覆
+ //throw new BusinessException(ResponseConstant.RESULT_PARAM_ERROR,"璇锋眰鍙傛暟閿欒锛岃姹傛姤鏂囦腑鏈寘鍚弬鏁� " + param + " 淇℃伅");
+ dataQuery.getRequestParams().put(param,"");
}
}
dataQuery.setServiceSql(currentServiceSql);
if (CommonConstant.QUERY_MODEL_SQL.equals(currentServiceSql.getQueryModel())) {
doExecuteSql(dataQuery);
- return;
}else if(CommonConstant.QUERY_MODE_JAVA.equals(currentServiceSql.getQueryModel())){
doExecuteJava(dataQuery);
- return ;
+ }else {
+ doExecuteProc(dataQuery);
}
- doExecuteProc(dataQuery);
+ responseEntity = new ResponseEntity<String>(dataQuery.getResponseInfo().toJSONString(), HttpStatus.OK);
}catch (BusinessException e){
logger.error("鍏敤鏌ヨ寮傚父锛�",e);
- dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_PARAM_ERROR,
- e.getMessage()));
+ /*dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_PARAM_ERROR,
+ e.getMessage()));*/
+ responseEntity = new ResponseEntity<String>("璇锋眰鍙戠敓寮傚父锛�"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+ }finally {
+ dataQuery.setResponseEntity(responseEntity);
}
+
}
@Override
@@ -254,7 +270,15 @@
}
} else {
currentSqlNew += "?";
- currentParams.add(params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "" + params.getString(sqls[sqlIndex]) + "");
+ Object param = params.getString(sqls[sqlIndex]);
+ if(params.get(sqls[sqlIndex]) instanceof Integer){
+ param = params.getInteger(sqls[sqlIndex]);
+ }
+ //杩欓噷瀵� page 鍜� rows 鐗规畩澶勭悊 锛岀洰鍓嶆病鏈夋兂鍒板叾浠栫殑鍔炴硶
+ if(StringUtils.isNumeric(param.toString()) && "page,rows".contains(sqls[sqlIndex])){
+ param = Integer.parseInt(param.toString());
+ }
+ currentParams.add(param);
//currentSqlNew += params.get(sqls[sqlIndex]) instanceof Integer ? params.getInteger(sqls[sqlIndex]) : "'" + params.getString(sqls[sqlIndex]) + "'";
}
}
--
Gitblit v1.8.0