MDM公用文件
This commit is contained in:
parent
197c7620c5
commit
a51412fa0e
|
@ -48,6 +48,25 @@ public class ComparisonEntity extends BaseEntity {
|
|||
private String ruleCode;//规则编码required 判断字段是否是必填
|
||||
private String ruleValue;//规则值 true/false 判断字段是否是必填
|
||||
private String filedId;//mdm_module_db_fileds_rule的id
|
||||
//小写字段
|
||||
private List<String> fields;
|
||||
private List<String> returnField;
|
||||
|
||||
public List<String> getReturnField() {
|
||||
return returnField;
|
||||
}
|
||||
|
||||
public void setReturnField(List<String> returnField) {
|
||||
this.returnField = returnField;
|
||||
}
|
||||
|
||||
public List<String> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setFields(List<String> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
public String getFiledId() {
|
||||
return filedId;
|
||||
|
|
|
@ -16,7 +16,23 @@
|
|||
<!--分页查询数据-->
|
||||
<select id="queryComparisonPage" resultType="java.util.Map"
|
||||
parameterType = "java.util.Map">
|
||||
select * from ${dbName}
|
||||
select
|
||||
|
||||
<if test="returnField != null and returnField.size>0">
|
||||
<trim suffixOverrides=",">
|
||||
<foreach collection="returnField" item="returnField">
|
||||
a.${returnField} as ${returnField} ,
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
<if test="returnField == null or returnField.size == 0">
|
||||
|
||||
<foreach item="field" collection="fields" separator="," >
|
||||
a.${field}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
from ${dbName} a
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<foreach collection="map.entrySet()" item="value" index="key">
|
||||
and ${key} like concat('%',#{value},'%')
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
|
||||
@Override
|
||||
public JsonResultEntity queryArchives(JSONObject json){
|
||||
logger.info("第一次入参"+String.valueOf(json));
|
||||
// logger.info("第一次入参"+String.valueOf(json));
|
||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||
//查询主数据来源表,根据来源类型为插件得进行分类,获取来源名称和编码
|
||||
List<MdmModuleSourceEntity> list = mdmModuleSourceDaoImpl.MdmModuleSourceentityGroupByType();
|
||||
|
@ -70,9 +70,12 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
String dbCode = mdmModuleSourceEntity.getDbCode();
|
||||
String mdmCode = mdmModuleSourceEntity.getMdmCode();
|
||||
List<JSONObject> listAll = new ArrayList<>();
|
||||
if(!"10003".equals(mdmCode)){
|
||||
if("10007".equals(mdmCode)){
|
||||
continue;
|
||||
}
|
||||
// if(!"10003".equals(mdmCode)){
|
||||
// continue;
|
||||
// }
|
||||
switch (appTyp) {//1、致远OA 2、用友U8C 3、用友BIP
|
||||
case "1":
|
||||
//通过主数据编码判断,不同的接口走不通的查询逻辑
|
||||
|
@ -150,7 +153,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
sb.append(" and a.modify_date < '"+endTime+"'");
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("SELECT id as data_id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0177 a WHERE 1=1 " );
|
||||
stringBuffer.append("SELECT id as data_id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0177 a WHERE 1=1 " +sb.toString());
|
||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
|
@ -198,8 +201,8 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select a.id as data_id, a.name as user_name, a.code AS user_code,e.LOGIN_NAME as login_name,CASE WHEN EXT_ATTR_11 = '1' \n" +
|
||||
"THEN '男' WHEN EXT_ATTR_11 = '2' THEN '女' ELSE NULL END AS gender,CASE WHEN (a.EXT_ATTR_1 IS NULL OR a.EXT_ATTR_1 ='') THEN '11111111111' ELSE a.EXT_ATTR_1 END AS mobile FROM org_member a left join org_principal e on a.id = e.MEMBER_ID\n" +
|
||||
// " WHERE 1=1 and e.LOGIN_NAME IS not null " + sb.toString());
|
||||
" WHERE 1=1 and a.id = '-2698997042624247722'");
|
||||
" WHERE 1=1 and e.LOGIN_NAME IS not null " + sb.toString());
|
||||
// " WHERE 1=1 and a.id = '-2698997042624247722'");
|
||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||
int i = 0;
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
|
||||
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
|
||||
|
@ -36,6 +37,8 @@ import java.util.stream.Collectors;
|
|||
public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String> implements IComparisonService {
|
||||
|
||||
private IComparisonDao comparisonDao;
|
||||
@Autowired
|
||||
private IMdmModuleDao mdmModuleDao;
|
||||
|
||||
@Autowired
|
||||
private IComparisonDetailsDao comparisonDetailsDao;
|
||||
|
@ -96,6 +99,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparisonEntity.setMap(map);
|
||||
try {
|
||||
List<JSONObject> list=new ArrayList<>();
|
||||
//查询所有列
|
||||
List<String> fields = getFields(comparisonEntity);
|
||||
comparisonEntity.setFields(fields);
|
||||
//查询主表数据
|
||||
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparisonEntity);
|
||||
if(CollectionUtils.isNotEmpty(comparisonEntitiePages)){
|
||||
|
@ -399,13 +405,15 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
List<List<Map<String,Object>>> mapDetails=new ArrayList<>();//将子表数据存到map中
|
||||
if(comparisonEntities !=null && comparisonEntities.size()>0) {
|
||||
map=spliceMainMap(comparisonEntities,jsonObjectMain,map,comparisonEntity,comparisonDetailsEntity);
|
||||
|
||||
//查询所有列
|
||||
List<String> fields = getFields(comparisonEntity);
|
||||
//根据data_id查询id.根据id更新主表数据,然后再根据主表id和明细表的data_id,删除明细表数据
|
||||
Map<String,Object> mapId=new HashMap<>();
|
||||
mapId.put("data_id",jsonObjectMain.getString("data_id"));
|
||||
ComparisonEntity comparison=new ComparisonEntity();
|
||||
comparison.setDbName(comparisonEntity.getDbName());
|
||||
comparison.setMap(mapId);
|
||||
comparison.setFields(fields);
|
||||
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||
return BaseResult.getFailureMessageEntity("根据data_id查询id数据为空,请检查data_id");
|
||||
|
@ -469,6 +477,12 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
return BaseResult.getFailureMessageEntity("查询失败","请检查传递参数");
|
||||
}
|
||||
|
||||
private List<String> getFields(ComparisonEntity comparisonEntity) {
|
||||
HashMap<String, Object> maps = new HashMap<>();
|
||||
maps.put("tableName",comparisonEntity.getDbName());
|
||||
return mdmModuleDao.queryMdMFields(maps);
|
||||
}
|
||||
|
||||
//删除通用数据
|
||||
@Override
|
||||
public JsonResultEntity deleteEntity(JSONObject json) {
|
||||
|
@ -530,13 +544,15 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//查询所有列
|
||||
List<String> fields = getFields(comparisonEntity);
|
||||
//根据data_id查询主表id.根据id删除主表数据,然后再根据主表id和明细表data_id删除明细表数据
|
||||
Map<String,Object> mapId=new HashMap<>();
|
||||
mapId.put("data_id",jsonObjectMain.getString("data_id"));
|
||||
ComparisonEntity comparison=new ComparisonEntity();
|
||||
comparison.setDbName(comparisonEntity.getDbName());
|
||||
comparison.setMap(mapId);
|
||||
comparison.setFields(fields);
|
||||
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||
return BaseResult.getFailureMessageEntity("根据data_id查询id数据为空,请检查data_id");
|
||||
|
|
Loading…
Reference in New Issue