同步优化
parent
9658ce154f
commit
0de7a593e9
|
@ -62,6 +62,9 @@ public class InsertOrUpdateState extends State{
|
||||||
String conditionScript = Util.sbc2dbcCase(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<>());
|
||||||
|
if(StrUtil.isNotBlank(dataId)){
|
||||||
|
rowDefinition.setDataId(Util.getIntValue(dataId, -1));
|
||||||
|
}
|
||||||
return StrUtil.isNotBlank(dataId);
|
return StrUtil.isNotBlank(dataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class InsertSate extends State{
|
||||||
}
|
}
|
||||||
rowDefinitionList.forEach(item ->{
|
rowDefinitionList.forEach(item ->{
|
||||||
item.getUpdateParam().put("mainid",mainId);
|
item.getUpdateParam().put("mainid",mainId);
|
||||||
|
item.getWhereParam().put("mainid",mainId);
|
||||||
});
|
});
|
||||||
if(mainDetailMap.containsKey(key)){
|
if(mainDetailMap.containsKey(key)){
|
||||||
TableDefinition tableDefinition = mainDetailMap.get(key);
|
TableDefinition tableDefinition = mainDetailMap.get(key);
|
||||||
|
|
|
@ -16,7 +16,7 @@ public abstract class State {
|
||||||
protected final ConfigMapper configMapper = Util.getMapper(ConfigMapper.class);
|
protected final ConfigMapper configMapper = Util.getMapper(ConfigMapper.class);
|
||||||
|
|
||||||
/** 日志对象 */
|
/** 日志对象 */
|
||||||
protected final Logger logger = Util.getLogger();
|
protected final Logger logger = Util.getLogger("json_util");
|
||||||
|
|
||||||
/** 上下文对象 */
|
/** 上下文对象 */
|
||||||
protected TableDefinition context;
|
protected TableDefinition context;
|
||||||
|
|
|
@ -83,6 +83,12 @@ public class UpdateState extends State {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
detailTableMap.forEach((key,value) ->{
|
detailTableMap.forEach((key,value) ->{
|
||||||
|
if(item.getDataId() > 0){
|
||||||
|
for (RowDefinition rowDefinition : value.getRowDefinitionList()) {
|
||||||
|
rowDefinition.getUpdateParam().put("mainid", item.getDataId());
|
||||||
|
rowDefinition.getWhereParam().put("mainid", item.getDataId());
|
||||||
|
}
|
||||||
|
}
|
||||||
if(mainDetailMap.containsKey(key)){
|
if(mainDetailMap.containsKey(key)){
|
||||||
mainDetailMap.get(key).getRowDefinitionList().addAll(value.getRowDefinitionList());
|
mainDetailMap.get(key).getRowDefinitionList().addAll(value.getRowDefinitionList());
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.api.xuanran.wang.xk_hospital.data_async.definitions.table;
|
||||||
|
|
||||||
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.entity.TableDefinition;
|
import aiyh.utils.response_deal.entity.TableDefinition;
|
||||||
import aiyh.utils.response_deal.intfaces.TableDefinitionCallback;
|
import aiyh.utils.response_deal.intfaces.TableDefinitionCallback;
|
||||||
|
@ -13,6 +14,7 @@ import weaver.matrix.MatrixUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +31,18 @@ public class HrmDepartmentTableDefinition extends XkHospitalCommonDefinition imp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tableHandle(TableDefinition tableDefinition) {
|
public void tableHandle(TableDefinition tableDefinition) {
|
||||||
|
if(ResponseConfigConstant.DETAIL_TABLE == tableDefinition.getMainOrDetail()){
|
||||||
|
List<RowDefinition> list = tableDefinition.getRowDefinitionList();
|
||||||
|
if(CollectionUtils.isEmpty(list)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (RowDefinition rowDefinition : list) {
|
||||||
|
Object mainId = rowDefinition.getUpdateParam().remove("mainid");
|
||||||
|
if(!Objects.isNull(mainId)){
|
||||||
|
rowDefinition.getUpdateParam().put("id", mainId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -53,8 +53,8 @@ public class XkHospitalTest extends BaseTest {
|
||||||
|
|
||||||
String json = "{\n" +
|
String json = "{\n" +
|
||||||
"\t\"ID\":\"1\",\n" +
|
"\t\"ID\":\"1\",\n" +
|
||||||
"\t\"EmplCode\":\"TEST1\",\n" +
|
"\t\"EmplCode\":\"TEST10\",\n" +
|
||||||
"\t\"EmplName\":\"测试人员1\",\n" +
|
"\t\"EmplName\":\"测试人员10\",\n" +
|
||||||
"\t\"EmplType\":\"人员类型代码\",\n" +
|
"\t\"EmplType\":\"人员类型代码\",\n" +
|
||||||
"\t\"EmplTypeCaption\":\"人员类型名称\",\n" +
|
"\t\"EmplTypeCaption\":\"人员类型名称\",\n" +
|
||||||
"\t\"Gender\":\"男\",\n" +
|
"\t\"Gender\":\"男\",\n" +
|
||||||
|
@ -70,4 +70,48 @@ public class XkHospitalTest extends BaseTest {
|
||||||
Util.null2DefaultStr(null,"");
|
Util.null2DefaultStr(null,"");
|
||||||
service.async("4bce0693734c","hrm",map);
|
service.async("4bce0693734c","hrm",map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testC(){
|
||||||
|
String json = "{\n" +
|
||||||
|
"\t\"ID\":\"主键\",\n" +
|
||||||
|
"\t\"GroupID\":\"test_yl_01\",\n" +
|
||||||
|
"\t\"GroupCode\":\"test_yl_dm_03\",\n" +
|
||||||
|
"\t\"GroupName\":\"医疗组名称1\",\n" +
|
||||||
|
"\t\"DeptCode\":\"test03\",\n" +
|
||||||
|
"\t\"DeptName\":\"测试科室03\",\n" +
|
||||||
|
"\t\"WardCode\":\"病区代码\",\n" +
|
||||||
|
"\t\"WardName\":\"病区名称\",\n" +
|
||||||
|
"\t\"Ward_BedNumber\":\"病区床位数,int类型\",\n" +
|
||||||
|
"\t\"IsDelete\":\"是否停用,bool类型\",\n" +
|
||||||
|
"\t\"Remark\":\"备注\",\n" +
|
||||||
|
"\t\"Wards\":[\t\n" +
|
||||||
|
"\t\t{\t\t\t\n" +
|
||||||
|
"\t\t\t\"ID\":\"1\",\n" +
|
||||||
|
"\t\t\t\"WardCode\":\"bq_01\",\n" +
|
||||||
|
"\t\t\t\"WardName\":\"病区名称01_2_3\"\n" +
|
||||||
|
"\t\t},{\t\t\t\n" +
|
||||||
|
"\t\t\t\"ID\":\"2\",\n" +
|
||||||
|
"\t\t\t\"WardCode\":\"bq_03\",\n" +
|
||||||
|
"\t\t\t\"WardName\":\"病区名称02_1_3\"\n" +
|
||||||
|
"\t\t}\n" +
|
||||||
|
"\t],\n" +
|
||||||
|
"\t\"WardHeads\":[\n" +
|
||||||
|
"\t\t{\n" +
|
||||||
|
"\t\t\t\"ID\":\"1\",\n" +
|
||||||
|
"\t\t\t\"EmplCode\":\"TEST10\",\n" +
|
||||||
|
"\t\t\t\"EmplName\":\"傻逼01\",\n" +
|
||||||
|
"\t\t\t\"Category\":\"人员分组,当人员为主治和住院医师时使用\"\n" +
|
||||||
|
"\t\t},{\n" +
|
||||||
|
"\t\t\t\"ID\":\"2\",\n" +
|
||||||
|
"\t\t\t\"EmplCode\":\"TEST10\",\n" +
|
||||||
|
"\t\t\t\"EmplName\":\"傻逼02\",\n" +
|
||||||
|
"\t\t\t\"Category\":\"人员分组,当人员为主治和住院医师时使用\"\n" +
|
||||||
|
"\t\t}\n" +
|
||||||
|
"\t]\n" +
|
||||||
|
"}\n";
|
||||||
|
Map map = JSONObject.parseObject(json, Map.class);
|
||||||
|
Util.null2DefaultStr(null,"");
|
||||||
|
service.async("4bce0693734d","common", map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue