主数据修改

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())){
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 ;
}
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getDeleteApi());
if(apiEntity == null || apiEntity.getId() == null ){
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 ;
}
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
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 ;
}
@ -493,7 +493,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getDeleteScript());
if(scriptEntity == null || scriptEntity.getId() == null ){
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 ;
}
@ -539,7 +539,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getQuerys();
bodys = jsonResultEntity.getBodys();
}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;
}
}
@ -555,11 +555,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
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;
}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;
}
}
@ -618,21 +618,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
}
if(mdmModuleDistributeEntities.get(i1).getUpdateApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getUpdateApi())){
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 ;
}
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getUpdateApi());
if(apiEntity == null || apiEntity.getId() == null ){
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 ;
}
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
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 ;
}
@ -642,7 +642,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getUpdateScript());
if(scriptEntity == null || scriptEntity.getId() == null ){
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 ;
}
@ -679,7 +679,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getQuerys();
bodys = jsonResultEntity.getBodys();
}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;
}
}
@ -695,11 +695,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
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;
}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;
}
}
@ -765,21 +765,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
}
if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){
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 ;
}
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(mdmModuleDistributeEntities.get(i1).getAddApi());
if(apiEntity == null || apiEntity.getId() == null ){
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 ;
}
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
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 ;
}
@ -789,7 +789,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript());
if(scriptEntity == null || scriptEntity.getId() == null ){
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 ;
}
@ -835,7 +835,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
querys = jsonResultEntity.getQuerys();
bodys = jsonResultEntity.getBodys();
}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;
}
}
@ -851,11 +851,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
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;
}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;
}
}
@ -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.setTableName(dbname+"_send_log");
mdmModuleSendLogEntity.setCreate();
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
mdmModuleSendLogEntity.setSts("Y");
@ -893,6 +894,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
mdmModuleSendLogEntity.setTargetApi(target_api);
mdmModuleSendLogEntity.setSourceData(source_data);
mdmModuleSendLogEntity.setOptionType(option_type);
mdmModuleSendLogEntity.setDataType(dataType);
mdmModuleSendLogEntity.setRemark(remark);
mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
}

View File

@ -54,8 +54,8 @@ public class temButtom {
public void test01() {
String a = AESUtil.encrypt("hzya@1314");
System.out.println(a);
//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}";
String b = AESUtil.decrypt("62e4295b615a30dbf3b8ee96f41c820b");
System.out.println(b);
}

View File

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

View File

@ -388,4 +388,13 @@ public interface IMdmModuleService extends IBaseService<MdmModuleEntity, String>
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
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();
mdmModuleDao.save(entity);
entity = mdmModuleDao.get(entity.getId());
return BaseResult.getSuccessMessageEntity("保存成功",entity);
}
@ -631,11 +632,28 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
data_type.setQueryType("1");
data_type.setListType("1");
data_type.setViewType("1");
data_type.setFiledLength("255");
data_type.setFiledLength("50");
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);
MdmModuleDbFiledsEntity code = new MdmModuleDbFiledsEntity();
code.setMdmId(entity.getMdmId());
code.setDbId(entity.getId());
@ -774,6 +792,40 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
option_type.setCreate();
option_type.setDataType("1");
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())) {
MdmModuleDbFiledsEntity data_status = new MdmModuleDbFiledsEntity();
@ -786,8 +838,8 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
data_status.setUpdateType("2");
data_status.setShowType("2");
data_status.setQueryType("2");
data_status.setListType("1");
data_status.setViewType("1");
data_status.setListType("2");
data_status.setViewType("2");
data_status.setFiledLength("1");
data_status.setCreate();
data_status.setDataType("1");
@ -2616,4 +2668,27 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
}
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> {
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 org.springframework.stereotype.Repository;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import java.util.HashMap;
/**
* 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层
*
@ -13,5 +16,10 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
@Repository(value = "MdmModuleDistributeDaoImpl")
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;
/** 应用id */
private String appId;
/** 应用id */
private Long mdmCode;
/** 触发类型 0、手动1、自动 */
private String enabledType;
/** 修改接口 */
@ -40,6 +42,13 @@ public class MdmModuleDistributeEntity extends BaseEntity {
/** 公司id */
private List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities;
public Long getMdmCode() {
return mdmCode;
}
public void setMdmCode(Long mdmCode) {
this.mdmCode = mdmCode;
}
public String getMdmId() {
return mdmId;
@ -144,5 +153,7 @@ public class MdmModuleDistributeEntity extends BaseEntity {
public void setMdmModuleDistributeDetailEntities(List<MdmModuleDistributeDetailEntity> 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 from mdm_module_distribute where id = #{id}
</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>

View File

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

View File

@ -8,6 +8,7 @@
<result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
<result property="dataType" column="data_type" 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="optionType" column="option_type" jdbcType="VARCHAR"/>
<result property="optionName" column="option_name" jdbcType="VARCHAR"/>
@ -27,6 +28,7 @@
,source_name
,data_type
,code
,remark
,source_data
,option_type
,option_name
@ -55,6 +57,7 @@
<if test="sourceName != null and sourceName != ''"> and source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType} </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="optionType != null and optionType != ''"> and option_type = #{optionType} </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="dataType != null and dataType != ''"> and data_type = #{dataType} </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="optionType != null and optionType != ''"> and option_type = #{optionType} </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="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="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="optionType != null and optionType != ''"> and option_type like concat('%',#{optionType},'%') </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>
and sts='Y'
</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>
</select>
@ -137,6 +142,7 @@
<if test="sourceName != null and sourceName != ''"> or source_name = #{sourceName} </if>
<if test="dataType != null and dataType != ''"> or data_type = #{dataType} </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="optionType != null and optionType != ''"> or option_type = #{optionType} </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="dataType != null and dataType != ''"> data_type , </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="optionType != null and optionType != ''"> option_type , </if>
<if test="optionName != null and optionName != ''"> option_name , </if>
@ -183,6 +190,7 @@
<if test="sourceName != null and sourceName != ''"> #{sourceName} ,</if>
<if test="dataType != null and dataType != ''"> #{dataType} ,</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="optionType != null and optionType != ''"> #{optionType} ,</if>
<if test="optionName != null and optionName != ''"> #{optionName} ,</if>
@ -200,24 +208,25 @@
</insert>
<!-- 批量新增 -->
<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
<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>
</insert>
<!-- 批量新增或者修改-->
<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
<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>
on duplicate key update
formmain_id = values(formmain_id),
source_name = values(source_name),
data_type = values(data_type),
code = values(code),
remark = values(remark),
source_data = values(source_data),
option_type = values(option_type),
option_name = values(option_name),
@ -236,6 +245,7 @@ update ${tableName} set
<if test="sourceName != null and sourceName != ''"> source_name = #{sourceName},</if>
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</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="optionType != null and optionType != ''"> option_type = #{optionType},</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="dataType != null and dataType != ''"> and data_type = #{dataType} </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="optionType != null and optionType != ''"> and option_type = #{optionType} </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 sourceData;
/** 状态 1、成功2、失败 */
private String dataType;
/** 备注 */
private String remark;
/** 操作类型 1新增2、修改3、删除*/
private String optionType;
/** 公司id */
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() {
return formmainId;

View File

@ -9,6 +9,8 @@
<result property="targetApi" column="target_api" jdbcType="VARCHAR"/>
<result property="sourceData" column="source_data" 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="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
@ -26,6 +28,8 @@
,target_api
,source_data
,option_type
,remark
,data_type
,sorts
,create_user_id
,create_time
@ -53,6 +57,8 @@
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </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="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="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>
@ -77,6 +83,8 @@
<if test="targetApi != null and targetApi != ''"> and target_api = #{targetApi} </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="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="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>
@ -103,6 +111,8 @@
<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="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="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>
@ -113,7 +123,7 @@
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
and sts='Y'
</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>
</select>
@ -129,6 +139,8 @@
<if test="targetApi != null and targetApi != ''"> or target_api = #{targetApi} </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="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="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>
@ -153,6 +165,8 @@
<if test="targetApi != null and targetApi != ''"> target_api , </if>
<if test="sourceData != null and sourceData != ''"> source_data , </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="create_user_id != null and create_user_id != ''"> create_user_id , </if>
<if test="create_time != null"> create_time , </if>
@ -171,6 +185,8 @@
<if test="targetApi != null and targetApi != ''"> #{targetApi} ,</if>
<if test="sourceData != null and sourceData != ''"> #{sourceData} ,</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="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
<if test="create_time != null"> #{create_time} ,</if>
@ -185,18 +201,18 @@
</insert>
<!-- 批量新增 -->
<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
<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>
</insert>
<!-- 批量新增或者修改-->
<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
<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>
on duplicate key update
formmain_id = values(formmain_id),
@ -204,6 +220,8 @@
target_api = values(target_api),
source_data = values(source_data),
option_type = values(option_type),
remark = values(remark),
data_type = values(data_type),
create_user_id = values(create_user_id),
create_time = values(create_time),
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="sourceData != null and sourceData != ''"> source_data = #{sourceData},</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_time != null"> create_time = #{create_time},</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="sourceData != null and sourceData != ''"> and source_data = #{sourceData} </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="sts != null and sts != ''"> and sts = #{sts} </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
**/
JsonResultEntity deleteMdmShowDetailsData(JSONObject jsonObject);
///**
// * @param jsonObject
// * @return com.hzya.frame.web.entity.JsonResultEntity
// * @Author lvleigang
// * @Description 处理分发数据
// * @Date 9:40 上午 2023/10/18
// **/
//JsonResultEntity doMdmDistribute(JSONObject jsonObject);
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 处理分发数据
* @Date 9:40 上午 2023/10/18
**/
JsonResultEntity doMdmDistribute(JSONObject jsonObject);
}

View File

@ -1,10 +1,12 @@
package com.hzya.frame.mdm.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.mdm.entity.DbFiledsDto;
import com.hzya.frame.mdm.entity.MdmDataDto;
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.entity.MdmModuleDistributeEntity;
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.entity.MdmModuleOptionLogEntity;
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.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.entity.SysButtonConfigEntity;
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao;
import com.hzya.frame.sysnew.menuConfig.entity.SysMenuConfigEntity;
import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao;
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.userCompany.entity.SysUserCompanyEntity;
import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity;
import com.hzya.frame.util.PluginUtils;
import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseResult;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
@ -81,8 +105,17 @@ import java.util.Map;
public class MdmServiceImpl implements IMdmService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
private ISysApplicationDao sysApplicationDao;
@Resource
private ISysApplicationApiDao sysApplicationApiDao;
@Resource
private ISysApplicationScriptDao sysApplicationScriptDao;
@Resource
private IMdmModuleDao mdmModuleDao;
@Resource
private IGroovyIntegrationService groovyIntegrationService;
@Resource
private IMdmModuleSendLogDao mdmModuleSendLogDao;
@Resource
@ -98,6 +131,8 @@ public class MdmServiceImpl implements IMdmService {
@Resource
private IMdmModuleDbDao mdmModuleDbDao;
@Resource
private ISysUserDao sysUserDao;
@Resource
private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao;
@Resource
private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao;
@ -113,7 +148,10 @@ public class MdmServiceImpl implements IMdmService {
private IMdmModuleViewButtonDao mdmModuleViewButtonDao;
@Resource
private IMdmModuleViewDetailDao mdmModuleViewDetailDao;
//多线程请求加锁 HttpRequest 构造方法是静态的
private final Object lock = new Object();
@Value("${ax.url}")
private String url;
/**
* @param object
@ -133,7 +171,7 @@ public class MdmServiceImpl implements IMdmService {
}
//查询模版
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){
if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("系统错误");
}
@ -184,28 +222,28 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleViewDetailEntities == null || mdmModuleViewDetailEntities.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误");
}
List<MdmViewFiledVo> queryList = getFiledByType("1",mdmModuleViewDetailEntities,mdmModuleDbEntityList,mdmModuleDbFiledsEntityList,mdmModuleDbFiledsRuleEntityList);
List<MdmViewFiledVo> queryList = getFiledByType("1", mdmModuleViewDetailEntities, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList);
mdmViewVo.setQueryList(queryList);
List<MdmViewFiledVo> listList = getFiledByType("2",mdmModuleViewDetailEntities,mdmModuleDbEntityList,mdmModuleDbFiledsEntityList,mdmModuleDbFiledsRuleEntityList);
List<MdmViewFiledVo> listList = getFiledByType("2", mdmModuleViewDetailEntities, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList);
mdmViewVo.setListList(listList);
return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo);
}
/**
* @Author lvleigang
* @Description 根据类型获取字段
* @Date 9:18 上午 2024/6/6
* @param viewType 类型
* @param mdmModuleViewDetailEntities 显示设置的字段
* @param mdmModuleDbEntityList
* @param mdmModuleDbFiledsEntityList 表字段
* @param mdmModuleDbFiledsRuleEntityList 字段规则
* @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) {
List<MdmViewFiledVo> mdmViewFiledVos = new ArrayList<>();
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
MdmViewFiledVo rule = new MdmViewFiledVo();
rule.setDbName(mdmModuleDbEntityList.get(i).getDbName());
rule.setDbType("1");
@ -252,16 +290,16 @@ public class MdmServiceImpl implements IMdmService {
rule.setRuleList(msgRule);
}
}
if(mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0){
if (mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0) {
for (int i = 0; i < mdmModuleViewDetailEntities.size(); i++) {
if(viewType.equals(mdmModuleViewDetailEntities.get(i).getViewType())){
if (viewType.equals(mdmModuleViewDetailEntities.get(i).getViewType())) {
//类型一致
MdmViewFiledVo mdmViewFiledVo = new MdmViewFiledVo();
mdmViewFiledVo.setId(mdmModuleViewDetailEntities.get(i).getViewFiled());
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
if(mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleViewDetailEntities.get(i).getViewFiled())){
if (mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleViewDetailEntities.get(i).getViewFiled())) {
for (int i2 = 0; i2 < mdmModuleDbEntityList.size(); i2++) {
if(mdmModuleDbEntityList.get(i2).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())){
if (mdmModuleDbEntityList.get(i2).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) {
mdmViewFiledVo.setDbName(mdmModuleDbEntityList.get(i2).getDbName());
mdmViewFiledVo.setDbType(mdmModuleDbEntityList.get(i2).getDbType());
mdmViewFiledVo.setMdmId(mdmModuleDbEntityList.get(i2).getMdmId());
@ -275,15 +313,15 @@ public class MdmServiceImpl implements IMdmService {
mdmViewFiledVo.setFiledType(mdmModuleDbFiledsEntityList.get(i1).getFiledType());
//字段规则
if(mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0){
if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) {
List<MdmModuleDbFiledsRuleEntity> ruleList = new ArrayList<>();
for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) {
if(mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())){
if (mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) {
ruleList.add(mdmModuleDbFiledsRuleEntityList.get(i2));
}
}
mdmViewFiledVo.setRuleList(ruleList);
if("data_status".equals(mdmModuleDbFiledsEntityList.get(i1).getEnName())){
if ("data_status".equals(mdmModuleDbFiledsEntityList.get(i1).getEnName())) {
List<MdmModuleDbFiledsRuleEntity> a = new ArrayList<>();
MdmModuleDbFiledsRuleEntity msgRuleTitie = new MdmModuleDbFiledsRuleEntity();
@ -330,7 +368,7 @@ public class MdmServiceImpl implements IMdmService {
}
}
}
if(mdmViewFiledVos != null && mdmViewFiledVos.size() > 0){
if (mdmViewFiledVos != null && mdmViewFiledVos.size() > 0) {
for (int i = 0; i < mdmViewFiledVos.size(); i++) {
mdmViewFiledVos.get(i).setSorts(i);
}
@ -338,6 +376,7 @@ public class MdmServiceImpl implements IMdmService {
return mdmViewFiledVos;
}
//
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -370,7 +409,7 @@ public class MdmServiceImpl implements IMdmService {
//
if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) {
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) {
for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) {
if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) {
@ -586,6 +625,7 @@ public class MdmServiceImpl implements IMdmService {
// mdmViewFiledVos.add(mdmViewFiledVo);
//}
//
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -599,24 +639,25 @@ public class MdmServiceImpl implements IMdmService {
if (entity == null) {
return BaseResult.getFailureMessageEntity("参数不允许为空");
}
entity.setMdmCode(10007L);
if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if(mdmModuleEntity == null || mdmModuleEntity.getId() == null ){
if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("主数据设置错误");
}
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDbEntity.setSts("Y");
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){
if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) {
return BaseResult.getFailureMessageEntity("主数据设置错误");
}
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if("1".equals(mdmModuleDbEntities.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) {
entity.setTableName(mdmModuleDbEntities.get(i).getDbName());
break;
}
}
}
//判断分页
if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) {
return BaseResult.getFailureMessageEntity("分页查询参数不存在");
@ -710,6 +751,7 @@ public class MdmServiceImpl implements IMdmService {
// return BaseResult.getSuccessMessageEntity("查询数据成功", returnData);
//}
//
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -741,6 +783,7 @@ public class MdmServiceImpl implements IMdmService {
}
}
//
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -763,13 +806,10 @@ public class MdmServiceImpl implements IMdmService {
if (entity.getUpId() == null || "".equals(entity.getUpId())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) {
return BaseResult.getFailureMessageEntity("系统错误");
}
if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){
//查询模版
MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if (mdmModuleEntities == null ) {
if (mdmModuleEntities == null) {
return BaseResult.getFailureMessageEntity("系统错误");
}
//查询数据源主表
@ -781,14 +821,13 @@ public class MdmServiceImpl implements IMdmService {
return BaseResult.getFailureMessageEntity("系统错误");
}
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if("1".equals(mdmModuleDbEntityList.get(i).getDbType())){
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
mdmModuleDbEntity = mdmModuleDbEntityList.get(i);
break;
}
}
entity.setTableName(mdmModuleDbEntity.getDbName());
}
if (checkStr(entity.getId())) {
if (!checkStr(entity.getValue())) {
@ -837,6 +876,7 @@ public class MdmServiceImpl implements IMdmService {
return BaseResult.getSuccessMessageEntity("查询数据成功", returnList);
}
}
//
private List<HashMap<String, Object>> gettochilder(String[] strArray, int i, List<HashMap<String, Object>> mapList) {
List<HashMap<String, Object>> maps = new ArrayList<>();
@ -851,6 +891,7 @@ public class MdmServiceImpl implements IMdmService {
}
return maps;
}
//
//private HashMap<String, Object> getFathers(List<HashMap<String, Object>> mapListAll, HashMap<String, Object> mapList, MdmDto entity) {
// if (mapList.get("upID") == null) {
@ -896,6 +937,7 @@ public class MdmServiceImpl implements IMdmService {
return returnList;
}
//
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -954,9 +996,9 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleViewDetailEntity.setViewType(entity.getShowType());//设置显示字段类型
List<MdmModuleViewDetailEntity> queryAll = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity);
List<MdmModuleViewDetailEntity> mdmModuleViewDetailEntityList = new ArrayList<>();
if(queryAll != null && queryAll.size() > 0){
if (queryAll != null && queryAll.size() > 0) {
for (int i = 0; i < queryAll.size(); i++) {
if(entity.getShowType().equals(queryAll.get(i).getViewType())){
if (entity.getShowType().equals(queryAll.get(i).getViewType())) {
mdmModuleViewDetailEntityList.add(queryAll.get(i));
}
}
@ -1250,6 +1292,7 @@ public class MdmServiceImpl implements IMdmService {
// }
//}
//
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -1272,7 +1315,7 @@ public class MdmServiceImpl implements IMdmService {
//查询模版
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode());
if (mdmModuleEntity == null ) {
if (mdmModuleEntity == null) {
return BaseResult.getFailureMessageEntity("系统错误");
}
//查询数据源主表
@ -1313,6 +1356,7 @@ public class MdmServiceImpl implements IMdmService {
return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject);
}
/**
* @param object
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -1347,7 +1391,7 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
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)) {
return BaseResult.getSuccessMessageEntity("修改数据成功");
@ -1391,7 +1435,9 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
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)) {
return BaseResult.getSuccessMessageEntity("保存数据成功");
@ -1399,8 +1445,29 @@ public class MdmServiceImpl implements IMdmService {
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
* @return com.hzya.frame.web.entity.JsonResultEntity
@ -1420,7 +1487,7 @@ public class MdmServiceImpl implements IMdmService {
}
//校验唯一
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(jsonObject.getLong("mdmCode"));
if (mdmModuleEntity == null ) {
if (mdmModuleEntity == null) {
return BaseResult.getFailureMessageEntity("系统错误");
}
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
@ -1430,9 +1497,10 @@ public class MdmServiceImpl implements IMdmService {
if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) {
return BaseResult.getFailureMessageEntity("系统错误");
}
String dbname = null;
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) {
dbname = mdmModuleDbEntityList.get(i).getDbName();
//查询视图如果树形删除下级及子集
//查询展示类型
MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity();
@ -1472,7 +1540,7 @@ public class MdmServiceImpl implements IMdmService {
}
mdmModuleDao.deleteTemplateById(formmainDeleteDto);
}else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
} else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) {
//删除明细
FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto();
formmainDeleteDto.setFormmain_id(jsonObject.getString("id"));
@ -1480,168 +1548,338 @@ public class MdmServiceImpl implements IMdmService {
formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName());
mdmModuleDao.deleteTemplateById(formmainDeleteDto);
}
}
saveOption(dbname,mdmModuleEntity.getMdmCode(),jsonObject,jsonObject.getString("id"),"界面删除");
return BaseResult.getSuccessMessageEntity("删除数据成功");
}
//
//
///**
// * @param object
// * @return com.hzya.frame.web.entity.JsonResultEntity
// * @Author lvleigang
// * @Description 处理分发数据
// * @Date 9:40 上午 2023/10/18
// **/
//@Override
//public JsonResultEntity doMdmDistribute(JSONObject object) {
// JSONObject jsonObject = getstrObj("jsonStr", object);
// //校验是否有servecr传参
// if (!checkData(jsonObject, "mdmCode")) {
// return BaseResult.getFailureMessageEntity("请先传递服务名");
// }
// if (!checkData(jsonObject, "id")) {
// return BaseResult.getFailureMessageEntity("请先传递要删除的数据");
// }
// if (!checkData(jsonObject, "appID")) {
// return BaseResult.getFailureMessageEntity("请先传递要删除的数据");
// }
// if (!checkData(jsonObject, "dataType")) {
// return BaseResult.getFailureMessageEntity("请先传递要删除的数据");
// }
// if("2".equals(jsonObject.getString("dataType"))){
// boolean flag = false;
// //1根据服务名查询分发数据
// MdmModuleEntity mdmModuleEntity = new MdmModuleEntity();
// mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode"));
// mdmModuleEntity.setSts("Y");
// List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity);
// if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) {
// MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
// mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId());
// mdmModuleDbEntity.setDbType("1");
// mdmModuleDbEntity.setSts("Y");
// List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity);
// if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) {
// mdmModuleDbEntity = mdmModuleDbEntities.get(0);
// }
// MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity();
// mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID"));
// mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId());
// List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity);
// 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查找插件
// SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getAddPlug());
// if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){
// //3调用插件
// PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode());
// try {
// JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject);
// flag = true;
// } catch (Exception e) {
// logger.error("插件处理失败"+e.getMessage());
// }
// }
// }
// } else {
// //TODO 连线
// flag = true;
// }
// }
// if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) {
// MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity();
// mdmDistributeEntity.setCreate();
// mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute");
// mdmDistributeEntity.setFormmainId(jsonObject.getString("id"));
// mdmDistributeEntity.setAppId(jsonObject.getString("appID"));
// mdmDistributeEntity.setStatus("1");
// mdmDistributeEntity.setMsg("发送成功");
// if (!flag) {
// mdmDistributeEntity.setStatus("3");
// mdmDistributeEntity.setMsg("发送失败");
// }
// mdmModuleDao.saveDistribute(mdmDistributeEntity);
// return BaseResult.getSuccessMessageEntity("下发数据成功");
//
// }else {
// return BaseResult.getFailureMessageEntity("系统错误");
// }
// }else {
// return BaseResult.getFailureMessageEntity("系统错误");
// }
// }else {
// if (!checkData(jsonObject, "distributeID")) {
// return BaseResult.getFailureMessageEntity("请先传递分发数据");
// }
// boolean flag = false;
// //1根据服务名查询分发数据
// MdmModuleEntity mdmModuleEntity = new MdmModuleEntity();
// mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode"));
// mdmModuleEntity.setSts("Y");
// List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity);
// if (mdmModuleEntities != null && mdmModuleEntities.size() == 1) {
// MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
// mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId());
// mdmModuleDbEntity.setDbType("1");
// mdmModuleDbEntity.setSts("Y");
// List<MdmModuleDbEntity> mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity);
// if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) {
// mdmModuleDbEntity = mdmModuleDbEntities.get(0);
// }
// MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity();
// mdmModuleDistributeEntity.setAppId(jsonObject.getString("appID"));
// mdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(0).getId());
// List<MdmModuleDistributeEntity> mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity);
// if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() == 1) {
// if (mdmModuleDistributeEntities.get(0).getDeleteType() != null && "1".equals(mdmModuleDistributeEntities.get(0).getDeleteType())) {
// //2查找插件
// if (mdmModuleDistributeEntities.get(0).getDeletePlug() != null && !"".equals(mdmModuleDistributeEntities.get(0).getDeletePlug())) {
// //2查找插件
// SysApplicationPluginEntity sysApplicationPluginEntity = sysApplicationPluginDao.get(mdmModuleDistributeEntities.get(0).getDeletePlug());
// if(sysApplicationPluginEntity.getPluginCode() != null && !"".equals(sysApplicationPluginEntity.getPluginCode())){
// //3调用插件
// PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode());
// try {
// JsonResultEntity s = pluginBaseEntity.executeBusiness(jsonObject);
// flag = true;
// } catch (Exception e) {
// logger.error("插件处理失败"+e.getMessage());
// }
// }
// }
// } else {
// //TODO 连线
// flag = true;
// }
// }
// if(mdmModuleDbEntity.getDbName()!= null && !"".equals(mdmModuleDbEntity.getDbName())) {
// //删除数据
// MdmDistributeEntity mdmDistributeEntity = new MdmDistributeEntity();
// mdmDistributeEntity.setId(jsonObject.getString("distributeID"));
// mdmDistributeEntity.setTableName(mdmModuleDbEntity.getDbName()+"_distribute");
// mdmDistributeEntity.setFormmainId(jsonObject.getString("id"));
// mdmDistributeEntity.setAppId(jsonObject.getString("appID"));
// mdmDistributeEntity.setStatus("1");
// mdmDistributeEntity.setMsg("删除成功");
// if (!flag) {
// mdmDistributeEntity.setStatus("3");
// mdmDistributeEntity.setMsg("删除失败");
// }
// mdmModuleDao.updateDistribute(mdmDistributeEntity);
// return BaseResult.getSuccessMessageEntity("删除数据成功");
//
// }else {
// return BaseResult.getFailureMessageEntity("系统错误");
// }
// }else {
// return BaseResult.getFailureMessageEntity("系统错误");
// }
// }
//
//}
//
/**
* @param jsonStr
* @return com.hzya.frame.web.entity.JsonResultEntity
* @Author lvleigang
* @Description 处理分发数据
* @Date 9:40 上午 2023/10/18
**/
@Override
public JsonResultEntity doMdmDistribute(JSONObject jsonStr) {
JSONObject jsonObject = getstrObj("jsonStr", jsonStr);
//校验是否有servecr传参
if (!checkData(jsonObject, "mdmCode")) {
return BaseResult.getFailureMessageEntity("请先传递服务名");
}
if (!checkData(jsonObject, "id")) {
return BaseResult.getFailureMessageEntity("请先传递要下发数据");
}
if (!checkData(jsonObject, "distributeId")) {
return BaseResult.getFailureMessageEntity("请先传递要下发的数据");
}
if (!checkData(jsonObject, "type")) {
return BaseResult.getFailureMessageEntity("系统错误");
}
Long mdmCode = jsonObject.getLong("mdmCode");//主数据编码
String id = jsonObject.getString("id");//行数据的单据规则编码
String distributeId = jsonObject.getString("distributeId");//发送表id
String type = jsonObject.getString("type");//发送类型1新增2修改3删除
String apiId = null;
String scriptId = null;
//查找对应数据组装数据发送
//获取主数据信息
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(mdmCode);
if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("主数据不存在");
}
//获取主数据db
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) {
return BaseResult.getFailureMessageEntity("主数据数据源不存在");
}
//获取分发表
//获取分发的接口
MdmModuleDistributeEntity mdmModuleDistributeEntity = mdmModuleDistributeDao.get(distributeId);
if (mdmModuleDistributeEntity == null || mdmModuleDistributeEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("分发不存在");
}
// 启用停用 0停用
if ("0".equals(mdmModuleDistributeEntity.getEnabledState())) {
return BaseResult.getFailureMessageEntity("分发已停用");
}
MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity();
mdmModuleDistributeDetailEntity.setDistributeId(distributeId);
mdmModuleDistributeDetailEntity.setSts("Y");
List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity);
// 启用停用 0停用
if ("1".equals(mdmModuleDistributeEntity.getEnabledType())) {
return BaseResult.getFailureMessageEntity("分发为自动下发,不允许手动下发");
}
//1新增2修改3删除
if ("1".equals(type)) {
apiId = mdmModuleDistributeEntity.getAddApi();
scriptId = mdmModuleDistributeEntity.getAddScript();
} else if ("2".equals(type)) {
apiId = mdmModuleDistributeEntity.getUpdateApi();
scriptId = mdmModuleDistributeEntity.getUpdateScript();
} else if ("3".equals(type)) {
apiId = mdmModuleDistributeEntity.getDeleteApi();
scriptId = mdmModuleDistributeEntity.getDeleteScript();
}
if (apiId == null || "".equals(apiId)) {
return BaseResult.getFailureMessageEntity("分发接口未选择,请先选择");
}
SysApplicationScriptEntity scriptEntity = null;
if (scriptId != null && !"".equals(scriptId)) {
scriptEntity = sysApplicationScriptDao.get(scriptId);
if (scriptEntity == null || scriptEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("分发接口脚本不存在");
}
}
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(apiId);
if (apiEntity == null || apiEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("分发接口不存在");
}
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if (sysApplicationEntity == null || sysApplicationEntity.getId() == null) {
return BaseResult.getFailureMessageEntity("应用不存在");
}
//获取主数据db字段以及字段的规则
MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity();
queryFild.setMdmId(mdmModuleEntity.getId());
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild);
MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity();
queryFildRule.setMdmId(mdmModuleEntity.getId());
queryFildRule.setRuleCode("service");
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
String dbname = null;
//获取主数据db对应的实体表的数据
JSONObject object = new JSONObject();
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) {
dbname = mdmModuleDbEntities.get(i).getDbName();
Map<String, Object> map = new HashMap<>();
map.put("tableName", mdmModuleDbEntities.get(i).getDbName());
map.put("id", id);
object = mdmModuleDao.queryMdmST(map);
if (object.getString("id") == null || "".equals(object.getString("id"))) {
return BaseResult.getFailureMessageEntity("当前数据不存在");
}
if (mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0) {
Map<String, Object> checkData = new HashMap<>();
checkData.put("tableName", mdmModuleDbEntities.get(i).getDbName());
checkData.put("id", id);
checkData.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
if (object1.getString("id") == null || "".equals(object1.getString("id"))) {
return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送");
}
}
//查看主表是否有字段是关联的
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())) {
Map<String, Object> mapDetail = new HashMap<>();
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
mapDetail.put("id", object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(), objectDetail);
}
}
}
}
}
}
}
}
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) {
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 saveData
@ -1653,9 +1891,14 @@ public class MdmServiceImpl implements IMdmService {
* @Description 校验数据
* @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();
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();
@ -1789,7 +2032,7 @@ public class MdmServiceImpl implements IMdmService {
mdmTableCodeRuleEntity.setSts("Y");
List<MdmTableCodeRuleEntity> allMdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity);
List<MdmTableCodeRuleEntity> mdmTableCodeRuleEntities = new ArrayList<>();
if(allMdmTableCodeRuleEntities != null && allMdmTableCodeRuleEntities.size() > 0){
if (allMdmTableCodeRuleEntities != null && allMdmTableCodeRuleEntities.size() > 0) {
mdmTableCodeRuleEntities = allMdmTableCodeRuleEntities;
//for (int i1 = 0; i1 < allMdmTableCodeRuleEntities.size(); i1++) {
// if(mdmModuleDbEntityList.get(i).getId().equals(allMdmTableCodeRuleEntities.get(i1).getDbId())){
@ -1838,7 +2081,8 @@ public class MdmServiceImpl implements IMdmService {
mdmDataFiledDtos.add(update_status);
MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("data_status");
data_status.setFiledsValue("F");;
data_status.setFiledsValue("F");
;
mdmDataFiledDtos.add(data_status);
int a = mdmModuleDao.updateForm(mdmDataDto);
} else {
@ -1852,15 +2096,18 @@ public class MdmServiceImpl implements IMdmService {
mdmDataFiledDtos.add(ids);
MdmDataFiledDto data_status = new MdmDataFiledDto();
data_status.setFiledsName("data_status");
data_status.setFiledsValue("Y");;
data_status.setFiledsValue("Y");
;
mdmDataFiledDtos.add(data_status);
MdmDataFiledDto org_id = new MdmDataFiledDto();
org_id.setFiledsName("org_id");
org_id.setFiledsValue("Y");;
org_id.setFiledsValue("Y");
;
mdmDataFiledDtos.add(org_id);
MdmDataFiledDto company_id = new MdmDataFiledDto();
company_id.setFiledsName("company_id");
company_id.setFiledsValue("Y");;
company_id.setFiledsValue("Y");
;
mdmDataFiledDtos.add(company_id);
MdmDataFiledDto add_status = new MdmDataFiledDto();
@ -1897,9 +2144,9 @@ public class MdmServiceImpl implements IMdmService {
mdmModuleDbFiledsEntity1.setSts("Y");
List<MdmModuleDbFiledsEntity> allfileds = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity1);
List<MdmModuleDbFiledsEntity> fileds = new ArrayList<>();
if(allfileds != null && allfileds.size() > 0){
if (allfileds != null && allfileds.size() > 0) {
for (int i1 = 0; i1 < allfileds.size(); i1++) {
if(mdmModuleDbEntityList.get(i).getId().equals(allfileds.get(i1).getDbId())){
if (mdmModuleDbEntityList.get(i).getId().equals(allfileds.get(i1).getDbId())) {
fileds.add(allfileds.get(i1));
}
}
@ -1948,6 +2195,9 @@ public class MdmServiceImpl implements IMdmService {
}
}
}
saveOption(dbname,mdmCode,saveData,id,msg);
}
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.PageInfo;
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.sysnew.application.api.dao.ISysApplicationApiDao;
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiDto;
@ -104,7 +106,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
private ISysMessageManageDao sysMessageManageDao;
@Resource
private ISysMessageManageDetailDao sysMessageManageDetailDao; //明细表
@Resource
private IMdmModuleDistributeDao mdmModuleDistributeDao;
@Resource
private IIntegrationTaskCacheableService iIntegrationTaskCacheableService;
@Resource
@ -631,6 +634,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
SysApplicationEntity sysApplicationEntity = new SysApplicationEntity();
sysApplicationEntity.setId(entity.getId());
/** 应用logo地址或者id */
sysApplicationEntity.setAppType(entity.getAppType());
/** 应用logo地址或者id */
sysApplicationEntity.setAppLogo(entity.getAppLogo());
/** 应用是否启用1、启用 2、停用 */
sysApplicationEntity.setAppStatus(entity.getAppStatus());
@ -2368,6 +2373,14 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
}
if (entity.getId() == null || "".equals(entity.getId())) {
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();
sysApplicationScriptDao.logicRemoveMultiCondition(entity);