Merge branch 'dev' of http://192.168.2.237:3000/root/kangarooDataCenterV3 into yuecheng-project
This commit is contained in:
commit
6779afc801
6
pom.xml
6
pom.xml
|
@ -369,6 +369,12 @@
|
|||
<artifactId>flyway-mysql</artifactId>
|
||||
<version>8.5.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>tlog-all-spring-boot-starter</artifactId>
|
||||
<version>1.5.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -9,12 +9,12 @@ public interface IControlsLogDao extends IBaseDao<ControlsLogEntity, String> {
|
|||
/**
|
||||
*
|
||||
* @content 操作日志保存
|
||||
* @Param formmainId:主表id,sourceName:来源名称,code:来源编码,sourceData:源数据,optionType:操作类型,optionName:操作人,dbName:数据库名称
|
||||
* @Param formmainId:主表id,sourceName:来源名称,code:来源编码,sourceData:源数据,optionType:操作类型,optionName:操作人,dbName:数据库名称,dataType:类型:1成功,2失败
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024/6/5 15:29
|
||||
* **/
|
||||
@DS("master")
|
||||
ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName);
|
||||
ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName,String dataType);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,7 @@ public class ControlsLogDaoImpl extends MybatisGenericDao<ControlsLogEntity, St
|
|||
|
||||
//操作日志新增
|
||||
@Override
|
||||
@DS("master")
|
||||
public ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName) {
|
||||
public ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName,String dataType) {
|
||||
ControlsLogEntity controlsLogEntity=new ControlsLogEntity();
|
||||
controlsLogEntity.setId(UUIDUtils.getUUID());
|
||||
controlsLogEntity.setFormmainId(formmainId);
|
||||
|
@ -23,6 +22,7 @@ public class ControlsLogDaoImpl extends MybatisGenericDao<ControlsLogEntity, St
|
|||
controlsLogEntity.setOptionType(optionType);
|
||||
controlsLogEntity.setOptionName(optionName);
|
||||
controlsLogEntity.setDbName(dbName);
|
||||
controlsLogEntity.setDataType(dataType);
|
||||
controlsLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
controlsLogEntity.setOrg_id("0");
|
||||
|
|
|
@ -20,6 +20,25 @@ public class ControlsLogEntity extends BaseEntity {
|
|||
|
||||
private String dbName;//表名称
|
||||
|
||||
private String dataType;//状态 1、成功2、失败
|
||||
private String remark;//备注
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getDbName() {
|
||||
return dbName;
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@
|
|||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="formmainId" column="formmain_id" jdbcType="VARCHAR"/>
|
||||
<result property="sourceName" column="source_name" jdbcType="INTEGER"/>
|
||||
<result property="sourceName" column="source_name" jdbcType="VARCHAR"/>
|
||||
<result property="code" column="code" jdbcType="VARCHAR"/>
|
||||
<result property="sourceData" column="source_data" jdbcType="TIMESTAMP"/>
|
||||
<result property="sourceData" column="source_data" jdbcType="VARCHAR"/>
|
||||
<result property="optionType" column="option_type" jdbcType="VARCHAR"/>
|
||||
<result property="optionName" column="option_name" jdbcType="TIMESTAMP"/>
|
||||
<result property="optionName" column="option_name" jdbcType="VARCHAR"/>
|
||||
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
|
||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<!--分页查询数据-->
|
||||
|
@ -31,6 +33,8 @@
|
|||
<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>
|
||||
<if test="dataType != null and dataType != ''">and data_type = #{dataType}</if>
|
||||
<if test="remark != null and remark != ''">and remark = #{remark}</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>
|
||||
|
@ -56,6 +60,8 @@
|
|||
<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>
|
||||
<if test="dataType != null and dataType != ''"> data_type,</if>
|
||||
<if test="remark != null and remark != ''"> remark,</if>
|
||||
<if test="sorts == null"> sorts , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
|
@ -74,6 +80,8 @@
|
|||
<if test="sourceData != null and sourceData != ''">#{sourceData} ,</if>
|
||||
<if test="optionType != null and optionType != ''">#{optionType} ,</if>
|
||||
<if test="optionName != null and optionName != ''">#{optionName} ,</if>
|
||||
<if test="dataType != null and dataType != ''"> #{dataType},</if>
|
||||
<if test="remark != null and remark != ''"> #{remark},</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from ${dbName} a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
|
@ -99,6 +107,8 @@
|
|||
<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>
|
||||
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</if>
|
||||
<if test="remark != null and remark != ''"> remark = #{remark},</if>
|
||||
<if test="sorts != null"> sorts = #{sorts},</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>
|
||||
|
@ -125,6 +135,8 @@
|
|||
<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>
|
||||
<if test="dataType != null and dataType != ''"> data_type = #{dataType},</if>
|
||||
<if test="remark != null and remark != ''"> remark = #{remark},</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>
|
||||
|
|
|
@ -109,5 +109,15 @@ public interface IComparisonDao extends IBaseDao<ComparisonEntity, String> {
|
|||
* @Date 2024/6/4 11:45
|
||||
* **/
|
||||
List<ComparisonEntity> queryComparisonBymdmIdFileds(ComparisonEntity comparison);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 根据mdm_id查询mdm_module_db_fileds_rule中的字段是否是必填项
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024/6/25 15:09
|
||||
* **/
|
||||
List<ComparisonEntity> queryComparisonBymdmIdDbIdFiledId(ComparisonEntity comparison);
|
||||
|
||||
}
|
||||
|
|
|
@ -81,4 +81,11 @@ public class ComparisonDaoImpl extends MybatisGenericDao<ComparisonEntity, Strin
|
|||
return list;
|
||||
}
|
||||
|
||||
//根据mdm_id查询mdm_module_db_fileds_rule中的字段是否是必填项
|
||||
@Override
|
||||
public List<ComparisonEntity> queryComparisonBymdmIdDbIdFiledId(ComparisonEntity comparison) {
|
||||
List<ComparisonEntity> list =(List<ComparisonEntity>) super.selectList(getSqlIdPrifx() + "queryComparisonBymdmIdDbIdFiledId", comparison);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,24 @@ public class ComparisonDetailsEntity extends BaseEntity {
|
|||
private String formmainId;//上级id
|
||||
|
||||
private String dataId;//第三方主键id
|
||||
private String ruleCode;//规则编码required 判断字段是否是必填
|
||||
private String ruleValue;//规则值 true/false 判断字段是否是必填
|
||||
|
||||
public String getRuleCode() {
|
||||
return ruleCode;
|
||||
}
|
||||
|
||||
public void setRuleCode(String ruleCode) {
|
||||
this.ruleCode = ruleCode;
|
||||
}
|
||||
|
||||
public String getRuleValue() {
|
||||
return ruleValue;
|
||||
}
|
||||
|
||||
public void setRuleValue(String ruleValue) {
|
||||
this.ruleValue = ruleValue;
|
||||
}
|
||||
|
||||
public String getDataId() {
|
||||
return dataId;
|
||||
|
|
|
@ -45,6 +45,33 @@ public class ComparisonEntity extends BaseEntity {
|
|||
private String viewType;//显示类型:显示
|
||||
|
||||
private String dataId;//第三方主键id
|
||||
private String ruleCode;//规则编码required 判断字段是否是必填
|
||||
private String ruleValue;//规则值 true/false 判断字段是否是必填
|
||||
private String filedId;//mdm_module_db_fileds_rule的id
|
||||
|
||||
public String getFiledId() {
|
||||
return filedId;
|
||||
}
|
||||
|
||||
public void setFiledId(String filedId) {
|
||||
this.filedId = filedId;
|
||||
}
|
||||
|
||||
public String getRuleCode() {
|
||||
return ruleCode;
|
||||
}
|
||||
|
||||
public void setRuleCode(String ruleCode) {
|
||||
this.ruleCode = ruleCode;
|
||||
}
|
||||
|
||||
public String getRuleValue() {
|
||||
return ruleValue;
|
||||
}
|
||||
|
||||
public void setRuleValue(String ruleValue) {
|
||||
this.ruleValue = ruleValue;
|
||||
}
|
||||
|
||||
public String getDataId() {
|
||||
return dataId;
|
||||
|
|
|
@ -82,6 +82,19 @@
|
|||
from ${dbName} where document_rule like concat(#{rulePrefix},'-',date_format(NOW(),#{ruleMiddle}),'-','%');
|
||||
</select>
|
||||
|
||||
<!--根据mdm_id查询mdm_module_db_fileds_rule中的字段是否是必填项-->
|
||||
<select id="queryComparisonBymdmIdDbIdFiledId" resultMap="get-ComparisonEntity-result"
|
||||
parameterType="com.hzya.frame.sysnew.comparison.entity.ComparisonEntity">
|
||||
select filed.ch_name as chName,filed.en_name as enName,filed.filed_type as filedType,
|
||||
rule.rule_value as ruleValue,rule.rule_code as ruleCode,db.db_name as dbName,db.db_type as dbType
|
||||
from mdm_module_db_fileds filed
|
||||
left join mdm_module_db db on db.id=filed.db_id
|
||||
left join mdm_module_db_fileds_rule rule on filed.id=rule.filed_id
|
||||
where filed.sts='Y' and rule.sts='Y' and db.sts='Y'
|
||||
and rule.rule_code='required' and rule.rule_value='true'
|
||||
and rule.mdm_id=#{mId}
|
||||
</select>
|
||||
|
||||
<!--新增档案数据-->
|
||||
<insert id="saveComparison" parameterType = "java.util.Map">
|
||||
insert into ${dbName}
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
|
|||
import com.hzya.frame.sysnew.comparison.service.IComparisonService;
|
||||
import com.hzya.frame.uuid.UUIDLong;
|
||||
import com.hzya.frame.uuid.UUIDUtils;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -140,6 +141,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
|
||||
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
|
||||
List<ComparisonEntity> comparisonEntities=new ArrayList<>();
|
||||
String uuid= String.valueOf(UUIDLong.longUUID());
|
||||
try {
|
||||
//根据主数据编码查询表名称,字段名称等信息 10001
|
||||
// comparisonEntities = comparisonDao.queryComparison(comparisonEntity);
|
||||
|
@ -153,7 +155,9 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
JSONObject jsonObjectMain=new JSONObject();
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
List<JSONArray> arrayList=new ArrayList<>();
|
||||
//根据dbtype和dbname分组,拿到表名称和表类型
|
||||
|
||||
String tableName=null;
|
||||
//根据dbtype和dbname分组,拿到表名称和表类型
|
||||
Map<String, Map<String, List<ComparisonEntity>>> collect = comparisonEntities.stream().collect(Collectors.groupingBy(ComparisonEntity::getDbName, Collectors.groupingBy(ComparisonEntity::getDbType)));
|
||||
List<Map.Entry<String, String>> keyPairs = collect.entrySet().stream()
|
||||
.flatMap(e1 -> e1.getValue().keySet().stream()
|
||||
|
@ -164,9 +168,12 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
//如果是1,就是主表,根据查询出来得主表是否是传输传递得主表
|
||||
if(keyPair.getValue().equals("1")){
|
||||
String main = jsonObject.getString(keyPair.getKey());
|
||||
tableName=keyPair.getKey();
|
||||
if(main!=null){
|
||||
jsonObjectMain = JSONObject.parseObject(main);
|
||||
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity("新增时候主表data_id不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -179,6 +186,8 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
JSONObject jsonObjectDetails = jsonArray.getJSONObject(i);
|
||||
jsonObjectDetails.put("table_name", keyPair.getKey());
|
||||
if(!checkStr(jsonObjectDetails.getString("data_id"))){
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity("新增时候明细data_id不能为空");
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +200,20 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
List<List<Map<String, Object>>> mapDetails = new ArrayList<>();//将子表数据存到map中
|
||||
if (comparisonEntities != null && comparisonEntities.size() > 0) {
|
||||
map = spliceMainMap(comparisonEntities, jsonObjectMain, map, comparisonEntity, comparisonDetailsEntity);
|
||||
String uuid= String.valueOf(UUIDLong.longUUID());
|
||||
|
||||
//判断输入的主表字段是否是必填项
|
||||
for (ComparisonEntity entity : comparisonEntities) {
|
||||
//如果必填字段不为空
|
||||
if(entity.getRuleValue()!=null && entity.getDbType().equals("1")){
|
||||
//如果值为空,说明没有传这个字段或者这个字段的值为空
|
||||
if(jsonObjectMain.getString(entity.getEnName()) ==null || jsonObjectMain.getString(entity.getEnName()).equals("")){
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName()+"表的"+entity.getEnName()+"字段不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map.put("id", uuid);
|
||||
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
|
@ -230,16 +252,40 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparisonEntityRule.setMap(map);
|
||||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候生成单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("通用数据保存接口中查询单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
try {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
JSONObject jsonObjectList = new JSONObject();
|
||||
|
||||
//判断明细表字段是否是必填项
|
||||
if (arrayList != null && arrayList.size() > 0) {
|
||||
for (JSONArray jsonArrayDetails : arrayList) {
|
||||
for (Object object : jsonArrayDetails) {
|
||||
JSONObject jsonObjectDetails = (JSONObject) JSON.toJSON(object);
|
||||
for (ComparisonEntity entity : comparisonEntities) {
|
||||
if(entity.getRuleValue()!=null && entity.getDbType().equals("2")){
|
||||
//如果值为空,说明没有传这个字段或者这个字段的值为空
|
||||
if(jsonObjectDetails.getString(entity.getEnName())==null || jsonObjectDetails.getString(entity.getEnName()).equals("")){
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName()+"表的"+entity.getEnName()+"字段不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//保存主表数据
|
||||
ComparisonEntity comparisonEntityOne = comparisonDao.saveComparison(comparisonEntityRule);
|
||||
jsonObjectList.put(comparisonEntityOne.getDbName(),map);
|
||||
|
@ -274,10 +320,12 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
list.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonEntityRule.getDbName()+"_option_log");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","1");
|
||||
return BaseResult.getSuccessMessageEntity("保存成功", list);
|
||||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
}
|
||||
|
@ -360,26 +408,16 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
return BaseResult.getFailureMessageEntity("根据data_id查询id数据为空,请检查data_id");
|
||||
}
|
||||
String id = String.valueOf(comparisonEntitiePages.get(0).get("id"));
|
||||
|
||||
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("org_id", "0");
|
||||
map.put("modify_time", new Date());
|
||||
map.put("sts", "Y");
|
||||
map.put("data_status","F");//数据状态
|
||||
map.put("update_status","0");//修改状态
|
||||
map.remove("id");
|
||||
comparisonEntity.setMap(map);
|
||||
comparisonEntity.setId(id);
|
||||
/*//生成单据规则
|
||||
comparisonEntity.setRulePrefix(jsonObject.getString("rulePrefix"));
|
||||
try {
|
||||
ComparisonEntity comparisonEntityRule = comparisonDao.queryComparisonRule(comparisonEntity);
|
||||
map.put("document_rule",comparisonEntityRule.getDocumentRule());//单据规则
|
||||
map.put("document_rule_num",comparisonEntityRule.getDocumentRuleNum());//单据规则流水号
|
||||
}catch (Exception e){
|
||||
logger.info("更新通用数据时候生成单据规则错误:{}",e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("更新失败",e.getMessage());
|
||||
}*/
|
||||
try {
|
||||
List<JSONObject> jsonObjects=new ArrayList<>();
|
||||
JSONObject jsonObjectList=new JSONObject();
|
||||
|
@ -398,14 +436,13 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
stringObjectMap.put("modify_time", new Date());
|
||||
stringObjectMap.put("sts", "Y");
|
||||
stringObjectMap.put("data_status","F");//数据状态
|
||||
stringObjectMap.remove("id");
|
||||
comparisonDetailsEntity.setDataId(String.valueOf(stringObjectMap.get("data_id")));
|
||||
comparisonDetailsEntity.setFormmainId(id);
|
||||
comparisonDetailsEntity.setMapDetails(stringObjectMap);
|
||||
comparisonDetailsEntity.setDbName(String.valueOf(stringObjectMap.get("table_name")));
|
||||
stringObjectMap.remove("table_name");
|
||||
comparisonDetailsDao.updateComparisonDetailsByType(comparisonDetailsEntity);
|
||||
//保存操作日志
|
||||
// controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
|
||||
}
|
||||
}
|
||||
jsonObjectList.put(comparisonDetailsEntity.getDbName(),mapDetails);
|
||||
|
@ -414,13 +451,15 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
jsonObjects.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),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","1");
|
||||
return BaseResult.getSuccessMessageEntity("更新成功", jsonObjects);
|
||||
}else{
|
||||
return BaseResult.getFailureMessageEntity("更新失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("更新通用数据时候错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity("更新失败");
|
||||
}
|
||||
}
|
||||
|
@ -501,6 +540,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
}
|
||||
String id = String.valueOf(comparisonEntitiePages.get(0).get("id"));
|
||||
|
||||
map.remove("id");
|
||||
comparisonEntity.setId(id);
|
||||
comparisonEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
comparisonEntity.setMap(map);
|
||||
|
@ -513,13 +553,14 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparisonDetailsDao.deleteComparisonDetails(comparisonDetailsEntity);
|
||||
// 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("appName"),jsonObject.getString("appCode"),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","1");
|
||||
return BaseResult.getSuccessMessageEntity("删除成功",integer);
|
||||
}else{
|
||||
return BaseResult.getFailureMessageEntity("删除失败","请查看data_id是否在表中存在");
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("删除通用数据数据错误:{}",e.getMessage());
|
||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity("删除失败");
|
||||
}
|
||||
}
|
||||
|
@ -610,6 +651,12 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(Long.valueOf(comparison.getMdmCode()));
|
||||
//根据模板主表id获取模版表数据
|
||||
if(mdmModuleEntity!=null){
|
||||
//根据mdm_id查询mdm_module_db_fileds_rule中的必填项字段
|
||||
ComparisonEntity comparisonEntity=new ComparisonEntity();
|
||||
comparisonEntity.setmId(mdmModuleEntity.getId());
|
||||
List<ComparisonEntity> comparisonEntitiesFieldRule = comparisonDao.queryComparisonBymdmIdDbIdFiledId(comparisonEntity);
|
||||
|
||||
//根据mdm_id查询mdm_module_db的信息
|
||||
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
|
||||
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
|
||||
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
|
||||
|
@ -641,6 +688,15 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
comparisonEntityFile.setmId(mdmModuleEntity.getId());
|
||||
comparisonEntityFile.setMdmName(mdmModuleEntity.getMdmName());
|
||||
comparisonEntityFile.setMdmCode(String.valueOf(mdmModuleEntity.getMdmCode()));
|
||||
if(CollectionUtils.isNotEmpty(comparisonEntitiesFieldRule)){
|
||||
for (ComparisonEntity entity : comparisonEntitiesFieldRule) {
|
||||
if(entity.getEnName().equals(moduleDbFiledsEntity.getEnName()) && entity.getDbType().equals(moduleDbEntity.getDbType())){
|
||||
//设置rule_code和rule_value,用于判断字段是否是必填项
|
||||
comparisonEntityFile.setRuleCode(entity.getRuleCode());
|
||||
comparisonEntityFile.setRuleValue(entity.getRuleValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
comparisonEntities.add(comparisonEntityFile);
|
||||
}
|
||||
}
|
||||
|
@ -688,73 +744,6 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
return null;
|
||||
}
|
||||
|
||||
//根据主数据编码获取数据,表名称,字段名称等
|
||||
public List<ComparisonEntity> getComparisonEntity(ComparisonEntity comparisonEntity) {
|
||||
List<ComparisonEntity> comparisonEntities = new ArrayList<>();
|
||||
//根据主数据编码查询mdm_module数据
|
||||
ComparisonEntity comparisonEntityModule = comparisonDao.queryComparisonBymdmCode(comparisonEntity);
|
||||
if (comparisonEntityModule != null) {
|
||||
//根据mdm_module得id查询mdm_module_db得数据
|
||||
List<ComparisonEntity> comparisonEntitiesModuleDb = comparisonDao.queryComparisonBymdmId(comparisonEntityModule);
|
||||
if(CollectionUtils.isNotEmpty(comparisonEntitiesModuleDb)) {
|
||||
for (ComparisonEntity comparison : comparisonEntitiesModuleDb) {
|
||||
//查询出主表和明细表信息
|
||||
if(comparison.getDbType().equals("1")||comparison.getDbType().equals("2")) {
|
||||
//根据mdm_module_db的id查询对应表的字段
|
||||
List<ComparisonEntity> comparisonEntitiesFiles = comparisonDao.queryComparisonBymdmIdFileds(comparison);
|
||||
if (CollectionUtils.isNotEmpty(comparisonEntitiesFiles)) {
|
||||
for (ComparisonEntity comparisonEntitiesFile : comparisonEntitiesFiles) {
|
||||
ComparisonEntity comparisonEntityFile = new ComparisonEntity();
|
||||
comparisonEntityFile.setChName(comparisonEntitiesFile.getChName());
|
||||
comparisonEntityFile.setEnName(comparisonEntitiesFile.getEnName());
|
||||
comparisonEntityFile.setFiledType(comparisonEntitiesFile.getFiledType());
|
||||
comparisonEntityFile.setAddType(comparisonEntitiesFile.getAddType());
|
||||
comparisonEntityFile.setUpdateType(comparisonEntitiesFile.getUpdateType());
|
||||
comparisonEntityFile.setShowType(comparisonEntitiesFile.getShowType());
|
||||
comparisonEntityFile.setQueryType(comparisonEntitiesFile.getQueryType());
|
||||
comparisonEntityFile.setListType(comparisonEntitiesFile.getListType());
|
||||
comparisonEntityFile.setViewType(comparisonEntitiesFile.getViewType());
|
||||
comparisonEntityFile.setDbName(comparison.getDbName());
|
||||
comparisonEntityFile.setDbType(comparison.getDbType());
|
||||
comparisonEntityFile.setDbId(comparison.getDbId());
|
||||
comparisonEntityFile.setmId(comparisonEntitiesFile.getmId());
|
||||
comparisonEntityFile.setMdmName(comparisonEntityModule.getMdmName());
|
||||
comparisonEntityFile.setMdmCode(comparisonEntityModule.getMdmCode());
|
||||
comparisonEntities.add(comparisonEntityFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* //根据mdm_module得id查询mdm_module_db_fileds得数据
|
||||
List<ComparisonEntity> comparisonEntitiesFiles = comparisonDao.queryComparisonBymdmIdFileds(comparisonEntityModule);
|
||||
for (ComparisonEntity comparison : comparisonEntitiesModuleDb) {
|
||||
for (ComparisonEntity comparisonEntitiesFile : comparisonEntitiesFiles) {
|
||||
if(comparison.getDbId().equals(comparisonEntitiesFile.getDbId())){
|
||||
ComparisonEntity comparisonEntityFile=new ComparisonEntity();
|
||||
comparisonEntityFile.setChName(comparisonEntitiesFile.getChName());
|
||||
comparisonEntityFile.setEnName(comparisonEntitiesFile.getEnName());
|
||||
comparisonEntityFile.setFiledType(comparisonEntitiesFile.getFiledType());
|
||||
comparisonEntityFile.setAddType(comparisonEntitiesFile.getAddType());
|
||||
comparisonEntityFile.setUpdateType(comparisonEntitiesFile.getUpdateType());
|
||||
comparisonEntityFile.setShowType(comparisonEntitiesFile.getShowType());
|
||||
comparisonEntityFile.setQueryType(comparisonEntitiesFile.getQueryType());
|
||||
comparisonEntityFile.setListType(comparisonEntitiesFile.getListType());
|
||||
comparisonEntityFile.setViewType(comparisonEntitiesFile.getViewType());
|
||||
comparisonEntityFile.setDbName(comparison.getDbName());
|
||||
comparisonEntityFile.setDbType(comparison.getDbType());
|
||||
comparisonEntityFile.setDbId(comparison.getDbId());
|
||||
comparisonEntityFile.setmId(comparisonEntitiesFile.getmId());
|
||||
comparisonEntityFile.setMdmName(comparisonEntityModule.getMdmName());
|
||||
comparisonEntityFile.setMdmCode(comparisonEntityModule.getMdmCode());
|
||||
comparisonEntities.add(comparisonEntityFile);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return comparisonEntities;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue