主数据修改

This commit is contained in:
lvleigang 2024-06-20 16:30:37 +08:00
parent 2adb827e0d
commit 353dd95a60
16 changed files with 734 additions and 291 deletions

View File

@ -469,21 +469,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
} }
if(mdmModuleDistributeEntities.get(i1).getDeleteApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getDeleteApi())){ if(mdmModuleDistributeEntities.get(i1).getDeleteApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getDeleteApi())){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3"); saveMdmModuleSendLogEntity("2","删除接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3");
} }
return ; return ;
} }
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getDeleteApi()); SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getDeleteApi());
if(apiEntity == null || apiEntity.getId() == null ){ if(apiEntity == null || apiEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3"); saveMdmModuleSendLogEntity("2","删除接口未找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"3");
} }
return ; return ;
} }
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); saveMdmModuleSendLogEntity("2","删除接口的应用未找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
} }
return ; return ;
} }
@ -493,7 +493,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getDeleteScript()); scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getDeleteScript());
if(scriptEntity == null || scriptEntity.getId() == null ){ if(scriptEntity == null || scriptEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); saveMdmModuleSendLogEntity("2","删除接口脚本未找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
} }
return ; return ;
} }
@ -539,7 +539,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getQuerys(); querys = jsonResultEntity.getQuerys();
bodys = jsonResultEntity.getBodys(); bodys = jsonResultEntity.getBodys();
}catch (Exception e){ }catch (Exception e){
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
continue; continue;
} }
} }
@ -555,11 +555,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){ if(jsonResultEntity.isFlag()){
//保存日志 //保存日志
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); saveMdmModuleSendLogEntity("1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
continue; continue;
}else { }else {
//保存日志 //保存日志
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
continue; continue;
} }
} }
@ -618,21 +618,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
} }
if(mdmModuleDistributeEntities.get(i1).getUpdateApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getUpdateApi())){ if(mdmModuleDistributeEntities.get(i1).getUpdateApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getUpdateApi())){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2"); saveMdmModuleSendLogEntity("2","修改接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2");
} }
return ; return ;
} }
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getUpdateApi()); SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getUpdateApi());
if(apiEntity == null || apiEntity.getId() == null ){ if(apiEntity == null || apiEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2"); saveMdmModuleSendLogEntity("2","修改接口未查找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"2");
} }
return ; return ;
} }
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); saveMdmModuleSendLogEntity("2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
} }
return ; return ;
} }
@ -642,7 +642,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getUpdateScript()); scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getUpdateScript());
if(scriptEntity == null || scriptEntity.getId() == null ){ if(scriptEntity == null || scriptEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); saveMdmModuleSendLogEntity("2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
} }
return ; return ;
} }
@ -679,7 +679,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getQuerys(); querys = jsonResultEntity.getQuerys();
bodys = jsonResultEntity.getBodys(); bodys = jsonResultEntity.getBodys();
}catch (Exception e){ }catch (Exception e){
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
continue; continue;
} }
} }
@ -695,11 +695,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){ if(jsonResultEntity.isFlag()){
//保存日志 //保存日志
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); saveMdmModuleSendLogEntity("1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
continue; continue;
}else { }else {
//保存日志 //保存日志
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
continue; continue;
} }
} }
@ -765,21 +765,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
} }
if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){ if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1"); saveMdmModuleSendLogEntity("2","新增接口未设置",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1");
} }
return ; return ;
} }
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getAddApi()); SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getAddApi());
if(apiEntity == null || apiEntity.getId() == null ){ if(apiEntity == null || apiEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1"); saveMdmModuleSendLogEntity("2","新增接口未查找到",mainDb,objects.get(i).getString("id"),null,null,doObjects.get(i).toJSONString(),"1");
} }
return ; return ;
} }
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); saveMdmModuleSendLogEntity("2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
} }
return ; return ;
} }
@ -789,7 +789,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript()); scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript());
if(scriptEntity == null || scriptEntity.getId() == null ){ if(scriptEntity == null || scriptEntity.getId() == null ){
for (int i = 0; i < doObjects.size(); i++) { for (int i = 0; i < doObjects.size(); i++) {
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); saveMdmModuleSendLogEntity("2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
} }
return ; return ;
} }
@ -835,7 +835,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getQuerys(); querys = jsonResultEntity.getQuerys();
bodys = jsonResultEntity.getBodys(); bodys = jsonResultEntity.getBodys();
}catch (Exception e){ }catch (Exception e){
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
continue; continue;
} }
} }
@ -851,11 +851,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys); JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){ if(jsonResultEntity.isFlag()){
//保存日志 //保存日志
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); saveMdmModuleSendLogEntity("1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
continue; continue;
}else { }else {
//保存日志 //保存日志
saveMdmModuleSendLogEntity(objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
continue; continue;
} }
} }
@ -877,8 +877,9 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
} }
} }
private void saveMdmModuleSendLogEntity(String formmain_id,String target_app,String target_api,String source_data, String option_type) { private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
mdmModuleSendLogEntity.setCreate(); mdmModuleSendLogEntity.setCreate();
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID()); mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
mdmModuleSendLogEntity.setSts("Y"); mdmModuleSendLogEntity.setSts("Y");
@ -893,6 +894,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
mdmModuleSendLogEntity.setTargetApi(target_api); mdmModuleSendLogEntity.setTargetApi(target_api);
mdmModuleSendLogEntity.setSourceData(source_data); mdmModuleSendLogEntity.setSourceData(source_data);
mdmModuleSendLogEntity.setOptionType(option_type); mdmModuleSendLogEntity.setOptionType(option_type);
mdmModuleSendLogEntity.setDataType(dataType);
mdmModuleSendLogEntity.setRemark(remark);
mdmModuleSendLogDao.save(mdmModuleSendLogEntity); mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
} }

View File

@ -54,8 +54,8 @@ public class temButtom {
public void test01() { public void test01() {
String a = AESUtil.encrypt("hzya@1314"); String a = AESUtil.encrypt("hzya@1314");
System.out.println(a); System.out.println(a);
String b = AESUtil.decrypt("62e4295b615a30dbf3b8ee96f41c820b");
//String sa= "{\n \\"status\\": \\"success\\",\n \\"data\\": \\"[{\\\\"pk_corp\\\\":\\\\"1001\\\\",\\\\"unitcode\\\\":\\\\"01\\\\",\\\\"unitname\\\\":\\\\"临安奥星电子股份有限公司\\\\",\\\\"createdate\\\\":\\\\"2024-04-24\\\\",\\\\"deptattr\\\\":\\\\"1\\\\",\\\\"deptname\\\\":\\\\"DEV测试一级部门\\\\",\\\\"deptcode\\\\":\\\\"99\\\\",\\\\"pk_deptdoc\\\\":\\\\"1001F1100000000067AS\\\\"}]\\",\n \\"taskNumber\\": \\"202404250041\\"\n}"; System.out.println(b);
} }

View File

@ -554,7 +554,7 @@ where id = #{id}
${item.getValueByType('a.')} ${item.getValueByType('a.')}
</foreach> </foreach>
</if> </if>
and a.sts='Y' and a.sts='Y' and a.data_status != 'N'
<if test="detailQueryCondition != null and detailQueryCondition.size>0"> <if test="detailQueryCondition != null and detailQueryCondition.size>0">
<foreach collection="detailQueryCondition" item="item" index="index"> <foreach collection="detailQueryCondition" item="item" index="index">
AND a.id IN ( AND a.id IN (
@ -594,7 +594,7 @@ where id = #{id}
</trim> </trim>
) )
</if> </if>
and sts = 'Y' and sts = 'Y' and data_status != 'N'
</trim> </trim>
order by sorts asc order by sorts asc
</select> </select>
@ -608,7 +608,7 @@ where id = #{id}
from ${tableName} from ${tableName}
<trim prefix="where" prefixOverrides="and"> <trim prefix="where" prefixOverrides="and">
<if test="id != null and id !='' ">and id = #{id}</if> <if test="id != null and id !='' ">and id = #{id}</if>
and sts = 'Y' and sts = 'Y' and data_status != 'N'
</trim> </trim>
order by sorts asc order by sorts asc
</select> </select>
@ -620,7 +620,7 @@ where id = #{id}
${label}, ${label},
${upId} ${upId}
from ${tableName} from ${tableName}
where sts = 'Y' where sts = 'Y' and data_status != 'N'
order by sorts asc order by sorts asc
</select> </select>
<!-- 查询符合条件的数量 --> <!-- 查询符合条件的数量 -->

View File

@ -388,4 +388,13 @@ public interface IMdmModuleService extends IBaseService<MdmModuleEntity, String>
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
**/ **/
JsonResultEntity queryMdmMainDBField(JSONObject jsonObject); JsonResultEntity queryMdmMainDBField(JSONObject jsonObject);
/**
* @Author lvleigang
* @Description 主数据-分发设置-列表获取
* @Date 11:43 上午 2024/6/11
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity queryMdmDistributeByMdmCode(JSONObject jsonObject);
} }

View File

@ -311,6 +311,7 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
} }
entity.setCreate(); entity.setCreate();
mdmModuleDao.save(entity); mdmModuleDao.save(entity);
entity = mdmModuleDao.get(entity.getId());
return BaseResult.getSuccessMessageEntity("保存成功",entity); return BaseResult.getSuccessMessageEntity("保存成功",entity);
} }
@ -631,11 +632,28 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
data_type.setQueryType("1"); data_type.setQueryType("1");
data_type.setListType("1"); data_type.setListType("1");
data_type.setViewType("1"); data_type.setViewType("1");
data_type.setFiledLength("255"); data_type.setFiledLength("50");
data_type.setCreate(); data_type.setCreate();
data_type.setDataType("1"); data_type.setDataType("1");
mdmModuleDbFiledsEntities.add(data_type); mdmModuleDbFiledsEntities.add(data_type);
MdmModuleDbFiledsEntity remark = new MdmModuleDbFiledsEntity();
remark.setMdmId(entity.getMdmId());
remark.setDbId(entity.getId());
remark.setEnName("remark");
remark.setChName("备注");
remark.setFiledType("3");
remark.setAddType("1");
remark.setUpdateType("1");
remark.setShowType("1");
remark.setQueryType("1");
remark.setListType("1");
remark.setViewType("1");
remark.setFiledLength("255");
remark.setCreate();
remark.setDataType("1");
mdmModuleDbFiledsEntities.add(remark);
MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity(); MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity();
code.setMdmId(entity.getMdmId()); code.setMdmId(entity.getMdmId());
code.setDbId(entity.getId()); code.setDbId(entity.getId());
@ -774,6 +792,40 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
option_type.setCreate(); option_type.setCreate();
option_type.setDataType("1"); option_type.setDataType("1");
mdmModuleDbFiledsEntities.add(option_type); mdmModuleDbFiledsEntities.add(option_type);
MdmModuleDbFiledsEntity data_type = new MdmModuleDbFiledsEntity();
data_type.setMdmId(entity.getMdmId());
data_type.setDbId(entity.getId());
data_type.setEnName("data_type");
data_type.setChName("状态");
data_type.setFiledType("3");
data_type.setAddType("1");
data_type.setUpdateType("1");
data_type.setShowType("1");
data_type.setQueryType("1");
data_type.setListType("1");
data_type.setViewType("1");
data_type.setFiledLength("255");
data_type.setCreate();
data_type.setDataType("1");
mdmModuleDbFiledsEntities.add(data_type);
MdmModuleDbFiledsEntity remark = new MdmModuleDbFiledsEntity();
remark.setMdmId(entity.getMdmId());
remark.setDbId(entity.getId());
remark.setEnName("remark");
remark.setChName("备注");
remark.setFiledType("3");
remark.setAddType("1");
remark.setUpdateType("1");
remark.setShowType("1");
remark.setQueryType("1");
remark.setListType("1");
remark.setViewType("1");
remark.setFiledLength("255");
remark.setCreate();
remark.setDataType("1");
mdmModuleDbFiledsEntities.add(remark);
} }
if ("2".equals(entity.getDbType()) || "1".equals(entity.getDbType())) { if ("2".equals(entity.getDbType()) || "1".equals(entity.getDbType())) {
MdmModuleDbFiledsEntity data_status = new MdmModuleDbFiledsEntity(); MdmModuleDbFiledsEntity data_status = new MdmModuleDbFiledsEntity();
@ -786,8 +838,8 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
data_status.setUpdateType("2"); data_status.setUpdateType("2");
data_status.setShowType("2"); data_status.setShowType("2");
data_status.setQueryType("2"); data_status.setQueryType("2");
data_status.setListType("1"); data_status.setListType("2");
data_status.setViewType("1"); data_status.setViewType("2");
data_status.setFiledLength("1"); data_status.setFiledLength("1");
data_status.setCreate(); data_status.setCreate();
data_status.setDataType("1"); data_status.setDataType("1");
@ -2616,4 +2668,27 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
} }
return BaseResult.getSuccessMessageEntity("查询数据成功", list); return BaseResult.getSuccessMessageEntity("查询数据成功", list);
} }
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 主数据-分发设置-列表获取
* @Date 11:43 上午 2024/6/11
**/
@Override
public JsonResultEntity queryMdmDistributeByMdmCode(JSONObject object) {
MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class);
if (entity == null) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
entity.setMdmId(mdmModuleEntity.getId());
List<MdmModuleDistributeEntity> list = mdmModuleDistributeDao.queryBase(entity);
return BaseResult.getSuccessMessageEntity("获取分发设置成功", list);
}
} }

View File

@ -11,5 +11,6 @@ import com.hzya.frame.basedao.dao.IBaseDao;
*/ */
public interface IMdmModuleDistributeDao extends IBaseDao<MdmModuleDistributeEntity, String> { public interface IMdmModuleDistributeDao extends IBaseDao<MdmModuleDistributeEntity, String> {
Integer queryCountUse(MdmModuleDistributeEntity mdmModuleDistributeEntity);
} }

View File

@ -4,6 +4,9 @@ import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity;
import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.basedao.dao.MybatisGenericDao;
import java.util.HashMap;
/** /**
* 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层 * 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层
* *
@ -13,5 +16,10 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
@Repository(value = "MdmModuleDistributeDaoImpl") @Repository(value = "MdmModuleDistributeDaoImpl")
public class MdmModuleDistributeDaoImpl extends MybatisGenericDao<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeDao{ public class MdmModuleDistributeDaoImpl extends MybatisGenericDao<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeDao{
@Override
public Integer queryCountUse(MdmModuleDistributeEntity mdmModuleDistributeEntity) {
Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryCountUse", mdmModuleDistributeEntity);
return o;
}
} }

View File

@ -17,6 +17,8 @@ public class MdmModuleDistributeEntity extends BaseEntity {
private String mdmId; private String mdmId;
/** 应用id */ /** 应用id */
private String appId; private String appId;
/** 应用id */
private Long mdmCode;
/** 触发类型 0、手动1、自动 */ /** 触发类型 0、手动1、自动 */
private String enabledType; private String enabledType;
/** 修改接口 */ /** 修改接口 */
@ -40,6 +42,13 @@ public class MdmModuleDistributeEntity extends BaseEntity {
/** 公司id */ /** 公司id */
private List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities; private List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities;
public Long getMdmCode() {
return mdmCode;
}
public void setMdmCode(Long mdmCode) {
this.mdmCode = mdmCode;
}
public String getMdmId() { public String getMdmId() {
return mdmId; return mdmId;
@ -144,5 +153,7 @@ public class MdmModuleDistributeEntity extends BaseEntity {
public void setMdmModuleDistributeDetailEntities(List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities) { public void setMdmModuleDistributeDetailEntities(List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities) {
this.mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailEntities; this.mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailEntities;
} }
} }

View File

@ -324,6 +324,16 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_
<delete id="entity_delete"> <delete id="entity_delete">
delete from mdm_module_distribute where id = #{id} delete from mdm_module_distribute where id = #{id}
</delete> </delete>
<!-- 查询符合条件的数量 -->
<select id="queryCountUse" resultType="Integer" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity">
select count(1) from mdm_module_distribute
where sts='Y' and (
<trim prefixOverrides="or" >
<if test="updateScript != null and updateScript != ''"> or update_script = #{updateScript} </if>
<if test="addScript != null and addScript != ''"> or add_script = #{addScript} </if>
<if test="deleteScript != null and deleteScript != ''"> or delete_script = #{deleteScript} </if>
</trim>
)
</select>
</mapper> </mapper>

View File

@ -19,6 +19,8 @@ public class MdmModuleOptionLogEntity extends BaseEntity {
private String sourceName; private String sourceName;
/** 状态 1、成功2、失败 */ /** 状态 1、成功2、失败 */
private String dataType; private String dataType;
/** 备注 */
private String remark;
/** 编码 */ /** 编码 */
private String code; private String code;
/** source_data */ /** source_data */
@ -30,6 +32,15 @@ public class MdmModuleOptionLogEntity extends BaseEntity {
/** 公司id */ /** 公司id */
private String companyId; private String companyId;
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getDataType() { public String getDataType() {
return dataType; return dataType;
} }

View File

@ -8,6 +8,7 @@
<result property="sourceName" column="source_name" jdbcType="VARCHAR"/> <result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
<result property="dataType" column="data_type" jdbcType="VARCHAR"/> <result property="dataType" column="data_type" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/> <result property="code" column="code" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="sourceData" column="source_data" jdbcType="VARCHAR"/> <result property="sourceData" column="source_data" jdbcType="VARCHAR"/>
<result property="optionType" column="option_type" jdbcType="VARCHAR"/> <result property="optionType" column="option_type" jdbcType="VARCHAR"/>
<result property="optionName" column="option_name" jdbcType="VARCHAR"/> <result property="optionName" column="option_name" jdbcType="VARCHAR"/>
@ -27,6 +28,7 @@
,source_name ,source_name
,data_type ,data_type
,code ,code
,remark
,source_data ,source_data
,option_type ,option_type
,option_name ,option_name
@ -55,6 +57,7 @@
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if> <if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if> <if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="code != null and code != ''"> and code = #{code} </if> <if test="code != null and code != ''"> and code = #{code} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="optionName != null and optionName != ''"> and option_name = #{optionName} </if> <if test="optionName != null and optionName != ''"> and option_name = #{optionName} </if>
@ -81,6 +84,7 @@
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if> <if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if> <if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="code != null and code != ''"> and code = #{code} </if> <if test="code != null and code != ''"> and code = #{code} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="optionName != null and optionName != ''"> and option_name = #{optionName} </if> <if test="optionName != null and optionName != ''"> and option_name = #{optionName} </if>
@ -109,6 +113,7 @@
<if test="sourceName != null and sourceName != ''"> and source_name like concat('%',#{sourceName},'%') </if> <if test="sourceName != null and sourceName != ''"> and source_name like concat('%',#{sourceName},'%') </if>
<if test="dataType != null and dataType != ''"> and data_type like concat('%',#{dataType},'%') </if> <if test="dataType != null and dataType != ''"> and data_type like concat('%',#{dataType},'%') </if>
<if test="code != null and code != ''"> and code like concat('%',#{code},'%') </if> <if test="code != null and code != ''"> and code like concat('%',#{code},'%') </if>
<if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </if>
<if test="sourceData != null and sourceData != ''"> and source_data like concat('%',#{sourceData},'%') </if> <if test="sourceData != null and sourceData != ''"> and source_data like concat('%',#{sourceData},'%') </if>
<if test="optionType != null and optionType != ''"> and option_type like concat('%',#{optionType},'%') </if> <if test="optionType != null and optionType != ''"> and option_type like concat('%',#{optionType},'%') </if>
<if test="optionName != null and optionName != ''"> and option_name like concat('%',#{optionName},'%') </if> <if test="optionName != null and optionName != ''"> and option_name like concat('%',#{optionName},'%') </if>
@ -122,7 +127,7 @@
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if> <if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
and sts='Y' and sts='Y'
</trim> </trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> <if test=" sort == null or sort == ''.toString() "> order by sorts desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select> </select>
@ -137,6 +142,7 @@
<if test="sourceName != null and sourceName != ''"> or source_name = #{sourceName} </if> <if test="sourceName != null and sourceName != ''"> or source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> or data_type = #{dataType} </if> <if test="dataType != null and dataType != ''"> or data_type = #{dataType} </if>
<if test="code != null and code != ''"> or code = #{code} </if> <if test="code != null and code != ''"> or code = #{code} </if>
<if test="remark != null and remark != ''"> or remark = #{remark} </if>
<if test="sourceData != null and sourceData != ''"> or source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> or source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> or option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> or option_type = #{optionType} </if>
<if test="optionName != null and optionName != ''"> or option_name = #{optionName} </if> <if test="optionName != null and optionName != ''"> or option_name = #{optionName} </if>
@ -163,6 +169,7 @@
<if test="sourceName != null and sourceName != ''"> source_name , </if> <if test="sourceName != null and sourceName != ''"> source_name , </if>
<if test="dataType != null and dataType != ''"> data_type , </if> <if test="dataType != null and dataType != ''"> data_type , </if>
<if test="code != null and code != ''"> code , </if> <if test="code != null and code != ''"> code , </if>
<if test="remark != null and remark != ''"> remark , </if>
<if test="sourceData != null and sourceData != ''"> source_data , </if> <if test="sourceData != null and sourceData != ''"> source_data , </if>
<if test="optionType != null and optionType != ''"> option_type , </if> <if test="optionType != null and optionType != ''"> option_type , </if>
<if test="optionName != null and optionName != ''"> option_name , </if> <if test="optionName != null and optionName != ''"> option_name , </if>
@ -183,6 +190,7 @@
<if test="sourceName != null and sourceName != ''"> #{sourceName} ,</if> <if test="sourceName != null and sourceName != ''"> #{sourceName} ,</if>
<if test="dataType != null and dataType != ''"> #{dataType} ,</if> <if test="dataType != null and dataType != ''"> #{dataType} ,</if>
<if test="code != null and code != ''"> #{code} ,</if> <if test="code != null and code != ''"> #{code} ,</if>
<if test="remark != null and remark != ''"> #{remark} ,</if>
<if test="sourceData != null and sourceData != ''"> #{sourceData} ,</if> <if test="sourceData != null and sourceData != ''"> #{sourceData} ,</if>
<if test="optionType != null and optionType != ''"> #{optionType} ,</if> <if test="optionType != null and optionType != ''"> #{optionType} ,</if>
<if test="optionName != null and optionName != ''"> #{optionName} ,</if> <if test="optionName != null and optionName != ''"> #{optionName} ,</if>
@ -200,24 +208,25 @@
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="entityInsertBatch" > <insert id="entityInsertBatch" >
insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) insert into ${tableName}(formmain_id, source_name,data_type, code,remark, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.remark},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach> </foreach>
</insert> </insert>
<!-- 批量新增或者修改--> <!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" > <insert id="entityInsertOrUpdateBatch" >
insert into ${tableName}(formmain_id, source_name,data_type, code, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) insert into ${tableName}(formmain_id, source_name,data_type, code, remark, source_data, option_type, option_name, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) (#{entity.formmainId},#{entity.sourceName},#{entity.dataType},#{entity.code},#{entity.remark},#{entity.sourceData},#{entity.optionType},#{entity.optionName},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
</foreach> </foreach>
on duplicate key update on duplicate key update
formmain_id = values(formmain_id), formmain_id = values(formmain_id),
source_name = values(source_name), source_name = values(source_name),
data_type = values(data_type), data_type = values(data_type),
code = values(code), code = values(code),
remark = values(remark),
source_data = values(source_data), source_data = values(source_data),
option_type = values(option_type), option_type = values(option_type),
option_name = values(option_name), option_name = values(option_name),
@ -236,6 +245,7 @@ update ${tableName} set
<if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if> <if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if>
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</if> <if test="dataType != null and dataType != ''"> data_type = #{dataType},</if>
<if test="code != null and code != ''"> code = #{code},</if> <if test="code != null and code != ''"> code = #{code},</if>
<if test="remark != null and remark != ''"> remark = #{remark},</if>
<if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if> <if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if>
<if test="optionType != null and optionType != ''"> option_type = #{optionType},</if> <if test="optionType != null and optionType != ''"> option_type = #{optionType},</if>
<if test="optionName != null and optionName != ''"> option_name = #{optionName},</if> <if test="optionName != null and optionName != ''"> option_name = #{optionName},</if>
@ -263,6 +273,7 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id =
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if> <if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if> <if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="code != null and code != ''"> and code = #{code} </if> <if test="code != null and code != ''"> and code = #{code} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="optionName != null and optionName != ''"> and option_name = #{optionName} </if> <if test="optionName != null and optionName != ''"> and option_name = #{optionName} </if>

View File

@ -21,11 +21,30 @@ public class MdmModuleSendLogEntity extends BaseEntity {
private String targetApi; private String targetApi;
/** 源数据 */ /** 源数据 */
private String sourceData; private String sourceData;
/** 状态 1、成功2、失败 */
private String dataType;
/** 备注 */
private String remark;
/** 操作类型 1新增2、修改3、删除*/ /** 操作类型 1新增2、修改3、删除*/
private String optionType; private String optionType;
/** 公司id */ /** 公司id */
private String companyId; private String companyId;
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getFormmainId() { public String getFormmainId() {
return formmainId; return formmainId;

View File

@ -9,6 +9,8 @@
<result property="targetApi" column="target_api" jdbcType="VARCHAR"/> <result property="targetApi" column="target_api" jdbcType="VARCHAR"/>
<result property="sourceData" column="source_data" jdbcType="VARCHAR"/> <result property="sourceData" column="source_data" jdbcType="VARCHAR"/>
<result property="optionType" column="option_type" jdbcType="VARCHAR"/> <result property="optionType" column="option_type" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/> <result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/> <result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/> <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
@ -26,6 +28,8 @@
,target_api ,target_api
,source_data ,source_data
,option_type ,option_type
,remark
,data_type
,sorts ,sorts
,create_user_id ,create_user_id
,create_time ,create_time
@ -53,6 +57,8 @@
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if> <if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="sorts != null"> and sorts = #{sorts} </if> <if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if> <if test="create_time != null"> and create_time = #{create_time} </if>
@ -77,6 +83,8 @@
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if> <if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="sorts != null"> and sorts = #{sorts} </if> <if test="sorts != null"> and sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
<if test="create_time != null"> and create_time = #{create_time} </if> <if test="create_time != null"> and create_time = #{create_time} </if>
@ -103,6 +111,8 @@
<if test="targetApi != null and targetApi != ''"> and target_api like concat('%',#{targetApi},'%') </if> <if test="targetApi != null and targetApi != ''"> and target_api like concat('%',#{targetApi},'%') </if>
<if test="sourceData != null and sourceData != ''"> and source_data like concat('%',#{sourceData},'%') </if> <if test="sourceData != null and sourceData != ''"> and source_data like concat('%',#{sourceData},'%') </if>
<if test="optionType != null and optionType != ''"> and option_type like concat('%',#{optionType},'%') </if> <if test="optionType != null and optionType != ''"> and option_type like concat('%',#{optionType},'%') </if>
<if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </if>
<if test="dataType != null and dataType != ''"> and data_type like concat('%',#{dataType},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if> <if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if> <if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if> <if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
@ -113,7 +123,7 @@
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if> <if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
and sts='Y' and sts='Y'
</trim> </trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> <if test=" sort == null or sort == ''.toString() "> order by sorts desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select> </select>
@ -129,6 +139,8 @@
<if test="targetApi != null and targetApi != ''"> or target_api = #{targetApi} </if> <if test="targetApi != null and targetApi != ''"> or target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> or source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> or source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> or option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> or option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> or remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> or data_type = #{dataType} </if>
<if test="sorts != null"> or sorts = #{sorts} </if> <if test="sorts != null"> or sorts = #{sorts} </if>
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if> <if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
<if test="create_time != null"> or create_time = #{create_time} </if> <if test="create_time != null"> or create_time = #{create_time} </if>
@ -153,6 +165,8 @@
<if test="targetApi != null and targetApi != ''"> target_api , </if> <if test="targetApi != null and targetApi != ''"> target_api , </if>
<if test="sourceData != null and sourceData != ''"> source_data , </if> <if test="sourceData != null and sourceData != ''"> source_data , </if>
<if test="optionType != null and optionType != ''"> option_type , </if> <if test="optionType != null and optionType != ''"> option_type , </if>
<if test="remark != null and remark != ''"> remark , </if>
<if test="dataType != null and dataType != ''"> data_type , </if>
<if test="sorts != null"> sorts , </if> <if test="sorts != null"> sorts , </if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if> <if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if> <if test="create_time != null"> create_time , </if>
@ -171,6 +185,8 @@
<if test="targetApi != null and targetApi != ''"> #{targetApi} ,</if> <if test="targetApi != null and targetApi != ''"> #{targetApi} ,</if>
<if test="sourceData != null and sourceData != ''"> #{sourceData} ,</if> <if test="sourceData != null and sourceData != ''"> #{sourceData} ,</if>
<if test="optionType != null and optionType != ''"> #{optionType} ,</if> <if test="optionType != null and optionType != ''"> #{optionType} ,</if>
<if test="remark != null and remark != ''"> #{remark} ,</if>
<if test="dataType != null and dataType != ''"> #{dataType} ,</if>
<if test="sorts != null"> #{sorts} ,</if> <if test="sorts != null"> #{sorts} ,</if>
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if> <if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if> <if test="create_time != null"> #{create_time} ,</if>
@ -185,18 +201,18 @@
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="entityInsertBatch" > <insert id="entityInsertBatch" >
insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') (#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach> </foreach>
</insert> </insert>
<!-- 批量新增或者修改--> <!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" > <insert id="entityInsertOrUpdateBatch" >
insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) insert into ${tableName}(formmain_id, target_app, target_api, source_data, option_type,remark,data_type, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) (#{entity.formmainId},#{entity.targetApp},#{entity.targetApi},#{entity.sourceData},#{entity.optionType},#{entity.remark},#{entity.dataType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
</foreach> </foreach>
on duplicate key update on duplicate key update
formmain_id = values(formmain_id), formmain_id = values(formmain_id),
@ -204,6 +220,8 @@
target_api = values(target_api), target_api = values(target_api),
source_data = values(source_data), source_data = values(source_data),
option_type = values(option_type), option_type = values(option_type),
remark = values(remark),
data_type = values(data_type),
create_user_id = values(create_user_id), create_user_id = values(create_user_id),
create_time = values(create_time), create_time = values(create_time),
modify_user_id = values(modify_user_id), modify_user_id = values(modify_user_id),
@ -220,6 +238,8 @@ update ${tableName} set
<if test="targetApi != null and targetApi != ''"> target_api = #{targetApi},</if> <if test="targetApi != null and targetApi != ''"> target_api = #{targetApi},</if>
<if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if> <if test="sourceData != null and sourceData != ''"> source_data = #{sourceData},</if>
<if test="optionType != null and optionType != ''"> option_type = #{optionType},</if> <if test="optionType != null and optionType != ''"> option_type = #{optionType},</if>
<if test="remark != null and remark != ''"> remark = #{remark},</if>
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</if>
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if> <if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
<if test="create_time != null"> create_time = #{create_time},</if> <if test="create_time != null"> create_time = #{create_time},</if>
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if> <if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
@ -245,6 +265,8 @@ update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id =
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if> <if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </if>
<if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if> <if test="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </if>
<if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if> <if test="optionType != null and optionType != ''"> and option_type = #{optionType} </if>
<if test="remark != null and remark != ''"> and remark = #{remark} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </if>
<if test="sorts != null"> and sorts = #{sorts} </if> <if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if> <if test="sts != null and sts != ''"> and sts = #{sts} </if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if> <if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>

View File

@ -110,14 +110,14 @@ public interface IMdmService {
* @Date 9:40 上午 2023/10/18 * @Date 9:40 上午 2023/10/18
**/ **/
JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject); JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject);
///** /**
// * @param jsonObject * @param jsonObject
// * @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
// * @Author lvleigang * @Author lvleigang
// * @Description 处理分发数据 * @Description 处理分发数据
// * @Date 9:40 上午 2023/10/18 * @Date 9:40 上午 2023/10/18
// **/ **/
//JsonResultEntity doMdmDistribute(JSONObject jsonObject); JsonResultEntity doMdmDistribute(JSONObject jsonObject);
} }

View File

@ -1,10 +1,12 @@
package com.hzya.frame.mdm.service.impl; package com.hzya.frame.mdm.service.impl;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.mdm.entity.DbFiledsDto; import com.hzya.frame.mdm.entity.DbFiledsDto;
import com.hzya.frame.mdm.entity.MdmDataDto; import com.hzya.frame.mdm.entity.MdmDataDto;
import com.hzya.frame.mdm.entity.MdmDataFiledDto; import com.hzya.frame.mdm.entity.MdmDataFiledDto;
@ -30,6 +32,7 @@ import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEnti
import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao; import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao;
import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity;
import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao; import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao;
import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity;
import com.hzya.frame.mdm.mdmModuleOptionLog.dao.IMdmModuleOptionLogDao; import com.hzya.frame.mdm.mdmModuleOptionLog.dao.IMdmModuleOptionLogDao;
import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity; import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity;
import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao; import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao;
@ -47,24 +50,45 @@ import com.hzya.frame.mdm.service.IMdmService;
import com.hzya.frame.mdm.service.IMdmServiceCache; import com.hzya.frame.mdm.service.IMdmServiceCache;
import com.hzya.frame.sys.entity.FormmainDeleteDto; import com.hzya.frame.sys.entity.FormmainDeleteDto;
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity;
import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao; import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao;
import com.hzya.frame.sysnew.buttonConfig.entity.SysButtonConfigEntity; import com.hzya.frame.sysnew.buttonConfig.entity.SysButtonConfigEntity;
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao; import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao;
import com.hzya.frame.sysnew.menuConfig.entity.SysMenuConfigEntity; import com.hzya.frame.sysnew.menuConfig.entity.SysMenuConfigEntity;
import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao; import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao;
import com.hzya.frame.sysnew.popedomOperate.entity.SysPopedomOperateEntity; import com.hzya.frame.sysnew.popedomOperate.entity.SysPopedomOperateEntity;
import com.hzya.frame.sysnew.user.dao.ISysUserDao;
import com.hzya.frame.sysnew.user.entity.SysUserEntity; import com.hzya.frame.sysnew.user.entity.SysUserEntity;
import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity; import com.hzya.frame.sysnew.userCompany.entity.SysUserCompanyEntity;
import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity; import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity;
import com.hzya.frame.util.PluginUtils;
import com.hzya.frame.uuid.UUIDUtils; import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity; import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -81,8 +105,17 @@ import java.util.Map;
public class MdmServiceImpl implements IMdmService { public class MdmServiceImpl implements IMdmService {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
private ISysApplicationDao sysApplicationDao;
@Resource
private ISysApplicationApiDao sysApplicationApiDao;
@Resource
private ISysApplicationScriptDao sysApplicationScriptDao;
@Resource @Resource
private IMdmModuleDao mdmModuleDao; private IMdmModuleDao mdmModuleDao;
@Resource
private IGroovyIntegrationService groovyIntegrationService;
@Resource @Resource
private IMdmModuleSendLogDao mdmModuleSendLogDao; private IMdmModuleSendLogDao mdmModuleSendLogDao;
@Resource @Resource
@ -98,6 +131,8 @@ public class MdmServiceImpl implements IMdmService {
@Resource @Resource
private IMdmModuleDbDao mdmModuleDbDao; private IMdmModuleDbDao mdmModuleDbDao;
@Resource @Resource
private ISysUserDao sysUserDao;
@Resource
private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao; private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao;
@Resource @Resource
private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao;
@ -113,7 +148,10 @@ public class MdmServiceImpl implements IMdmService {
private IMdmModuleViewButtonDao mdmModuleViewButtonDao; private IMdmModuleViewButtonDao mdmModuleViewButtonDao;
@Resource @Resource
private IMdmModuleViewDetailDao mdmModuleViewDetailDao; private IMdmModuleViewDetailDao mdmModuleViewDetailDao;
//多线程请求加锁 HttpRequest 构造方法是静态的
private final Object lock = new Object();
@Value("${ax.url}")
private String url;
/** /**
* @param object * @param object
@ -192,15 +230,15 @@ public class MdmServiceImpl implements IMdmService {
} }
/** /**
* @Author lvleigang
* @Description 根据类型获取字段
* @Date 9:18 上午 2024/6/6
* @param viewType 类型 * @param viewType 类型
* @param mdmModuleViewDetailEntities 显示设置的字段 * @param mdmModuleViewDetailEntities 显示设置的字段
* @param mdmModuleDbEntityList * @param mdmModuleDbEntityList
* @param mdmModuleDbFiledsEntityList 表字段 * @param mdmModuleDbFiledsEntityList 表字段
* @param mdmModuleDbFiledsRuleEntityList 字段规则 * @param mdmModuleDbFiledsRuleEntityList 字段规则
* @return java.util.List<com.hzya.frame.mdm.entity.MdmViewFiledVo> * @return java.util.List<com.hzya.frame.mdm.entity.MdmViewFiledVo>
* @Author lvleigang
* @Description 根据类型获取字段
* @Date 9:18 上午 2024/6/6
**/ **/
private List<MdmViewFiledVo> getFiledByType(String viewType, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities, List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList) { private List<MdmViewFiledVo> getFiledByType(String viewType, List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntities, List<MdmModuleDbEntity> mdmModuleDbEntityList, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntityList, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntityList) {
List<MdmViewFiledVo> mdmViewFiledVos = new ArrayList<>(); List<MdmViewFiledVo> mdmViewFiledVos = new ArrayList<>();
@ -338,6 +376,7 @@ public class MdmServiceImpl implements IMdmService {
return mdmViewFiledVos; return mdmViewFiledVos;
} }
// //
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -586,6 +625,7 @@ public class MdmServiceImpl implements IMdmService {
// mdmViewFiledVos.add(mdmViewFiledVo); // mdmViewFiledVos.add(mdmViewFiledVo);
//} //}
// //
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -599,7 +639,7 @@ public class MdmServiceImpl implements IMdmService {
if (entity == null) { if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空"); return BaseResult.getFailureMessageEntity("参数不允许为空");
} }
entity.setMdmCode(10007L); if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("主数据设置错误"); return BaseResult.getFailureMessageEntity("主数据设置错误");
@ -617,6 +657,7 @@ public class MdmServiceImpl implements IMdmService {
break; break;
} }
} }
}
//判断分页 //判断分页
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
return BaseResult.getFailureMessageEntity("分页查询参数不存在"); return BaseResult.getFailureMessageEntity("分页查询参数不存在");
@ -710,6 +751,7 @@ public class MdmServiceImpl implements IMdmService {
// return BaseResult.getSuccessMessageEntity("查询数据成功", returnData); // return BaseResult.getSuccessMessageEntity("查询数据成功", returnData);
//} //}
// //
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -741,6 +783,7 @@ public class MdmServiceImpl implements IMdmService {
} }
} }
// //
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -763,10 +806,7 @@ public class MdmServiceImpl implements IMdmService {
if (entity.getUpId() == null || "".equals(entity.getUpId())) { if (entity.getUpId() == null || "".equals(entity.getUpId())) {
return BaseResult.getFailureMessageEntity("系统错误"); return BaseResult.getFailureMessageEntity("系统错误");
} }
if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
return BaseResult.getFailureMessageEntity("系统错误");
}
//查询模版 //查询模版
MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if (mdmModuleEntities == null) { if (mdmModuleEntities == null) {
@ -787,8 +827,7 @@ public class MdmServiceImpl implements IMdmService {
} }
} }
entity.setTableName(mdmModuleDbEntity.getDbName()); entity.setTableName(mdmModuleDbEntity.getDbName());
}
if (checkStr(entity.getId())) { if (checkStr(entity.getId())) {
if (!checkStr(entity.getValue())) { if (!checkStr(entity.getValue())) {
@ -837,6 +876,7 @@ public class MdmServiceImpl implements IMdmService {
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
} }
} }
// //
private List<HashMap<String, Object>> gettochilder(String[] strArray, int i, List<HashMap<String, Object>> mapList) { private List<HashMap<String, Object>> gettochilder(String[] strArray, int i, List<HashMap<String, Object>> mapList) {
List<HashMap<String, Object>> maps = new ArrayList<>(); List<HashMap<String, Object>> maps = new ArrayList<>();
@ -851,6 +891,7 @@ public class MdmServiceImpl implements IMdmService {
} }
return maps; return maps;
} }
// //
//private HashMap<String, Object> getFathers(List<HashMap<String, Object>> mapListAll, HashMap<String, Object> mapList, MdmDto entity) { //private HashMap<String, Object> getFathers(List<HashMap<String, Object>> mapListAll, HashMap<String, Object> mapList, MdmDto entity) {
// if (mapList.get("upID") == null) { // if (mapList.get("upID") == null) {
@ -896,6 +937,7 @@ public class MdmServiceImpl implements IMdmService {
return returnList; return returnList;
} }
// //
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -1250,6 +1292,7 @@ public class MdmServiceImpl implements IMdmService {
// } // }
//} //}
// //
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -1313,6 +1356,7 @@ public class MdmServiceImpl implements IMdmService {
return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject); return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject);
} }
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -1347,7 +1391,7 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误"); return BaseResult.getFailureMessageEntity("系统错误");
} }
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList); String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList,"界面修改");
if (res == null || "".equals(res)) { if (res == null || "".equals(res)) {
return BaseResult.getSuccessMessageEntity("修改数据成功"); return BaseResult.getSuccessMessageEntity("修改数据成功");
@ -1391,7 +1435,9 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误"); return BaseResult.getFailureMessageEntity("系统错误");
} }
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList);
String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList,"界面新增");
if (res == null || "".equals(res)) { if (res == null || "".equals(res)) {
return BaseResult.getSuccessMessageEntity("保存数据成功"); return BaseResult.getSuccessMessageEntity("保存数据成功");
@ -1399,8 +1445,29 @@ public class MdmServiceImpl implements IMdmService {
return BaseResult.getFailureMessageEntity(res); return BaseResult.getFailureMessageEntity(res);
} }
} }
private void saveOption(String dbname ,Long mdmCode ,JSONObject jsonObject,String id,String msg) {
MdmModuleOptionLogEntity mdmModuleOptionLogEntity = new MdmModuleOptionLogEntity();
mdmModuleOptionLogEntity.setTableName(dbname+"_option_log");
mdmModuleOptionLogEntity.setMdmCode(mdmCode);
mdmModuleOptionLogEntity.setFormmainId(id);
mdmModuleOptionLogEntity.setSourceName("数智中台");
mdmModuleOptionLogEntity.setDataType("1");
mdmModuleOptionLogEntity.setRemark(msg);
mdmModuleOptionLogEntity.setCode("800004");
mdmModuleOptionLogEntity.setSourceData(jsonObject.toJSONString());
mdmModuleOptionLogEntity.setOptionType(msg);
SysUserEntity sysUserEntity = sysUserDao.get(StpUtil.getLoginIdAsString());
if(sysUserEntity != null){
mdmModuleOptionLogEntity.setOptionName(sysUserEntity.getPersonName());
}
mdmModuleOptionLogEntity.setCreate();
mdmModuleOptionLogDao.save(mdmModuleOptionLogEntity);
}
// //
// //
/** /**
* @param object * @param object
* @return com.hzya.frame.web.entity.JsonResultEntity * @return com.hzya.frame.web.entity.JsonResultEntity
@ -1430,9 +1497,10 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误"); return BaseResult.getFailureMessageEntity("系统错误");
} }
String dbname = null;
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
dbname = mdmModuleDbEntityList.get(i).getDbName();
//查询视图如果树形删除下级及子集 //查询视图如果树形删除下级及子集
//查询展示类型 //查询展示类型
MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity();
@ -1480,168 +1548,338 @@ public class MdmServiceImpl implements IMdmService {
formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName());
mdmModuleDao.deleteTemplateById(formmainDeleteDto); mdmModuleDao.deleteTemplateById(formmainDeleteDto);
} }
} }
saveOption(dbname,mdmModuleEntity.getMdmCode(),jsonObject,jsonObject.getString("id"),"界面删除");
return BaseResult.getSuccessMessageEntity("删除数据成功"); return BaseResult.getSuccessMessageEntity("删除数据成功");
} }
//
// /**
///** * @param jsonStr
// * @param object * @return com.hzya.frame.web.entity.JsonResultEntity
// * @return com.hzya.frame.web.entity.JsonResultEntity * @Author lvleigang
// * @Author lvleigang * @Description 处理分发数据
// * @Description 处理分发数据 * @Date 9:40 上午 2023/10/18
// * @Date 9:40 上午 2023/10/18 **/
// **/ @Override
//@Override public JsonResultEntity doMdmDistribute(JSONObject jsonStr) {
//public JsonResultEntity doMdmDistribute(JSONObject object) { JSONObject jsonObject = getstrObj("jsonStr", jsonStr);
// JSONObject jsonObject = getstrObj("jsonStr", object); //校验是否有servecr传参
// //校验是否有servecr传参 if (!checkData(jsonObject, "mdmCode")) {
// if (!checkData(jsonObject, "mdmCode")) { return BaseResult.getFailureMessageEntity("请先传递服务名");
// return BaseResult.getFailureMessageEntity("请先传递服务名"); }
// } if (!checkData(jsonObject, "id")) {
// if (!checkData(jsonObject, "id")) { return BaseResult.getFailureMessageEntity("请先传递要下发数据");
// return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); }
// } if (!checkData(jsonObject, "distributeId")) {
// if (!checkData(jsonObject, "appID")) { return BaseResult.getFailureMessageEntity("请先传递要下发的数据");
// return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); }
// } if (!checkData(jsonObject, "type")) {
// if (!checkData(jsonObject, "dataType")) { return BaseResult.getFailureMessageEntity("系统错误");
// return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); }
// } Long mdmCode = jsonObject.getLong("mdmCode");//主数据编码
// if("2".equals(jsonObject.getString("dataType"))){ String id = jsonObject.getString("id");//行数据的单据规则编码
// boolean flag = false; String distributeId = jsonObject.getString("distributeId");//发送表id
// //1根据服务名查询分发数据 String type = jsonObject.getString("type");//发送类型1新增2修改3删除
// MdmModuleEntity mdmModuleEntity = new MdmModuleEntity();
// mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); String apiId = null;
// mdmModuleEntity.setSts("Y"); String scriptId = null;
// List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); //查找对应数据组装数据发送
// if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) {
// MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); //获取主数据信息
// mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(mdmCode);
// mdmModuleDbEntity.setDbType("1"); if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) {
// mdmModuleDbEntity.setSts("Y"); return BaseResult.getFailureMessageEntity("主数据不存在");
// List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity); }
// if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) {
// mdmModuleDbEntity = mdmModuleDbEntities.get(0); //获取主数据db
// } MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
// MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
// mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID")); List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
// mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId()); if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) {
// List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); return BaseResult.getFailureMessageEntity("主数据数据源不存在");
// if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() == 1) { }
// if (mdmModuleDistributeEntities.get(0).getAddType() != null && "1".equals(mdmModuleDistributeEntities.get(0).getAddType())) {
// //2查找插件 //获取分发表
// if (mdmModuleDistributeEntities.get(0).getAddPlug() != null && !"".equals(mdmModuleDistributeEntities.get(0).getAddPlug())) { //获取分发的接口
// //2查找插件 MdmModuleDistributeEntity mdmModuleDistributeEntity = mdmModuleDistributeDao.get(distributeId);
// SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getAddPlug()); if (mdmModuleDistributeEntity == null || mdmModuleDistributeEntity.getId() == null) {
// if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){ return BaseResult.getFailureMessageEntity("分发不存在");
// //3调用插件 }
// PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode()); // 启用停用 0停用
// try { if ("0".equals(mdmModuleDistributeEntity.getEnabledState())) {
// JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject); return BaseResult.getFailureMessageEntity("分发已停用");
// flag = true; }
// } catch (Exception e) { MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity();
// logger.error("插件处理失败"+e.getMessage()); mdmModuleDistributeDetailEntity.setDistributeId(distributeId);
// } mdmModuleDistributeDetailEntity.setSts("Y");
// } List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity);
// }
// } else { // 启用停用 0停用
// //TODO 连线 if ("1".equals(mdmModuleDistributeEntity.getEnabledType())) {
// flag = true; return BaseResult.getFailureMessageEntity("分发为自动下发,不允许手动下发");
// } }
// } //1新增2修改3删除
// if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) { if ("1".equals(type)) {
// MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity(); apiId = mdmModuleDistributeEntity.getAddApi();
// mdmDistributeEntity.setCreate(); scriptId = mdmModuleDistributeEntity.getAddScript();
// mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute"); } else if ("2".equals(type)) {
// mdmDistributeEntity.setFormmainId(jsonObject.getString("id")); apiId = mdmModuleDistributeEntity.getUpdateApi();
// mdmDistributeEntity.setAppId(jsonObject.getString("appID")); scriptId = mdmModuleDistributeEntity.getUpdateScript();
// mdmDistributeEntity.setStatus("1");
// mdmDistributeEntity.setMsg("发送成功"); } else if ("3".equals(type)) {
// if (!flag) { apiId = mdmModuleDistributeEntity.getDeleteApi();
// mdmDistributeEntity.setStatus("3"); scriptId = mdmModuleDistributeEntity.getDeleteScript();
// mdmDistributeEntity.setMsg("发送失败"); }
// } if (apiId == null || "".equals(apiId)) {
// mdmModuleDao.saveDistribute(mdmDistributeEntity); return BaseResult.getFailureMessageEntity("分发接口未选择,请先选择");
// return BaseResult.getSuccessMessageEntity("下发数据成功"); }
// SysApplicationScriptEntity scriptEntity = null;
// }else { if (scriptId != null && !"".equals(scriptId)) {
// return BaseResult.getFailureMessageEntity("系统错误"); scriptEntity = sysApplicationScriptDao.get(scriptId);
// } if (scriptEntity == null || scriptEntity.getId() == null) {
// }else { return BaseResult.getFailureMessageEntity("分发接口脚本不存在");
// return BaseResult.getFailureMessageEntity("系统错误"); }
// } }
// }else { SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(apiId);
// if (!checkData(jsonObject, "distributeID")) { if (apiEntity == null || apiEntity.getId() == null) {
// return BaseResult.getFailureMessageEntity("请先传递分发数据"); return BaseResult.getFailureMessageEntity("分发接口不存在");
// }
// boolean flag = false; }
// //1根据服务名查询分发数据 SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
// MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); if (sysApplicationEntity == null || sysApplicationEntity.getId() == null) {
// mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); return BaseResult.getFailureMessageEntity("应用不存在");
// mdmModuleEntity.setSts("Y"); }
// List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity);
// if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) { //获取主数据db字段以及字段的规则
// MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity();
// mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); queryFild.setMdmId(mdmModuleEntity.getId());
// mdmModuleDbEntity.setDbType("1"); List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild);
// mdmModuleDbEntity.setSts("Y"); MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity();
// List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity); queryFildRule.setMdmId(mdmModuleEntity.getId());
// if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) { queryFildRule.setRuleCode("service");
// mdmModuleDbEntity = mdmModuleDbEntities.get(0); List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
// }
// MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); String dbname = null;
// mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID")); //获取主数据db对应的实体表的数据
// mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId()); JSONObject object = new JSONObject();
// List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
// if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() == 1) { if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) {
// if (mdmModuleDistributeEntities.get(0).getDeleteType() != null && "1".equals(mdmModuleDistributeEntities.get(0).getDeleteType())) { dbname = mdmModuleDbEntities.get(i).getDbName();
// //2查找插件 Map<String, Object> map = new HashMap<>();
// if (mdmModuleDistributeEntities.get(0).getDeletePlug() != null && !"".equals(mdmModuleDistributeEntities.get(0).getDeletePlug())) { map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
// //2查找插件 map.put("id", id);
// SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getDeletePlug()); object = mdmModuleDao.queryMdmST(map);
// if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){ if (object.getString("id") == null || "".equals(object.getString("id"))) {
// //3调用插件 return BaseResult.getFailureMessageEntity("当前数据不存在");
// PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode()); }
// try { if (mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0) {
// JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject); Map<String, Object> checkData = new HashMap<>();
// flag = true; checkData.put("tableName", mdmModuleDbEntities.get(i).getDbName());
// } catch (Exception e) { checkData.put("id", id);
// logger.error("插件处理失败"+e.getMessage()); checkData.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
// } JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
// } if (object1.getString("id") == null || "".equals(object1.getString("id"))) {
// } return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送");
// } else { }
// //TODO 连线 }
// flag = true; //查看主表是否有字段是关联的
// } if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) {
// } for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
// if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) { if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())) {
// //删除数据 if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
// MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity(); for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
// mdmDistributeEntity.setId(jsonObject.getString("distributeID")); if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
// mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute"); Map<String, Object> mapDetail = new HashMap<>();
// mdmDistributeEntity.setFormmainId(jsonObject.getString("id")); mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
// mdmDistributeEntity.setAppId(jsonObject.getString("appID")); mapDetail.put("id", object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
// mdmDistributeEntity.setStatus("1"); JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
// mdmDistributeEntity.setMsg("删除成功"); object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail);
// if (!flag) { }
// mdmDistributeEntity.setStatus("3"); }
// mdmDistributeEntity.setMsg("删除失败"); }
// } }
// mdmModuleDao.updateDistribute(mdmDistributeEntity); }
// return BaseResult.getSuccessMessageEntity("删除数据成功"); }
// }
// }else { }
// return BaseResult.getFailureMessageEntity("系统错误");
// } for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
// }else { if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) {
// return BaseResult.getFailureMessageEntity("系统错误"); Map<String, String> map = new HashMap<>();
// } map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
// } map.put("formmainId", object.getString("id"));
// List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
//} //查看主表是否有字段是关联的
// if (detail != null && detail.size() > 0) {
if (mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0) {
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
if (mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())) {
if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
for (int i3 = 0; i3 < detail.size(); i3++) {
Map<String, Object> mapDetail = new HashMap<>();
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
mapDetail.put("id", detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail);
}
}
}
}
}
}
}
}
object.put(mdmModuleDbEntities.get(i).getDbName(), detail);
}
}
//执行脚本
JSONObject groovy = new JSONObject();
JSONObject parameterJson = new JSONObject();
parameterJson.put("header", apiEntity.getHeaderIn());
parameterJson.put("body", apiEntity.getBodyIn());
parameterJson.put("query", apiEntity.getQueryIn());
parameterJson.put("data", object);
/** head */
Map<String, String> header = null;
/** query */
String querys = null;
/** body */
String bodys = object.toJSONString();
if (scriptEntity != null && scriptEntity.getId() != null) {
groovy.put("code", scriptEntity.getScriptCode());
groovy.put("className", scriptEntity.getClassName());
groovy.put("name", scriptEntity.getScriptName());
groovy.put("methodStr", scriptEntity.getScriptData());
groovy.put("parameterJson", parameterJson);
JSONObject groovyStr = new JSONObject();
groovyStr.put("jsonStr", groovy);
try {
//SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy);
SysExtensionApiEntity jsonResultEntity = new SysExtensionApiEntity();
jsonResultEntity.setBodys("{\"ufinterface\":{\"billtype\":\"supplier\",\"sender\":\"OA\",\"replace\":\"Y\",\"isexchange\":\"Y\",\"account\":\"01\",\"groupcode\":\"00\"},\"bill\":{\"billhead\":{\"pk_country\":\"CN\",\"pk_group\":\"00\",\"enablestate\":\"2\",\"code\":\"01004\",\"supprop\":\"0\",\"pk_format\":\"ZH-CN\",\"pk_supplierclass\":\"S01\",\"custstate\":\"1\",\"name\":\"\",\"pk_timezone\":\"P0800\",\"taxpayerid\":\"087981489021135119\",\"pk_org\":\"003\"}}}");
header = jsonResultEntity.getHeaders();
querys = jsonResultEntity.getQuerys();
bodys = jsonResultEntity.getBodys();
} catch (Exception e) {
return BaseResult.getFailureMessageEntity("分发脚本转换错误");
}
}
Map<String, String> headers = new HashMap<>();
headers.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
headers.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
headers.put("appId", sysApplicationEntity.getAppId().toString());
headers.put("apiCode", apiEntity.getApiCode().toString());
if (header != null) {
headers.putAll(header);
}
//组装数据发送
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers, bodys, querys);
if (jsonResultEntity.isFlag()) {
saveMdmModuleSendLogEntity("1","发送成功",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送成功");
} else {
saveMdmModuleSendLogEntity("2","转发失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:"+jsonResultEntity.getMsg());
}
}
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
mdmModuleSendLogEntity.setCreate();
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
mdmModuleSendLogEntity.setSts("Y");
mdmModuleSendLogEntity.setCreate_user_id("1");
mdmModuleSendLogEntity.setModify_user_id("1");
mdmModuleSendLogEntity.setCreate_time(new Date());
mdmModuleSendLogEntity.setModify_time(new Date());
mdmModuleSendLogEntity.setOrg_id("0");
mdmModuleSendLogEntity.setCompanyId("0");
mdmModuleSendLogEntity.setFormmainId(formmain_id);
mdmModuleSendLogEntity.setTargetApp(target_app);
mdmModuleSendLogEntity.setTargetApi(target_api);
mdmModuleSendLogEntity.setSourceData(source_data);
mdmModuleSendLogEntity.setOptionType(option_type);
mdmModuleSendLogEntity.setDataType(dataType);
mdmModuleSendLogEntity.setRemark(remark);
mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
}
private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map<String, String> headers, String bodys, String querys) {
StringBuffer urls = new StringBuffer(url);
if (querys != null) {
urls.append("?");
urls.append(querys);
}
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
HttpPost post = new HttpPost(urls.toString());
CloseableHttpResponse response = null;
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(Integer.valueOf(applicationApiEntity.getTimeoutPeriod())).build();
post.setConfig(requestConfig);//设置请求参数超时时间
if (headers != null && headers.size() > 0) {
for (String key : headers.keySet()) {
post.setHeader(key, headers.get(key));
}
}
StringBuilder body = new StringBuilder();
boolean flag = true;
try {
if (bodys != null && !"".equals(bodys)) {
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
entity.setContentType("application/json");
post.setEntity(entity);
}
response = closeableHttpClient.execute(post);
HttpEntity entity = response.getEntity();
synchronized (lock) {
body.append(EntityUtils.toString(entity, "UTF-8"));
}
flag = true;
logger.info("返回结果:" + body);
} catch (Exception e) {
logger.error("请求错误:" + e.getMessage());
body.append(e.getMessage());
flag = false;
} finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
if (flag) {
if (JSONUtil.isTypeJSON(body.toString())) {
JsonResultEntity jsonResultEntity = JSONObject.parseObject(body.toString(), JsonResultEntity.class);
if (jsonResultEntity.isFlag()) {
return BaseResult.getSuccessMessageEntity("转发成功", body);
} else {
return BaseResult.getFailureMessageEntity("转发失败", body);
}
} else {
return BaseResult.getFailureMessageEntity("转发失败", body);
}
} else {
return BaseResult.getFailureMessageEntity("转发失败", body);
}
}
/** /**
* @param mdmCode * @param mdmCode
* @param saveData * @param saveData
@ -1653,9 +1891,14 @@ public class MdmServiceImpl implements IMdmService {
* @Description 校验数据 * @Description 校验数据
* @Date 11:20 上午 2023/11/6 * @Date 11:20 上午 2023/11/6
**/ **/
private String checkDataOnly(Integer mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List<MdmModuleDbEntity> mdmModuleDbEntityList) { private String checkDataOnly(long mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List<MdmModuleDbEntity> mdmModuleDbEntityList,String msg) {
StringBuffer str = new StringBuffer(); StringBuffer str = new StringBuffer();
String dbname = null;
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
dbname = mdmModuleDbEntityList.get(i).getDbName();
}
}
//查询字段 //查询字段
//查询字段下的必填规则 //查询字段下的必填规则
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity();
@ -1838,7 +2081,8 @@ public class MdmServiceImpl implements IMdmService {
mdmDataFiledDtos.add(update_status); mdmDataFiledDtos.add(update_status);
MdmDataFiledDto data_status = new MdmDataFiledDto(); MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("data_status"); data_status.setFiledsName("data_status");
data_status.setFiledsValue("F");; data_status.setFiledsValue("F");
;
mdmDataFiledDtos.add(data_status); mdmDataFiledDtos.add(data_status);
int a = mdmModuleDao.updateForm(mdmDataDto); int a = mdmModuleDao.updateForm(mdmDataDto);
} else { } else {
@ -1852,15 +2096,18 @@ public class MdmServiceImpl implements IMdmService {
mdmDataFiledDtos.add(ids); mdmDataFiledDtos.add(ids);
MdmDataFiledDto data_status = new MdmDataFiledDto(); MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("data_status"); data_status.setFiledsName("data_status");
data_status.setFiledsValue("Y");; data_status.setFiledsValue("Y");
;
mdmDataFiledDtos.add(data_status); mdmDataFiledDtos.add(data_status);
MdmDataFiledDto org_id = new MdmDataFiledDto(); MdmDataFiledDto org_id = new MdmDataFiledDto();
org_id.setFiledsName("org_id"); org_id.setFiledsName("org_id");
org_id.setFiledsValue("Y");; org_id.setFiledsValue("Y");
;
mdmDataFiledDtos.add(org_id); mdmDataFiledDtos.add(org_id);
MdmDataFiledDto company_id = new MdmDataFiledDto(); MdmDataFiledDto company_id = new MdmDataFiledDto();
company_id.setFiledsName("company_id"); company_id.setFiledsName("company_id");
company_id.setFiledsValue("Y");; company_id.setFiledsValue("Y");
;
mdmDataFiledDtos.add(company_id); mdmDataFiledDtos.add(company_id);
MdmDataFiledDto add_status = new MdmDataFiledDto(); MdmDataFiledDto add_status = new MdmDataFiledDto();
@ -1948,6 +2195,9 @@ public class MdmServiceImpl implements IMdmService {
} }
} }
} }
saveOption(dbname,mdmCode,saveData,id,msg);
} }
return str.toString(); return str.toString();
} }

View File

@ -11,6 +11,8 @@ import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hzya.frame.basedao.service.impl.BaseService; import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao;
import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity;
import com.hzya.frame.serviceUtil.DsDataSourceUtil; import com.hzya.frame.serviceUtil.DsDataSourceUtil;
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao; import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiDto; import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiDto;
@ -104,7 +106,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
private ISysMessageManageDao sysMessageManageDao; private ISysMessageManageDao sysMessageManageDao;
@Resource @Resource
private ISysMessageManageDetailDao sysMessageManageDetailDao; //明细表 private ISysMessageManageDetailDao sysMessageManageDetailDao; //明细表
@Resource
private IMdmModuleDistributeDao mdmModuleDistributeDao;
@Resource @Resource
private IIntegrationTaskCacheableService iIntegrationTaskCacheableService; private IIntegrationTaskCacheableService iIntegrationTaskCacheableService;
@Resource @Resource
@ -631,6 +634,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
SysApplicationEntity sysApplicationEntity = new SysApplicationEntity(); SysApplicationEntity sysApplicationEntity = new SysApplicationEntity();
sysApplicationEntity.setId(entity.getId()); sysApplicationEntity.setId(entity.getId());
/** 应用logo地址或者id */ /** 应用logo地址或者id */
sysApplicationEntity.setAppType(entity.getAppType());
/** 应用logo地址或者id */
sysApplicationEntity.setAppLogo(entity.getAppLogo()); sysApplicationEntity.setAppLogo(entity.getAppLogo());
/** 应用是否启用1、启用 2、停用 */ /** 应用是否启用1、启用 2、停用 */
sysApplicationEntity.setAppStatus(entity.getAppStatus()); sysApplicationEntity.setAppStatus(entity.getAppStatus());
@ -2368,6 +2373,14 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
} }
if (entity.getId() == null || "".equals(entity.getId())) { if (entity.getId() == null || "".equals(entity.getId())) {
return BaseResult.getFailureMessageEntity("系统错误"); return BaseResult.getFailureMessageEntity("系统错误");
}
MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity();
mdmModuleDistributeEntity.setAddScript(entity.getId());
mdmModuleDistributeEntity.setUpdateScript(entity.getId());
mdmModuleDistributeEntity.setDeleteScript(entity.getId());
Integer a = mdmModuleDistributeDao.queryCountUse(mdmModuleDistributeEntity);
if(a > 0){
return BaseResult.getFailureMessageEntity("脚本已经被使用,请先取消关联");
} }
entity.setUpdate(); entity.setUpdate();
sysApplicationScriptDao.logicRemoveMultiCondition(entity); sysApplicationScriptDao.logicRemoveMultiCondition(entity);