响应回写问题修复
parent
fe37d194a3
commit
9658ce154f
|
@ -68,6 +68,16 @@ public class ResponseMappingDeal {
|
||||||
logger.info(String.format("%s 相关响应配置信息==> %s", uniqueCode, JSON.toJSONString(responseConfigList)));
|
logger.info(String.format("%s 相关响应配置信息==> %s", uniqueCode, JSON.toJSONString(responseConfigList)));
|
||||||
// 自定义校验
|
// 自定义校验
|
||||||
ResponseUtil.parameterJudgment(responseConfigList, "response config is empty please check!!! ");
|
ResponseUtil.parameterJudgment(responseConfigList, "response config is empty please check!!! ");
|
||||||
|
// 将所有跟sql有关的字段全部全角转半角
|
||||||
|
responseConfigList.forEach(item-> {
|
||||||
|
item.getResponseConfigAliasList().forEach(responseConfigAlias -> {
|
||||||
|
responseConfigAlias.setConditionScript(Util.sbc2dbcCase(responseConfigAlias.getConditionScript()));
|
||||||
|
responseConfigAlias.setJudgmentScript(Util.sbc2dbcCase(responseConfigAlias.getJudgmentScript()));
|
||||||
|
});
|
||||||
|
item.getValueChangeList().forEach(responseConfigValueChange -> {
|
||||||
|
responseConfigValueChange.setCusText(Util.sbc2dbcCase(responseConfigValueChange.getCusText()));
|
||||||
|
});
|
||||||
|
});
|
||||||
Map<String, ResponseConfig> tableNameConfig;
|
Map<String, ResponseConfig> tableNameConfig;
|
||||||
try {
|
try {
|
||||||
// 对查询到的多个配置进行整合,以同步表表名作为key 配置作为value
|
// 对查询到的多个配置进行整合,以同步表表名作为key 配置作为value
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package aiyh.utils.response_deal.state;
|
package aiyh.utils.response_deal.state;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.response_deal.constant.ResponseConfigConstant;
|
import aiyh.utils.response_deal.constant.ResponseConfigConstant;
|
||||||
import aiyh.utils.response_deal.entity.RowDefinition;
|
import aiyh.utils.response_deal.entity.RowDefinition;
|
||||||
import aiyh.utils.response_deal.entity.TableDefinition;
|
import aiyh.utils.response_deal.entity.TableDefinition;
|
||||||
|
@ -58,7 +59,7 @@ public class InsertOrUpdateState extends State{
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean judgmentRepetition(RowDefinition rowDefinition){
|
private boolean judgmentRepetition(RowDefinition rowDefinition){
|
||||||
String conditionScript = rowDefinition.getConditionScript();
|
String conditionScript = Util.sbc2dbcCase(rowDefinition.getConditionScript());
|
||||||
String cusQuerySql = "select id from " + rowDefinition.getAssignTable() + " where " + conditionScript;
|
String cusQuerySql = "select id from " + rowDefinition.getAssignTable() + " where " + conditionScript;
|
||||||
String dataId = this.configMapper.executeCusQuerySql(cusQuerySql, rowDefinition.getWhereParam(),new HashMap<>());
|
String dataId = this.configMapper.executeCusQuerySql(cusQuerySql, rowDefinition.getWhereParam(),new HashMap<>());
|
||||||
return StrUtil.isNotBlank(dataId);
|
return StrUtil.isNotBlank(dataId);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class InsertSate extends State{
|
||||||
Util.rebuildModeDataShareByAsyncList(1,modeId,dataIdList);
|
Util.rebuildModeDataShareByAsyncList(1,modeId,dataIdList);
|
||||||
}else {
|
}else {
|
||||||
String insertSql = MapperBuilderSql.builderInsertSql(assignTable, tempRowDefinition.getUpdateParam(),"item");
|
String insertSql = MapperBuilderSql.builderInsertSql(assignTable, tempRowDefinition.getUpdateParam(),"item");
|
||||||
List<Map<String, Object>> insertList = rowDefinitionList.stream().map(RowDefinition::getUpdateParam).collect(Collectors.toList());
|
List<Map<String, Object>> insertList = new ArrayList<>();
|
||||||
rowDefinitionList.forEach(item ->{
|
rowDefinitionList.forEach(item ->{
|
||||||
if(mainOrDetail == ResponseConfigConstant.MAIN_TABLE){
|
if(mainOrDetail == ResponseConfigConstant.MAIN_TABLE){
|
||||||
detailTableDeal(item,detailTableMap);
|
detailTableDeal(item,detailTableMap);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.api.xuanran.wang.xk_hospital.data_async.definitions.row;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.response_deal.constant.ResponseConfigConstant;
|
||||||
import aiyh.utils.response_deal.entity.RowDefinition;
|
import aiyh.utils.response_deal.entity.RowDefinition;
|
||||||
import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
|
import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
|
||||||
import aiyh.utils.response_deal.mapper.ConfigMapper;
|
import aiyh.utils.response_deal.mapper.ConfigMapper;
|
||||||
|
@ -9,6 +10,7 @@ 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 lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -31,9 +33,11 @@ public class HrmDepartmentRowDefinition extends XkHospitalCommonDefinition imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean judgmentRepetition(RowDefinition rowDefinition) {
|
public boolean judgmentRepetition(RowDefinition rowDefinition) {
|
||||||
String conditionScript = rowDefinition.getConditionScript();
|
int orDetail = rowDefinition.getMainOrDetail();
|
||||||
|
String conditionScript = Util.sbc2dbcCase(rowDefinition.getConditionScript());
|
||||||
String cusQuerySql = "select id from " + rowDefinition.getAssignTable() + " where " + conditionScript;
|
String cusQuerySql = "select id from " + rowDefinition.getAssignTable() + " where " + conditionScript;
|
||||||
String dataId = configMapper.executeCusQuerySql(cusQuerySql, rowDefinition.getWhereParam(),new HashMap<>());
|
String dataId = configMapper.executeCusQuerySql(cusQuerySql, rowDefinition.getWhereParam(),new HashMap<>());
|
||||||
|
if(ResponseConfigConstant.MAIN_TABLE == orDetail){
|
||||||
if(StrUtil.isBlank(dataId)){
|
if(StrUtil.isBlank(dataId)){
|
||||||
int nextId = -1;
|
int nextId = -1;
|
||||||
if(HRM_RESOURCE.equals(table)){
|
if(HRM_RESOURCE.equals(table)){
|
||||||
|
@ -54,6 +58,9 @@ public class HrmDepartmentRowDefinition extends XkHospitalCommonDefinition imple
|
||||||
rowDefinition.setConditionScript(" id = #{whereItem.id}");
|
rowDefinition.setConditionScript(" id = #{whereItem.id}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
return StringUtils.isNotBlank(dataId);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,18 +38,18 @@ public class XkHospitalTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testB(){
|
public void testB(){
|
||||||
String json2 = "{\n" +
|
// String json2 = "{\n" +
|
||||||
"\t\"ID\":\"1\",\n" +
|
// "\t\"ID\":\"1\",\n" +
|
||||||
"\t\"DeptCode\":\"test3\",\n" +
|
// "\t\"DeptCode\":\"test3\",\n" +
|
||||||
"\t\"DeptName\":\"科室测试名称3\",\n" +
|
// "\t\"DeptName\":\"科室测试名称3\",\n" +
|
||||||
"\t\"DeptLevel\": null, \n" +
|
// "\t\"DeptLevel\": null, \n" +
|
||||||
"\t\"ParentDeptCode\": \"test2\",\n" +
|
// "\t\"ParentDeptCode\": \"test2\",\n" +
|
||||||
"\t\"IsDelete\": false, \n" +
|
// "\t\"IsDelete\": false, \n" +
|
||||||
"\t\"Remark\":\"备注\"\n" +
|
// "\t\"Remark\":\"备注\"\n" +
|
||||||
"}\n";
|
// "}\n";
|
||||||
|
//
|
||||||
Map map2 = JSONObject.parseObject(json2, Map.class);
|
// Map map2 = JSONObject.parseObject(json2, Map.class);
|
||||||
service.async("4bce0693734a","dept",map2);
|
// service.async("4bce0693734a","dept",map2);
|
||||||
|
|
||||||
String json = "{\n" +
|
String json = "{\n" +
|
||||||
"\t\"ID\":\"1\",\n" +
|
"\t\"ID\":\"1\",\n" +
|
||||||
|
|
Loading…
Reference in New Issue