增加api扩展方法,获取应用名称和应用编码

This commit is contained in:
hecan 2024-06-11 14:27:42 +08:00 committed by 476474485@qq.com
parent 5f27f7d631
commit 75face51b2
4 changed files with 45 additions and 18 deletions

View File

@ -102,8 +102,8 @@ public class MasterDataOrgsServiceImpl extends BaseService<ComparisonEntity, Str
main.put(key, hashMap.get(key));
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("appName","数智中台");
jsonObjectUser.put("appCode","800004");
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {
@ -121,8 +121,8 @@ public class MasterDataOrgsServiceImpl extends BaseService<ComparisonEntity, Str
main.put("id",id);
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("appName","数智中台");
jsonObjectUser.put("appCode","800004");
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {

View File

@ -95,8 +95,8 @@ public class MasterDataProjectServiceImpl extends BaseService<ComparisonEntity,
main.put(key, hashMap.get(key));
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("appName","数智中台");
jsonObjectUser.put("appCode","800004");
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {
@ -114,8 +114,8 @@ public class MasterDataProjectServiceImpl extends BaseService<ComparisonEntity,
main.put("id",id);
}
jsonObjectUser.put("main", main);
jsonObjectUser.put("sourceName",mdmModuleSourceEntity.getSourceName());
jsonObjectUser.put("code",mdmModuleSourceEntity.getSourceCode());
jsonObjectUser.put("appName","数智中台");
jsonObjectUser.put("appCode","800004");
jsonObjectUser.put("optionName", "数智中台");
jsonStr.put("jsonStr", jsonObjectUser);
try {

View File

@ -3,6 +3,7 @@ package com.hzya.frame.sysnew.comparison.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
@ -16,7 +17,6 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
* @Author hecan
* @Date 2024/5/7 15:55
* **/
@DS("master")
JsonResultEntity queryEntityPage(JSONObject jsonObject);
/**
@ -27,7 +27,6 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
* @Author hecan
* @Date 2024/5/7 16:52
* **/
@DS("master")
JsonResultEntity saveEntity(JSONObject jsonObject);
/**
@ -38,7 +37,6 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
* @Author hecan
* @Date 2024/5/9 10:19
* **/
@DS("master")
JsonResultEntity updateEntity(JSONObject jsonObject);
/**
@ -49,6 +47,16 @@ public interface IComparisonService extends IBaseService<ComparisonEntity, Strin
* @Author hecan
* @Date 2024/5/9 13:59
* **/
@DS("master")
JsonResultEntity deleteEntity(JSONObject jsonObject);
/**
*
* @content 获取应用编码和应用名称
* @Param
* @Return
* @Author hecan
* @Date 2024/6/11 11:37
* **/
SysExtensionApiEntity getAppNameAndCode(SysExtensionApiEntity sysExtensionApiEntity);
}

View File

@ -10,6 +10,8 @@ import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
import com.hzya.frame.mdm.service.impl.MdmServiceCache;
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.sysnew.comparison.controlsLog.dao.impl.ControlsLogDaoImpl;
import com.hzya.frame.sysnew.comparison.dao.IComparisonDao;
import com.hzya.frame.sysnew.comparison.dao.IComparisonDetailsDao;
@ -79,6 +81,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
comparisonEntity.setDbName(entity.getDbName());
if(!"mdmCode".equals(key)){
map.put(key, jsonObject.getString(key));
map.remove("appName");
map.remove("appCode");
}
}
}
@ -207,10 +211,10 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
//comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne);
map.put("details",mapDetails);
//保存操作日志
controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
}
//保存操作日志
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
return BaseResult.getSuccessMessageEntity("保存成功", map);
} catch (Exception e) {
logger.info("保存通用数据时候错误:{}", e.getMessage());
@ -292,10 +296,10 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
comparisonDetailsEntity.setMapDetails(mapDetails);
comparisonDetailsDao.updateComparisonDetailsByType(comparisonDetailsEntity);
//保存操作日志
controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
}
//保存操作日志
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
return BaseResult.getSuccessMessageEntity("更新成功", integer);
}else{
return BaseResult.getFailureMessageEntity("更新失败");
@ -318,6 +322,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
if (!checkStr(jsonObject.getString("mdmCode"))) {
return BaseResult.getFailureMessageEntity("主数据编码为空");
}
if (!checkStr(jsonObject.getString("optionName"))) {
return BaseResult.getFailureMessageEntity("操作人为空");
}
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
JSONObject jsonObjectMain=jsonObject.getJSONObject("main");//获取主表数据
@ -361,9 +368,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
comparisonDetailsEntity.setFormmainId(jsonObjectMain.getString("id"));
comparisonDetailsEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
comparisonDetailsDao.deleteComparisonDetails(comparisonDetailsEntity);
controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
}
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("sourceName"),jsonObject.getString("code"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
return BaseResult.getSuccessMessageEntity("删除成功",integer);
}else{
return BaseResult.getFailureMessageEntity("删除失败","请查看id是否在表中存在");
@ -376,6 +383,18 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
return BaseResult.getFailureMessageEntity("查询失败","请检查传递参数");
}
//根据应用key和应用密钥获取应用编码和应用名称
@Override
public SysExtensionApiEntity getAppNameAndCode(SysExtensionApiEntity sysExtensionApiEntity) {
String bodys = sysExtensionApiEntity.getBodys();
SysApplicationEntity sendApp = sysExtensionApiEntity.getSendApp();
JSONObject jsonObject = JSON.parseObject(bodys);
jsonObject.put("appName",sendApp.getName());
jsonObject.put("appCode",sendApp.getAppId());
sysExtensionApiEntity.setBodys(jsonObject.toJSONString());
return sysExtensionApiEntity;
}
//根据不同的日期格式返回不同的值
private String getRuleDate(String str){
switch (str){