sql format 异常捕获提升
parent
194042f5e9
commit
bfec43d804
|
@ -2,6 +2,7 @@ package aiyh.utils.recordset;
|
||||||
|
|
||||||
import com.alibaba.druid.sql.SQLUtils;
|
import com.alibaba.druid.sql.SQLUtils;
|
||||||
import com.alibaba.druid.sql.parser.ParserException;
|
import com.alibaba.druid.sql.parser.ParserException;
|
||||||
|
import com.icbc.api.internal.apache.http.E;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -27,7 +28,7 @@ public class FormatSqlUtil {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return SQLUtils.format(sql, dbType);
|
return SQLUtils.format(sql, dbType);
|
||||||
} catch (ParserException e) {
|
} catch (Exception e) {
|
||||||
return toSqlString(sql);
|
return toSqlString(sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import aiyh.utils.ApiResult;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.api.xuanran.wang.xk_hospital.data_async.service.XkHospitalCommonDataAsyncService;
|
import com.api.xuanran.wang.xk_hospital.data_async.service.XkHospitalCommonDataAsyncService;
|
||||||
import com.api.xuanran.wang.xk_hospital.data_async.service.impl.XkHospitalCommonDataAsyncServiceImpl;
|
import com.api.xuanran.wang.xk_hospital.data_async.service.impl.XkHospitalCommonDataAsyncServiceImpl;
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
@ -42,7 +43,7 @@ public class CommonDataAsyncController {
|
||||||
if(StrUtil.isBlank(configId) || StrUtil.isBlank(type)){
|
if(StrUtil.isBlank(configId) || StrUtil.isBlank(type)){
|
||||||
throw new CustomerException("configId or type can not be empty!");
|
throw new CustomerException("configId or type can not be empty!");
|
||||||
}
|
}
|
||||||
logger.info(Util.logStr("configId : {}, type : {}, params : {}", configId, type, params));
|
logger.info(Util.logStr("configId : {}, type : {}, params : {}", configId, type, JSONObject.toJSONString(params)));
|
||||||
service.async(configId, type, params);
|
service.async(configId, type, params);
|
||||||
return ApiResult.successNoData();
|
return ApiResult.successNoData();
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
|
@ -5,6 +5,7 @@ import aiyh.utils.Util;
|
||||||
import aiyh.utils.response_deal.mapper.ConfigMapper;
|
import aiyh.utils.response_deal.mapper.ConfigMapper;
|
||||||
import com.api.xuanran.wang.xk_hospital.data_async.mapper.XkHospitalDataAsyncMapper;
|
import com.api.xuanran.wang.xk_hospital.data_async.mapper.XkHospitalDataAsyncMapper;
|
||||||
import com.engine.common.service.impl.ThemeServiceImpl;
|
import com.engine.common.service.impl.ThemeServiceImpl;
|
||||||
|
import ln.LN;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.hrm.company.DepartmentComInfo;
|
import weaver.hrm.company.DepartmentComInfo;
|
||||||
import weaver.hrm.resource.ResourceComInfo;
|
import weaver.hrm.resource.ResourceComInfo;
|
||||||
|
@ -55,6 +56,8 @@ public class XkHospitalCommonDefinition {
|
||||||
**/
|
**/
|
||||||
protected static ResourceComInfo RESOURCE_COM_INFO = null;
|
protected static ResourceComInfo RESOURCE_COM_INFO = null;
|
||||||
|
|
||||||
|
protected final LN ln = new LN();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
RESOURCE_COM_INFO = new ResourceComInfo();
|
RESOURCE_COM_INFO = new ResourceComInfo();
|
||||||
|
|
|
@ -8,6 +8,7 @@ import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
|
||||||
import aiyh.utils.response_deal.mapper.ConfigMapper;
|
import aiyh.utils.response_deal.mapper.ConfigMapper;
|
||||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
import com.api.xuanran.wang.xk_hospital.data_async.definitions.XkHospitalCommonDefinition;
|
import com.api.xuanran.wang.xk_hospital.data_async.definitions.XkHospitalCommonDefinition;
|
||||||
|
import ln.LN;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -41,6 +42,10 @@ public class HrmDepartmentRowDefinition extends XkHospitalCommonDefinition imple
|
||||||
if(StrUtil.isBlank(dataId)){
|
if(StrUtil.isBlank(dataId)){
|
||||||
int nextId = -1;
|
int nextId = -1;
|
||||||
if(HRM_RESOURCE.equals(table)){
|
if(HRM_RESOURCE.equals(table)){
|
||||||
|
int licenseNum = ln.CkHrmnum();
|
||||||
|
if(licenseNum < 1){
|
||||||
|
throw new CustomerException("当前可用license数量不足!");
|
||||||
|
}
|
||||||
nextId = Util.getNextHrmId();
|
nextId = Util.getNextHrmId();
|
||||||
}else if(DEPARTMENT.equals(table)){
|
}else if(DEPARTMENT.equals(table)){
|
||||||
nextId = Util.getNextDepartmentId();
|
nextId = Util.getNextDepartmentId();
|
||||||
|
|
|
@ -74,42 +74,45 @@ public class XkHospitalTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testC(){
|
public void testC(){
|
||||||
String json = "{\n" +
|
String json = "{\n" +
|
||||||
"\t\"ID\":\"主键\",\n" +
|
" \"ID\":\"主键\",\n" +
|
||||||
"\t\"GroupID\":\"test_yl_01\",\n" +
|
" \"GroupID\":\"test_yl_01\",\n" +
|
||||||
"\t\"GroupCode\":\"test_yl_dm_03\",\n" +
|
" \"GroupCode\":\"test_yl_dm_03\",\n" +
|
||||||
"\t\"GroupName\":\"医疗组名称1\",\n" +
|
" \"GroupName\":\"医疗组名称1\",\n" +
|
||||||
"\t\"DeptCode\":\"test03\",\n" +
|
" \"DeptCode\":\"test03\",\n" +
|
||||||
"\t\"DeptName\":\"测试科室03\",\n" +
|
" \"DeptName\":\"测试科室03\",\n" +
|
||||||
"\t\"WardCode\":\"病区代码\",\n" +
|
" \"WardCode\":\"testbq_dm_1\",\n" +
|
||||||
"\t\"WardName\":\"病区名称\",\n" +
|
" \"WardName\":\"测试主表病区名称1\",\n" +
|
||||||
"\t\"Ward_BedNumber\":\"病区床位数,int类型\",\n" +
|
" \"Ward_BedNumber\":\"病区床位数,int类型\",\n" +
|
||||||
"\t\"IsDelete\":\"是否停用,bool类型\",\n" +
|
" \"IsDelete\":\"是否停用,bool类型\",\n" +
|
||||||
"\t\"Remark\":\"备注\",\n" +
|
" \"Remark\":\"备注\",\n" +
|
||||||
"\t\"Wards\":[\t\n" +
|
" \"Wards\":[\n" +
|
||||||
"\t\t{\t\t\t\n" +
|
" {\n" +
|
||||||
"\t\t\t\"ID\":\"1\",\n" +
|
" \"ID\":\"1\",\n" +
|
||||||
"\t\t\t\"WardCode\":\"bq_01\",\n" +
|
" \"WardCode\":\"bq_01\",\n" +
|
||||||
"\t\t\t\"WardName\":\"病区名称01_2_3\"\n" +
|
" \"WardName\":\"病区名称01_2_3\"\n" +
|
||||||
"\t\t},{\t\t\t\n" +
|
" },\n" +
|
||||||
"\t\t\t\"ID\":\"2\",\n" +
|
" {\n" +
|
||||||
"\t\t\t\"WardCode\":\"bq_03\",\n" +
|
" \"ID\":\"2\",\n" +
|
||||||
"\t\t\t\"WardName\":\"病区名称02_1_3\"\n" +
|
" \"WardCode\":\"bq_03\",\n" +
|
||||||
"\t\t}\n" +
|
" \"WardName\":\"病区名称02_1_3\"\n" +
|
||||||
"\t],\n" +
|
" }\n" +
|
||||||
"\t\"WardHeads\":[\n" +
|
" ],\n" +
|
||||||
"\t\t{\n" +
|
" \"WardHeads\":[\n" +
|
||||||
"\t\t\t\"ID\":\"1\",\n" +
|
" {\n" +
|
||||||
"\t\t\t\"EmplCode\":\"TEST10\",\n" +
|
" \"ID\":\"1\",\n" +
|
||||||
"\t\t\t\"EmplName\":\"傻逼01\",\n" +
|
" \"EmplCode\":\"TEST10\",\n" +
|
||||||
"\t\t\t\"Category\":\"人员分组,当人员为主治和住院医师时使用\"\n" +
|
" \"EmplName\":\"傻逼01\",\n" +
|
||||||
"\t\t},{\n" +
|
" \"Category\":\"人员分组,当人员为主治和住院医师时使用\"\n" +
|
||||||
"\t\t\t\"ID\":\"2\",\n" +
|
" },\n" +
|
||||||
"\t\t\t\"EmplCode\":\"TEST10\",\n" +
|
" {\n" +
|
||||||
"\t\t\t\"EmplName\":\"傻逼02\",\n" +
|
" \"ID\":\"2\",\n" +
|
||||||
"\t\t\t\"Category\":\"人员分组,当人员为主治和住院医师时使用\"\n" +
|
" \"EmplCode\":\"TEST10\",\n" +
|
||||||
"\t\t}\n" +
|
" \"EmplName\":\"傻逼02\",\n" +
|
||||||
"\t]\n" +
|
" \"Category\":\"人员分组,当人员为主治和住院医师时使用\"\n" +
|
||||||
"}\n";
|
" }\n" +
|
||||||
|
" ]\n" +
|
||||||
|
"}";
|
||||||
|
System.out.println(json);
|
||||||
Map map = JSONObject.parseObject(json, Map.class);
|
Map map = JSONObject.parseObject(json, Map.class);
|
||||||
Util.null2DefaultStr(null,"");
|
Util.null2DefaultStr(null,"");
|
||||||
service.async("4bce0693734d","common", map);
|
service.async("4bce0693734d","common", map);
|
||||||
|
|
Loading…
Reference in New Issue