commit
dedfee53c1
|
@ -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,8 @@
|
||||||
package aiyh.utils.response_deal.state;
|
package aiyh.utils.response_deal.state;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.excention.ParseSqlException;
|
||||||
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;
|
||||||
|
@ -7,6 +10,7 @@ import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
|
||||||
import aiyh.utils.response_deal.util.ResponseUtil;
|
import aiyh.utils.response_deal.util.ResponseUtil;
|
||||||
import aiyh.utils.tool.cn.hutool.core.bean.BeanUtil;
|
import aiyh.utils.tool.cn.hutool.core.bean.BeanUtil;
|
||||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -58,9 +62,18 @@ 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;
|
||||||
|
try {
|
||||||
|
dataId = this.configMapper.executeCusQuerySql(cusQuerySql, rowDefinition.getWhereParam(),new HashMap<>());
|
||||||
|
}catch (ParseSqlException e){
|
||||||
|
logger.error(Util.logStr("parse sql error, current sql : [{}], whereParam : [{}]", cusQuerySql, JSONObject.toJSONString(rowDefinition.getWhereParam())));
|
||||||
|
throw new CustomerException(e);
|
||||||
|
}
|
||||||
|
if(StrUtil.isNotBlank(dataId)){
|
||||||
|
rowDefinition.setDataId(Util.getIntValue(dataId, -1));
|
||||||
|
}
|
||||||
return StrUtil.isNotBlank(dataId);
|
return StrUtil.isNotBlank(dataId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package aiyh.utils.response_deal.state;
|
package aiyh.utils.response_deal.state;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.excention.ParseSqlException;
|
||||||
import aiyh.utils.recordset.MapperBuilderSql;
|
import aiyh.utils.recordset.MapperBuilderSql;
|
||||||
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;
|
||||||
import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
|
import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
|
||||||
import aiyh.utils.response_deal.util.ResponseUtil;
|
import aiyh.utils.response_deal.util.ResponseUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -62,19 +65,29 @@ public class InsertSate extends State{
|
||||||
}
|
}
|
||||||
String updateSql = MapperBuilderSql.builderUpdateSql(assignTable, tempRowDefinition.getUpdateParam(),"upItem");
|
String updateSql = MapperBuilderSql.builderUpdateSql(assignTable, tempRowDefinition.getUpdateParam(),"upItem");
|
||||||
updateSql = updateSql + " where id = #{whereItem.id}";
|
updateSql = updateSql + " where id = #{whereItem.id}";
|
||||||
flag = this.configMapper.executeUpdateBatchCusSql(updateSql, updateList, whereList);
|
try {
|
||||||
|
flag = this.configMapper.executeUpdateBatchCusSql(updateSql, updateList, whereList);
|
||||||
|
}catch (ParseSqlException e){
|
||||||
|
logger.error(Util.logStr("parse sql error, current sql : [{}], updateList : [{}], whereList : [{}]", updateSql, JSONObject.toJSONString(updateList), JSONObject.toJSONString(whereList)));
|
||||||
|
throw new CustomerException(e);
|
||||||
|
}
|
||||||
String modeId = Util.getModeIdByTableName(assignTable);
|
String modeId = Util.getModeIdByTableName(assignTable);
|
||||||
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);
|
||||||
}
|
}
|
||||||
insertList.add(item.getUpdateParam());
|
insertList.add(item.getUpdateParam());
|
||||||
});
|
});
|
||||||
flag = this.configMapper.executeInsertBatchCusSql(insertSql, insertList);
|
try {
|
||||||
|
flag = this.configMapper.executeInsertBatchCusSql(insertSql, insertList);
|
||||||
|
}catch (ParseSqlException e){
|
||||||
|
logger.error(Util.logStr("parse sql error, current sql : [{}], insertList : [{}]", insertSql, JSONObject.toJSONString(insertList)));
|
||||||
|
throw new CustomerException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(ResponseUtil.parameterIsNotNull(detailTableMap) && flag){
|
if(ResponseUtil.parameterIsNotNull(detailTableMap) && flag){
|
||||||
detailTableMap.forEach((key,value)->{
|
detailTableMap.forEach((key,value)->{
|
||||||
|
@ -97,6 +110,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;
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
package aiyh.utils.response_deal.state;
|
package aiyh.utils.response_deal.state;
|
||||||
|
|
||||||
import aiyh.utils.ScriptUtil;
|
import aiyh.utils.ScriptUtil;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.excention.ParseSqlException;
|
||||||
import aiyh.utils.recordset.MapperBuilderSql;
|
import aiyh.utils.recordset.MapperBuilderSql;
|
||||||
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;
|
||||||
import aiyh.utils.response_deal.exception.ResponseException;
|
import aiyh.utils.response_deal.exception.ResponseException;
|
||||||
import aiyh.utils.response_deal.util.ResponseUtil;
|
import aiyh.utils.response_deal.util.ResponseUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -58,7 +62,13 @@ public class UpdateState extends State {
|
||||||
String tempConditionScript = rowDefinition.getConditionScript();
|
String tempConditionScript = rowDefinition.getConditionScript();
|
||||||
String updateSql = MapperBuilderSql.builderUpdateSql(assignTable, rowDefinition.getUpdateParam(),"upItem");
|
String updateSql = MapperBuilderSql.builderUpdateSql(assignTable, rowDefinition.getUpdateParam(),"upItem");
|
||||||
updateSql = updateSql + " where " + tempConditionScript;
|
updateSql = updateSql + " where " + tempConditionScript;
|
||||||
boolean flag = this.configMapper.executeUpdateBatchCusSql(updateSql, updateList, whereList);
|
boolean flag;
|
||||||
|
try {
|
||||||
|
flag = this.configMapper.executeUpdateBatchCusSql(updateSql, updateList, whereList);
|
||||||
|
}catch (ParseSqlException e){
|
||||||
|
logger.error(Util.logStr("parse sql error, current sql : [{}], updateList : [{}], whereList : [{}]", updateSql, JSONObject.toJSONString(updateList), JSONObject.toJSONString(whereList)));
|
||||||
|
throw new CustomerException(e);
|
||||||
|
}
|
||||||
logger.info("批量更新处理结果 ==>"+flag);
|
logger.info("批量更新处理结果 ==>"+flag);
|
||||||
if(ResponseUtil.parameterIsNotNull(this.context.getTableDefinitionCallback())){
|
if(ResponseUtil.parameterIsNotNull(this.context.getTableDefinitionCallback())){
|
||||||
this.context.getTableDefinitionCallback().afterHandle(this.context,flag);
|
this.context.getTableDefinitionCallback().afterHandle(this.context,flag);
|
||||||
|
@ -83,6 +93,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,8 @@ package com.api.xuanran.wang.xk_hospital.data_async.controller;
|
||||||
|
|
||||||
import aiyh.utils.ApiResult;
|
import aiyh.utils.ApiResult;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
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;
|
||||||
|
@ -37,6 +39,10 @@ public class CommonDataAsyncController {
|
||||||
@PathParam("type") String type,
|
@PathParam("type") String type,
|
||||||
@RequestBody Map<String, Object> params){
|
@RequestBody Map<String, Object> params){
|
||||||
try {
|
try {
|
||||||
|
if(StrUtil.isBlank(configId) || StrUtil.isBlank(type)){
|
||||||
|
throw new CustomerException("configId or type can not be empty!");
|
||||||
|
}
|
||||||
|
logger.info(Util.logStr("configId : {}, type : {}, params : {}", configId, type, params));
|
||||||
service.async(configId, type, params);
|
service.async(configId, type, params);
|
||||||
return ApiResult.successNoData();
|
return ApiResult.successNoData();
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
|
@ -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,28 +33,33 @@ 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(StrUtil.isBlank(dataId)){
|
if(ResponseConfigConstant.MAIN_TABLE == orDetail){
|
||||||
int nextId = -1;
|
if(StrUtil.isBlank(dataId)){
|
||||||
if(HRM_RESOURCE.equals(table)){
|
int nextId = -1;
|
||||||
nextId = Util.getNextHrmId();
|
if(HRM_RESOURCE.equals(table)){
|
||||||
}else if(DEPARTMENT.equals(table)){
|
nextId = Util.getNextHrmId();
|
||||||
nextId = Util.getNextDepartmentId();
|
}else if(DEPARTMENT.equals(table)){
|
||||||
}
|
nextId = Util.getNextDepartmentId();
|
||||||
if(nextId < 0){
|
}
|
||||||
throw new CustomerException("从 " + table + " 获取下一个id失败!");
|
if(nextId < 0){
|
||||||
}
|
throw new CustomerException("从 " + table + " 获取下一个id失败!");
|
||||||
rowDefinition.setDataId(nextId);
|
}
|
||||||
if(HRM_RESOURCE.equals(table)){
|
rowDefinition.setDataId(nextId);
|
||||||
rowDefinition.getUpdateParam().put("id", nextId);
|
if(HRM_RESOURCE.equals(table)){
|
||||||
rowDefinition.setConditionScript("");
|
rowDefinition.getUpdateParam().put("id", nextId);
|
||||||
return false;
|
rowDefinition.setConditionScript("");
|
||||||
}else {
|
return false;
|
||||||
rowDefinition.getWhereParam().put("id", nextId);
|
}else {
|
||||||
rowDefinition.setConditionScript(" id = #{whereItem.id}");
|
rowDefinition.getWhereParam().put("id", nextId);
|
||||||
|
rowDefinition.setConditionScript(" id = #{whereItem.id}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
return StringUtils.isNotBlank(dataId);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1></h1>
|
* <h1>数据同步</h1>
|
||||||
*
|
*
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
* @date 2023/7/18 11:15
|
* @date 2023/7/18 11:15
|
||||||
|
|
|
@ -63,23 +63,31 @@ public class PushEmployeeCronJob extends BaseCronJob {
|
||||||
HttpUtils httpUtils = new HttpUtils();
|
HttpUtils httpUtils = new HttpUtils();
|
||||||
|
|
||||||
if(employeeList != null && employeeList.size() > 0){//遍历结果集
|
if(employeeList != null && employeeList.size() > 0){//遍历结果集
|
||||||
|
|
||||||
|
logger.info("人员记录条数:[" + employeeList.size() + "]");
|
||||||
|
|
||||||
for(Map<String,Object> employeeMap : employeeList){
|
for(Map<String,Object> employeeMap : employeeList){
|
||||||
|
|
||||||
int keyId = (int) employeeMap.get("code");
|
int keyId = Util.getIntValue(Util.null2String(employeeMap.get("code")));
|
||||||
|
|
||||||
|
Map<String,String> dataMap = new HashMap<>();
|
||||||
|
dataMap.put("code",Util.null2String(employeeMap.get("code")));
|
||||||
|
dataMap.put("name",Util.null2String(employeeMap.get("name")));
|
||||||
|
dataMap.put("id",Util.null2String(employeeMap.get("id")));
|
||||||
|
|
||||||
Map<String,String> header = new HashMap<>();
|
Map<String,String> header = new HashMap<>();
|
||||||
header.put("Content-Type", HttpArgsType.APPLICATION_JSON);
|
header.put("Content-Type", HttpArgsType.APPLICATION_JSON);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ResponeVo responeVo = httpUtils.apiPostObject(pushEmployeeRequestURL,employeeMap,header);
|
ResponeVo responeVo = httpUtils.apiPostObject(pushEmployeeRequestURL,dataMap,header);
|
||||||
|
|
||||||
if(responeVo.getCode() == VoucherConstants.REQUEST_SUCCESS_CODE){
|
if(responeVo.getCode() == VoucherConstants.REQUEST_SUCCESS_CODE){
|
||||||
Map<String,Object> resultMap = responeVo.getResponseMap();
|
Map<String,Object> resultMap = responeVo.getResponseMap();
|
||||||
|
|
||||||
if(!resultMap.isEmpty()){
|
if(!resultMap.isEmpty()){
|
||||||
int code = (int) resultMap.get("code");
|
int code = Util.getIntValue(Util.null2String(resultMap.get("code")));
|
||||||
|
|
||||||
if(code == 1){
|
if(code == 0){
|
||||||
String pk = (String) resultMap.get("pk");
|
String pk = (String) resultMap.get("pk");
|
||||||
|
|
||||||
sqlMapper.writeBackKeyToEmployee(pk,keyId);
|
sqlMapper.writeBackKeyToEmployee(pk,keyId);
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class PushModeDataUtil {
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getConfiguration(Map<String, Object> configMap) {
|
private Map<String, Object> getConfiguration(Map<String, Object> configMap) {
|
||||||
if(configMap != null && configMap.size() > 0){
|
if(configMap != null && configMap.size() > 0){
|
||||||
int mainKeyId = (int) configMap.get("id");
|
int mainKeyId = Util.getIntValue(configMap.get("id").toString());
|
||||||
|
|
||||||
List<Map<String, Object>> fieldList = sqlMapper.getPushDataDetailConfiguration(mainKeyId);
|
List<Map<String, Object>> fieldList = sqlMapper.getPushDataDetailConfiguration(mainKeyId);
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class PushModeDataUtil {
|
||||||
//建模字段名称
|
//建模字段名称
|
||||||
String fieldName = Util.null2String(fieldMap.get("fieldName"));
|
String fieldName = Util.null2String(fieldMap.get("fieldName"));
|
||||||
//转换规则
|
//转换规则
|
||||||
int changeRule = (int) fieldMap.get("changeRule");
|
int changeRule = Util.getIntValue(fieldMap.get("changeRule").toString());
|
||||||
//自定义规则
|
//自定义规则
|
||||||
String cusSQL = Util.null2String(fieldMap.get("cusSQL"));
|
String cusSQL = Util.null2String(fieldMap.get("cusSQL"));
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import aiyh.utils.Util;
|
||||||
import aiyh.utils.httpUtil.HttpArgsType;
|
import aiyh.utils.httpUtil.HttpArgsType;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.file.Prop;
|
import weaver.file.Prop;
|
||||||
|
@ -29,7 +30,6 @@ public class VoucherPushAction implements CusActionPostInterface {
|
||||||
private final Logger logger = Util.getLogger();
|
private final Logger logger = Util.getLogger();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后置处理方法
|
* 后置处理方法
|
||||||
*
|
*
|
||||||
|
@ -44,6 +44,7 @@ public class VoucherPushAction implements CusActionPostInterface {
|
||||||
JSONObject postObj = (JSONObject) params.get("pushJsonObject");
|
JSONObject postObj = (JSONObject) params.get("pushJsonObject");
|
||||||
Map<String,Object> workflowBaseMap = (Map<String,Object>) params.get("workflowBaseMap");
|
Map<String,Object> workflowBaseMap = (Map<String,Object>) params.get("workflowBaseMap");
|
||||||
Map<String,String> pathParam = (Map<String,String>) params.get("pathParam");
|
Map<String,String> pathParam = (Map<String,String>) params.get("pathParam");
|
||||||
|
String isArray = Util.null2String(params.get("isArray"));
|
||||||
|
|
||||||
|
|
||||||
Map<String,Object> logMap = new HashMap<>();
|
Map<String,Object> logMap = new HashMap<>();
|
||||||
|
@ -63,7 +64,16 @@ public class VoucherPushAction implements CusActionPostInterface {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//进行接口数据推送
|
//进行接口数据推送
|
||||||
ResponeVo responeVo = httpUtils.apiPostObject(requestURL, postObj, headerMap);
|
ResponeVo responeVo ;
|
||||||
|
|
||||||
|
if("Y".equals(isArray)){
|
||||||
|
JSONArray postArray = new JSONArray();
|
||||||
|
postArray.add(postObj);
|
||||||
|
|
||||||
|
responeVo = httpUtils.apiPostObject(requestURL, postArray, headerMap);
|
||||||
|
} else {
|
||||||
|
responeVo = httpUtils.apiPostObject(requestURL, postObj, headerMap);
|
||||||
|
}
|
||||||
|
|
||||||
if(responeVo != null && responeVo.getCode() == 200){
|
if(responeVo != null && responeVo.getCode() == 200){
|
||||||
logMap.put("message",responeVo.getEntityString());
|
logMap.put("message",responeVo.getEntityString());
|
||||||
|
@ -71,6 +81,8 @@ public class VoucherPushAction implements CusActionPostInterface {
|
||||||
//接口返回所有信息
|
//接口返回所有信息
|
||||||
resultMessageUtil.setResponseBody(responeVo.getEntityString());
|
resultMessageUtil.setResponseBody(responeVo.getEntityString());
|
||||||
|
|
||||||
|
logger.info("接口响应信息:[" + responeVo.getEntityString() + "]");
|
||||||
|
|
||||||
Map<String,Object> resultMap = responeVo.getResponseMap();
|
Map<String,Object> resultMap = responeVo.getResponseMap();
|
||||||
|
|
||||||
if(resultMap != null){
|
if(resultMap != null){
|
||||||
|
@ -97,7 +109,11 @@ public class VoucherPushAction implements CusActionPostInterface {
|
||||||
|
|
||||||
int modeid = Util.getIntValue(Prop.getPropValue("global", "interfacelog_modeid"));
|
int modeid = Util.getIntValue(Prop.getPropValue("global", "interfacelog_modeid"));
|
||||||
|
|
||||||
CommonUtil.insertNewDataToMode(modeid,"uf_interface_log",logMap);
|
CommonUtil commonUtil = new CommonUtil();
|
||||||
|
|
||||||
|
logger.info("日志信息:[" + JSONObject.toJSONString(logMap) + "]");
|
||||||
|
|
||||||
|
commonUtil.insertNewDataToMode(modeid,"uf_interface_log",logMap);
|
||||||
|
|
||||||
return resultMessageUtil;
|
return resultMessageUtil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class CommonUtil {
|
||||||
/**
|
/**
|
||||||
* 获取数据库操作接口
|
* 获取数据库操作接口
|
||||||
*/
|
*/
|
||||||
private static final CommonSqlMapper sqlMapper = Util.getMapper(CommonSqlMapper.class);
|
private final CommonSqlMapper sqlMapper = Util.getMapper(CommonSqlMapper.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字段详细信息
|
* 获取字段详细信息
|
||||||
|
@ -66,7 +66,7 @@ public class CommonUtil {
|
||||||
* @param modeTableName 模块表名称
|
* @param modeTableName 模块表名称
|
||||||
* @return 模块ID
|
* @return 模块ID
|
||||||
*/
|
*/
|
||||||
public static int getModeIdByTableName(String modeTableName) {
|
public int getModeIdByTableName(String modeTableName) {
|
||||||
return sqlMapper.getModeIdByTableName(modeTableName);
|
return sqlMapper.getModeIdByTableName(modeTableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class CommonUtil {
|
||||||
* @param modeTableName 模块表名称
|
* @param modeTableName 模块表名称
|
||||||
* @param dataMap 数据集
|
* @param dataMap 数据集
|
||||||
*/
|
*/
|
||||||
public static void insertNewDataToMode(int modeId,String modeTableName, Map<String,Object> dataMap){
|
public void insertNewDataToMode(int modeId,String modeTableName, Map<String,Object> dataMap){
|
||||||
//获取新的记录ID
|
//获取新的记录ID
|
||||||
int newDataId = Util.getModeDataId(modeTableName,modeId,1);
|
int newDataId = Util.getModeDataId(modeTableName,modeId,1);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Map;
|
||||||
* @author bleach
|
* @author bleach
|
||||||
* @version 2023-07-12
|
* @version 2023-07-12
|
||||||
*/
|
*/
|
||||||
|
@SqlMapper
|
||||||
public interface CommonSqlMapper {
|
public interface CommonSqlMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,10 +34,10 @@ public interface CommonSqlMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除建模数据
|
* 删除建模数据
|
||||||
|
*
|
||||||
* @param tableName 表单名称
|
* @param tableName 表单名称
|
||||||
* @param dataId 数据ID
|
* @param dataId 数据ID
|
||||||
* @return 更新结果
|
|
||||||
*/
|
*/
|
||||||
@Delete("delete from $t{tableName} where id = #{dataId}")
|
@Delete("delete from $t{tableName} where id = #{dataId}")
|
||||||
boolean deleteRedundancyData(@ParamMapper("tableName") String tableName, @ParamMapper("dataId") int dataId);
|
void deleteRedundancyData(@ParamMapper("tableName") String tableName, @ParamMapper("dataId") int dataId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,12 @@ package weaver.weilin.zhu.common.voucher.action;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.action.SafeCusBaseAction;
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
import aiyh.utils.annotation.ActionDefaultTestValue;
|
import aiyh.utils.annotation.ActionDefaultTestValue;
|
||||||
|
import aiyh.utils.annotation.ActionOptionalParam;
|
||||||
import aiyh.utils.annotation.PrintParamMark;
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
import aiyh.utils.annotation.RequiredMark;
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
@ -27,6 +30,8 @@ import java.util.Map;
|
||||||
* @author bleach
|
* @author bleach
|
||||||
* @version 2023-07-10
|
* @version 2023-07-10
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
public class CommonVoucherAction extends SafeCusBaseAction {
|
public class CommonVoucherAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,8 +47,14 @@ public class CommonVoucherAction extends SafeCusBaseAction {
|
||||||
/**
|
/**
|
||||||
* 自定义参数值
|
* 自定义参数值
|
||||||
*/
|
*/
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionOptionalParam(value = "", desc = "自定义参数值")
|
||||||
private String cusParamValue;
|
private String cusParamValue;
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionOptionalParam(value = "N", desc = "推送的JSON数据是否为数组")
|
||||||
|
private String isArray = "N";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后置实现类接口路径
|
* 后置实现类接口路径
|
||||||
*/
|
*/
|
||||||
|
@ -81,7 +92,10 @@ public class CommonVoucherAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
assert baseConfigDao != null;
|
assert baseConfigDao != null;
|
||||||
|
|
||||||
voucherUtil.setThisUser(user);
|
if(user != null){
|
||||||
|
voucherUtil.setThisUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
voucherUtil.setObjectMappingDaoList(baseConfigDao.getObjectMappingDaoList());
|
voucherUtil.setObjectMappingDaoList(baseConfigDao.getObjectMappingDaoList());
|
||||||
voucherUtil.setNodeFieldMappingDaoList(baseConfigDao.getNodeFieldMappingDaoList());
|
voucherUtil.setNodeFieldMappingDaoList(baseConfigDao.getNodeFieldMappingDaoList());
|
||||||
|
|
||||||
|
@ -99,18 +113,32 @@ public class CommonVoucherAction extends SafeCusBaseAction {
|
||||||
logger.info("当前流程不满足自定义条件!");
|
logger.info("当前流程不满足自定义条件!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rs.beforFirst();
|
||||||
|
Map<String,Object> mainTableInfo = Util.recordSet2Map(rs);
|
||||||
|
|
||||||
|
logger.info("主表字段信息:[" + JSONObject.toJSONString(mainTableInfo) + "]");
|
||||||
|
|
||||||
|
voucherUtil.setMainTableInfo(mainTableInfo);
|
||||||
|
|
||||||
|
workflowBaseMap.put("requestId",requestId);
|
||||||
|
workflowBaseMap.put("billTableName",billTable);
|
||||||
workflowBaseMap.put("mainId",Util.null2String(rs.getString("id")));
|
workflowBaseMap.put("mainId",Util.null2String(rs.getString("id")));
|
||||||
|
|
||||||
|
logger.info(workflowBaseMap.toString());
|
||||||
|
|
||||||
//推送的报文
|
//推送的报文
|
||||||
JSONObject postJsonObj = new JSONObject();
|
JSONObject postJsonObj = new JSONObject();
|
||||||
|
|
||||||
StringBuilder postXmlObj = new StringBuilder();
|
StringBuilder postXmlObj = new StringBuilder();
|
||||||
|
|
||||||
if(baseConfigDao.getDataFormat() == 1){
|
if(baseConfigDao.getDataFormat() == 1){
|
||||||
postXmlObj = voucherUtil.recursionGenerateXML("",null,null,0,0,0);
|
postXmlObj = voucherUtil.generateXML(mainTableInfo);
|
||||||
|
|
||||||
|
logger.info("请求的XML报文信息:[" + postXmlObj + "]");
|
||||||
} else {
|
} else {
|
||||||
//推送的报文
|
//推送的报文
|
||||||
postJsonObj = voucherUtil.recursionGenerateJsonObject("",null,null,0,0,0);
|
postJsonObj = voucherUtil.generateJsonObject(mainTableInfo);
|
||||||
|
logger.info("请求的JSON报文信息:[" + postJsonObj + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(postJsonObj != null || postXmlObj.length() > 0){
|
if(postJsonObj != null || postXmlObj.length() > 0){
|
||||||
|
@ -126,6 +154,7 @@ public class CommonVoucherAction extends SafeCusBaseAction {
|
||||||
paramsMap.put("requestInfo",requestInfo);
|
paramsMap.put("requestInfo",requestInfo);
|
||||||
paramsMap.put("workflowBaseMap",workflowBaseMap);
|
paramsMap.put("workflowBaseMap",workflowBaseMap);
|
||||||
paramsMap.put("userInfo",user);
|
paramsMap.put("userInfo",user);
|
||||||
|
paramsMap.put("isArray",isArray);
|
||||||
|
|
||||||
ResultMessageUtil resultMessageUtil = executePostProcessor(className,paramsMap);
|
ResultMessageUtil resultMessageUtil = executePostProcessor(className,paramsMap);
|
||||||
|
|
||||||
|
@ -190,6 +219,7 @@ public class CommonVoucherAction extends SafeCusBaseAction {
|
||||||
try {
|
try {
|
||||||
aClass = Class.forName(className);
|
aClass = Class.forName(className);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
|
logger.error(Util.getErrString(e));
|
||||||
throw new IllegalArgumentException("未能找到自定义action接口处理方法:" + className);
|
throw new IllegalArgumentException("未能找到自定义action接口处理方法:" + className);
|
||||||
}
|
}
|
||||||
Constructor<?> constructor;
|
Constructor<?> constructor;
|
||||||
|
@ -206,25 +236,9 @@ public class CommonVoucherAction extends SafeCusBaseAction {
|
||||||
try {
|
try {
|
||||||
o = (CusActionPostInterface) constructor.newInstance();
|
o = (CusActionPostInterface) constructor.newInstance();
|
||||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
|
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
|
||||||
|
logger.error(Util.getErrString(e));
|
||||||
throw new IllegalArgumentException("无法构造" + className + "对象!");
|
throw new IllegalArgumentException("无法构造" + className + "对象!");
|
||||||
}
|
}
|
||||||
return o.postProcessor(params);
|
return o.postProcessor(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCusParamValue() {
|
|
||||||
return cusParamValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCusParamValue(String cusParamValue) {
|
|
||||||
this.cusParamValue = cusParamValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImplementorPath() {
|
|
||||||
return implementorPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImplementorPath(String implementorPath) {
|
|
||||||
this.implementorPath = implementorPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,13 @@ public class FieldChangeRuleMethod {
|
||||||
if(StringUtils.isNotBlank(fieldName)){
|
if(StringUtils.isNotBlank(fieldName)){
|
||||||
int viewType = fieldInfo.getViewType();
|
int viewType = fieldInfo.getViewType();
|
||||||
|
|
||||||
if(viewType == 0){
|
if(viewType == 0 && param.getMainTableInfo() != null){
|
||||||
fieldValue = Util.null2String(param.getRs().getString(fieldName));
|
//fieldValue = Util.null2String(param.getRs().getString(fieldName));
|
||||||
|
Map<String, Object> mainTableInfo = param.getMainTableInfo();
|
||||||
|
|
||||||
|
if(mainTableInfo.containsKey(fieldName)){
|
||||||
|
fieldValue = Util.null2String(mainTableInfo.get(fieldName));
|
||||||
|
}
|
||||||
} else if(viewType == 1 && param.getRs_detail() != null){
|
} else if(viewType == 1 && param.getRs_detail() != null){
|
||||||
fieldValue = Util.null2String(param.getRs_detail().getString(fieldName));
|
fieldValue = Util.null2String(param.getRs_detail().getString(fieldName));
|
||||||
}
|
}
|
||||||
|
@ -173,11 +178,11 @@ public class FieldChangeRuleMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param.getThisUser() != null){
|
if(param.getThisUser() != null){
|
||||||
cusSQL = cusSQL.replace("{userId}", String.valueOf(param.getThisUser().getUID()));
|
cusSQL = cusSQL.replace("{?userId}", String.valueOf(param.getThisUser().getUID()));
|
||||||
|
|
||||||
cusSQL = cusSQL.replace("{departmentId}", String.valueOf(param.getThisUser().getUserDepartment()));
|
cusSQL = cusSQL.replace("{?departmentId}", String.valueOf(param.getThisUser().getUserDepartment()));
|
||||||
|
|
||||||
cusSQL = cusSQL.replace("{subCompanyId}", String.valueOf(param.getThisUser().getUserSubCompany1()));
|
cusSQL = cusSQL.replace("{?subCompanyId}", String.valueOf(param.getThisUser().getUserSubCompany1()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,11 @@ public class RuleMethodParam {
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> workflowBaseMap;
|
private Map<String,Object> workflowBaseMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程主表信息
|
||||||
|
*/
|
||||||
|
private Map<String,Object> mainTableInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 明细序列
|
* 明细序列
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,6 +2,7 @@ package weaver.weilin.zhu.common.voucher.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.*;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.weilin.zhu.common.util.FieldDetailInfo;
|
||||||
import weaver.weilin.zhu.common.voucher.entity.BaseConfigDao;
|
import weaver.weilin.zhu.common.voucher.entity.BaseConfigDao;
|
||||||
import weaver.weilin.zhu.common.voucher.entity.NodeFieldMappingDao;
|
import weaver.weilin.zhu.common.voucher.entity.NodeFieldMappingDao;
|
||||||
import weaver.weilin.zhu.common.voucher.entity.ObjectMappingDao;
|
import weaver.weilin.zhu.common.voucher.entity.ObjectMappingDao;
|
||||||
|
@ -21,7 +22,7 @@ public interface CommVoucherSqlMapper {
|
||||||
* @param workflowIds 流程类型ID
|
* @param workflowIds 流程类型ID
|
||||||
* @return 配置信息
|
* @return 配置信息
|
||||||
*/
|
*/
|
||||||
@Select("select * from uf_comm_voucher where wfId in ($t{workflowIds})")
|
@Select("select * from uf_comm_voucher where workflowId in ($t{workflowIds})")
|
||||||
@CollectionMappings({
|
@CollectionMappings({
|
||||||
@CollectionMapping(
|
@CollectionMapping(
|
||||||
property = "objectMappingDaoList",
|
property = "objectMappingDaoList",
|
||||||
|
@ -34,6 +35,7 @@ public interface CommVoucherSqlMapper {
|
||||||
id = @Id(value = Integer.class,methodId = 2)
|
id = @Id(value = Integer.class,methodId = 2)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@CaseConversion(value = false)
|
||||||
BaseConfigDao getConfigurationByWorkflowId(@ParamMapper("workflowIds") String workflowIds);
|
BaseConfigDao getConfigurationByWorkflowId(@ParamMapper("workflowIds") String workflowIds);
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ public interface CommVoucherSqlMapper {
|
||||||
* @param workflowIds 流程类型ID
|
* @param workflowIds 流程类型ID
|
||||||
* @return 配置信息
|
* @return 配置信息
|
||||||
*/
|
*/
|
||||||
@Select("select * from uf_comm_voucher where wfId in ($t{workflowIds}) and cusParamValue = #{cusParamValue}")
|
@Select("select * from uf_comm_voucher where workflowId in ($t{workflowIds}) and cusParamValue = #{cusParamValue}")
|
||||||
@CollectionMappings({
|
@CollectionMappings({
|
||||||
@CollectionMapping(
|
@CollectionMapping(
|
||||||
property = "objectMappingDaoList",
|
property = "objectMappingDaoList",
|
||||||
|
@ -56,6 +58,7 @@ public interface CommVoucherSqlMapper {
|
||||||
id = @Id(value = Integer.class,methodId = 2)
|
id = @Id(value = Integer.class,methodId = 2)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@CaseConversion(value = false)
|
||||||
BaseConfigDao getConfigurationByWorkflowIdAndCondition(@ParamMapper("workflowIds") String workflowIds,@ParamMapper("cusParamValue") String cusParamValue);
|
BaseConfigDao getConfigurationByWorkflowIdAndCondition(@ParamMapper("workflowIds") String workflowIds,@ParamMapper("cusParamValue") String cusParamValue);
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,11 +69,11 @@ public interface CommVoucherSqlMapper {
|
||||||
* @return 映射详细信息
|
* @return 映射详细信息
|
||||||
*/
|
*/
|
||||||
@Select("select * from uf_comm_voucher_dt1 where mainId = #{mainId}")
|
@Select("select * from uf_comm_voucher_dt1 where mainId = #{mainId}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
@CollectionMethod(value = 1,desc = "获取对象与流程明细表映射配置信息")
|
@CollectionMethod(value = 1,desc = "获取对象与流程明细表映射配置信息")
|
||||||
List<ObjectMappingDao> getObjectMappingByMainKeyId(@ParamMapper("mainId") int mainId);
|
List<ObjectMappingDao> getObjectMappingByMainKeyId(@ParamMapper("mainId") int mainId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取对象与流程明细表映射配置信息
|
* 获取对象与流程明细表映射配置信息
|
||||||
* @param mainId 主表主键ID
|
* @param mainId 主表主键ID
|
||||||
|
@ -81,8 +84,7 @@ public interface CommVoucherSqlMapper {
|
||||||
@Association(
|
@Association(
|
||||||
property = "wfField",
|
property = "wfField",
|
||||||
column = "wfField",
|
column = "wfField",
|
||||||
select = "weaver.weilin.zhu.common.util.CommonUtil.getFieldDetailInfo",
|
id = @Id(value = Integer.class,methodId = 3)
|
||||||
id = @Id(Integer.class)
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@CaseConversion(value = false)
|
@CaseConversion(value = false)
|
||||||
|
@ -90,6 +92,30 @@ public interface CommVoucherSqlMapper {
|
||||||
List<NodeFieldMappingDao> getNodeFieldMappingByMainKeyId(@ParamMapper("mainId") int mainId);
|
List<NodeFieldMappingDao> getNodeFieldMappingByMainKeyId(@ParamMapper("mainId") int mainId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字段信息
|
||||||
|
* @param fieldId 字段ID
|
||||||
|
* @return 字段信息
|
||||||
|
*/
|
||||||
|
@Select("select id,fieldName,viewType,detailTable,fieldDbType from workflow_billField where id = #{fieldId}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
|
@AssociationMethod(value = 3,desc = "获取字段详细信息")
|
||||||
|
FieldDetailInfo getFieldDetailInfo(@ParamMapper("fieldId") int fieldId);
|
||||||
|
/*
|
||||||
|
@Select("select id,fieldName,viewType,detailTable,fieldDbType,case when VIEWTYPE = 1 and CHARINDEX('_dt',DETAILTABLE) > 0 then \n" +
|
||||||
|
"\t substring(DETAILTABLE,CHARINDEX('_dt',DETAILTABLE) + 3)\n" +
|
||||||
|
"else 0\n" +
|
||||||
|
"end detailIndex from workflow_billField where id = #{fieldId}")
|
||||||
|
|
||||||
|
|
||||||
|
@Select("select id,fieldName,viewType,detailTable,fieldDbType,case when VIEWTYPE = 1 and LOCATE('_dt',DETAILTABLE) > 0 then \n" +
|
||||||
|
"\t substr(DETAILTABLE,LOCATE('_dt',DETAILTABLE) + 3)\n" +
|
||||||
|
"else 0\n" +
|
||||||
|
"end detailIndex from workflow_billField where id = #{fieldId}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
|
@AssociationMethod(value = 3,desc = "获取字段详细信息")
|
||||||
|
FieldDetailInfo getFieldDetailInfo(@ParamMapper("fieldId") int fieldId);
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询流程主表的信息
|
* 查询流程主表的信息
|
||||||
|
|
|
@ -3,7 +3,10 @@ package weaver.weilin.zhu.common.voucher.util;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
import weaver.weilin.zhu.common.util.FieldDetailInfo;
|
import weaver.weilin.zhu.common.util.FieldDetailInfo;
|
||||||
|
@ -27,6 +30,8 @@ import java.util.Map;
|
||||||
* @author bleach
|
* @author bleach
|
||||||
* @version 2023-07-10
|
* @version 2023-07-10
|
||||||
*/
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
public class CommonVoucherUtil {
|
public class CommonVoucherUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,12 +39,19 @@ public class CommonVoucherUtil {
|
||||||
*/
|
*/
|
||||||
private final CommVoucherSqlMapper sqlMapper = Util.getMapper(CommVoucherSqlMapper.class);
|
private final CommVoucherSqlMapper sqlMapper = Util.getMapper(CommVoucherSqlMapper.class);
|
||||||
|
|
||||||
|
private final Logger logger = Util.getLogger();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程基础信息
|
* 流程基础信息
|
||||||
*/
|
*/
|
||||||
private Map<String,Object> workflowBaseMap;
|
private Map<String,Object> workflowBaseMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程主表信息
|
||||||
|
*/
|
||||||
|
private Map<String,Object> mainTableInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前用户
|
* 当前用户
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +77,7 @@ public class CommonVoucherUtil {
|
||||||
* @return 配置信息
|
* @return 配置信息
|
||||||
*/
|
*/
|
||||||
public BaseConfigDao getConfigurationByWorkflowId(String workflowId,String cusParamValue){
|
public BaseConfigDao getConfigurationByWorkflowId(String workflowId,String cusParamValue){
|
||||||
BaseConfigDao dao = new BaseConfigDao();
|
BaseConfigDao dao ;
|
||||||
|
|
||||||
//获取该流程类型对应的所有版本ID
|
//获取该流程类型对应的所有版本ID
|
||||||
String allWorkflowIds = WorkflowVersion.getAllVersionStringByWFIDs(workflowId);
|
String allWorkflowIds = WorkflowVersion.getAllVersionStringByWFIDs(workflowId);
|
||||||
|
@ -79,20 +91,49 @@ public class CommonVoucherUtil {
|
||||||
return dao;
|
return dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据配置生成JSON对象
|
||||||
|
* @return 返回生成JSON对象
|
||||||
|
*/
|
||||||
|
public JSONObject generateJsonObject(Map<String,Object> mainTableInfo){
|
||||||
|
|
||||||
|
if(this.mainTableInfo == null || this.mainTableInfo.size() == 0){
|
||||||
|
this.mainTableInfo = mainTableInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return recursionGenerateJsonObject("",null,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据配置生成JSON对象
|
||||||
|
* @return 返回生成JSON对象
|
||||||
|
*/
|
||||||
|
public StringBuilder generateXML(Map<String,Object> mainTableInfo){
|
||||||
|
|
||||||
|
if(this.mainTableInfo == null || this.mainTableInfo.size() == 0){
|
||||||
|
this.mainTableInfo = mainTableInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return recursionGenerateXML("",null,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归生成JSON对象
|
* 递归生成JSON对象
|
||||||
* @param parentNode 父节点名称
|
* @param parentNode 父节点名称
|
||||||
* @param rs 流程主表数据集
|
|
||||||
* @param rs_detail 流程某个明细表某行数据集
|
* @param rs_detail 流程某个明细表某行数据集
|
||||||
* @param dtIndex 明细序列
|
* @param dtIndex 明细序列
|
||||||
* @param itemDirection 借贷方向
|
* @param itemDirection 借贷方向
|
||||||
* @param rowNum 明细序号
|
* @param rowNum 明细序号
|
||||||
* @return JSON对象
|
* @return JSON对象
|
||||||
*/
|
*/
|
||||||
public JSONObject recursionGenerateJsonObject(String parentNode, RecordSet rs,RecordSet rs_detail, int dtIndex, int itemDirection,int rowNum){
|
public JSONObject recursionGenerateJsonObject(String parentNode, RecordSet rs_detail, int dtIndex, int itemDirection,int rowNum){
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
|
||||||
for(NodeFieldMappingDao nodeFieldMappingDao : nodeFieldMappingDaoList){
|
for(NodeFieldMappingDao nodeFieldMappingDao : nodeFieldMappingDaoList){
|
||||||
|
logger.info("nodeFieldMappingDao:" + nodeFieldMappingDao.toString());
|
||||||
|
|
||||||
//节点名称
|
//节点名称
|
||||||
String _nodeName = nodeFieldMappingDao.getNodeName();
|
String _nodeName = nodeFieldMappingDao.getNodeName();
|
||||||
|
|
||||||
|
@ -109,9 +150,12 @@ public class CommonVoucherUtil {
|
||||||
|
|
||||||
int _nodeType = nodeFieldMappingDao.getNodeType();
|
int _nodeType = nodeFieldMappingDao.getNodeType();
|
||||||
|
|
||||||
|
|
||||||
if(itemDirection > 0){//说明为会计分录
|
if(itemDirection > 0){//说明为会计分录
|
||||||
String _entriesDirection = nodeFieldMappingDao.getEntriesDirection();
|
String _entriesDirection = nodeFieldMappingDao.getEntriesDirection();
|
||||||
|
|
||||||
|
//System.out.println("_entriesDirection:" + _entriesDirection );
|
||||||
|
|
||||||
if(!_entriesDirection.contains(String.valueOf(itemDirection))){//传进来的会计分录方向与当前不一致
|
if(!_entriesDirection.contains(String.valueOf(itemDirection))){//传进来的会计分录方向与当前不一致
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -124,20 +168,29 @@ public class CommonVoucherUtil {
|
||||||
int _viewType = workflowField.getViewType();
|
int _viewType = workflowField.getViewType();
|
||||||
|
|
||||||
int _detailIndex = workflowField.getDetailIndex();
|
int _detailIndex = workflowField.getDetailIndex();
|
||||||
|
|
||||||
|
String _detailTableName = Util.null2String(workflowField.getDetailTable());
|
||||||
|
|
||||||
|
if(_detailIndex == -1 && StringUtils.isNotBlank(_detailTableName)){
|
||||||
|
_detailIndex = Util.getIntValue(_detailTableName.substring(_detailTableName.indexOf("_dt") + 3),-1);
|
||||||
|
}
|
||||||
|
|
||||||
if(_viewType == 1 && _detailIndex != dtIndex){
|
if(_viewType == 1 && _detailIndex != dtIndex){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RuleMethodParam param = new RuleMethodParam();
|
RuleMethodParam param = new RuleMethodParam();
|
||||||
param.setRs(rs);
|
//param.setRs(rs);
|
||||||
param.setRs_detail(rs_detail);
|
param.setRs_detail(rs_detail);
|
||||||
param.setWorkflowBaseMap(workflowBaseMap);
|
param.setWorkflowBaseMap(workflowBaseMap);
|
||||||
param.setRowNum(rowNum);
|
param.setRowNum(rowNum);
|
||||||
param.setThisUser(thisUser);
|
param.setThisUser(thisUser);
|
||||||
|
param.setMainTableInfo(mainTableInfo);
|
||||||
|
|
||||||
switch (_nodeType){
|
switch (_nodeType){
|
||||||
case VoucherConstants.Node_Type_Comm_Text:
|
case VoucherConstants.Node_Type_Comm_Text:
|
||||||
|
|
||||||
String nodeValue = FieldChangeRuleMethod.VALUE_RULE_FUNCTION.get(nodeFieldMappingDao.getChangeRule()).apply(nodeFieldMappingDao, param);
|
String nodeValue = FieldChangeRuleMethod.VALUE_RULE_FUNCTION.get(nodeFieldMappingDao.getChangeRule()).apply(nodeFieldMappingDao, param);
|
||||||
|
|
||||||
if(nodeFieldMappingDao.getSpecialAttr() == 1 && Util.getDoubleValue(nodeValue,0.0) == 0){
|
if(nodeFieldMappingDao.getSpecialAttr() == 1 && Util.getDoubleValue(nodeValue,0.0) == 0){
|
||||||
|
@ -148,7 +201,7 @@ public class CommonVoucherUtil {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case VoucherConstants.Node_Type_Comm_Object:
|
case VoucherConstants.Node_Type_Comm_Object:
|
||||||
JSONObject commObj = recursionGenerateJsonObject(_nodeName,rs,rs_detail,dtIndex,itemDirection,rowNum);
|
JSONObject commObj = recursionGenerateJsonObject(_nodeName,rs_detail,dtIndex,itemDirection,rowNum);
|
||||||
|
|
||||||
jsonObject.put(_nodeName,commObj);
|
jsonObject.put(_nodeName,commObj);
|
||||||
break;
|
break;
|
||||||
|
@ -170,12 +223,13 @@ public class CommonVoucherUtil {
|
||||||
int _rowNum = 1;
|
int _rowNum = 1;
|
||||||
|
|
||||||
for(ObjectMappingDao objectMappingDao : objectMappingDaoList){
|
for(ObjectMappingDao objectMappingDao : objectMappingDaoList){
|
||||||
|
|
||||||
String _objectName = objectMappingDao.getObjectName();
|
String _objectName = objectMappingDao.getObjectName();
|
||||||
|
|
||||||
//别名
|
//别名
|
||||||
String alias = objectMappingDao.getAlias();
|
String alias = objectMappingDao.getAlias();
|
||||||
|
|
||||||
if(!_objectName.equals(_nodeName) || (StringUtils.isNotBlank(alias) && !alias.equals(_nodeName))){//对象节点名称 与当前节点不一致
|
if(!_objectName.equals(_nodeName)){//对象节点名称 与当前节点不一致
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +258,7 @@ public class CommonVoucherUtil {
|
||||||
|
|
||||||
while(_rs_detail.next()){
|
while(_rs_detail.next()){
|
||||||
for(String direction : Util.TokenizerString2(_entriesDirection,",")) {
|
for(String direction : Util.TokenizerString2(_entriesDirection,",")) {
|
||||||
JSONObject itemObj = recursionGenerateJsonObject(tmpParentNode, rs, _rs_detail, _dtIndex, Util.getIntValue(direction), _rowNum++);
|
JSONObject itemObj = recursionGenerateJsonObject(tmpParentNode, _rs_detail, _dtIndex, Util.getIntValue(direction), _rowNum++);
|
||||||
|
|
||||||
if(itemObj == null || itemObj.isEmpty()){
|
if(itemObj == null || itemObj.isEmpty()){
|
||||||
_rowNum--;
|
_rowNum--;
|
||||||
|
@ -215,7 +269,7 @@ public class CommonVoucherUtil {
|
||||||
}
|
}
|
||||||
} else {//说明信息来自主表
|
} else {//说明信息来自主表
|
||||||
for(String direction : Util.TokenizerString2(_entriesDirection,",")){
|
for(String direction : Util.TokenizerString2(_entriesDirection,",")){
|
||||||
JSONObject itemObj = recursionGenerateJsonObject(tmpParentNode,rs,null,0,Util.getIntValue(direction),_rowNum++);
|
JSONObject itemObj = recursionGenerateJsonObject(tmpParentNode,null,0,Util.getIntValue(direction),_rowNum++);
|
||||||
|
|
||||||
if(itemObj == null || itemObj.isEmpty()){
|
if(itemObj == null || itemObj.isEmpty()){
|
||||||
_rowNum--;
|
_rowNum--;
|
||||||
|
@ -235,17 +289,17 @@ public class CommonVoucherUtil {
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归生成XML字符串
|
* 递归生成XML字符串
|
||||||
* @param parentNode 父节点名称
|
* @param parentNode 父节点名称
|
||||||
* @param rs 流程主表数据集
|
|
||||||
* @param rs_detail 流程某个明细表某行数据集
|
* @param rs_detail 流程某个明细表某行数据集
|
||||||
* @param dtIndex 明细序列
|
* @param dtIndex 明细序列
|
||||||
* @param itemDirection 借贷方向
|
* @param itemDirection 借贷方向
|
||||||
* @param rowNum 明细序号
|
* @param rowNum 明细序号
|
||||||
* @return XML字符串
|
* @return XML字符串
|
||||||
*/
|
*/
|
||||||
public StringBuilder recursionGenerateXML(String parentNode, RecordSet rs,RecordSet rs_detail, int dtIndex, int itemDirection,int rowNum){
|
public StringBuilder recursionGenerateXML(String parentNode, RecordSet rs_detail, int dtIndex, int itemDirection,int rowNum){
|
||||||
StringBuilder xmlBuilder = new StringBuilder();
|
StringBuilder xmlBuilder = new StringBuilder();
|
||||||
for(NodeFieldMappingDao nodeFieldMappingDao : nodeFieldMappingDaoList) {
|
for(NodeFieldMappingDao nodeFieldMappingDao : nodeFieldMappingDaoList) {
|
||||||
//节点名称
|
//节点名称
|
||||||
|
@ -279,17 +333,25 @@ public class CommonVoucherUtil {
|
||||||
int _viewType = workflowField.getViewType();
|
int _viewType = workflowField.getViewType();
|
||||||
|
|
||||||
int _detailIndex = workflowField.getDetailIndex();
|
int _detailIndex = workflowField.getDetailIndex();
|
||||||
if (_viewType == 1 && _detailIndex != dtIndex) {
|
|
||||||
|
String _detailTableName = Util.null2String(workflowField.getDetailTable());
|
||||||
|
|
||||||
|
if(_detailIndex == -1 && StringUtils.isNotBlank(_detailTableName)){
|
||||||
|
_detailIndex = Util.getIntValue(_detailTableName.substring(_detailTableName.indexOf("_dt") + 3),-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_viewType == 1 && _detailIndex != dtIndex){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RuleMethodParam param = new RuleMethodParam();
|
RuleMethodParam param = new RuleMethodParam();
|
||||||
param.setRs(rs);
|
//param.setRs(rs);
|
||||||
param.setRs_detail(rs_detail);
|
param.setRs_detail(rs_detail);
|
||||||
param.setWorkflowBaseMap(workflowBaseMap);
|
param.setWorkflowBaseMap(workflowBaseMap);
|
||||||
param.setRowNum(rowNum);
|
param.setRowNum(rowNum);
|
||||||
param.setThisUser(thisUser);
|
param.setThisUser(thisUser);
|
||||||
|
param.setMainTableInfo(mainTableInfo);
|
||||||
|
|
||||||
switch (_nodeType) {
|
switch (_nodeType) {
|
||||||
case VoucherConstants.Node_Type_Comm_Text:
|
case VoucherConstants.Node_Type_Comm_Text:
|
||||||
|
@ -306,7 +368,7 @@ public class CommonVoucherUtil {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VoucherConstants.Node_Type_Comm_Object:
|
case VoucherConstants.Node_Type_Comm_Object:
|
||||||
StringBuilder innerXML = recursionGenerateXML(_nodeName,rs,rs_detail,dtIndex,itemDirection,rowNum);
|
StringBuilder innerXML = recursionGenerateXML(_nodeName,rs_detail,dtIndex,itemDirection,rowNum);
|
||||||
xmlBuilder.append("<").append(_nodeName).append(">");
|
xmlBuilder.append("<").append(_nodeName).append(">");
|
||||||
xmlBuilder.append(innerXML);
|
xmlBuilder.append(innerXML);
|
||||||
xmlBuilder.append("</").append(_nodeName).append(">\n");
|
xmlBuilder.append("</").append(_nodeName).append(">\n");
|
||||||
|
@ -321,7 +383,7 @@ public class CommonVoucherUtil {
|
||||||
//别名
|
//别名
|
||||||
String alias = objectMappingDao.getAlias();
|
String alias = objectMappingDao.getAlias();
|
||||||
|
|
||||||
if (!_objectName.equals(_nodeName) || (StringUtils.isNotBlank(alias) && !alias.equals(_nodeName))) {//对象节点名称 与当前节点不一致
|
if(!_objectName.equals(_nodeName)){//对象节点名称 与当前节点不一致
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +412,7 @@ public class CommonVoucherUtil {
|
||||||
|
|
||||||
while (_rs_detail.next()) {
|
while (_rs_detail.next()) {
|
||||||
for (String direction : Util.TokenizerString2(_entriesDirection, ",")) {
|
for (String direction : Util.TokenizerString2(_entriesDirection, ",")) {
|
||||||
StringBuilder innerItem = recursionGenerateXML(tmpParentNode,rs,_rs_detail,_dtIndex,Util.getIntValue(direction),_rowNum);
|
StringBuilder innerItem = recursionGenerateXML(tmpParentNode,_rs_detail,_dtIndex,Util.getIntValue(direction),_rowNum);
|
||||||
|
|
||||||
if(innerItem != null && innerItem.length() > 0){
|
if(innerItem != null && innerItem.length() > 0){
|
||||||
xmlBuilder.append("<").append(_nodeName).append(">");
|
xmlBuilder.append("<").append(_nodeName).append(">");
|
||||||
|
@ -363,7 +425,7 @@ public class CommonVoucherUtil {
|
||||||
}
|
}
|
||||||
} else { //说明数据来自主表
|
} else { //说明数据来自主表
|
||||||
for(String direction : Util.TokenizerString2(_entriesDirection,",")){
|
for(String direction : Util.TokenizerString2(_entriesDirection,",")){
|
||||||
StringBuilder innerItem = recursionGenerateXML(tmpParentNode,rs,null,0,Util.getIntValue(direction),_rowNum++);
|
StringBuilder innerItem = recursionGenerateXML(tmpParentNode,null,0,Util.getIntValue(direction),_rowNum++);
|
||||||
|
|
||||||
if(innerItem != null && innerItem.length() > 0){
|
if(innerItem != null && innerItem.length() > 0){
|
||||||
xmlBuilder.append("<").append(_nodeName).append(">");
|
xmlBuilder.append("<").append(_nodeName).append(">");
|
||||||
|
@ -381,36 +443,4 @@ public class CommonVoucherUtil {
|
||||||
}
|
}
|
||||||
return xmlBuilder;
|
return xmlBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getThisUser() {
|
|
||||||
return thisUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setThisUser(User thisUser) {
|
|
||||||
this.thisUser = thisUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getWorkflowBaseMap() {
|
|
||||||
return workflowBaseMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWorkflowBaseMap(Map<String, Object> workflowBaseMap) {
|
|
||||||
this.workflowBaseMap = workflowBaseMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ObjectMappingDao> getObjectMappingDaoList() {
|
|
||||||
return objectMappingDaoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setObjectMappingDaoList(List<ObjectMappingDao> objectMappingDaoList) {
|
|
||||||
this.objectMappingDaoList = objectMappingDaoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NodeFieldMappingDao> getNodeFieldMappingDaoList() {
|
|
||||||
return nodeFieldMappingDaoList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeFieldMappingDaoList(List<NodeFieldMappingDao> nodeFieldMappingDaoList) {
|
|
||||||
this.nodeFieldMappingDaoList = nodeFieldMappingDaoList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package weaver.weilin.zhu.xyzq.scheduled.sqlmapper;
|
package weaver.weilin.zhu.xyzq.scheduled.sqlmapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.*;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
import weaver.weilin.zhu.common.util.FieldDetailInfo;
|
||||||
import weaver.weilin.zhu.xyzq.scheduled.entity.SyncConfigDao;
|
import weaver.weilin.zhu.xyzq.scheduled.entity.SyncConfigDao;
|
||||||
import weaver.weilin.zhu.xyzq.scheduled.entity.SyncConfigDetailDao;
|
import weaver.weilin.zhu.xyzq.scheduled.entity.SyncConfigDetailDao;
|
||||||
|
|
||||||
|
@ -32,8 +33,7 @@ public interface OrganizationSyncSqlMapper {
|
||||||
@Association(
|
@Association(
|
||||||
property = "foreignKeyField",
|
property = "foreignKeyField",
|
||||||
column = "foreignKeyField",
|
column = "foreignKeyField",
|
||||||
select = "weaver.common.util.CommonUtil.getFieldInfo",
|
id = @Id(value = Integer.class,methodId = 2)
|
||||||
id = @Id(Integer.class)
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
SyncConfigDao getConfigurationByKeyId(@ParamMapper("keyId") int keyId);
|
SyncConfigDao getConfigurationByKeyId(@ParamMapper("keyId") int keyId);
|
||||||
|
@ -48,13 +48,23 @@ public interface OrganizationSyncSqlMapper {
|
||||||
@Association(
|
@Association(
|
||||||
property = "modeField",
|
property = "modeField",
|
||||||
column = "modeField",
|
column = "modeField",
|
||||||
select = "weaver.weilin.zhu.common.util.CommonUtil.getFieldDetailInfo",
|
id = @Id(value = Integer.class,methodId = 2)
|
||||||
id = @Id(Integer.class)
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@CollectionMethod(value = 1,desc = "获取详细的字段配置信息")
|
@CollectionMethod(value = 1,desc = "获取详细的字段配置信息")
|
||||||
List<SyncConfigDetailDao> getConfigurationDetailByMainKeyId(@ParamMapper("mainId") int mainId);
|
List<SyncConfigDetailDao> getConfigurationDetailByMainKeyId(@ParamMapper("mainId") int mainId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字段信息
|
||||||
|
* @param fieldId 字段ID
|
||||||
|
* @return 字段信息
|
||||||
|
*/
|
||||||
|
@Select("select id,fieldName,viewType,detailTable,fieldDbType from workflow_billField where id = #{fieldId}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
|
@AssociationMethod(value = 2,desc = "获取字段详细信息")
|
||||||
|
FieldDetailInfo getFieldDetailInfo(@ParamMapper("fieldId") int fieldId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前模块中已存在记录集合
|
* 获取当前模块中已存在记录集合
|
||||||
* @param foreignKeyFieldName 外键字段名称
|
* @param foreignKeyFieldName 外键字段名称
|
||||||
|
|
|
@ -38,23 +38,23 @@ 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" +
|
||||||
"\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