diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/dao/IMdmCustomerBankDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/dao/IMdmCustomerBankDao.java new file mode 100644 index 00000000..d22d954a --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/dao/IMdmCustomerBankDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.plugin.masterData.customer.bank.dao; + +import com.hzya.frame.plugin.masterData.customer.bank.entity.MdmCustomerBankEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 客户银行(mdm_customer_bank: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-21 13:55:55 + */ +public interface IMdmCustomerBankDao extends IBaseDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/dao/impl/MdmCustomerBankDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/dao/impl/MdmCustomerBankDaoImpl.java new file mode 100644 index 00000000..78161b29 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/dao/impl/MdmCustomerBankDaoImpl.java @@ -0,0 +1,16 @@ +package com.hzya.frame.plugin.masterData.customer.bank.dao.impl; + +import com.hzya.frame.plugin.masterData.customer.bank.entity.MdmCustomerBankEntity; +import com.hzya.frame.plugin.masterData.customer.bank.dao.IMdmCustomerBankDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 客户银行(MdmCustomerBank)表数据库访问层 + * + * @author makejava + * @since 2024-06-21 13:55:55 + */ +public class MdmCustomerBankDaoImpl extends MybatisGenericDao implements IMdmCustomerBankDao{ + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/entity/MdmCustomerBankEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/entity/MdmCustomerBankEntity.java new file mode 100644 index 00000000..4c389315 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/entity/MdmCustomerBankEntity.java @@ -0,0 +1,86 @@ +package com.hzya.frame.plugin.masterData.customer.bank.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 客户银行(MdmCustomerBank)实体类 + * + * @author makejava + * @since 2024-06-21 13:55:55 + */ +public class MdmCustomerBankEntity extends BaseEntity { + + /** formmain_id */ + private String formmainId; + /** 数据状态 Y正常 N删除 F修改 */ + private String dataStatus; + /** 公司id */ + private String companyId; + /** 银行 */ + private String bank; + /** 开户银行 */ + private String pkBankdoc; + /** 账号 */ + private String accnum; + /** 联行号 */ + private String combinenum; + + + public String getFormmainId() { + return formmainId; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getDataStatus() { + return dataStatus; + } + + public void setDataStatus(String dataStatus) { + this.dataStatus = dataStatus; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getBank() { + return bank; + } + + public void setBank(String bank) { + this.bank = bank; + } + + public String getPkBankdoc() { + return pkBankdoc; + } + + public void setPkBankdoc(String pkBankdoc) { + this.pkBankdoc = pkBankdoc; + } + + public String getAccnum() { + return accnum; + } + + public void setAccnum(String accnum) { + this.accnum = accnum; + } + + public String getCombinenum() { + return combinenum; + } + + public void setCombinenum(String combinenum) { + this.combinenum = combinenum; + } + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/entity/MdmCustomerBankEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/entity/MdmCustomerBankEntity.xml new file mode 100644 index 00000000..3689e8c9 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/entity/MdmCustomerBankEntity.xml @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + id + ,formmain_id + ,data_status + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + ,bank + ,pk_bankdoc + ,accnum + ,combinenum + + + + + + + + + + + + + + + + insert into mdm_customer_bank( + + id , + formmain_id , + data_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + bank , + pk_bankdoc , + accnum , + combinenum , + sorts, + sts, + + )values( + + #{id} , + #{formmainId} , + #{dataStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{bank} , + #{pkBankdoc} , + #{accnum} , + #{combinenum} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_customer_bank a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_customer_bank(formmain_id, data_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bank, pk_bankdoc, accnum, combinenum, sts) + values + + (#{entity.formmainId},#{entity.dataStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.bank},#{entity.pkBankdoc},#{entity.accnum},#{entity.combinenum}, 'Y') + + + + + insert into mdm_customer_bank(formmain_id, data_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, bank, pk_bankdoc, accnum, combinenum) + values + + (#{entity.formmainId},#{entity.dataStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.bank},#{entity.pkBankdoc},#{entity.accnum},#{entity.combinenum}) + + on duplicate key update + formmain_id = values(formmain_id), + data_status = values(data_status), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id), + bank = values(bank), + pk_bankdoc = values(pk_bankdoc), + accnum = values(accnum), + combinenum = values(combinenum) + + +update mdm_customer_bank set + + formmain_id = #{formmainId}, + data_status = #{dataStatus}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + bank = #{bank}, + pk_bankdoc = #{pkBankdoc}, + accnum = #{accnum}, + combinenum = #{combinenum}, + +where id = #{id} + + + +update mdm_customer_bank set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_customer_bank set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and formmain_id = #{formmainId} + and data_status = #{dataStatus} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and bank = #{bank} + and pk_bankdoc = #{pkBankdoc} + and accnum = #{accnum} + and combinenum = #{combinenum} + and sts='Y' + + + + + delete from mdm_customer_bank where id = #{id} + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/plugin/MdmCustomerBankPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/plugin/MdmCustomerBankPluginInitializer.java new file mode 100644 index 00000000..e62824b8 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/plugin/MdmCustomerBankPluginInitializer.java @@ -0,0 +1,50 @@ +package com.hzya.frame.plugin.masterData.customer.bank.plugin; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +/** + * 客户银行(MdmCustomerBank)表服务接口 + * + * @author makejava + * @since 2024-06-21 13:55:55 + */ +public class MdmCustomerBankPluginInitializer extends PluginBaseEntity{ + Logger logger = LoggerFactory.getLogger(MdmCustomerBankPluginInitializer.class); + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "MdmCustomerBankPlugin"; + } + + @Override + public String getPluginName() { + return "MdmCustomerBankPlugin插件"; + } + + @Override + public String getPluginLabel() { + return "MdmCustomerBankPlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + logger.info("执行业务代码逻辑"); + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/service/IMdmCustomerBankService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/service/IMdmCustomerBankService.java new file mode 100644 index 00000000..b1be580d --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/service/IMdmCustomerBankService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.plugin.masterData.customer.bank.service; + +import com.hzya.frame.plugin.masterData.customer.bank.entity.MdmCustomerBankEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 客户银行(MdmCustomerBank)表服务接口 + * + * @author makejava + * @since 2024-06-21 13:55:55 + */ +public interface IMdmCustomerBankService extends IBaseService{ +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/service/impl/MdmCustomerBankServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/service/impl/MdmCustomerBankServiceImpl.java new file mode 100644 index 00000000..11fe5130 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/bank/service/impl/MdmCustomerBankServiceImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.plugin.masterData.customer.bank.service.impl; + +import com.hzya.frame.plugin.masterData.customer.bank.entity.MdmCustomerBankEntity; +import com.hzya.frame.plugin.masterData.customer.bank.dao.IMdmCustomerBankDao; +import com.hzya.frame.plugin.masterData.customer.bank.service.IMdmCustomerBankService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 客户银行(MdmCustomerBank)表服务实现类 + * + * @author makejava + * @since 2024-06-21 13:55:55 + */ +public class MdmCustomerBankServiceImpl extends BaseService implements IMdmCustomerBankService { + + private IMdmCustomerBankDao mdmCustomerBankDao; + + @Autowired + public void setMdmCustomerBankDao(IMdmCustomerBankDao dao) { + this.mdmCustomerBankDao = dao; + this.dao = dao; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/dao/IMdmCustomerDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/dao/IMdmCustomerDao.java new file mode 100644 index 00000000..8b8ae96e --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/dao/IMdmCustomerDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.plugin.masterData.customer.dao; + +import com.hzya.frame.plugin.masterData.customer.entity.MdmCustomerEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 客户档案(mdm_customer: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public interface IMdmCustomerDao extends IBaseDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/dao/impl/MdmCustomerDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/dao/impl/MdmCustomerDaoImpl.java new file mode 100644 index 00000000..8899979b --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/dao/impl/MdmCustomerDaoImpl.java @@ -0,0 +1,16 @@ +package com.hzya.frame.plugin.masterData.customer.dao.impl; + +import com.hzya.frame.plugin.masterData.customer.entity.MdmCustomerEntity; +import com.hzya.frame.plugin.masterData.customer.dao.IMdmCustomerDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 客户档案(MdmCustomer)表数据库访问层 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public class MdmCustomerDaoImpl extends MybatisGenericDao implements IMdmCustomerDao{ + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/entity/MdmCustomerEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/entity/MdmCustomerEntity.java new file mode 100644 index 00000000..7e61cc1c --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/entity/MdmCustomerEntity.java @@ -0,0 +1,186 @@ +package com.hzya.frame.plugin.masterData.customer.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 客户档案(MdmCustomer)实体类 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public class MdmCustomerEntity extends BaseEntity { + + /** 单据规则 */ + private String documentRule; + /** 单据规则流水号 */ + private Long documentRuleNum; + /** 数据状态 Y正常 N删除 F修改 */ + private String dataStatus; + /** 新增数据状态 0待下发 1已下发 */ + private String addStatus; + /** 修改数据状态 0待下发 1已下发 */ + private String updateStatus; + /** 删除数据状态 0待下发 1已下发 */ + private String deleteStatus; + /** 公司id */ + private String companyId; + /** 客户编码 */ + private String code; + /** 客户类型 */ + private String custprop; + /** 客户状态 */ + private String custstate; + /** 启用状态 */ + private String enablestate; + /** 客户名称 */ + private String name; + /** 国家/地区 */ + private String pkCountry; + /** 客户基本分类 */ + private String pkCustclass; + /** 所属集团 */ + private String pkGroup; + /** 所属组织 */ + private String pkOrg; + /** 纳税人登记号 */ + private String taxpayerid; + + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Long getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Long documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getDataStatus() { + return dataStatus; + } + + public void setDataStatus(String dataStatus) { + this.dataStatus = dataStatus; + } + + public String getAddStatus() { + return addStatus; + } + + public void setAddStatus(String addStatus) { + this.addStatus = addStatus; + } + + public String getUpdateStatus() { + return updateStatus; + } + + public void setUpdateStatus(String updateStatus) { + this.updateStatus = updateStatus; + } + + public String getDeleteStatus() { + return deleteStatus; + } + + public void setDeleteStatus(String deleteStatus) { + this.deleteStatus = deleteStatus; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCustprop() { + return custprop; + } + + public void setCustprop(String custprop) { + this.custprop = custprop; + } + + public String getCuststate() { + return custstate; + } + + public void setCuststate(String custstate) { + this.custstate = custstate; + } + + public String getEnablestate() { + return enablestate; + } + + public void setEnablestate(String enablestate) { + this.enablestate = enablestate; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPkCountry() { + return pkCountry; + } + + public void setPkCountry(String pkCountry) { + this.pkCountry = pkCountry; + } + + public String getPkCustclass() { + return pkCustclass; + } + + public void setPkCustclass(String pkCustclass) { + this.pkCustclass = pkCustclass; + } + + public String getPkGroup() { + return pkGroup; + } + + public void setPkGroup(String pkGroup) { + this.pkGroup = pkGroup; + } + + public String getPkOrg() { + return pkOrg; + } + + public void setPkOrg(String pkOrg) { + this.pkOrg = pkOrg; + } + + public String getTaxpayerid() { + return taxpayerid; + } + + public void setTaxpayerid(String taxpayerid) { + this.taxpayerid = taxpayerid; + } + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/entity/MdmCustomerEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/entity/MdmCustomerEntity.xml new file mode 100644 index 00000000..41c3a4ff --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/entity/MdmCustomerEntity.xml @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,document_rule + ,document_rule_num + ,data_status + ,add_status + ,update_status + ,delete_status + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + ,code + ,custprop + ,custstate + ,enablestate + ,name + ,pk_country + ,pk_custclass + ,pk_group + ,pk_org + ,taxpayerid + + + + + + + + + + + + + + + + insert into mdm_customer( + + id , + document_rule , + document_rule_num , + data_status , + add_status , + update_status , + delete_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + code , + custprop , + custstate , + enablestate , + name , + pk_country , + pk_custclass , + pk_group , + pk_org , + taxpayerid , + sorts, + sts, + + )values( + + #{id} , + #{documentRule} , + #{documentRuleNum} , + #{dataStatus} , + #{addStatus} , + #{updateStatus} , + #{deleteStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{code} , + #{custprop} , + #{custstate} , + #{enablestate} , + #{name} , + #{pkCountry} , + #{pkCustclass} , + #{pkGroup} , + #{pkOrg} , + #{taxpayerid} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_customer a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_customer(document_rule, document_rule_num, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, code, custprop, custstate, enablestate, name, pk_country, pk_custclass, pk_group, pk_org, taxpayerid, sts) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.code},#{entity.custprop},#{entity.custstate},#{entity.enablestate},#{entity.name},#{entity.pkCountry},#{entity.pkCustclass},#{entity.pkGroup},#{entity.pkOrg},#{entity.taxpayerid}, 'Y') + + + + + insert into mdm_customer(document_rule, document_rule_num, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, code, custprop, custstate, enablestate, name, pk_country, pk_custclass, pk_group, pk_org, taxpayerid) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.code},#{entity.custprop},#{entity.custstate},#{entity.enablestate},#{entity.name},#{entity.pkCountry},#{entity.pkCustclass},#{entity.pkGroup},#{entity.pkOrg},#{entity.taxpayerid}) + + on duplicate key update + document_rule = values(document_rule), + document_rule_num = values(document_rule_num), + data_status = values(data_status), + add_status = values(add_status), + update_status = values(update_status), + delete_status = values(delete_status), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id), + code = values(code), + custprop = values(custprop), + custstate = values(custstate), + enablestate = values(enablestate), + name = values(name), + pk_country = values(pk_country), + pk_custclass = values(pk_custclass), + pk_group = values(pk_group), + pk_org = values(pk_org), + taxpayerid = values(taxpayerid) + + +update mdm_customer set + + document_rule = #{documentRule}, + document_rule_num = #{documentRuleNum}, + data_status = #{dataStatus}, + add_status = #{addStatus}, + update_status = #{updateStatus}, + delete_status = #{deleteStatus}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + code = #{code}, + custprop = #{custprop}, + custstate = #{custstate}, + enablestate = #{enablestate}, + name = #{name}, + pk_country = #{pkCountry}, + pk_custclass = #{pkCustclass}, + pk_group = #{pkGroup}, + pk_org = #{pkOrg}, + taxpayerid = #{taxpayerid}, + +where id = #{id} + + + +update mdm_customer set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_customer set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and document_rule = #{documentRule} + and document_rule_num = #{documentRuleNum} + and data_status = #{dataStatus} + and add_status = #{addStatus} + and update_status = #{updateStatus} + and delete_status = #{deleteStatus} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and code = #{code} + and custprop = #{custprop} + and custstate = #{custstate} + and enablestate = #{enablestate} + and name = #{name} + and pk_country = #{pkCountry} + and pk_custclass = #{pkCustclass} + and pk_group = #{pkGroup} + and pk_org = #{pkOrg} + and taxpayerid = #{taxpayerid} + and sts='Y' + + + + + delete from mdm_customer where id = #{id} + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/plugin/MdmCustomerPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/plugin/MdmCustomerPluginInitializer.java new file mode 100644 index 00000000..a1eb009e --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/plugin/MdmCustomerPluginInitializer.java @@ -0,0 +1,50 @@ +package com.hzya.frame.plugin.masterData.customer.plugin; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +/** + * 客户档案(MdmCustomer)表服务接口 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public class MdmCustomerPluginInitializer extends PluginBaseEntity{ + Logger logger = LoggerFactory.getLogger(MdmCustomerPluginInitializer.class); + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "MdmCustomerPlugin"; + } + + @Override + public String getPluginName() { + return "MdmCustomerPlugin插件"; + } + + @Override + public String getPluginLabel() { + return "MdmCustomerPlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + logger.info("执行业务代码逻辑"); + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/service/IMdmCustomerService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/service/IMdmCustomerService.java new file mode 100644 index 00000000..83ea4dfe --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/service/IMdmCustomerService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.plugin.masterData.customer.service; + +import com.hzya.frame.plugin.masterData.customer.entity.MdmCustomerEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 客户档案(MdmCustomer)表服务接口 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public interface IMdmCustomerService extends IBaseService{ +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/service/impl/MdmCustomerServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/service/impl/MdmCustomerServiceImpl.java new file mode 100644 index 00000000..6e48b6d1 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/customer/service/impl/MdmCustomerServiceImpl.java @@ -0,0 +1,25 @@ +package com.hzya.frame.plugin.masterData.customer.service.impl; + +import com.hzya.frame.plugin.masterData.customer.entity.MdmCustomerEntity; +import com.hzya.frame.plugin.masterData.customer.dao.IMdmCustomerDao; +import com.hzya.frame.plugin.masterData.customer.service.IMdmCustomerService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 客户档案(MdmCustomer)表服务实现类 + * + * @author makejava + * @since 2024-06-21 13:52:35 + */ +public class MdmCustomerServiceImpl extends BaseService implements IMdmCustomerService { + + private IMdmCustomerDao mdmCustomerDao; + + @Autowired + public void setMdmCustomerDao(IMdmCustomerDao dao) { + this.mdmCustomerDao = dao; + this.dao = dao; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/dao/IMdmOrgDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/dao/IMdmOrgDao.java new file mode 100644 index 00000000..bfe0e1cd --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/dao/IMdmOrgDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.plugin.masterData.org.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.masterData.org.entity.MdmOrgEntity; + +/** + * 组织档案(mdm_org: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-07 18:30:04 + */ +public interface IMdmOrgDao extends IBaseDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/dao/impl/MdmOrgDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/dao/impl/MdmOrgDaoImpl.java new file mode 100644 index 00000000..dc0271b5 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/dao/impl/MdmOrgDaoImpl.java @@ -0,0 +1,16 @@ +package com.hzya.frame.plugin.masterData.org.dao.impl; + +import com.hzya.frame.plugin.masterData.org.dao.IMdmOrgDao; +import com.hzya.frame.plugin.masterData.org.entity.MdmOrgEntity; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 组织档案(MdmOrg)表数据库访问层 + * + * @author makejava + * @since 2024-06-07 18:30:04 + */ +public class MdmOrgDaoImpl extends MybatisGenericDao implements IMdmOrgDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/entity/MdmOrgEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/entity/MdmOrgEntity.java new file mode 100644 index 00000000..55aa6f31 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/entity/MdmOrgEntity.java @@ -0,0 +1,196 @@ +package com.hzya.frame.plugin.masterData.org.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 组织档案(MdmOrg)实体类 + * + * @author makejava + * @since 2024-06-07 18:30:04 + */ +public class MdmOrgEntity extends BaseEntity { + + /** 单据规则 */ + private String documentRule; + /** 单据规则流水号 */ + private Long documentRuleNum; + /** 组织编码 */ + private String orgCode; + /** 组织名称 */ + private String orgName; + /** 地址 */ + private String orgAddress; + /** 国家地区 */ + private String orgCountryzone; + /** 内部编码 */ + private String orgInnercode; + /** 说明 */ + private String orgMemo; + /** 助记码 */ + private String orgMnecode; + /** 所属行业 */ + private String orgNcindustry; + /** 上级业务单元 */ + private String orgFatherorg; + /** 负责人 */ + private String orgPrincipal; + /** 电话 */ + private String orgTel; + /** 数据状态 Y正常 N删除 F修改 */ + private String dataStatus; + /** 新增数据状态 0待下发 1已下发 */ + private String addStatus; + /** 修改数据状态 0待下发 1已下发 */ + private String updateStatus; + /** 删除数据状态 0待下发 1已下发 */ + private String deleteStatus; + /** 公司id */ + private String companyId; + + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Long getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Long documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getOrgCode() { + return orgCode; + } + + public void setOrgCode(String orgCode) { + this.orgCode = orgCode; + } + + public String getOrgName() { + return orgName; + } + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + public String getOrgAddress() { + return orgAddress; + } + + public void setOrgAddress(String orgAddress) { + this.orgAddress = orgAddress; + } + + public String getOrgCountryzone() { + return orgCountryzone; + } + + public void setOrgCountryzone(String orgCountryzone) { + this.orgCountryzone = orgCountryzone; + } + + public String getOrgInnercode() { + return orgInnercode; + } + + public void setOrgInnercode(String orgInnercode) { + this.orgInnercode = orgInnercode; + } + + public String getOrgMemo() { + return orgMemo; + } + + public void setOrgMemo(String orgMemo) { + this.orgMemo = orgMemo; + } + + public String getOrgMnecode() { + return orgMnecode; + } + + public void setOrgMnecode(String orgMnecode) { + this.orgMnecode = orgMnecode; + } + + public String getOrgNcindustry() { + return orgNcindustry; + } + + public void setOrgNcindustry(String orgNcindustry) { + this.orgNcindustry = orgNcindustry; + } + + public String getOrgFatherorg() { + return orgFatherorg; + } + + public void setOrgFatherorg(String orgFatherorg) { + this.orgFatherorg = orgFatherorg; + } + + public String getOrgPrincipal() { + return orgPrincipal; + } + + public void setOrgPrincipal(String orgPrincipal) { + this.orgPrincipal = orgPrincipal; + } + + public String getOrgTel() { + return orgTel; + } + + public void setOrgTel(String orgTel) { + this.orgTel = orgTel; + } + + public String getDataStatus() { + return dataStatus; + } + + public void setDataStatus(String dataStatus) { + this.dataStatus = dataStatus; + } + + public String getAddStatus() { + return addStatus; + } + + public void setAddStatus(String addStatus) { + this.addStatus = addStatus; + } + + public String getUpdateStatus() { + return updateStatus; + } + + public void setUpdateStatus(String updateStatus) { + this.updateStatus = updateStatus; + } + + public String getDeleteStatus() { + return deleteStatus; + } + + public void setDeleteStatus(String deleteStatus) { + this.deleteStatus = deleteStatus; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/entity/MdmOrgEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/entity/MdmOrgEntity.xml new file mode 100644 index 00000000..ed02fdf9 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/entity/MdmOrgEntity.xml @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,document_rule + ,document_rule_num + ,org_code + ,org_name + ,org_address + ,org_countryzone + ,org_innercode + ,org_memo + ,org_mnecode + ,org_ncindustry + ,org_fatherorg + ,org_principal + ,org_tel + ,data_status + ,add_status + ,update_status + ,delete_status + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + insert into mdm_org( + + id , + document_rule , + document_rule_num , + org_code , + org_name , + org_address , + org_countryzone , + org_innercode , + org_memo , + org_mnecode , + org_ncindustry , + org_fatherorg , + org_principal , + org_tel , + data_status , + add_status , + update_status , + delete_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sorts, + sts, + + )values( + + #{id} , + #{documentRule} , + #{documentRuleNum} , + #{orgCode} , + #{orgName} , + #{orgAddress} , + #{orgCountryzone} , + #{orgInnercode} , + #{orgMemo} , + #{orgMnecode} , + #{orgNcindustry} , + #{orgFatherorg} , + #{orgPrincipal} , + #{orgTel} , + #{dataStatus} , + #{addStatus} , + #{updateStatus} , + #{deleteStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_org a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_org(document_rule, document_rule_num, org_code, org_name, org_address, org_countryzone, org_innercode, org_memo, org_mnecode, org_ncindustry, org_fatherorg, org_principal, org_tel, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.orgCode},#{entity.orgName},#{entity.orgAddress},#{entity.orgCountryzone},#{entity.orgInnercode},#{entity.orgMemo},#{entity.orgMnecode},#{entity.orgNcindustry},#{entity.orgFatherorg},#{entity.orgPrincipal},#{entity.orgTel},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + + + + + insert into mdm_org(document_rule, document_rule_num, org_code, org_name, org_address, org_countryzone, org_innercode, org_memo, org_mnecode, org_ncindustry, org_fatherorg, org_principal, org_tel, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.orgCode},#{entity.orgName},#{entity.orgAddress},#{entity.orgCountryzone},#{entity.orgInnercode},#{entity.orgMemo},#{entity.orgMnecode},#{entity.orgNcindustry},#{entity.orgFatherorg},#{entity.orgPrincipal},#{entity.orgTel},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + document_rule = values(document_rule), + document_rule_num = values(document_rule_num), + org_code = values(org_code), + org_name = values(org_name), + org_address = values(org_address), + org_countryzone = values(org_countryzone), + org_innercode = values(org_innercode), + org_memo = values(org_memo), + org_mnecode = values(org_mnecode), + org_ncindustry = values(org_ncindustry), + org_fatherorg = values(org_fatherorg), + org_principal = values(org_principal), + org_tel = values(org_tel), + data_status = values(data_status), + add_status = values(add_status), + update_status = values(update_status), + delete_status = values(delete_status), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + +update mdm_org set + + document_rule = #{documentRule}, + document_rule_num = #{documentRuleNum}, + org_code = #{orgCode}, + org_name = #{orgName}, + org_address = #{orgAddress}, + org_countryzone = #{orgCountryzone}, + org_innercode = #{orgInnercode}, + org_memo = #{orgMemo}, + org_mnecode = #{orgMnecode}, + org_ncindustry = #{orgNcindustry}, + org_fatherorg = #{orgFatherorg}, + org_principal = #{orgPrincipal}, + org_tel = #{orgTel}, + data_status = #{dataStatus}, + add_status = #{addStatus}, + update_status = #{updateStatus}, + delete_status = #{deleteStatus}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + +where id = #{id} + + + +update mdm_org set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_org set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and document_rule = #{documentRule} + and document_rule_num = #{documentRuleNum} + and org_code = #{orgCode} + and org_name = #{orgName} + and org_address = #{orgAddress} + and org_countryzone = #{orgCountryzone} + and org_innercode = #{orgInnercode} + and org_memo = #{orgMemo} + and org_mnecode = #{orgMnecode} + and org_ncindustry = #{orgNcindustry} + and org_fatherorg = #{orgFatherorg} + and org_principal = #{orgPrincipal} + and org_tel = #{orgTel} + and data_status = #{dataStatus} + and add_status = #{addStatus} + and update_status = #{updateStatus} + and delete_status = #{deleteStatus} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from mdm_org where id = #{id} + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/plugin/MdmOrgPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/plugin/MdmOrgPluginInitializer.java new file mode 100644 index 00000000..f4e7c8f6 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/plugin/MdmOrgPluginInitializer.java @@ -0,0 +1,62 @@ +package com.hzya.frame.plugin.masterData.org.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.sysnew.comparison.masterData.service.impl.MasterDataOrgsServiceImpl; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * 组织档案(MdmOrg)表服务接口 + * + * @author makejava + * @since 2024-06-07 18:30:05 + */ +public class MdmOrgPluginInitializer extends PluginBaseEntity{ + Logger logger = LoggerFactory.getLogger(MdmOrgPluginInitializer.class); + @Autowired + private MasterDataOrgsServiceImpl masterDataOrgsService; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "MdmOrgPlugin"; + } + + @Override + public String getPluginName() { + return "MdmOrgPlugin插件"; + } + + @Override + public String getPluginLabel() { + return "MdmOrgPlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("======开始执行主数据档案组织档案同步========"); + return masterDataOrgsService.queryOrgsArchives(requestJson); + }catch (Exception e){ + logger.info("======执行主数据档案组织档案同步失败:{}========",e.getMessage()); + e.printStackTrace(); + } + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/service/IMdmOrgService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/service/IMdmOrgService.java new file mode 100644 index 00000000..fa37d8cd --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/service/IMdmOrgService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.plugin.masterData.org.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.masterData.org.entity.MdmOrgEntity; + +/** + * 组织档案(MdmOrg)表服务接口 + * + * @author makejava + * @since 2024-06-07 18:30:05 + */ +public interface IMdmOrgService extends IBaseService{ +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/service/impl/MdmOrgServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/service/impl/MdmOrgServiceImpl.java new file mode 100644 index 00000000..f4f543ee --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/org/service/impl/MdmOrgServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.plugin.masterData.org.service.impl; + + +import com.hzya.frame.plugin.masterData.org.dao.IMdmOrgDao; +import com.hzya.frame.plugin.masterData.org.entity.MdmOrgEntity; +import com.hzya.frame.plugin.masterData.org.service.IMdmOrgService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 组织档案(MdmOrg)表服务实现类 + * + * @author makejava + * @since 2024-06-07 18:30:05 + */ +public class MdmOrgServiceImpl extends BaseService implements IMdmOrgService { + + private IMdmOrgDao mdmOrgDao; + + @Autowired + public void setMdmOrgDao(IMdmOrgDao dao) { + this.mdmOrgDao = dao; + this.dao = dao; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/dao/IMdmProjectDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/dao/IMdmProjectDao.java new file mode 100644 index 00000000..8b130a7f --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/dao/IMdmProjectDao.java @@ -0,0 +1,16 @@ +package com.hzya.frame.plugin.masterData.project.dao; + + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.masterData.project.entity.MdmProjectEntity; + +/** + * 项目档案(mdm_project: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-07 18:29:23 + */ +public interface IMdmProjectDao extends IBaseDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/dao/impl/MdmProjectDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/dao/impl/MdmProjectDaoImpl.java new file mode 100644 index 00000000..ae270f7d --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/dao/impl/MdmProjectDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.plugin.masterData.project.dao.impl; + + +import com.hzya.frame.plugin.masterData.project.dao.IMdmProjectDao; +import com.hzya.frame.plugin.masterData.project.entity.MdmProjectEntity; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 项目档案(MdmProject)表数据库访问层 + * + * @author makejava + * @since 2024-06-07 18:29:23 + */ +public class MdmProjectDaoImpl extends MybatisGenericDao implements IMdmProjectDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.java new file mode 100644 index 00000000..fba1cf1c --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.java @@ -0,0 +1,186 @@ +package com.hzya.frame.plugin.masterData.project.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 项目档案(MdmProject)实体类 + * + * @author makejava + * @since 2024-06-07 18:29:23 + */ +public class MdmProjectEntity extends BaseEntity { + + /** 单据规则 */ + private String documentRule; + /** 单据规则流水号 */ + private Long documentRuleNum; + /** 项目编码 */ + private String projectCode; + /** 项目名称 */ + private String projectName; + /** 单据类型 */ + private String projectBillType; + /** 备注 */ + private String projectMemo; + /** 币种 */ + private String projectCurrtype; + /** 责任人 */ + private String projectDutier; + /** 责任部门 */ + private String projectDutyDept; + /** 管理组织 */ + private String projectOrg; + /** 父项目 */ + private String projectParentpro; + /** 项目简称 */ + private String projectShName; + /** 数据状态 Y正常 N删除 F修改 */ + private String dataStatus; + /** 新增数据状态 0待下发 1已下发 */ + private String addStatus; + /** 修改数据状态 0待下发 1已下发 */ + private String updateStatus; + /** 删除数据状态 0待下发 1已下发 */ + private String deleteStatus; + /** 公司id */ + private String companyId; + + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Long getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Long documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getProjectCode() { + return projectCode; + } + + public void setProjectCode(String projectCode) { + this.projectCode = projectCode; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public String getProjectBillType() { + return projectBillType; + } + + public void setProjectBillType(String projectBillType) { + this.projectBillType = projectBillType; + } + + public String getProjectMemo() { + return projectMemo; + } + + public void setProjectMemo(String projectMemo) { + this.projectMemo = projectMemo; + } + + public String getProjectCurrtype() { + return projectCurrtype; + } + + public void setProjectCurrtype(String projectCurrtype) { + this.projectCurrtype = projectCurrtype; + } + + public String getProjectDutier() { + return projectDutier; + } + + public void setProjectDutier(String projectDutier) { + this.projectDutier = projectDutier; + } + + public String getProjectDutyDept() { + return projectDutyDept; + } + + public void setProjectDutyDept(String projectDutyDept) { + this.projectDutyDept = projectDutyDept; + } + + public String getProjectOrg() { + return projectOrg; + } + + public void setProjectOrg(String projectOrg) { + this.projectOrg = projectOrg; + } + + public String getProjectParentpro() { + return projectParentpro; + } + + public void setProjectParentpro(String projectParentpro) { + this.projectParentpro = projectParentpro; + } + + public String getProjectShName() { + return projectShName; + } + + public void setProjectShName(String projectShName) { + this.projectShName = projectShName; + } + + public String getDataStatus() { + return dataStatus; + } + + public void setDataStatus(String dataStatus) { + this.dataStatus = dataStatus; + } + + public String getAddStatus() { + return addStatus; + } + + public void setAddStatus(String addStatus) { + this.addStatus = addStatus; + } + + public String getUpdateStatus() { + return updateStatus; + } + + public void setUpdateStatus(String updateStatus) { + this.updateStatus = updateStatus; + } + + public String getDeleteStatus() { + return deleteStatus; + } + + public void setDeleteStatus(String deleteStatus) { + this.deleteStatus = deleteStatus; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.xml new file mode 100644 index 00000000..467882e1 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/entity/MdmProjectEntity.xml @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,document_rule + ,document_rule_num + ,project_code + ,project_name + ,project_bill_type + ,project_memo + ,project_currtype + ,project_dutier + ,project_duty_dept + ,project_org + ,project_parentpro + ,project_sh_name + ,data_status + ,add_status + ,update_status + ,delete_status + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + insert into mdm_project( + + id , + document_rule , + document_rule_num , + project_code , + project_name , + project_bill_type , + project_memo , + project_currtype , + project_dutier , + project_duty_dept , + project_org , + project_parentpro , + project_sh_name , + data_status , + add_status , + update_status , + delete_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sorts, + sts, + + )values( + + #{id} , + #{documentRule} , + #{documentRuleNum} , + #{projectCode} , + #{projectName} , + #{projectBillType} , + #{projectMemo} , + #{projectCurrtype} , + #{projectDutier} , + #{projectDutyDept} , + #{projectOrg} , + #{projectParentpro} , + #{projectShName} , + #{dataStatus} , + #{addStatus} , + #{updateStatus} , + #{deleteStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_project a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_project(document_rule, document_rule_num, project_code, project_name, project_bill_type, project_memo, project_currtype, project_dutier, project_duty_dept, project_org, project_parentpro, project_sh_name, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.projectCode},#{entity.projectName},#{entity.projectBillType},#{entity.projectMemo},#{entity.projectCurrtype},#{entity.projectDutier},#{entity.projectDutyDept},#{entity.projectOrg},#{entity.projectParentpro},#{entity.projectShName},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + + + + + insert into mdm_project(document_rule, document_rule_num, project_code, project_name, project_bill_type, project_memo, project_currtype, project_dutier, project_duty_dept, project_org, project_parentpro, project_sh_name, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.projectCode},#{entity.projectName},#{entity.projectBillType},#{entity.projectMemo},#{entity.projectCurrtype},#{entity.projectDutier},#{entity.projectDutyDept},#{entity.projectOrg},#{entity.projectParentpro},#{entity.projectShName},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + document_rule = values(document_rule), + document_rule_num = values(document_rule_num), + project_code = values(project_code), + project_name = values(project_name), + project_bill_type = values(project_bill_type), + project_memo = values(project_memo), + project_currtype = values(project_currtype), + project_dutier = values(project_dutier), + project_duty_dept = values(project_duty_dept), + project_org = values(project_org), + project_parentpro = values(project_parentpro), + project_sh_name = values(project_sh_name), + data_status = values(data_status), + add_status = values(add_status), + update_status = values(update_status), + delete_status = values(delete_status), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + +update mdm_project set + + document_rule = #{documentRule}, + document_rule_num = #{documentRuleNum}, + project_code = #{projectCode}, + project_name = #{projectName}, + project_bill_type = #{projectBillType}, + project_memo = #{projectMemo}, + project_currtype = #{projectCurrtype}, + project_dutier = #{projectDutier}, + project_duty_dept = #{projectDutyDept}, + project_org = #{projectOrg}, + project_parentpro = #{projectParentpro}, + project_sh_name = #{projectShName}, + data_status = #{dataStatus}, + add_status = #{addStatus}, + update_status = #{updateStatus}, + delete_status = #{deleteStatus}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + +where id = #{id} + + + +update mdm_project set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_project set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and document_rule = #{documentRule} + and document_rule_num = #{documentRuleNum} + and project_code = #{projectCode} + and project_name = #{projectName} + and project_bill_type = #{projectBillType} + and project_memo = #{projectMemo} + and project_currtype = #{projectCurrtype} + and project_dutier = #{projectDutier} + and project_duty_dept = #{projectDutyDept} + and project_org = #{projectOrg} + and project_parentpro = #{projectParentpro} + and project_sh_name = #{projectShName} + and data_status = #{dataStatus} + and add_status = #{addStatus} + and update_status = #{updateStatus} + and delete_status = #{deleteStatus} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from mdm_project where id = #{id} + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/plugin/MdmProjectPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/plugin/MdmProjectPluginInitializer.java new file mode 100644 index 00000000..0a554a69 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/plugin/MdmProjectPluginInitializer.java @@ -0,0 +1,64 @@ +package com.hzya.frame.plugin.masterData.project.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.sysnew.comparison.masterData.service.impl.MasterDataProjectServiceImpl; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * 项目档案(MdmProject)表服务接口 + * + * @author makejava + * @since 2024-06-07 18:29:23 + */ +public class MdmProjectPluginInitializer extends PluginBaseEntity{ + Logger logger = LoggerFactory.getLogger(MdmProjectPluginInitializer.class); + + @Autowired + private MasterDataProjectServiceImpl masterDataProjectService; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "MdmProjectPlugin"; + } + + @Override + public String getPluginName() { + return "MdmProjectPlugin插件"; + } + + @Override + public String getPluginLabel() { + return "MdmProjectPlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try { + logger.info("=====开始执行主数据档案项目档案同步======="); + JsonResultEntity jsonResultEntity = masterDataProjectService.queryProjectArchives(requestJson); + return jsonResultEntity; + }catch (Exception e){ + logger.info("======执行主数据档案项目档案同步失败:{}",e.getMessage()); + e.printStackTrace(); + } + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/service/IMdmProjectService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/service/IMdmProjectService.java new file mode 100644 index 00000000..f35a9209 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/service/IMdmProjectService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.plugin.masterData.project.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.masterData.project.entity.MdmProjectEntity; + +/** + * 项目档案(MdmProject)表服务接口 + * + * @author makejava + * @since 2024-06-07 18:29:23 + */ +public interface IMdmProjectService extends IBaseService{ +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/service/impl/MdmProjectServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/service/impl/MdmProjectServiceImpl.java new file mode 100644 index 00000000..0284f229 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/project/service/impl/MdmProjectServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.plugin.masterData.project.service.impl; + + +import com.hzya.frame.plugin.masterData.project.dao.IMdmProjectDao; +import com.hzya.frame.plugin.masterData.project.entity.MdmProjectEntity; +import com.hzya.frame.plugin.masterData.project.service.IMdmProjectService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 项目档案(MdmProject)表服务实现类 + * + * @author makejava + * @since 2024-06-07 18:29:23 + */ +public class MdmProjectServiceImpl extends BaseService implements IMdmProjectService { + + private IMdmProjectDao mdmProjectDao; + + @Autowired + public void setMdmProjectDao(IMdmProjectDao dao) { + this.mdmProjectDao = dao; + this.dao = dao; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/dao/IMdmUserDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/dao/IMdmUserDao.java new file mode 100644 index 00000000..1556e191 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/dao/IMdmUserDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.plugin.masterData.user.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.plugin.masterData.user.entity.MdmUserEntity; + +/** + * 用户档案(mdm_user: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-17 14:52:30 + */ +public interface IMdmUserDao extends IBaseDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/dao/impl/MdmUserDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/dao/impl/MdmUserDaoImpl.java new file mode 100644 index 00000000..e8d048ea --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/dao/impl/MdmUserDaoImpl.java @@ -0,0 +1,15 @@ +package com.hzya.frame.plugin.masterData.user.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.plugin.masterData.user.dao.IMdmUserDao; +import com.hzya.frame.plugin.masterData.user.entity.MdmUserEntity; +/** + * 用户档案(MdmUser)表数据库访问层 + * + * @author makejava + * @since 2024-06-17 14:52:30 + */ +public class MdmUserDaoImpl extends MybatisGenericDao implements IMdmUserDao { + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.java new file mode 100644 index 00000000..5a89edcf --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.java @@ -0,0 +1,275 @@ +package com.hzya.frame.plugin.masterData.user.entity; + +import com.hzya.frame.web.entity.BaseEntity; +/** + * 用户档案(MdmUser)实体类 + * + * @author makejava + * @since 2024-06-17 14:52:30 + */ +public class MdmUserEntity extends BaseEntity { + + /** 单据规则 */ + private String documentRule; + /** 单据规则流水号 */ + private Long documentRuleNum; + /** 数据状态 Y正常 N删除 F修改 */ + private String dataStatus; + /** 新增数据状态 0待下发 1已下发 */ + private String addStatus; + /** 修改数据状态 0待下发 1已下发 */ + private String updateStatus; + /** 删除数据状态 0待下发 1已下发 */ + private String deleteStatus; + /** 公司id */ + private String companyId; + /** 用户名称 */ + private String userName; + /** 用户编码 */ + private String userCode; + /** 用户密码 */ + private String userPassword; + /** 密码安全级别 */ + private String pwdlevelcode; + /** 密码参数 */ + private String pwdparam; + /** 备注 */ + private String userNote; + /** 生效日期 */ + private String abledate; + /** 失效日期 */ + private String disabledate; + /** 锁定 */ + private String islocked; + /** 用户类型 */ + private String userType; + /** 身份类型 */ + private String baseDocType; + /** 身份 */ + private String pkBaseDoc; + /** 认证类型 */ + private String identityverifycode; + /** 所属组织 */ + private String pkOrg; + /** 数据格式 */ + private String format; + /** CA用户 */ + private String isca; + /** 启用状态 */ + private String enablestate; + /** 内容语种 */ + private String contentlang; + /** 用户编码 */ + private String userCodeQ; + + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Long getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Long documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getDataStatus() { + return dataStatus; + } + + public void setDataStatus(String dataStatus) { + this.dataStatus = dataStatus; + } + + public String getAddStatus() { + return addStatus; + } + + public void setAddStatus(String addStatus) { + this.addStatus = addStatus; + } + + public String getUpdateStatus() { + return updateStatus; + } + + public void setUpdateStatus(String updateStatus) { + this.updateStatus = updateStatus; + } + + public String getDeleteStatus() { + return deleteStatus; + } + + public void setDeleteStatus(String deleteStatus) { + this.deleteStatus = deleteStatus; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getUserCode() { + return userCode; + } + + public void setUserCode(String userCode) { + this.userCode = userCode; + } + + public String getUserPassword() { + return userPassword; + } + + public void setUserPassword(String userPassword) { + this.userPassword = userPassword; + } + + public String getPwdlevelcode() { + return pwdlevelcode; + } + + public void setPwdlevelcode(String pwdlevelcode) { + this.pwdlevelcode = pwdlevelcode; + } + + public String getPwdparam() { + return pwdparam; + } + + public void setPwdparam(String pwdparam) { + this.pwdparam = pwdparam; + } + + public String getUserNote() { + return userNote; + } + + public void setUserNote(String userNote) { + this.userNote = userNote; + } + + public String getAbledate() { + return abledate; + } + + public void setAbledate(String abledate) { + this.abledate = abledate; + } + + public String getDisabledate() { + return disabledate; + } + + public void setDisabledate(String disabledate) { + this.disabledate = disabledate; + } + + public String getIslocked() { + return islocked; + } + + public void setIslocked(String islocked) { + this.islocked = islocked; + } + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + + public String getBaseDocType() { + return baseDocType; + } + + public void setBaseDocType(String baseDocType) { + this.baseDocType = baseDocType; + } + + public String getPkBaseDoc() { + return pkBaseDoc; + } + + public void setPkBaseDoc(String pkBaseDoc) { + this.pkBaseDoc = pkBaseDoc; + } + + public String getIdentityverifycode() { + return identityverifycode; + } + + public void setIdentityverifycode(String identityverifycode) { + this.identityverifycode = identityverifycode; + } + + public String getPkOrg() { + return pkOrg; + } + + public void setPkOrg(String pkOrg) { + this.pkOrg = pkOrg; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public String getIsca() { + return isca; + } + + public void setIsca(String isca) { + this.isca = isca; + } + + public String getEnablestate() { + return enablestate; + } + + public void setEnablestate(String enablestate) { + this.enablestate = enablestate; + } + + public String getContentlang() { + return contentlang; + } + + public void setContentlang(String contentlang) { + this.contentlang = contentlang; + } + + public String getUserCodeQ() { + return userCodeQ; + } + + public void setUserCodeQ(String userCodeQ) { + this.userCodeQ = userCodeQ; + } + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.xml new file mode 100644 index 00000000..b594d94b --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/entity/MdmUserEntity.xml @@ -0,0 +1,476 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,document_rule + ,document_rule_num + ,data_status + ,add_status + ,update_status + ,delete_status + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + ,user_name + ,user_code + ,user_password + ,pwdlevelcode + ,pwdparam + ,user_note + ,abledate + ,disabledate + ,islocked + ,user_type + ,base_doc_type + ,pk_base_doc + ,identityverifycode + ,pk_org + ,format + ,isca + ,enablestate + ,contentlang + ,user_code_q + + + + + + + + + + + + + + + + insert into mdm_user( + + id , + document_rule , + document_rule_num , + data_status , + add_status , + update_status , + delete_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + user_name , + user_code , + user_password , + pwdlevelcode , + pwdparam , + user_note , + abledate , + disabledate , + islocked , + user_type , + base_doc_type , + pk_base_doc , + identityverifycode , + pk_org , + format , + isca , + enablestate , + contentlang , + user_code_q , + sorts, + sts, + + )values( + + #{id} , + #{documentRule} , + #{documentRuleNum} , + #{dataStatus} , + #{addStatus} , + #{updateStatus} , + #{deleteStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + #{userName} , + #{userCode} , + #{userPassword} , + #{pwdlevelcode} , + #{pwdparam} , + #{userNote} , + #{abledate} , + #{disabledate} , + #{islocked} , + #{userType} , + #{baseDocType} , + #{pkBaseDoc} , + #{identityverifycode} , + #{pkOrg} , + #{format} , + #{isca} , + #{enablestate} , + #{contentlang} , + #{userCodeQ} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_user a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_user(document_rule, document_rule_num, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, user_name, user_code, user_password, pwdlevelcode, pwdparam, user_note, abledate, disabledate, islocked, user_type, base_doc_type, pk_base_doc, identityverifycode, pk_org, format, isca, enablestate, contentlang, user_code_q, sts) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.userName},#{entity.userCode},#{entity.userPassword},#{entity.pwdlevelcode},#{entity.pwdparam},#{entity.userNote},#{entity.abledate},#{entity.disabledate},#{entity.islocked},#{entity.userType},#{entity.baseDocType},#{entity.pkBaseDoc},#{entity.identityverifycode},#{entity.pkOrg},#{entity.format},#{entity.isca},#{entity.enablestate},#{entity.contentlang},#{entity.userCodeQ}, 'Y') + + + + + insert into mdm_user(document_rule, document_rule_num, data_status, add_status, update_status, delete_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, user_name, user_code, user_password, pwdlevelcode, pwdparam, user_note, abledate, disabledate, islocked, user_type, base_doc_type, pk_base_doc, identityverifycode, pk_org, format, isca, enablestate, contentlang, user_code_q) + values + + (#{entity.documentRule},#{entity.documentRuleNum},#{entity.dataStatus},#{entity.addStatus},#{entity.updateStatus},#{entity.deleteStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},#{entity.userName},#{entity.userCode},#{entity.userPassword},#{entity.pwdlevelcode},#{entity.pwdparam},#{entity.userNote},#{entity.abledate},#{entity.disabledate},#{entity.islocked},#{entity.userType},#{entity.baseDocType},#{entity.pkBaseDoc},#{entity.identityverifycode},#{entity.pkOrg},#{entity.format},#{entity.isca},#{entity.enablestate},#{entity.contentlang},#{entity.userCodeQ}) + + on duplicate key update + document_rule = values(document_rule), + document_rule_num = values(document_rule_num), + data_status = values(data_status), + add_status = values(add_status), + update_status = values(update_status), + delete_status = values(delete_status), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id), + user_name = values(user_name), + user_code = values(user_code), + user_password = values(user_password), + pwdlevelcode = values(pwdlevelcode), + pwdparam = values(pwdparam), + user_note = values(user_note), + abledate = values(abledate), + disabledate = values(disabledate), + islocked = values(islocked), + user_type = values(user_type), + base_doc_type = values(base_doc_type), + pk_base_doc = values(pk_base_doc), + identityverifycode = values(identityverifycode), + pk_org = values(pk_org), + format = values(format), + isca = values(isca), + enablestate = values(enablestate), + contentlang = values(contentlang), + user_code_q = values(user_code_q) + + +update mdm_user set + + document_rule = #{documentRule}, + document_rule_num = #{documentRuleNum}, + data_status = #{dataStatus}, + add_status = #{addStatus}, + update_status = #{updateStatus}, + delete_status = #{deleteStatus}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + user_name = #{userName}, + user_code = #{userCode}, + user_password = #{userPassword}, + pwdlevelcode = #{pwdlevelcode}, + pwdparam = #{pwdparam}, + user_note = #{userNote}, + abledate = #{abledate}, + disabledate = #{disabledate}, + islocked = #{islocked}, + user_type = #{userType}, + base_doc_type = #{baseDocType}, + pk_base_doc = #{pkBaseDoc}, + identityverifycode = #{identityverifycode}, + pk_org = #{pkOrg}, + format = #{format}, + isca = #{isca}, + enablestate = #{enablestate}, + contentlang = #{contentlang}, + user_code_q = #{userCodeQ}, + +where id = #{id} + + + +update mdm_user set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_user set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and document_rule = #{documentRule} + and document_rule_num = #{documentRuleNum} + and data_status = #{dataStatus} + and add_status = #{addStatus} + and update_status = #{updateStatus} + and delete_status = #{deleteStatus} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and user_name = #{userName} + and user_code = #{userCode} + and user_password = #{userPassword} + and pwdlevelcode = #{pwdlevelcode} + and pwdparam = #{pwdparam} + and user_note = #{userNote} + and abledate = #{abledate} + and disabledate = #{disabledate} + and islocked = #{islocked} + and user_type = #{userType} + and base_doc_type = #{baseDocType} + and pk_base_doc = #{pkBaseDoc} + and identityverifycode = #{identityverifycode} + and pk_org = #{pkOrg} + and format = #{format} + and isca = #{isca} + and enablestate = #{enablestate} + and contentlang = #{contentlang} + and user_code_q = #{userCodeQ} + and sts='Y' + + + + + delete from mdm_user where id = #{id} + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/plugin/MdmUserPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/plugin/MdmUserPluginInitializer.java new file mode 100644 index 00000000..0fbea074 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/plugin/MdmUserPluginInitializer.java @@ -0,0 +1,50 @@ +package com.hzya.frame.plugin.masterData.user.plugin; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +/** + * 用户档案(MdmUser)表服务接口 + * + * @author makejava + * @since 2024-06-17 14:52:30 + */ +public class MdmUserPluginInitializer extends PluginBaseEntity{ + Logger logger = LoggerFactory.getLogger(MdmUserPluginInitializer.class); + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "MdmUserPlugin"; + } + + @Override + public String getPluginName() { + return "MdmUserPlugin插件"; + } + + @Override + public String getPluginLabel() { + return "MdmUserPlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + logger.info("执行业务代码逻辑"); + return null; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/service/IMdmUserService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/service/IMdmUserService.java new file mode 100644 index 00000000..e7f984eb --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/service/IMdmUserService.java @@ -0,0 +1,13 @@ +package com.hzya.frame.plugin.masterData.user.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.plugin.masterData.user.entity.MdmUserEntity; + +/** + * 用户档案(MdmUser)表服务接口 + * + * @author makejava + * @since 2024-06-17 14:52:30 + */ +public interface IMdmUserService extends IBaseService{ +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/service/impl/MdmUserServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/service/impl/MdmUserServiceImpl.java new file mode 100644 index 00000000..3f88a2d2 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/masterData/user/service/impl/MdmUserServiceImpl.java @@ -0,0 +1,23 @@ +package com.hzya.frame.plugin.masterData.user.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.plugin.masterData.user.dao.IMdmUserDao; +import com.hzya.frame.plugin.masterData.user.entity.MdmUserEntity; +import com.hzya.frame.plugin.masterData.user.service.IMdmUserService; +import org.springframework.beans.factory.annotation.Autowired; +/** + * 用户档案(MdmUser)表服务实现类 + * + * @author makejava + * @since 2024-06-17 14:52:30 + */ +public class MdmUserServiceImpl extends BaseService implements IMdmUserService { + + private IMdmUserDao mdmUserDao; + + @Autowired + public void setMdmUserDao(IMdmUserDao dao) { + this.mdmUserDao = dao; + this.dao = dao; + } +} diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java new file mode 100644 index 00000000..6c683a0a --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/mdmDistribute/plugin/MdmModulePluginInitializer.java @@ -0,0 +1,1010 @@ +package com.hzya.frame.plugin.mdmDistribute.plugin; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +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.mdmModuleSendLog.dao.IMdmModuleSendLogDao; +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.mdm.service.IMdmServiceCache; +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.script.dao.ISysApplicationScriptDao; +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 主数据模版(MdmModule)表服务接口 + * + * @author makejava + * @since 2024-06-18 10:33:32 + */ +public class MdmModulePluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(MdmModulePluginInitializer.class); + @Resource + private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; + @Resource + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + @Resource + private ISysApplicationApiDao sysApplicationApiDao; + @Resource + private ISysApplicationDao sysApplicationDao; + @Resource + private ISysApplicationScriptDao sysApplicationScriptDao; + @Resource + private IMdmModuleDistributeDao mdmModuleDistributeDao; + @Resource + private IGroovyIntegrationService groovyIntegrationService; + @Resource + private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; + @Resource + private IMdmModuleDao mdmModuleDao; + @Resource + private IMdmServiceCache mdmServiceCache; + @Resource + private IMdmModuleSendLogDao mdmModuleSendLogDao; + + @Value("${zt.url}") + private String url ; + + //多线程请求加锁 HttpRequest 构造方法是静态的 + private final Object lock = new Object(); + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "MdmModulePlugin"; + } + + @Override + public String getPluginName() { + return "MdmModulePlugin插件"; + } + + @Override + public String getPluginLabel() { + return "MdmModulePlugin"; + } + + @Override + public String getPluginType() { + return "1"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) { + try{ + //重试方法 + if (null != requestJson) { + //如果这个id不为空,说明是重试的 + String id = requestJson.getString("integration_task_living_details_id"); + //执行重新发送 + if (StrUtil.isNotEmpty(id)) { + //查询日志表 + IntegrationTaskLivingDetailsEntity taskDetailEntity = taskLivingDetailsService.get(id); + if (null != taskDetailEntity && JSONUtil.isTypeJSON(taskDetailEntity.getRootAppPk())){ + //拿到这张表的源系统ID + JSONObject jsonObject = JSONObject.parseObject(taskDetailEntity.getRootAppPk()); + Long mdmCode = jsonObject.getLong("mdmCode");//主数据编码 + String documentRule = jsonObject.getString("documentRule");//行数据的单据规则编码 + String distributeId = jsonObject.getString("distributeId");//发送表id + String type = jsonObject.getString("type");//发送类型,1、新增2、修改3、删除 + if(mdmCode == null || documentRule == null || distributeId == null || type == null + || "".equals(mdmCode) || "".equals(documentRule) || "".equals(distributeId) || "".equals(type)){ + taskDetailEntity.setResult("系统保存参数错误"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("系统保存参数错误"); + } + String apiId = null; + String scriptId = null; + //查找对应数据,组装数据发送 + + //获取主数据信息 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(mdmCode); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null ){ + taskDetailEntity.setResult("主数据不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("主数据不存在"); + + } + + //获取主数据db + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){ + taskDetailEntity.setResult("主数据数据源不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("主数据数据源不存在"); + + } + + //获取分发表 + //获取分发的接口 + MdmModuleDistributeEntity mdmModuleDistributeEntity = mdmModuleDistributeDao.get(distributeId); + if(mdmModuleDistributeEntity == null || mdmModuleDistributeEntity.getId() == null ){ + taskDetailEntity.setResult("分发不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发不存在"); + + } + // 启用停用 0、停用 + if("0".equals(mdmModuleDistributeEntity.getEnabledState())){ + taskDetailEntity.setResult("分发已停用"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发已停用"); + + } + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(distributeId); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + + // 启用停用 0、停用 + //if("1".equals(mdmModuleDistributeEntity.getEnabledType())){ + // taskDetailEntity.setResult("分发为手动下发"); + // taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + // 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)){ + taskDetailEntity.setResult("分发接口未选择,请先选择"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发接口未选择,请先选择"); + + } + SysApplicationScriptEntity scriptEntity = null; + if(scriptId != null && !"".equals(scriptId)){ + scriptEntity = sysApplicationScriptDao.get(scriptId); + if(scriptEntity == null || scriptEntity.getId() == null ){ + taskDetailEntity.setResult("分发接口脚本不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发接口脚本不存在"); + } + } + SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(apiId); + if(apiEntity == null || apiEntity.getId() == null ){ + taskDetailEntity.setResult("分发接口不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发接口不存在"); + + } + SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId()); + if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){ + taskDetailEntity.setResult("应用不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("应用不存在"); + } + + //获取主数据db字段,以及字段的规则 + MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity(); + queryFild.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); + MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity(); + queryFildRule.setMdmId(mdmModuleEntity.getId()); + queryFildRule.setRuleCode("service"); + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); + + //获取主数据db对应的实体表的数据 + JSONObject object = new JSONObject(); + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + Map map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + map.put("documentRule",documentRule); + object = mdmModuleDao.queryMdmST(map); + if(object.getString("id") == null || "".equals(object.getString("id")) ){ + taskDetailEntity.setResult("当前数据不存在"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("当前数据不存在"); + } + if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){ + Map checkData = new HashMap<>(); + checkData.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + checkData.put("documentRule",documentRule); + checkData.put("mdmModuleDistributeDetailEntities",mdmModuleDistributeDetailEntities); + JSONObject object1 = mdmModuleDao.queryMdmST(checkData); + if(object1.getString("id") == null || "".equals(object1.getString("id")) ){ + taskDetailEntity.setResult("当前数据不符合规则不发送"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + 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 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 map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + map.put("formmainId",object.getString("id")); + List 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 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 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); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + taskDetailEntity.setResult("分发脚本转换错误"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("分发脚本转换错误"); + } + } + Map 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()){ + taskDetailEntity.setResult("发送成功"); + taskLivingDetailsService.saveLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("发送成功"); + }else { + taskDetailEntity.setResult("发送错误"); + taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity); + return BaseResult.getFailureMessageEntity("发送错误"); + } + } + }else {//执行正常下发 + + //查询主数据 + MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity(); + queryMdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(queryMdmModuleEntity); + if(mdmModuleEntities == null || mdmModuleEntities.size() == 0){ + return BaseResult.getSuccessMessageEntity("主数据未设置,不需要下发"); + } + //查询下发的配置 没有直接跳过 + for (int i = 0; i < mdmModuleEntities.size(); i++) { + MdmModuleDistributeEntity queryMdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + queryMdmModuleDistributeEntity.setMdmId(mdmModuleEntities.get(i).getId()); + queryMdmModuleDistributeEntity.setEnabledType("1"); + queryMdmModuleDistributeEntity.setEnabledState("1"); + List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(queryMdmModuleDistributeEntity); + if(mdmModuleDistributeEntities == null || mdmModuleDistributeEntities.size() == 0){ + continue; + } + //查询主数据db + MdmModuleDbEntity queryMdmModuleDbEntity = new MdmModuleDbEntity(); + queryMdmModuleDbEntity.setMdmId(mdmModuleEntities.get(i).getId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(queryMdmModuleDbEntity); + if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){ + continue; + } + //查询主数据字段 + MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity(); + queryFild.setMdmId(mdmModuleEntities.get(i).getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); + if(mdmModuleDbFiledsEntities == null || mdmModuleDbFiledsEntities.size() == 0){ + continue; + } + //字段的规则 + MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity(); + queryFildRule.setMdmId(mdmModuleEntities.get(i).getId()); + queryFildRule.setRuleCode("service"); + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule); + + //新增 + doAdd(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + //修改 + doUpdate(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + //删除 + doDelete(mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + + } + + } + } + logger.info("执行成功"); + return BaseResult.getSuccessMessageEntity("执行成功"); + } catch (Exception e) { + logger.error("执行失败{}",e.getMessage()); + } + return BaseResult.getSuccessMessageEntity("执行成功"); + } + + private void doDelete(List mdmModuleDbEntities, List mdmModuleDistributeEntities, List mdmModuleDbFiledsRuleEntities, List mdmModuleDbFiledsEntities) { + //查询一千条数据 + String mainDb = null; + List objects = new ArrayList<>(); + for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) { + if("1".equals(mdmModuleDbEntities.get(i2).getDbType())) { + mainDb = mdmModuleDbEntities.get(i2).getDbName(); + } + } + if(mainDb == null){ + return; + } + Map map1 = new HashMap<>(); + map1.put("tableName",mainDb); + map1.put("dataStatus", "N"); + map1.put("deleteStatus", "0"); + map1.put("size", 1000); + objects = mdmModuleDao.queryMdmSTs(map1); + + if(objects == null || objects.size() == 0){ + return; + } + for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { + //查询下发的配置 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + //查询这一千条数据是否符合规则 + Map map = new HashMap<>(); + map.put("tableName", mainDb); + map.put("dataStatus", "N"); + map.put("deleteStatus", "0"); + map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities); + map.put("ids", objects); + List doObjects = mdmModuleDao.queryMdmSTs(map); + if(doObjects == null || doObjects.size() == 0){ + continue; + } + if(mdmModuleDistributeEntities.get(i1).getDeleteApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getDeleteApi())){ + for (int i = 0; i < doObjects.size(); i++) { + 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("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("2","删除接口的应用未找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + } + return ; + } + + SysApplicationScriptEntity scriptEntity = null; + if(mdmModuleDistributeEntities.get(i1).getDeleteScript() != null && !"".equals(mdmModuleDistributeEntities.get(i1).getDeleteScript())){ + scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getDeleteScript()); + if(scriptEntity == null || scriptEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity("2","删除接口脚本未找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + } + return ; + } + } + + for (int i = 0; i < doObjects.size(); i++) { + //查询发送日志是否已经有这条数据 + MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); + mdmModuleSendLogEntity.setTableName(mainDb+"_send_log"); + mdmModuleSendLogEntity.setFormmainId(doObjects.get(i).getString("id")); + mdmModuleSendLogEntity.setSts("Y"); + mdmModuleSendLogEntity.setOptionType("3"); + Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity); + if(num > 0){//已经过不发送 + continue; + } + getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + + //执行脚本 + 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",doObjects.get(i)); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = doObjects.get(i).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); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + continue; + } + } + Map 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","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + continue; + }else { + //保存日志 + saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3"); + continue; + } + } + + } + + //所有下发发送完成,修改数据状态 + for (int i = 0; i < objects.size(); i++) { + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + updateMap.put("dataStatus", "N"); + updateMap.put("deleteStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + } + } + + private void doUpdate(List mdmModuleDbEntities, List mdmModuleDistributeEntities, List mdmModuleDbFiledsRuleEntities, List mdmModuleDbFiledsEntities) { + //查询一千条数据 + String mainDb = null; + List objects = new ArrayList<>(); + for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) { + if("1".equals(mdmModuleDbEntities.get(i2).getDbType())) { + mainDb = mdmModuleDbEntities.get(i2).getDbName(); + } + } + if(mainDb == null){ + return; + } + Map map1 = new HashMap<>(); + map1.put("tableName",mainDb); + map1.put("dataStatus", "F"); + map1.put("updateStatus", "0"); + map1.put("size", 1000); + objects = mdmModuleDao.queryMdmSTs(map1); + + if(objects == null || objects.size() == 0){ + return; + } + for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { + //查询下发的配置 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + //查询这一千条数据是否符合规则 + Map map = new HashMap<>(); + map.put("tableName", mainDb); + map.put("dataStatus", "F"); + map.put("updateStatus", "0"); + map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities); + map.put("ids", objects); + List doObjects = mdmModuleDao.queryMdmSTs(map); + if(doObjects == null || doObjects.size() == 0){ + continue; + } + if(mdmModuleDistributeEntities.get(i1).getUpdateApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getUpdateApi())){ + for (int i = 0; i < doObjects.size(); i++) { + 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("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("2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + } + return ; + } + + SysApplicationScriptEntity scriptEntity = null; + if(mdmModuleDistributeEntities.get(i1).getUpdateScript() != null && !"".equals(mdmModuleDistributeEntities.get(i1).getUpdateScript())){ + scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getUpdateScript()); + if(scriptEntity == null || scriptEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity("2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + } + return ; + } + } + + for (int i = 0; i < doObjects.size(); i++) { + + getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + + //执行脚本 + 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",doObjects.get(i)); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = doObjects.get(i).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); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + continue; + } + } + Map 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","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + continue; + }else { + //保存日志 + saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2"); + continue; + } + } + } + + //所有下发发送完成,修改数据状态 + for (int i = 0; i < objects.size(); i++) { + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + updateMap.put("dataStatus", "F"); + updateMap.put("updateStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + } + } + + /** + * @Author lvleigang + * @Description 处理新增数据 + * @Date 1:55 下午 2024/6/19 + * @param mdmModuleDbEntities + * @param mdmModuleDistributeEntities + * @return void + **/ + private void doAdd(List mdmModuleDbEntities, List mdmModuleDistributeEntities,List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities ) { + //查询一千条数据 + String mainDb = null; + List objects = new ArrayList<>(); + for (int i2 = 0; i2 < mdmModuleDbEntities.size(); i2++) { + if("1".equals(mdmModuleDbEntities.get(i2).getDbType())) { + mainDb = mdmModuleDbEntities.get(i2).getDbName(); + } + } + if(mainDb == null){ + return; + } + Map map1 = new HashMap<>(); + map1.put("tableName",mainDb); + map1.put("dataStatus", "Y"); + map1.put("addStatus", "0"); + map1.put("size", 1000); + objects = mdmModuleDao.queryMdmSTs(map1); + + if(objects == null || objects.size() == 0){ + return; + } + for (int i1 = 0; i1 < mdmModuleDistributeEntities.size(); i1++) { + //查询下发的配置 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity() ; + mdmModuleDistributeDetailEntity.setDistributeId(mdmModuleDistributeEntities.get(i1).getId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + //查询这一千条数据是否符合规则 + Map map = new HashMap<>(); + map.put("tableName", mainDb); + map.put("dataStatus", "Y"); + map.put("addStatus", "0"); + map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities); + map.put("ids", objects); + List doObjects = mdmModuleDao.queryMdmSTs(map); + if(doObjects == null || doObjects.size() == 0){ + continue; + } + if(mdmModuleDistributeEntities.get(i1).getAddApi() == null || "".equals(mdmModuleDistributeEntities.get(i1).getAddApi())){ + for (int i = 0; i < doObjects.size(); i++) { + 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("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("2","应用未查找到",mainDb,objects.get(i).getString("id"),null,apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + } + return ; + } + + SysApplicationScriptEntity scriptEntity = null; + if(mdmModuleDistributeEntities.get(i1).getAddScript() != null && !"".equals(mdmModuleDistributeEntities.get(i1).getAddScript())){ + scriptEntity = sysApplicationScriptDao.get(mdmModuleDistributeEntities.get(i1).getAddScript()); + if(scriptEntity == null || scriptEntity.getId() == null ){ + for (int i = 0; i < doObjects.size(); i++) { + saveMdmModuleSendLogEntity("2","脚本未查找到",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + } + return ; + } + } + + for (int i = 0; i < doObjects.size(); i++) { + //查询是否已经手动发送过。只有新增校验,查询发送日志是否已经有这条数据 + MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity(); + mdmModuleSendLogEntity.setTableName(mainDb+"_send_log"); + mdmModuleSendLogEntity.setFormmainId(doObjects.get(i).getString("id")); + mdmModuleSendLogEntity.setSts("Y"); + mdmModuleSendLogEntity.setOptionType("1"); + Integer num = mdmModuleSendLogDao.getCount(mdmModuleSendLogEntity); + if(num > 0){//已经新增过不发送 + continue; + } + getDetailData(mdmModuleDbEntities,doObjects.get(i),mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities); + + //执行脚本 + 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",doObjects.get(i)); + /** head */ + Map header = null; + /** query */ + String querys = null; + /** body */ + String bodys = doObjects.get(i).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); + header = jsonResultEntity.getHeaders(); + querys = jsonResultEntity.getQuerys(); + bodys = jsonResultEntity.getBodys(); + }catch (Exception e){ + saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + continue; + } + } + Map 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","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + continue; + }else { + //保存日志 + saveMdmModuleSendLogEntity("2","转发失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1"); + continue; + } + } + + + + + + } + + //所有下发发送完成,修改数据状态 + for (int i = 0; i < objects.size(); i++) { + Map updateMap = new HashMap<>(); + updateMap.put("tableName",mainDb); + updateMap.put("dataStatus", "Y"); + updateMap.put("addStatus", "1"); + updateMap.put("id", objects.get(i).getString("id")); + mdmModuleDao.updateMdmSTs(updateMap); + } + } + + 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 JSONObject getDetailData(List mdmModuleDbEntities, JSONObject object, List mdmModuleDbFiledsRuleEntities,List mdmModuleDbFiledsEntities) { + + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("2".equals(mdmModuleDbEntities.get(i).getDbType())){ + Map map = new HashMap<>(); + map.put("tableName",mdmModuleDbEntities.get(i).getDbName()); + map.put("formmainId",object.getString("id")); + List 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 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); + } + } + + return object; + } + + + private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map 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); + } + } +} diff --git a/buildpackage/src/main/resources/application-ax.yml b/buildpackage/src/main/resources/application-ax.yml index ffd172f8..fda31564 100644 --- a/buildpackage/src/main/resources/application-ax.yml +++ b/buildpackage/src/main/resources/application-ax.yml @@ -19,5 +19,5 @@ spring: savefile: # 文件保存路径 path: E:\yongansystem\file -ax: +zt: url: http://127.0.0.1:9081/kangarooDataCenterV3/entranceController/externalCallInterface \ No newline at end of file diff --git a/buildpackage/src/main/resources/application-hclocal.yml b/buildpackage/src/main/resources/application-hclocal.yml index 5d960999..3e44c377 100644 --- a/buildpackage/src/main/resources/application-hclocal.yml +++ b/buildpackage/src/main/resources/application-hclocal.yml @@ -6,18 +6,22 @@ logging: encodings: UTF-8 file: # 日志保存路径 - path: /Users/apple/Desktop/log/local + path: D:\yongansystem\kangarooDataCenter\v3\logs spring: datasource: dynamic: datasource: master: - url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true - username: root - password: bd993088e8a7c3dc5f44441617f9b4bf - driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 +# url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true +# username: root +# password: bd993088e8a7c3dc5f44441617f9b4bf +# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 + url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true + username: root + password: 62e4295b615a30dbf3b8ee96f41c820b + driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 savefile: # 文件保存路径 - path: /Users/apple/Desktop/log/local -ax: + path: D:\yongansystem\kangarooDataCenter\v3\logs +zt: url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface \ No newline at end of file diff --git a/buildpackage/src/main/resources/application-llg.yml b/buildpackage/src/main/resources/application-llg.yml index 25a80574..d1c57a17 100644 --- a/buildpackage/src/main/resources/application-llg.yml +++ b/buildpackage/src/main/resources/application-llg.yml @@ -24,5 +24,5 @@ spring: savefile: # 文件保存路径 path: /Users/apple/Desktop/log/local -ax: +zt: url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface \ No newline at end of file diff --git a/buildpackage/src/main/resources/application-local.yml b/buildpackage/src/main/resources/application-local.yml index e2364fc0..4fc3208a 100644 --- a/buildpackage/src/main/resources/application-local.yml +++ b/buildpackage/src/main/resources/application-local.yml @@ -19,5 +19,5 @@ spring: savefile: # 文件保存路径 path: /Users/apple/Desktop/log/local -ax: +zt: url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface \ No newline at end of file diff --git a/buildpackage/src/main/resources/application-yuqh.yml b/buildpackage/src/main/resources/application-yuqh.yml index 47544edc..b5209253 100644 --- a/buildpackage/src/main/resources/application-yuqh.yml +++ b/buildpackage/src/main/resources/application-yuqh.yml @@ -19,5 +19,5 @@ spring: savefile: # 文件保存路径 path: E:\yongansystem\log -ax: +zt: url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface \ No newline at end of file diff --git a/buildpackage/src/main/resources/application.yml b/buildpackage/src/main/resources/application.yml index ceab32b0..9a669fa1 100644 --- a/buildpackage/src/main/resources/application.yml +++ b/buildpackage/src/main/resources/application.yml @@ -90,7 +90,7 @@ mybatis-plus: global-config: db-config: id-type: auto # 主键策略 -ax: +zt: url: # 积木报表工具 #JimuReport[minidao配置] diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/pluginCfg.xml new file mode 100644 index 00000000..5543d57a --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/pluginCfg.xml @@ -0,0 +1,6 @@ + + +MdmCustomerBankPlugin +MdmCustomerBankPlugin插件 +90000001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..d3358861 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..d99236a7 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..5fe75f54 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer.bank/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/pluginCfg.xml new file mode 100644 index 00000000..df03dbcd --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/pluginCfg.xml @@ -0,0 +1,6 @@ + + +MdmCustomerPlugin +MdmCustomerPlugin插件 +90000001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..62161706 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..41c79445 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..cdbf695b --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.customer/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/pluginCfg.xml new file mode 100644 index 00000000..e6a21caa --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/pluginCfg.xml @@ -0,0 +1,6 @@ + + +MdmProjectPlugin +MdmProjectPlugin插件 +90000001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..4b2b24ab --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..272d01ca --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..5b26e6ed --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.project/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/pluginCfg.xml new file mode 100644 index 00000000..b7b315a4 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/pluginCfg.xml @@ -0,0 +1,6 @@ + + +MdmUserPlugin +MdmUserPlugin插件 +90000001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..08c20d5f --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..a9e42b61 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..0b5dc5ca --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData.user/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/pluginCfg.xml new file mode 100644 index 00000000..f2f50ef1 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/pluginCfg.xml @@ -0,0 +1,6 @@ + + +MdmOrgPlugin +MdmOrgPlugin插件 +90000001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-dao.xml new file mode 100644 index 00000000..134e2407 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-dao.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..a8e39d7b --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-service.xml b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-service.xml new file mode 100644 index 00000000..9cea180a --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/masterData/org/spring/spring-buildpackage-service.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/pluginCfg.xml b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/pluginCfg.xml new file mode 100644 index 00000000..7b7b63b8 --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/pluginCfg.xml @@ -0,0 +1,6 @@ + + +MdmModulePlugin +MdmModulePlugin插件 +90000001 + diff --git a/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/spring/spring-buildpackage-plugin.xml new file mode 100644 index 00000000..4952fc4c --- /dev/null +++ b/buildpackage/src/main/resources/cfgHome/plugin/mdmDistribute/spring/spring-buildpackage-plugin.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/buildpackage/src/test/java/com/hzya/frame/temButtom.java b/buildpackage/src/test/java/com/hzya/frame/temButtom.java index e3154559..34f7fcb4 100644 --- a/buildpackage/src/test/java/com/hzya/frame/temButtom.java +++ b/buildpackage/src/test/java/com/hzya/frame/temButtom.java @@ -2,6 +2,7 @@ package com.hzya.frame; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.plugin.mdmDistribute.plugin.MdmModulePluginInitializer; import com.hzya.frame.plugin.seeyonExt.plugin.SeeyonExtPluginInitializer; import com.hzya.frame.util.AESUtil; import org.junit.Test; @@ -23,6 +24,8 @@ public class temButtom { @Resource SeeyonExtPluginInitializer seeyonExtPluginInitializer; + @Resource + MdmModulePluginInitializer mdmModulePluginInitializer; @Test public void seeyonExtTest(){ JSONObject jsonStr = new JSONObject(); @@ -36,12 +39,23 @@ public class temButtom { } } + @Test + public void mdm(){ + JSONObject jsonStr = new JSONObject(); + jsonStr.put("integration_task_living_details_id","123123123123"); + try { + mdmModulePluginInitializer.executeBusiness(jsonStr); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + @Test 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); } diff --git a/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java index a999a9fa..1b9d09b3 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/IBaseDao.java @@ -73,7 +73,6 @@ public interface IBaseDao { * @return */ int delete(String paramString, Object paramObject); - /** * 修改 * @param paramString sqlMapperID @@ -178,6 +177,8 @@ public interface IBaseDao { */ Integer getCount(E paramE); + Integer getCount(String statement,Object baseEntity); + /** * 分页查询 * @param paramString mapperID diff --git a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java index c578b60e..95e43393 100644 --- a/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java +++ b/common/src/main/java/com/hzya/frame/basedao/dao/MybatisGenericDao.java @@ -276,6 +276,11 @@ public abstract class MybatisGenericDao query(Object baseEntity) { Assert.notNull(baseEntity, "query baseEntity :不能为NULL"); diff --git a/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java b/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java index 468e0c3c..ff02bcc4 100644 --- a/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java +++ b/common/src/main/java/com/hzya/frame/execsql/service/ExecSqlServiceImpl.java @@ -53,7 +53,7 @@ public class ExecSqlServiceImpl implements IExecSqlService { public List> execSelectSql(ExecSqlEntity entity) throws RuntimeException { List> list = new ArrayList<>(); logger.info("=============进入execSelectSql方法============"); - if (null != entity && ObjectUtils.isEmpty(entity.getSql())) { + if (null != entity && null!=entity.getSql()) { //sqlsession // SqlSession sqlSession = getSqlSession(entity.getDatasource_code()); // SqlSession sqlSession = new DataSourceUtil().getDefaultSqlSession(); @@ -61,7 +61,7 @@ public class ExecSqlServiceImpl implements IExecSqlService { logger.info("=============execSelectSql方法要执行的sql:============" + select_sql); if (!select_sql.contains("update") && !select_sql.contains("delete") && !select_sql.contains("insert") && !select_sql.contains("create")) { - list = sqlSession.selectList("com.hzya.frame.sysnew.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql", entity); + list = sqlSession.selectList("com.hzya.frame.execsql.entity.ExecSqlEntity.ExecSqlEntity_execsql", entity); logger.info("===========execSelectSql方法返回的结果条数=============" + list.size()); } //sqlSession.close(); diff --git a/pom.xml b/pom.xml index fa54a84e..383d109f 100644 --- a/pom.xml +++ b/pom.xml @@ -244,12 +244,12 @@ - - - com.dameng - Dm8JdbcDriver18 - 8.1.1.49 - + + + + + + @@ -338,21 +338,7 @@ org.springframework.boot spring-boot-starter-cache - - - - org.jeecgframework.jimureport - jimureport-spring-boot-starter - ${jimureport.version} - - - - io.minio - minio - ${minio.version} - true - - + org.postgresql postgresql diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/DbFiledsDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/DbFiledsDto.java new file mode 100644 index 00000000..e0f5e05b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/DbFiledsDto.java @@ -0,0 +1,83 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; + +public class DbFiledsDto { + + /** + * 1新增 2、修改 + */ + private String dataType; + + /** + * 中文名 + */ + private String chName; + /** + * 英文名 + */ + private String enName; + /** + * 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + */ + private String filedType; + /** + * 长度 + */ + private String filedLength; + + public DbFiledsDto() { + } + + public DbFiledsDto(String dataType,String chName, String enName, String filedType, String filedLength) { + this.dataType = dataType; + this.chName = chName; + this.enName = enName; + this.filedType = filedType; + this.filedLength = filedLength; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } + + public String getFiledLength() { + return filedLength; + } + + public void setFiledLength(String filedLength) { + this.filedLength = filedLength; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java new file mode 100644 index 00000000..0370431c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataDto.java @@ -0,0 +1,69 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; + +import java.util.List; + +public class MdmDataDto { + + private String id; + private String tableName; + private String documentRule; + private Integer documentRuleNum; + /** + * 类型 1、主表 2、明细 + */ + private String dbType; + + private List mdmDataFiledDtos; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public List getMdmDataFiledDtos() { + return mdmDataFiledDtos; + } + + public void setMdmDataFiledDtos(List mdmDataFiledDtos) { + this.mdmDataFiledDtos = mdmDataFiledDtos; + } + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Integer getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Integer documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java new file mode 100644 index 00000000..d9e40e8d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDataFiledDto.java @@ -0,0 +1,29 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; + +import java.util.List; + +public class MdmDataFiledDto { + + private String filedsName; + private String filedsValue; + + public String getFiledsName() { + return filedsName; + } + + public void setFiledsName(String filedsName) { + this.filedsName = filedsName; + } + + public String getFiledsValue() { + return filedsValue; + } + + public void setFiledsValue(String filedsValue) { + this.filedsValue = filedsValue; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbFiledVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbFiledVo.java new file mode 100644 index 00000000..921f2e8b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDbFiledVo.java @@ -0,0 +1,32 @@ +package com.hzya.frame.mdm.entity; + + +public class MdmDbFiledVo { + private String id; + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public MdmDbFiledVo() { + } + + public MdmDbFiledVo(String id, String name) { + this.id = id; + this.name = name; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java new file mode 100644 index 00000000..586e4d7d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDetailViewVo.java @@ -0,0 +1,41 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; + +import java.util.List; + +public class MdmDetailViewVo { + //模版信息 + private MdmModuleEntity mdmModuleEntity; + //主数据主表 + private MdmModuleDbEntity mainMdmModuleDb; + //主数据子表 + private List sublistMdmModuleDb; + + public MdmModuleEntity getMdmModuleEntity() { + return mdmModuleEntity; + } + + public void setMdmModuleEntity(MdmModuleEntity mdmModuleEntity) { + this.mdmModuleEntity = mdmModuleEntity; + } + + public MdmModuleDbEntity getMainMdmModuleDb() { + return mainMdmModuleDb; + } + + public void setMainMdmModuleDb(MdmModuleDbEntity mainMdmModuleDb) { + this.mainMdmModuleDb = mainMdmModuleDb; + } + + public List getSublistMdmModuleDb() { + return sublistMdmModuleDb; + } + + public void setSublistMdmModuleDb(List sublistMdmModuleDb) { + this.sublistMdmModuleDb = sublistMdmModuleDb; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java new file mode 100644 index 00000000..57b97fdc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDistributeDto.java @@ -0,0 +1,31 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import java.util.List; + +public class MdmDistributeDto { + + + //主数据编码 + private Long mdmCode; + + private List mdmModuleDistributeEntities; + + public List getMdmModuleDistributeEntities() { + return mdmModuleDistributeEntities; + } + + public void setMdmModuleDistributeEntities(List mdmModuleDistributeEntities) { + this.mdmModuleDistributeEntities = mdmModuleDistributeEntities; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java index b5e8332d..93774e10 100644 --- a/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmDto.java @@ -2,6 +2,7 @@ package com.hzya.frame.mdm.entity; import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; import java.util.List; @@ -12,11 +13,50 @@ public class MdmDto { private Long mdmCode; //单据编码规则 private List mdmTableCodeRuleEntityList; + //字段规则 + private List mdmModuleDbFiledsRuleEntities; //主数据主表 private MdmModuleDbEntity mainMdmModuleDb; //主数据子表 private List sublistMdmModuleDb; + + //id + private String id; + //id + private String fieldId; + //id + private String dbId; + //3、新增4、修改 5、查看 + private String showType; + //分页 + private Integer pageNum; + private Integer pageSize; + /** + * 显示字段 + */ + private String viewFiled; + /** + * 上级id字段 + */ + private String upIdFiled; + //主数据名称 + private String mdmName; + //主数据类型 + private String mdmType; + //描述 + private String remark; + //描述 + private String[] ids; + + private String tableName; + private String value; + + private String label; + private String lableValue; + + private String upId; + public Long getMdmCode() { return mdmCode; } @@ -48,5 +88,149 @@ public class MdmDto { public void setSublistMdmModuleDb(List sublistMdmModuleDb) { this.sublistMdmModuleDb = sublistMdmModuleDb; } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getShowType() { + return showType; + } + + public void setShowType(String showType) { + this.showType = showType; + } + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getViewFiled() { + return viewFiled; + } + + public void setViewFiled(String viewFiled) { + this.viewFiled = viewFiled; + } + + public String getUpIdFiled() { + return upIdFiled; + } + + public void setUpIdFiled(String upIdFiled) { + this.upIdFiled = upIdFiled; + } + + public String getMdmName() { + return mdmName; + } + + public void setMdmName(String mdmName) { + this.mdmName = mdmName; + } + + public String getMdmType() { + return mdmType; + } + + public void setMdmType(String mdmType) { + this.mdmType = mdmType; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String[] getIds() { + return ids; + } + + public void setIds(String[] ids) { + this.ids = ids; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getLableValue() { + return lableValue; + } + + public void setLableValue(String lableValue) { + this.lableValue = lableValue; + } + + public String getUpId() { + return upId; + } + + public void setUpId(String upId) { + this.upId = upId; + } + + public List getMdmModuleDbFiledsRuleEntities() { + return mdmModuleDbFiledsRuleEntities; + } + + public void setMdmModuleDbFiledsRuleEntities(List mdmModuleDbFiledsRuleEntities) { + this.mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleEntities; + } + + public String getFieldId() { + return fieldId; + } + + public void setFieldId(String fieldId) { + this.fieldId = fieldId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewDto.java new file mode 100644 index 00000000..047809ee --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewDto.java @@ -0,0 +1,91 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; + +import java.util.List; + +public class MdmModuleViewDto { + + private Long mdmCode; + //模版 + private MdmModuleViewEntity mdmModuleViewEntity; + //新增 + private List addFiled; + //修改 + private List editFiled; + //查看 + private List showFiled; + //查询 + private List queryFiled; + //列表 + private List listFiled; + //按钮 + private List dbButtonFiled; + + public MdmModuleViewEntity getMdmModuleViewEntity() { + return mdmModuleViewEntity; + } + + public void setMdmModuleViewEntity(MdmModuleViewEntity mdmModuleViewEntity) { + this.mdmModuleViewEntity = mdmModuleViewEntity; + } + + public List getAddFiled() { + return addFiled; + } + + public void setAddFiled(List addFiled) { + this.addFiled = addFiled; + } + + public List getEditFiled() { + return editFiled; + } + + public void setEditFiled(List editFiled) { + this.editFiled = editFiled; + } + + public List getShowFiled() { + return showFiled; + } + + public void setShowFiled(List showFiled) { + this.showFiled = showFiled; + } + + public List getQueryFiled() { + return queryFiled; + } + + public void setQueryFiled(List queryFiled) { + this.queryFiled = queryFiled; + } + + public List getListFiled() { + return listFiled; + } + + public void setListFiled(List listFiled) { + this.listFiled = listFiled; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } + + public List getDbButtonFiled() { + return dbButtonFiled; + } + + public void setDbButtonFiled(List dbButtonFiled) { + this.dbButtonFiled = dbButtonFiled; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java new file mode 100644 index 00000000..44719c62 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmModuleViewVo.java @@ -0,0 +1,154 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; + +import java.util.List; + +public class MdmModuleViewVo { + + + /** 主数据模版ID */ + private String mdmId; + /** 类型1、查询2、列表3、新增4、修改 5、查看 */ + private String viewType; + //模版 + private MdmModuleViewEntity mdmModuleViewEntity; + //新增 + private List addFiled; + //修改 + private List editFiled; + //查看 + private List showFiled; + //查询 + private List queryFiled; + //列表 + private List listFiled; + + //新增 + private List dbAddFiled; + //修改 + private List dbEditFiled; + //查看 + private List dbShowFiled; + //查询 + private List dbQueryFiled; + //列表 + private List dbListFiled; + //按钮 + private List dbButtonFiled; + + public List getAddFiled() { + return addFiled; + } + + public void setAddFiled(List addFiled) { + this.addFiled = addFiled; + } + + public List getEditFiled() { + return editFiled; + } + + public void setEditFiled(List editFiled) { + this.editFiled = editFiled; + } + + public List getShowFiled() { + return showFiled; + } + + public void setShowFiled(List showFiled) { + this.showFiled = showFiled; + } + + public List getQueryFiled() { + return queryFiled; + } + + public void setQueryFiled(List queryFiled) { + this.queryFiled = queryFiled; + } + + public List getListFiled() { + return listFiled; + } + + public void setListFiled(List listFiled) { + this.listFiled = listFiled; + } + + public MdmModuleViewEntity getMdmModuleViewEntity() { + return mdmModuleViewEntity; + } + + public void setMdmModuleViewEntity(MdmModuleViewEntity mdmModuleViewEntity) { + this.mdmModuleViewEntity = mdmModuleViewEntity; + } + + public List getDbAddFiled() { + return dbAddFiled; + } + + public void setDbAddFiled(List dbAddFiled) { + this.dbAddFiled = dbAddFiled; + } + + public List getDbEditFiled() { + return dbEditFiled; + } + + public void setDbEditFiled(List dbEditFiled) { + this.dbEditFiled = dbEditFiled; + } + + public List getDbShowFiled() { + return dbShowFiled; + } + + public void setDbShowFiled(List dbShowFiled) { + this.dbShowFiled = dbShowFiled; + } + + public List getDbQueryFiled() { + return dbQueryFiled; + } + + public void setDbQueryFiled(List dbQueryFiled) { + this.dbQueryFiled = dbQueryFiled; + } + + public List getDbListFiled() { + return dbListFiled; + } + + public void setDbListFiled(List dbListFiled) { + this.dbListFiled = dbListFiled; + } + + public List getDbButtonFiled() { + return dbButtonFiled; + } + + public void setDbButtonFiled(List dbButtonFiled) { + this.dbButtonFiled = dbButtonFiled; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getViewType() { + return viewType; + } + + public void setViewType(String viewType) { + this.viewType = viewType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java new file mode 100644 index 00000000..be40977f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmQuery.java @@ -0,0 +1,79 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.sys.entity.TemplateKeyValue; + +import java.util.List; + +public class MdmQuery { + + //分页 + private Integer pageNum; + //分页 + private Long mdmCode; + private Integer pageSize; + //表名 + private String tableName; + //查询条件 + private List queryCondition; + //返回字段 + private List returnField; + //明细表查询条件 + private List detailQueryCondition; + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public List getQueryCondition() { + return queryCondition; + } + + public void setQueryCondition(List queryCondition) { + this.queryCondition = queryCondition; + } + + public List getReturnField() { + return returnField; + } + + public void setReturnField(List returnField) { + this.returnField = returnField; + } + + public List getDetailQueryCondition() { + return detailQueryCondition; + } + + public void setDetailQueryCondition(List detailQueryCondition) { + this.detailQueryCondition = detailQueryCondition; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmSourceDto.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmSourceDto.java new file mode 100644 index 00000000..e00af986 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmSourceDto.java @@ -0,0 +1,34 @@ +package com.hzya.frame.mdm.entity; + + +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; + +import java.util.List; + +public class MdmSourceDto { + + + //主数据编码 + private Long mdmCode; + + private List mdmModuleSourceEntities; + + + public List getMdmModuleSourceEntities() { + return mdmModuleSourceEntities; + } + + public void setMdmModuleSourceEntities(List mdmModuleSourceEntities) { + this.mdmModuleSourceEntities = mdmModuleSourceEntities; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java new file mode 100644 index 00000000..f1e25c5a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewFiledVo.java @@ -0,0 +1,114 @@ +package com.hzya.frame.mdm.entity; + +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; + +import java.util.List; + +public class MdmViewFiledVo { + + //字段id + private String id; + //表名 + private String dbName; + //类型 1、主表 2、明细 + private String dbType; + //主数据模版ID + private String mdmId; + //模版数据库id + private String dbId; + //中文名 + private String chName; + //英文名 + private String enName; + //排序 + private Integer sorts; + /** + * 字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + */ + private String filedType; + //字段规则 + private List ruleList; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public List getRuleList() { + return ruleList; + } + + public void setRuleList(List ruleList) { + this.ruleList = ruleList; + } + + public Integer getSorts() { + return sorts; + } + + public void setSorts(Integer sorts) { + this.sorts = sorts; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java new file mode 100644 index 00000000..8630811e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/entity/MdmViewVo.java @@ -0,0 +1,64 @@ +package com.hzya.frame.mdm.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +public class MdmViewVo { + + private String id; + //模版信息 + private MdmModuleEntity mdmModuleEntity; + //模版展示信息 + private MdmModuleViewEntity mdmModuleViewEntity; + //查询条件 + private List queryList; + //列表 + private List listList; + + public List getQueryList() { + return queryList; + } + + public void setQueryList(List queryList) { + this.queryList = queryList; + } + + public List getListList() { + return listList; + } + + public void setListList(List listList) { + this.listList = listList; + } + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MdmModuleEntity getMdmModuleEntity() { + return mdmModuleEntity; + } + + public void setMdmModuleEntity(MdmModuleEntity mdmModuleEntity) { + this.mdmModuleEntity = mdmModuleEntity; + } + + public MdmModuleViewEntity getMdmModuleViewEntity() { + return mdmModuleViewEntity; + } + + public void setMdmModuleViewEntity(MdmModuleViewEntity mdmModuleViewEntity) { + this.mdmModuleViewEntity = mdmModuleViewEntity; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java index 8dcabbcb..c13defa1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/IMdmModuleDao.java @@ -1,8 +1,15 @@ package com.hzya.frame.mdm.mdmModule.dao; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.mdm.entity.MdmDataDto; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.sys.entity.FormmainDeleteDto; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -19,6 +26,34 @@ public interface IMdmModuleDao extends IBaseDao { MdmModuleEntity getByMdmCode(Long mdmCode); Integer checkTable(Map maps); + Integer createTable(Map maps); + Integer alterTable(Map maps); + Integer alterTableField(MdmModuleDbFiledsEntity entity); + Integer alterTableName(Map maps); + List> queryMdmShowData(MdmQuery entity); + List> queryTemplateDataMore(MdmDto entity); + HashMap queryTemplateDataOne(MdmDto entity); + Integer checkData(Map map); + Integer updateForm(MdmDataDto mdmDataDto); + Integer saveForm(MdmDataDto mdmDataDto); + Integer deleteTemplateById(FormmainDeleteDto formmainDeleteDto); + Integer deleteChilder(FormmainDeleteDto formmainDeleteDto); + List> querySelectData(MdmDto entity); + List> queryDataAll(MdmDto entity); + + Integer deleteMdmModuleEntity(MdmModuleEntity entity); + + Integer queryMainCount(MdmQuery mdmQuery); + + Integer deleteTable(Map maps); + + + JSONObject queryMdmST(Map maps); + List queryMdmSTDetail(Map maps); + + List queryMdmSTs(Map map); + + void updateMdmSTs(Map updateMap); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java index fda4b148..497b69b5 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/dao/impl/MdmModuleDaoImpl.java @@ -1,10 +1,17 @@ package com.hzya.frame.mdm.mdmModule.dao.impl; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.mdm.entity.MdmDataDto; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.sys.entity.FormmainDeleteDto; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,7 +32,7 @@ public class MdmModuleDaoImpl extends MybatisGenericDao @Override public MdmModuleEntity getByMdmCode(Long mdmCode) { - MdmModuleEntity mdmModuleEntity = (MdmModuleEntity) super.query(getSqlIdPrifx() + "getByMdmCode",mdmCode); + MdmModuleEntity mdmModuleEntity = (MdmModuleEntity) super.selectOne(getSqlIdPrifx() + "getByMdmCode",mdmCode); return mdmModuleEntity; } @@ -35,5 +42,132 @@ public class MdmModuleDaoImpl extends MybatisGenericDao return o; } + @Override + public List> queryDataAll(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryDataAll", entity); + return o; + } + + @Override + public Integer deleteMdmModuleEntity(MdmModuleEntity entity) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteMdmModuleEntity", entity); + return o; + } + + @Override + public Integer queryMainCount(MdmQuery entity) { + Integer o = (Integer) super.getCount(getSqlIdPrifx() + "queryMainCount", entity); + return o; + } + + @Override + public Integer checkData(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "checkData", maps); + return o; + + } + @Override + public Integer updateForm(MdmDataDto mdmDataDto) { + Integer o = super.update(getSqlIdPrifx() + "updateForm", mdmDataDto); + return o; + + } + @Override + public List> querySelectData(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "querySelectData", entity); + return o; + + } + @Override + public Integer deleteChilder(FormmainDeleteDto entity) { + Integer o = super.delete(getSqlIdPrifx() + "deleteChilder", entity); + return o; + + } + @Override + public Integer deleteTemplateById(FormmainDeleteDto entity) { + Integer o = super.delete(getSqlIdPrifx() + "deleteTemplateById", entity); + return o; + + } + @Override + public Integer saveForm(MdmDataDto mdmDataDto) { + Integer o = super.update(getSqlIdPrifx() + "saveForm", mdmDataDto); + return o; + + } + @Override + public List> queryTemplateDataMore(MdmDto entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryTemplateDataMore", entity); + return o; + + } + + @Override + public HashMap queryTemplateDataOne(MdmDto entity) { + HashMap o = (HashMap) super.selectOne(getSqlIdPrifx() + "queryTemplateDataOne", entity); + return o; + + } + + @Override + public List> queryMdmShowData(MdmQuery entity) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "queryMdmShowData", entity); + return o; + } + @Override + public Integer createTable(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "createTable", maps); + return o; + } + + @Override + public Integer deleteTable(Map maps) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteTable", maps); + return o; + } + + + + @Override + public Integer alterTable(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTable", maps); + return o; + } + @Override + public Integer alterTableField(MdmModuleDbFiledsEntity entity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTableField", entity); + return o; + } + + @Override + public Integer alterTableName(Map maps) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTableName", maps); + return o; + + } + + @Override + public JSONObject queryMdmST(Map maps) { + JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps); + return o; + } + @Override + public List queryMdmSTs(Map maps) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryMdmST", maps); + return o; + } + + @Override + public void updateMdmSTs(Map maps) { + super.update(getSqlIdPrifx() + "updateMdmSTs", maps); + } + + @Override + public List queryMdmSTDetail(Map maps) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryMdmSTDetail", maps); + return o; + } + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml index f323ccab..5882dd6c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/entity/MdmModuleEntity.xml @@ -2,26 +2,26 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + id ,mdm_name ,mdm_logo @@ -40,227 +40,243 @@ - - + select + + from mdm_module + + and id = #{id} + and mdm_name = #{mdmName} + and mdm_logo = #{mdmLogo} + and mdm_code = #{mdmCode} + and mdm_type = #{mdmType} + and remark = #{remark} + and sorts = #{sorts} + and create_user_id = #{create_user_id} + and create_time = #{create_time} + and modify_user_id = #{modify_user_id} + and modify_time = #{modify_time} + and sts = #{sts} + and org_id = #{org_id} + and company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - - - - + + + - + select + + from mdm_module + + and id like concat('%',#{id},'%') + and mdm_name like concat('%',#{mdmName},'%') + and mdm_logo like concat('%',#{mdmLogo},'%') + and mdm_code like concat('%',#{mdmCode},'%') + and mdm_type like concat('%',#{mdmType},'%') + and remark like concat('%',#{remark},'%') + and sorts like concat('%',#{sorts},'%') + and create_user_id like + concat('%',#{create_user_id},'%') + + and create_time like concat('%',#{create_time},'%') + and modify_user_id like + concat('%',#{modify_user_id},'%') + + and modify_time like concat('%',#{modify_time},'%') + and sts like concat('%',#{sts},'%') + and org_id like concat('%',#{org_id},'%') + and company_id like concat('%',#{companyId},'%') and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - + select + + from mdm_module + + or id = #{id} + or mdm_name = #{mdmName} + or mdm_logo = #{mdmLogo} + or mdm_code = #{mdmCode} + or mdm_type = #{mdmType} + or remark = #{remark} + or sorts = #{sorts} + or create_user_id = #{create_user_id} + or create_time = #{create_time} + or modify_user_id = #{modify_user_id} + or modify_time = #{modify_time} + or sts = #{sts} + or org_id = #{org_id} + or company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - - insert into mdm_module( - - id , - mdm_name , - mdm_logo , - mdm_code , - mdm_code , - mdm_type , - remark , - sorts , - create_user_id , - create_time , - modify_user_id , - modify_time , - sts , - org_id , - company_id , - sts, - - )values( - - #{id} , - #{mdmName} , - #{mdmLogo} , - #{mdmCode} , + + + insert into mdm_module( + + id , + mdm_name , + mdm_logo , + mdm_code , + mdm_code , + mdm_type , + remark , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sts, + + )values( + + #{id} , + #{mdmName} , + #{mdmLogo} , + #{mdmCode} , (SELECT IFNULL(MAX(b.mdm_code)+1,10001) AS mdmCode FROM mdm_module b ), - #{mdmType} , - #{remark} , - #{sorts} , - #{create_user_id} , - #{create_time} , - #{modify_user_id} , - #{modify_time} , - #{sts} , - #{org_id} , - #{companyId} , - 'Y', - - ) - - - - insert into mdm_module(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) - values - - (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - - - - - insert into mdm_module(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) - values - - (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) - - on duplicate key update - mdm_name = values(mdm_name), - mdm_logo = values(mdm_logo), - mdm_code = values(mdm_code), - mdm_type = values(mdm_type), - remark = values(remark), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id), - company_id = values(company_id) - - -update mdm_module set - - mdm_name = #{mdmName}, - mdm_logo = #{mdmLogo}, - mdm_code = #{mdmCode}, - mdm_type = #{mdmType}, - remark = #{remark}, - create_user_id = #{create_user_id}, - create_time = #{create_time}, - modify_user_id = #{modify_user_id}, - modify_time = #{modify_time}, - sts = #{sts}, - org_id = #{org_id}, - company_id = #{companyId}, - -where id = #{id} - - - + #{mdmType} , + #{remark} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + 'Y', + + ) + + + + insert into mdm_module(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, + 'Y') + + + + + insert into mdm_module(mdm_name, mdm_logo, mdm_code, mdm_type, remark, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.mdmName},#{entity.mdmLogo},#{entity.mdmCode},#{entity.mdmType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + mdm_name = values(mdm_name), + mdm_logo = values(mdm_logo), + mdm_code = values(mdm_code), + mdm_type = values(mdm_type), + remark = values(remark), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + + + update mdm_module set + + mdm_name = #{mdmName}, + mdm_logo = #{mdmLogo}, + mdm_code = #{mdmCode}, + mdm_type = #{mdmType}, + remark = #{remark}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + + where id = #{id} + + + update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} where id = #{id} - - -update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} - - and id = #{id} - and mdm_name = #{mdmName} - and mdm_logo = #{mdmLogo} - and mdm_code = #{mdmCode} - and mdm_type = #{mdmType} - and remark = #{remark} - and sorts = #{sorts} - and sts = #{sts} - and company_id = #{companyId} + + + update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_name = #{mdmName} + and mdm_logo = #{mdmLogo} + and mdm_code = #{mdmCode} + and mdm_type = #{mdmType} + and remark = #{remark} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} and sts='Y' - - - - + + + + delete from mdm_module where id = #{id} + + + DROP TABLE ${tableName} + - select a.id as id, a.mdm_name as mdm_name, @@ -292,7 +308,7 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # @@ -305,5 +321,567 @@ update mdm_module set sts= 'N' ,modify_time = #{modify_time},modify_user_id = # TABLE_SCHEMA = 'businesscenter' and TABLE_NAME = #{tableName} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update ${tableName} set + + + + + ${item.filedsName} = #{item.filedsValue}, + + + modify_user_id = #{item.filedsValue}, + + + + modify_time = now(), + + where id = #{id} + + + + insert into ${tableName}( + + + + + ${item.filedsName}, + + + create_user_id, + modify_user_id, + + + + create_time, + modify_time, + sts, + + document_rule, + document_rule_num, + + + )values + ( + + + + + #{item.filedsValue}, + + + #{item.filedsValue}, + #{item.filedsValue}, + + + + + now(), + now(), + 'Y', + + ( concat(#{documentRule}, + (SELECT + IF + ( + LENGTH( (SELECT + IFNULL(MAX(b.document_rule_num),0)+1 + FROM + ${tableName} b + WHERE + DATE_FORMAT( b.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) ) <= ${documentRuleNum}, + LPAD( (SELECT + IFNULL(MAX(c.document_rule_num),0)+1 + FROM + ${tableName} c + WHERE + DATE_FORMAT( c.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )), ${documentRuleNum}, '0' ), + (SELECT + IFNULL(MAX(d.document_rule_num),0)+1 + FROM + ${tableName} d + WHERE + DATE_FORMAT( d.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) + ) + ) + )), + (SELECT + IF + ( + LENGTH( (SELECT + IFNULL(MAX(e.document_rule_num),0)+1 + FROM + ${tableName} e + WHERE + DATE_FORMAT( e.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) ) <= ${documentRuleNum}, + LPAD( (SELECT + IFNULL(MAX(f.document_rule_num),0)+1 + FROM + ${tableName} f + WHERE + DATE_FORMAT( f.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )), ${documentRuleNum}, '0' ), + (SELECT + IFNULL(MAX(g.document_rule_num),0)+1 + FROM + ${tableName} g + WHERE + DATE_FORMAT( g.create_time, '%Y-%m' ) = DATE_FORMAT( now(), '%Y-%m' )) + ) + ) + + + ) + + + update ${tableName} set + data_status ='N',modify_time = now(),modify_user_id = #{loginId} + ,delete_status = '0' + + and id = #{id} + and formmain_id = #{formmain_id} + and sts='Y' + + + + + update ${tableName} set + data_status='N',modify_time = now(),modify_user_id = #{loginId},delete_status = '0' + + + and ${upIdFiled} like concat(#{upIdFiledValue},'%') + + and sts='Y' + + + + + + + + + delete from mdm_module where mdm_code = #{mdmCode} + + + + + + + + + + + + + + + update ${tableName} set + + , add_status = #{addStatus} + ,modify_time = now() + + + and id = #{id} + and data_status = #{dataStatus} + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java index 02372e74..ca980443 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/IMdmModuleService.java @@ -1,7 +1,10 @@ package com.hzya.frame.mdm.mdmModule.service; +import com.alibaba.fastjson.JSONObject; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.web.entity.JsonResultEntity; + /** * 主数据模版(MdmModule)表服务接口 * @@ -9,4 +12,389 @@ import com.hzya.frame.basedao.service.IBaseService; * @since 2024-06-03 08:46:29 */ public interface IMdmModuleService extends IBaseService{ + + /** + * @Author lvleigang + * @Description 查询所有主数据 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 删除主数据 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-基本信息获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-基本信息新增 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdm(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-基本信息修改(同步修改菜单名称) + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdm(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-单据规则获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdmTableCodeRule(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-单据规则新增或修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveOrUpdateMdmTableCodeRule(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表新增 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmDb(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDbField(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段明细 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDbFieldDetail(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段新增 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmDbField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDbField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmDbField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDbFieldRule(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDbFieldRule(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示类型获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmView(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示类型保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmView(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示类型修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmView(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示字段获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmViewField(JSONObject jsonObject); + + + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示字段设置保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveOrUpdateMdmViewField(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmViewButton(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveOrUpdateMdmViewButton(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据来源-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据来源保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据来源获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据来源修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmSource(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 主数据-数据来源删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmSource(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置保存 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity saveMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity getMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置修改 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity updateMdmDistribute(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-分发设置删除 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity deleteMdmDistribute(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-写入日志-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmOptionLogPage(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-下发日志-列表获取 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmDistributeLogPage(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务获取(只获取主表) + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmService(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务字段获取(只获取主表) + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmServiceField(JSONObject jsonObject); + + + /** + * @Author lvleigang + * @Description 主数据-分发-只获取主表 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryMdmMainDB(JSONObject jsonObject); + + /** + * @Author lvleigang + * @Description 主数据-数据源-只获取主表字段 + * @Date 11:43 上午 2024/6/11 + * @param jsonObject + * @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); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java index a47b3505..c5b3d267 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java @@ -1,12 +1,66 @@ package com.hzya.frame.mdm.mdmModule.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.mdm.entity.MdmDbFiledVo; +import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmModuleViewVo; +import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; import com.hzya.frame.mdm.mdmModule.service.IMdmModuleService; -import org.springframework.stereotype.Service; +import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; +import com.hzya.frame.mdm.mdmModuleDb.dao.impl.MdmModuleDbDaoImpl; +import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; +import com.hzya.frame.mdm.mdmModuleDbFileds.dao.IMdmModuleDbFiledsDao; +import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +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; +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.mdm.mdmModuleSource.dao.IMdmModuleSourceDao; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewButton.dao.IMdmModuleViewButtonDao; +import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.impl.MdmTableCodeRuleDaoImpl; +import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; +import com.hzya.frame.mdm.service.IMdmServiceCache; +import com.hzya.frame.mdm.service.impl.MdmServiceCache; +import com.hzya.frame.sysnew.buttonConfig.dao.ISysButtonConfigDao; +import com.hzya.frame.sysnew.buttonConfig.entity.SysButtonConfigEntity; +import com.hzya.frame.sysnew.menuConfig.dao.ISysMenuConfigDao; +import com.hzya.frame.sysnew.menuConfig.entity.SysMenuConfigEntity; +import com.hzya.frame.sysnew.popedomMenu.dao.ISysPopedomMenuDao; +import com.hzya.frame.sysnew.popedomMenu.entity.SysPopedomMenuEntity; +import com.hzya.frame.sysnew.popedomOperate.dao.ISysPopedomOperateDao; +import com.hzya.frame.sysnew.popedomOperate.entity.SysPopedomOperateEntity; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.checkerframework.checker.units.qual.A; +import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; + import javax.annotation.Resource; + import com.hzya.frame.basedao.service.impl.BaseService; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 主数据模版(MdmModule)表服务实现类 * @@ -15,12 +69,2626 @@ import com.hzya.frame.basedao.service.impl.BaseService; */ @Service(value = "mdmModuleService") public class MdmModuleServiceImpl extends BaseService implements IMdmModuleService { - + private IMdmModuleDao mdmModuleDao; - + @Resource + private ISysPopedomMenuDao sysPopedomMenuDao; + @Resource + private ISysPopedomOperateDao sysPopedomOperateDao; + @Resource + private ISysButtonConfigDao sysButtonConfigDao; + @Resource + private ISysMenuConfigDao sysMenuConfigDao; + + @Resource + private IMdmModuleSendLogDao mdmModuleSendLogDao; + @Resource + private IMdmModuleOptionLogDao mdmModuleOptionLogDao; + @Resource + private IMdmServiceCache mdmServiceCache; + @Resource + private IMdmModuleDbDao mdmModuleDbDao; + @Resource + private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao; + @Resource + private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; + @Resource + private IMdmModuleDistributeDao mdmModuleDistributeDao; + @Resource + private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; + @Resource + private IMdmModuleViewDao mdmModuleViewDao; + + @Resource + private IMdmModuleSourceDao mdmModuleSourceDao; + @Resource + private IMdmModuleViewButtonDao mdmModuleViewButtonDao; + @Resource + private IMdmModuleViewDetailDao mdmModuleViewDetailDao; + @Resource + private IMdmTableCodeRuleDao mdmTableCodeRuleDao; + @Autowired - public void setMdmModuleDao(IMdmModuleDao dao) { - this.mdmModuleDao = dao; - this.dao = dao; - } + public void setMdmModuleDao(IMdmModuleDao dao) { + this.mdmModuleDao = dao; + this.dao = dao; + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询所有主数据 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + List mdmModuleEntities = mdmModuleDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询所有主数据", mdmModuleEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除主数据 校验主表是不是有数据,有数据不允许删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getId()); + if (mdmModuleEntity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表 + MdmModuleDbEntity queryDb = new MdmModuleDbEntity(); + queryDb.setMdmId(mdmModuleEntity.getId()); + queryDb.setSts("Y"); + queryDb.setDbType("1");//主表 + List mdmModuleDbEntities = mdmModuleDbDao.queryBase(queryDb); + if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() == 1) { + MdmQuery mdmQuery = new MdmQuery(); + mdmQuery.setTableName(mdmModuleDbEntities.get(0).getDbName()); + Integer count = mdmModuleDao.queryMainCount(mdmQuery); + if (count > 0) { + return BaseResult.getFailureMessageEntity(mdmModuleEntity.getMdmName() + "存在数据,不允许删除"); + } + MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity(); + queryCount.setMdmId(entity.getId()); + queryCount.setRuleCode("service"); + queryCount.setRuleValue(mdmModuleDbEntities.get(0).getDbName()); + Integer counts = mdmModuleDbFiledsRuleDao.queryUserMdm(queryCount); + if (counts > 0) { + return BaseResult.getFailureMessageEntity(mdmModuleEntity.getMdmName() + "已被引用,不允许删除"); + } + } + + + + //删除单据规则 + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setUpdate(); + mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmTableCodeRuleDao.logicRemoveMultiCondition(mdmTableCodeRuleEntity); + + //删除视图设置的字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + + //删除设置按钮 + MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); + mdmModuleViewButtonEntity.setUpdate(); + mdmModuleViewButtonEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewButtonDao.logicRemoveMultiCondition(mdmModuleViewButtonEntity); + + //删除显示信息 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setUpdate(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDao.logicRemoveMultiCondition(mdmModuleViewEntity); + //删除数据来源配置 + MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); + mdmModuleSourceEntity.setUpdate(); + mdmModuleSourceEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleSourceDao.logicRemoveMultiCondition(mdmModuleSourceEntity); + //删除下发配置,以及下发配置的数据权限 + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setUpdate(); + mdmModuleDistributeDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + + MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + mdmModuleDistributeEntity.setUpdate(); + mdmModuleDistributeEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); + //删除字段规则表 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + //删除字段表 + mdmServiceCache.deleteMdmModuleDbFileds(mdmModuleEntity.getId(), null); + //删除设置的db,以及实体表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbEntities1 = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities1 != null && mdmModuleDbEntities1.size() > 0) { + for (int i = 0; i < mdmModuleDbEntities1.size(); i++) { + Map maps = new HashMap<>(); + maps.put("tableName", mdmModuleDbEntities1.get(i).getDbName()); + mdmModuleDao.deleteTable(maps); + } + } + mdmServiceCache.deleteMdmModuleDb(mdmModuleEntity.getId(), null); + + //删除菜单和按钮,以及权限分配(用户权限和角色权限) + SysMenuConfigEntity sysMenuConfigEntity = new SysMenuConfigEntity(); + sysMenuConfigEntity.setFormId(mdmModuleEntity.getId()); + sysMenuConfigEntity.setSts("Y"); + List sysMenuConfigEntities = sysMenuConfigDao.queryBase(sysMenuConfigEntity); + if (sysMenuConfigEntities != null && sysMenuConfigEntities.size() > 0) { + for (int i = 0; i < sysMenuConfigEntities.size(); i++) { + SysButtonConfigEntity sysButtonConfigEntity = new SysButtonConfigEntity(); + sysButtonConfigEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysButtonConfigEntity.setSts("Y"); + sysButtonConfigEntity.setUpdate(); + sysButtonConfigDao.logicRemoveMultiCondition(sysButtonConfigEntity); + + SysPopedomOperateEntity sysPopedomOperateEntity = new SysPopedomOperateEntity(); + sysPopedomOperateEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomOperateEntity.setSts("Y"); + sysPopedomOperateEntity.setUpdate(); + sysPopedomOperateDao.logicRemoveMultiCondition(sysPopedomOperateEntity); + + SysPopedomMenuEntity sysPopedomMenuEntity = new SysPopedomMenuEntity(); + sysPopedomMenuEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomMenuEntity.setSts("Y"); + sysPopedomMenuEntity.setUpdate(); + sysPopedomMenuDao.logicRemoveMultiCondition(sysPopedomMenuEntity); + sysMenuConfigEntities.get(i).setUpdate(); + sysMenuConfigDao.logicRemoveMultiCondition(sysMenuConfigEntities.get(i)); + } + } + + + //删除主数据 + mdmServiceCache.deleteMdmModuleEntity(mdmModuleEntity); + + return BaseResult.getSuccessMessageEntity("删除成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-基本信息获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getId()); + if (mdmModuleEntity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + return BaseResult.getSuccessMessageEntity("获取成功", mdmModuleEntity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-基本信息新增 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmName() == null || "".equals(entity.getMdmName())) { + return BaseResult.getFailureMessageEntity("请先输入主数据名称"); + } + if (entity.getMdmType() == null || "".equals(entity.getMdmType())) { + return BaseResult.getFailureMessageEntity("请先输入主数据类型"); + } + entity.setCreate(); + mdmModuleDao.save(entity); + entity = mdmModuleDao.get(entity.getId()); + return BaseResult.getSuccessMessageEntity("保存成功",entity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-基本信息修改(同步修改菜单名称) + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdm(JSONObject object) { + MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmServiceCache.updateMdmModuleEntity(entity); + + //修改菜单的显示信息 + SysMenuConfigEntity sysMenuConfigEntity = new SysMenuConfigEntity(); + sysMenuConfigEntity.setFormId(entity.getId()); + sysMenuConfigEntity.setSts("Y"); + List sysMenuConfigEntities = sysMenuConfigDao.queryBase(sysMenuConfigEntity); + if (sysMenuConfigEntities != null && sysMenuConfigEntities.size() > 0) { + for (int i = 0; i < sysMenuConfigEntities.size(); i++) { + + sysMenuConfigEntities.get(i).setUpdate(); + if ("1".equals(entity.getMdmType())) { + //1、档案 + sysMenuConfigEntities.get(i).setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); + } else { + //2、单据 + sysMenuConfigEntities.get(i).setParentMenuId("58714ddb7ec94f5da91df74efada042f"); + } + sysMenuConfigEntities.get(i).setMenuName(entity.getMdmName()); + sysMenuConfigEntities.get(i).setMenuEnglishName("integrationOptionAdmin" + entity.getMdmCode()); + JSONObject object1 = JSONObject.parseObject(sysMenuConfigEntities.get(i).getOptions()); + object1.put("mdmId", entity.getId());//主数据id + object1.put("mdmCode", entity.getMdmCode());//主数据编码 + sysMenuConfigEntities.get(i).setOptions(object1.toString());//菜单mate参数 + sysMenuConfigDao.update(sysMenuConfigEntities.get(i)); + } + } + return BaseResult.getSuccessMessageEntity("修改成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-单据规则获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdmTableCodeRule(JSONObject object) { + MdmTableCodeRuleEntity entity = getData("jsonStr", object, MdmTableCodeRuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List mdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取单据规则成功", mdmTableCodeRuleEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-单据规则新增或修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveOrUpdateMdmTableCodeRule(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmTableCodeRuleEntityList() == null || entity.getMdmTableCodeRuleEntityList().size() == 0) { + return BaseResult.getFailureMessageEntity("请先设置单据规则"); + } + + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setMdmId(entity.getId()); + mdmTableCodeRuleEntity.setSts("Y"); + mdmTableCodeRuleEntity.setUpdate(); + mdmTableCodeRuleDao.logicRemoveMultiCondition(mdmTableCodeRuleEntity); + if (entity.getMdmTableCodeRuleEntityList() != null && entity.getMdmTableCodeRuleEntityList().size() > 0) { + for (int i = 0; i < entity.getMdmTableCodeRuleEntityList().size(); i++) { + entity.getMdmTableCodeRuleEntityList().get(i).setMdmId(entity.getId()); + entity.getMdmTableCodeRuleEntityList().get(i).setCreate(); + mdmTableCodeRuleDao.save(entity.getMdmTableCodeRuleEntityList().get(i)); + } + } + + return BaseResult.getSuccessMessageEntity("保存单据规则成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(entity); + List dbEntities = new ArrayList<>(); + if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if ("1".equals(mdmModuleDbEntities.get(i).getDbType()) || "2".equals(mdmModuleDbEntities.get(i).getDbType())) { + dbEntities.add(mdmModuleDbEntities.get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("获取数据源表成功", dbEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表新增 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List mdmModuleDbEntities = new ArrayList<>(); + List mdmModuleDbFiledsEntities = new ArrayList<>(); + entity.setDataType("1"); + //保存数据表,新建默认字段 + entity.setCreate(); + mdmModuleDbEntities.add(entity); + setMdmField(entity, mdmModuleDbFiledsEntities); + //如果是主表,同步新建 两张日志表,添加日志表字段 + if ("1".equals(entity.getDbType())) { + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + mdmModuleDbEntity.setDbName(entity.getDbName() + "_option_log"); + mdmModuleDbEntity.setDbType("3"); + mdmModuleDbEntity.setRemark(entity.getRemark()+"操作日志"); + mdmModuleDbEntity.setCreate(); + mdmModuleDbEntity.setDataType("1"); + mdmModuleDbEntities.add(mdmModuleDbEntity); + //新增 设置日志表 + setMdmField(mdmModuleDbEntity, mdmModuleDbFiledsEntities); + + MdmModuleDbEntity mdmModuleDbEntity1 = new MdmModuleDbEntity(); + mdmModuleDbEntity1.setMdmId(entity.getMdmId()); + mdmModuleDbEntity1.setDbName(entity.getDbName() + "_send_log"); + mdmModuleDbEntity1.setDbType("4"); + mdmModuleDbEntity1.setRemark(entity.getRemark()+"下发日志"); + mdmModuleDbEntity1.setCreate(); + mdmModuleDbEntity1.setDataType("1"); + mdmModuleDbEntities.add(mdmModuleDbEntity1); + //新增 设置日志表 + setMdmField(mdmModuleDbEntity1, mdmModuleDbFiledsEntities); + } + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + //查看表是否存在 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setDbName(mdmModuleDbEntities.get(i).getDbName()); + mdmModuleDbEntity.setSts("Y"); + int a = mdmModuleDbDao.getCount(mdmModuleDbEntity); + if(a > 0){ + return BaseResult.getFailureMessageEntity("表已存在,请修改"); + } + } + mdmServiceCache.saveOrUpdateMdmModuleDb(entity.getMdmId(), mdmModuleDbEntities); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + + //新建表 + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + Map maps = new HashMap<>(); + maps.put("tableName", mdmModuleDbEntities.get(i).getDbName());//表名 + maps.put("tableRemark", mdmModuleDbEntities.get(i).getRemark());//表备注 + maps.put("tableType", mdmModuleDbEntities.get(i).getDbType());//表备注 + mdmModuleDao.createTable(maps); + } + return BaseResult.getSuccessMessageEntity("保存表成功"); + } + + /** + * @param entity + * @param mdmModuleDbFiledsEntities + * @return void + * @Author lvleigang + * @Description 设置默认字段 + * @Date 10:47 上午 2024/6/12 + **/ + private void setMdmField(MdmModuleDbEntity entity, List mdmModuleDbFiledsEntities) { + + MdmModuleDbFiledsEntity id = new MdmModuleDbFiledsEntity(); + id.setMdmId(entity.getMdmId()); + id.setDbId(entity.getId()); + id.setChName("id"); + id.setEnName("id"); + id.setFiledType("3"); + id.setAddType("2"); + id.setUpdateType("2"); + id.setShowType("2"); + id.setQueryType("2"); + id.setListType("2"); + id.setViewType("2"); + id.setFiledLength("50"); + id.setCreate(); + id.setDataType("1"); + mdmModuleDbFiledsEntities.add(id); + + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity documentRule = new MdmModuleDbFiledsEntity(); + documentRule.setMdmId(entity.getMdmId()); + documentRule.setDbId(entity.getId()); + documentRule.setEnName("document_rule"); + documentRule.setChName("单据规则"); + documentRule.setFiledType("3"); + documentRule.setAddType("2"); + documentRule.setUpdateType("1"); + documentRule.setShowType("1"); + documentRule.setQueryType("1"); + documentRule.setListType("1"); + documentRule.setViewType("1"); + documentRule.setFiledLength("50"); + documentRule.setCreate(); + documentRule.setDataType("1"); + + mdmModuleDbFiledsEntities.add(documentRule); + + MdmModuleDbFiledsEntity document_rule_num = new MdmModuleDbFiledsEntity(); + document_rule_num.setMdmId(entity.getMdmId()); + document_rule_num.setDbId(entity.getId()); + document_rule_num.setEnName("document_rule_num"); + document_rule_num.setChName("单据规则流水号"); + document_rule_num.setFiledType("1"); + document_rule_num.setAddType("2"); + document_rule_num.setUpdateType("2"); + document_rule_num.setShowType("2"); + document_rule_num.setQueryType("2"); + document_rule_num.setListType("2"); + document_rule_num.setViewType("2"); + document_rule_num.setFiledLength("50"); + document_rule_num.setCreate(); + document_rule_num.setDataType("1"); + mdmModuleDbFiledsEntities.add(document_rule_num); + } + if ("2".equals(entity.getDbType()) || "3".equals(entity.getDbType()) || "4".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity formmain_id = new MdmModuleDbFiledsEntity(); + formmain_id.setMdmId(entity.getMdmId()); + formmain_id.setDbId(entity.getId()); + formmain_id.setEnName("formmain_id"); + formmain_id.setChName("主表id"); + formmain_id.setFiledType("3"); + formmain_id.setAddType("2"); + formmain_id.setUpdateType("2"); + formmain_id.setShowType("2"); + formmain_id.setQueryType("2"); + formmain_id.setListType("2"); + formmain_id.setViewType("2"); + formmain_id.setFiledLength("50"); + formmain_id.setCreate(); + formmain_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(formmain_id); + } + //写入日志字段:操作人 + if ("3".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity source_name = new MdmModuleDbFiledsEntity(); + source_name.setMdmId(entity.getMdmId()); + source_name.setDbId(entity.getId()); + source_name.setEnName("source_name"); + source_name.setChName("来源名称"); + source_name.setFiledType("3"); + source_name.setAddType("2"); + source_name.setUpdateType("2"); + source_name.setShowType("2"); + source_name.setQueryType("2"); + source_name.setListType("2"); + source_name.setViewType("2"); + source_name.setFiledLength("255"); + source_name.setCreate(); + source_name.setDataType("1"); + mdmModuleDbFiledsEntities.add(source_name); + + 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("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()); + code.setEnName("code"); + code.setChName("编码"); + code.setFiledType("3"); + code.setAddType("1"); + code.setUpdateType("1"); + code.setShowType("1"); + code.setQueryType("1"); + code.setListType("1"); + code.setViewType("1"); + code.setFiledLength("255"); + code.setCreate(); + code.setDataType("1"); + mdmModuleDbFiledsEntities.add(code); + + MdmModuleDbFiledsEntity source_data = new MdmModuleDbFiledsEntity(); + source_data.setMdmId(entity.getMdmId()); + source_data.setDbId(entity.getId()); + source_data.setEnName("source_data"); + source_data.setChName("源数据"); + source_data.setFiledType("3"); + source_data.setAddType("1"); + source_data.setUpdateType("1"); + source_data.setShowType("1"); + source_data.setQueryType("1"); + source_data.setListType("1"); + source_data.setViewType("1"); + source_data.setFiledLength("255"); + source_data.setCreate(); + source_data.setDataType("1"); + mdmModuleDbFiledsEntities.add(source_data); + + MdmModuleDbFiledsEntity option_type = new MdmModuleDbFiledsEntity(); + option_type.setMdmId(entity.getMdmId()); + option_type.setDbId(entity.getId()); + option_type.setEnName("option_type"); + option_type.setChName("操作类型"); + option_type.setFiledType("3"); + option_type.setAddType("1"); + option_type.setUpdateType("1"); + option_type.setShowType("1"); + option_type.setQueryType("1"); + option_type.setListType("1"); + option_type.setViewType("1"); + option_type.setFiledLength("255"); + option_type.setCreate(); + option_type.setDataType("1"); + mdmModuleDbFiledsEntities.add(option_type); + + MdmModuleDbFiledsEntity option_Name = new MdmModuleDbFiledsEntity(); + option_Name.setMdmId(entity.getMdmId()); + option_Name.setDbId(entity.getId()); + option_Name.setEnName("option_name"); + option_Name.setChName("操作人"); + option_Name.setFiledType("3"); + option_Name.setAddType("1"); + option_Name.setUpdateType("1"); + option_Name.setShowType("1"); + option_Name.setQueryType("1"); + option_Name.setListType("1"); + option_Name.setViewType("1"); + option_Name.setFiledLength("255"); + option_Name.setCreate(); + option_Name.setDataType("1"); + mdmModuleDbFiledsEntities.add(option_Name); + } + + //目标应用、目标api、 + if ("4".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity target_app = new MdmModuleDbFiledsEntity(); + target_app.setMdmId(entity.getMdmId()); + target_app.setDbId(entity.getId()); + target_app.setEnName("target_app"); + target_app.setChName("目标应用"); + target_app.setFiledType("3"); + target_app.setAddType("1"); + target_app.setUpdateType("1"); + target_app.setShowType("1"); + target_app.setQueryType("1"); + target_app.setListType("1"); + target_app.setViewType("1"); + target_app.setFiledLength("255"); + target_app.setCreate(); + target_app.setDataType("1"); + mdmModuleDbFiledsEntities.add(target_app); + + MdmModuleDbFiledsEntity target_api = new MdmModuleDbFiledsEntity(); + target_api.setMdmId(entity.getMdmId()); + target_api.setDbId(entity.getId()); + target_api.setEnName("target_api"); + target_api.setChName("目标api"); + target_api.setFiledType("3"); + target_api.setAddType("1"); + target_api.setUpdateType("1"); + target_api.setShowType("1"); + target_api.setQueryType("1"); + target_api.setListType("1"); + target_api.setViewType("1"); + target_api.setFiledLength("255"); + target_api.setCreate(); + target_api.setDataType("1"); + mdmModuleDbFiledsEntities.add(target_api); + + MdmModuleDbFiledsEntity source_data = new MdmModuleDbFiledsEntity(); + source_data.setMdmId(entity.getMdmId()); + source_data.setDbId(entity.getId()); + source_data.setEnName("source_data"); + source_data.setChName("源数据"); + source_data.setFiledType("3"); + source_data.setAddType("1"); + source_data.setUpdateType("1"); + source_data.setShowType("1"); + source_data.setQueryType("1"); + source_data.setListType("1"); + source_data.setViewType("1"); + source_data.setFiledLength("255"); + source_data.setCreate(); + source_data.setDataType("1"); + mdmModuleDbFiledsEntities.add(source_data); + + MdmModuleDbFiledsEntity option_type = new MdmModuleDbFiledsEntity(); + option_type.setMdmId(entity.getMdmId()); + option_type.setDbId(entity.getId()); + option_type.setEnName("option_type"); + option_type.setChName("操作类型"); + option_type.setFiledType("3"); + option_type.setAddType("1"); + option_type.setUpdateType("1"); + option_type.setShowType("1"); + option_type.setQueryType("1"); + option_type.setListType("1"); + option_type.setViewType("1"); + option_type.setFiledLength("255"); + 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(); + data_status.setMdmId(entity.getMdmId()); + data_status.setDbId(entity.getId()); + data_status.setEnName("data_status"); + data_status.setChName("数据状态"); + data_status.setFiledType("3"); + data_status.setAddType("2"); + data_status.setUpdateType("2"); + data_status.setShowType("2"); + data_status.setQueryType("2"); + data_status.setListType("2"); + data_status.setViewType("2"); + data_status.setFiledLength("1"); + data_status.setCreate(); + data_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(data_status); + } + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity add_status = new MdmModuleDbFiledsEntity(); + add_status.setMdmId(entity.getMdmId()); + add_status.setDbId(entity.getId()); + add_status.setEnName("add_status"); + add_status.setChName("新增数据状态 0待下发 1已下发"); + add_status.setFiledType("3"); + add_status.setAddType("2"); + add_status.setUpdateType("2"); + add_status.setShowType("2"); + add_status.setQueryType("2"); + add_status.setListType("2"); + add_status.setViewType("2"); + add_status.setFiledLength("1"); + add_status.setCreate(); + add_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(add_status); + } + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity update_status = new MdmModuleDbFiledsEntity(); + update_status.setMdmId(entity.getMdmId()); + update_status.setDbId(entity.getId()); + update_status.setEnName("update_status"); + update_status.setChName("修改数据状态 0待下发 1已下发"); + update_status.setFiledType("3"); + update_status.setAddType("2"); + update_status.setUpdateType("2"); + update_status.setShowType("2"); + update_status.setQueryType("2"); + update_status.setListType("2"); + update_status.setViewType("2"); + update_status.setFiledLength("1"); + update_status.setCreate(); + update_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(update_status); + } + + if ("1".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity delete_status = new MdmModuleDbFiledsEntity(); + delete_status.setMdmId(entity.getMdmId()); + delete_status.setDbId(entity.getId()); + delete_status.setEnName("delete_status"); + delete_status.setChName("删除数据状态 0待下发 1已下发"); + delete_status.setFiledType("3"); + delete_status.setAddType("2"); + delete_status.setUpdateType("2"); + delete_status.setShowType("2"); + delete_status.setQueryType("2"); + delete_status.setListType("2"); + delete_status.setViewType("2"); + delete_status.setFiledLength("1"); + delete_status.setCreate(); + delete_status.setDataType("1"); + mdmModuleDbFiledsEntities.add(delete_status); + } + + MdmModuleDbFiledsEntity sorts = new MdmModuleDbFiledsEntity(); + sorts.setMdmId(entity.getMdmId()); + sorts.setDbId(entity.getId()); + sorts.setEnName("sorts"); + sorts.setChName("排序"); + sorts.setFiledType("1"); + sorts.setAddType("2"); + sorts.setUpdateType("2"); + sorts.setShowType("2"); + sorts.setQueryType("2"); + sorts.setListType("2"); + sorts.setViewType("2"); + sorts.setFiledLength("20"); + sorts.setCreate(); + sorts.setDataType("1"); + mdmModuleDbFiledsEntities.add(sorts); + MdmModuleDbFiledsEntity create_user_id = new MdmModuleDbFiledsEntity(); + create_user_id.setMdmId(entity.getMdmId()); + create_user_id.setDbId(entity.getId()); + create_user_id.setEnName("create_user_id"); + create_user_id.setChName("创建人id"); + create_user_id.setFiledType("3"); + create_user_id.setAddType("2"); + create_user_id.setUpdateType("2"); + create_user_id.setShowType("2"); + create_user_id.setQueryType("2"); + create_user_id.setListType("2"); + create_user_id.setViewType("2"); + create_user_id.setFiledLength("50"); + create_user_id.setCreate(); + create_user_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(create_user_id); + MdmModuleDbFiledsEntity create_time = new MdmModuleDbFiledsEntity(); + create_time.setMdmId(entity.getMdmId()); + create_time.setDbId(entity.getId()); + create_time.setEnName("create_time"); + create_time.setChName("创建时间"); + create_time.setFiledType("4"); + create_time.setAddType("2"); + create_time.setUpdateType("2"); + create_time.setShowType("2"); + create_time.setQueryType("2"); + create_time.setListType("2"); + create_time.setViewType("2"); + create_time.setFiledLength(null); + create_time.setCreate(); + create_time.setDataType("1"); + mdmModuleDbFiledsEntities.add(create_time); + MdmModuleDbFiledsEntity modify_user_id = new MdmModuleDbFiledsEntity(); + modify_user_id.setMdmId(entity.getMdmId()); + modify_user_id.setDbId(entity.getId()); + modify_user_id.setEnName("modify_user_id"); + modify_user_id.setChName("修改人id"); + modify_user_id.setFiledType("3"); + modify_user_id.setAddType("2"); + modify_user_id.setUpdateType("2"); + modify_user_id.setShowType("2"); + modify_user_id.setQueryType("2"); + modify_user_id.setListType("2"); + modify_user_id.setViewType("2"); + modify_user_id.setFiledLength("50"); + modify_user_id.setCreate(); + modify_user_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(modify_user_id); + MdmModuleDbFiledsEntity modify_time = new MdmModuleDbFiledsEntity(); + modify_time.setMdmId(entity.getMdmId()); + modify_time.setDbId(entity.getId()); + modify_time.setEnName("modify_time"); + modify_time.setChName("修改时间"); + modify_time.setFiledType("4"); + modify_time.setAddType("2"); + modify_time.setUpdateType("2"); + modify_time.setShowType("2"); + modify_time.setQueryType("2"); + modify_time.setListType("2"); + modify_time.setViewType("2"); + modify_time.setFiledLength(null); + modify_time.setCreate(); + modify_time.setDataType("1"); + mdmModuleDbFiledsEntities.add(modify_time); + MdmModuleDbFiledsEntity sts = new MdmModuleDbFiledsEntity(); + sts.setMdmId(entity.getMdmId()); + sts.setDbId(entity.getId()); + sts.setEnName("sts"); + sts.setChName("状态(Y正常N删除)"); + sts.setFiledType("3"); + sts.setAddType("2"); + sts.setUpdateType("2"); + sts.setShowType("2"); + sts.setQueryType("2"); + sts.setListType("2"); + sts.setViewType("2"); + sts.setFiledLength("1"); + sts.setCreate(); + sts.setDataType("1"); + mdmModuleDbFiledsEntities.add(sts); + MdmModuleDbFiledsEntity org_id = new MdmModuleDbFiledsEntity(); + org_id.setMdmId(entity.getMdmId()); + org_id.setDbId(entity.getId()); + org_id.setEnName("org_id"); + org_id.setChName("组织机构ID"); + org_id.setFiledType("3"); + org_id.setAddType("2"); + org_id.setUpdateType("2"); + org_id.setShowType("2"); + org_id.setQueryType("2"); + org_id.setListType("2"); + org_id.setViewType("2"); + org_id.setFiledLength("50"); + org_id.setCreate(); + org_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(org_id); + MdmModuleDbFiledsEntity company_id = new MdmModuleDbFiledsEntity(); + company_id.setMdmId(entity.getMdmId()); + company_id.setDbId(entity.getId()); + company_id.setEnName("company_id"); + company_id.setChName("公司id"); + company_id.setFiledType("3"); + company_id.setAddType("2"); + company_id.setUpdateType("2"); + company_id.setShowType("2"); + company_id.setQueryType("2"); + company_id.setListType("2"); + company_id.setViewType("2"); + company_id.setFiledLength("50"); + company_id.setCreate(); + company_id.setDataType("1"); + mdmModuleDbFiledsEntities.add(company_id); + } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List mdmModuleDbEntities = new ArrayList<>(); + entity.setDataType("2"); + mdmModuleDbEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDb(entity.getMdmId(), mdmModuleDbEntities); + Map tablename = new HashMap<>(); + tablename.put("tableName", entity.getDbName());//表名 + tablename.put("tableRemark", entity.getRemark());//表备注 + mdmModuleDao.alterTableName(tablename); + return BaseResult.getSuccessMessageEntity("修改数据源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmDb(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbType() == null || "".equals(entity.getDbType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + MdmQuery mdmQuery = new MdmQuery(); + mdmQuery.setTableName(entity.getDbName()); + Integer count = mdmModuleDao.queryMainCount(mdmQuery); + if (count > 0) { + return BaseResult.getFailureMessageEntity(entity.getDbName() + "存在数据,不允许删除"); + } + MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity(); + queryCount.setMdmId(entity.getMdmId()); + queryCount.setRuleCode("service"); + queryCount.setRuleValue(entity.getDbName()); + Integer counts = mdmModuleDbFiledsRuleDao.queryUserMdm(queryCount); + if (counts > 0) { + return BaseResult.getFailureMessageEntity(entity.getDbName() + "已被引用,不允许删除"); + } + + if ("1".equals(entity.getDbType())) { + //删除视图设置的字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + + //删除显示信息 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setUpdate(); + mdmModuleViewEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDao.logicRemoveMultiCondition(mdmModuleViewEntity); + + //删除字段规则表 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleEntity.setMdmId(entity.getMdmId()); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + //删除字段表 + mdmServiceCache.deleteMdmModuleDbFileds(entity.getMdmId(), null); + //删除设置的db,以及实体表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + List mdmModuleDbEntities1 = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities1 != null && mdmModuleDbEntities1.size() > 0) { + for (int i = 0; i < mdmModuleDbEntities1.size(); i++) { + Map maps = new HashMap<>(); + maps.put("tableName", mdmModuleDbEntities1.get(i).getDbName()); + mdmModuleDao.deleteTable(maps); + } + } + mdmServiceCache.deleteMdmModuleDb(entity.getMdmId(), null); + + //删除菜单和按钮,以及权限分配(用户权限和角色权限) + SysMenuConfigEntity sysMenuConfigEntity = new SysMenuConfigEntity(); + sysMenuConfigEntity.setFormId(entity.getMdmId()); + sysMenuConfigEntity.setSts("Y"); + List sysMenuConfigEntities = sysMenuConfigDao.queryBase(sysMenuConfigEntity); + if (sysMenuConfigEntities != null && sysMenuConfigEntities.size() > 0) { + for (int i = 0; i < sysMenuConfigEntities.size(); i++) { + SysButtonConfigEntity sysButtonConfigEntity = new SysButtonConfigEntity(); + sysButtonConfigEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysButtonConfigEntity.setSts("Y"); + sysButtonConfigEntity.setUpdate(); + sysButtonConfigDao.logicRemoveMultiCondition(sysButtonConfigEntity); + + SysPopedomOperateEntity sysPopedomOperateEntity = new SysPopedomOperateEntity(); + sysPopedomOperateEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomOperateEntity.setSts("Y"); + sysPopedomOperateEntity.setUpdate(); + sysPopedomOperateDao.logicRemoveMultiCondition(sysPopedomOperateEntity); + + SysPopedomMenuEntity sysPopedomMenuEntity = new SysPopedomMenuEntity(); + sysPopedomMenuEntity.setMenuId(sysMenuConfigEntities.get(i).getId()); + sysPopedomMenuEntity.setSts("Y"); + sysPopedomMenuEntity.setUpdate(); + sysPopedomMenuDao.logicRemoveMultiCondition(sysPopedomMenuEntity); + sysMenuConfigEntities.get(i).setUpdate(); + sysMenuConfigDao.logicRemoveMultiCondition(sysMenuConfigEntities.get(i)); + } + } + } + + if ("2".equals(entity.getDbType())) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setDbId(entity.getId()); + List mdmModuleDbFiledsEntities = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { + //删除视图设置的字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewFiled(mdmModuleDbFiledsEntities.get(i).getId()); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + } + } + //删除字段规则表 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleEntity.setMdmId(entity.getMdmId()); + mdmModuleDbFiledsRuleEntity.setDbId(entity.getId()); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + //删除字段表 + mdmServiceCache.deleteMdmModuleDbFileds(entity.getMdmId(), entity.getId()); + //删除设置的db,以及实体表 + + Map maps = new HashMap<>(); + maps.put("tableName", entity.getDbName()); + mdmModuleDao.deleteTable(maps); + mdmServiceCache.deleteMdmModuleDb(entity.getMdmId(), entity.getId()); + } + + return BaseResult.getSuccessMessageEntity("删除成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsEntity queryEntity = new MdmModuleDbFiledsEntity(); + queryEntity.setMdmId(entity.getMdmId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryEntity); + List dbEntities = new ArrayList<>(); + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { + if (entity.getDbId().equals(mdmModuleDbFiledsEntities.get(i).getDbId()) && "1".equals(mdmModuleDbFiledsEntities.get(i).getViewType())) { + dbEntities.add(mdmModuleDbFiledsEntities.get(i)); + MdmModuleDbFiledsRuleEntity ruleEntity = new MdmModuleDbFiledsRuleEntity(); + ruleEntity.setMdmId(mdmModuleDbFiledsEntities.get(i).getMdmId()); + ruleEntity.setFiledId(mdmModuleDbFiledsEntities.get(i).getId()); + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(ruleEntity); + mdmModuleDbFiledsEntities.get(i).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRuleEntities); + } + } + } + return BaseResult.getSuccessMessageEntity("获取数据源表字段成功", dbEntities); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段明细 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDbFieldDetail(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsEntity queryEntity = new MdmModuleDbFiledsEntity(); + queryEntity.setMdmId(entity.getMdmId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryEntity); + List dbEntities = new ArrayList<>(); + if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { + if (entity.getId().equals(mdmModuleDbFiledsEntities.get(i).getId())) { + entity = mdmModuleDbFiledsEntities.get(i); + MdmModuleDbFiledsRuleEntity ruleEntity = new MdmModuleDbFiledsRuleEntity(); + ruleEntity.setMdmId(entity.getMdmId()); + ruleEntity.setFiledId(entity.getId()); + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(ruleEntity); + entity.setMdmModuleDbFiledsRules(mdmModuleDbFiledsRuleEntities); + } + } + } + return BaseResult.getSuccessMessageEntity("获取数据源表字段成功", entity); + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段新增 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getEnName() == null || "".equals(entity.getEnName())) { + return BaseResult.getFailureMessageEntity("请输入中文名称"); + } + if (entity.getChName() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请输入英文名称"); + } + if (entity.getFiledType() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请选择字段类型"); + } + if (entity.getDbType() == null || "".equals(entity.getDbType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + if(mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0){ + for (int i = 0; i < mdmModuleDbFiledsEntityList.size(); i++) { + if(entity.getDbId().equals(mdmModuleDbFiledsEntityList.get(i).getDbId()) && entity.getEnName().equals(mdmModuleDbFiledsEntityList.get(i).getEnName())){ + return BaseResult.getFailureMessageEntity("字段已存在,请修改"); + } + } + } + entity.setCreate(); + if("1".equals(entity.getDbType())){ + entity.setAddType("1"); + entity.setUpdateType("1"); + entity.setShowType("1"); + entity.setQueryType("1"); + entity.setListType("1"); + entity.setViewType("1"); + }else { + entity.setAddType("1"); + entity.setUpdateType("1"); + entity.setShowType("1"); + entity.setQueryType("1"); + entity.setListType("2"); + entity.setViewType("1"); + } + entity.setDataType("1"); + List mdmModuleDbFiledsEntities = new ArrayList<>(); + mdmModuleDbFiledsEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + + if (entity.getMdmModuleDbFiledsRules() != null && entity.getMdmModuleDbFiledsRules().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDbFiledsRules().size(); i++) { + entity.getMdmModuleDbFiledsRules().get(i).setDbId(entity.getDbId()); + entity.getMdmModuleDbFiledsRules().get(i).setMdmId(entity.getMdmId()); + entity.getMdmModuleDbFiledsRules().get(i).setFiledId(entity.getId()); + entity.getMdmModuleDbFiledsRules().get(i).setSts("Y"); + entity.getMdmModuleDbFiledsRules().get(i).setCreate(); + mdmModuleDbFiledsRuleDao.save(entity.getMdmModuleDbFiledsRules().get(i)); + } + } + + mdmModuleDao.alterTableField(entity); + return BaseResult.getSuccessMessageEntity("新增字段成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getEnName() == null || "".equals(entity.getEnName())) { + return BaseResult.getFailureMessageEntity("请输入中文名称"); + } + if (entity.getChName() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请输入英文名称"); + } + if (entity.getFiledType() == null || "".equals(entity.getChName())) { + return BaseResult.getFailureMessageEntity("请选择字段类型"); + } + entity.setUpdate(); + entity.setDataType("2"); + List mdmModuleDbFiledsEntities = new ArrayList<>(); + mdmModuleDbFiledsEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setFiledId(entity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + if (entity.getMdmModuleDbFiledsRules() != null && entity.getMdmModuleDbFiledsRules().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDbFiledsRules().size(); i++) { + entity.getMdmModuleDbFiledsRules().get(i).setDbId(entity.getDbId()); + entity.getMdmModuleDbFiledsRules().get(i).setMdmId(entity.getMdmId()); + entity.getMdmModuleDbFiledsRules().get(i).setFiledId(entity.getId()); + entity.getMdmModuleDbFiledsRules().get(i).setSts("Y"); + if (entity.getMdmModuleDbFiledsRules().get(i).getId() != null) { + entity.getMdmModuleDbFiledsRules().get(i).setUpdate(); + mdmModuleDbFiledsRuleDao.update(entity.getMdmModuleDbFiledsRules().get(i)); + } else { + entity.getMdmModuleDbFiledsRules().get(i).setCreate(); + mdmModuleDbFiledsRuleDao.save(entity.getMdmModuleDbFiledsRules().get(i)); + } + } + } + mdmModuleDao.alterTableField(entity); + return BaseResult.getSuccessMessageEntity("修改字段成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmDbField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbName() == null || "".equals(entity.getDbName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getEnName() == null || "".equals(entity.getEnName())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getFiledType() == null || "".equals(entity.getFiledType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsRuleEntity queryCount = new MdmModuleDbFiledsRuleEntity(); + queryCount.setDbId(entity.getDbId()); + queryCount.setRuleCode("label"); + queryCount.setRuleValue(entity.getEnName()); + Integer counts = mdmModuleDbFiledsRuleDao.queryUserMdm(queryCount); + if (counts > 0) { + return BaseResult.getFailureMessageEntity(entity.getEnName() + "已被引用,不允许删除"); + } + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(entity.getMdmId()); + mdmModuleViewEntity.setViewFiled(entity.getId()); + mdmModuleViewEntity.setUpIdFiled(entity.getId()); + Integer countss = mdmModuleViewDao.queryUserMdm(mdmModuleViewEntity); + if (countss > 0) { + return BaseResult.getFailureMessageEntity(entity.getEnName() + "已被显示引用,不允许删除"); + } + entity.setUpdate(); + entity.setDataType("3"); + List mdmModuleDbFiledsEntities = new ArrayList<>(); + mdmModuleDbFiledsEntities.add(entity); + mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setFiledId(entity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setViewFiled(entity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + mdmModuleDao.alterTableField(entity); + return BaseResult.getSuccessMessageEntity("删除字段成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDbFieldRule(JSONObject object) { + MdmModuleDbFiledsRuleEntity entity = getData("jsonStr", object, MdmModuleDbFiledsRuleEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getFiledId() == null || "".equals(entity.getFiledId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取数据源表字段规则成功", mdmModuleDbFiledsRuleEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据源-数据表字段规则修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDbFieldRule(JSONObject object) { + + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getFieldId() == null || "".equals(entity.getFieldId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmModuleDbFiledsRuleEntities() == null || entity.getMdmModuleDbFiledsRuleEntities().size() == 0) { + return BaseResult.getFailureMessageEntity("请先设置字段规则"); + } + + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setFiledId(entity.getFieldId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + mdmModuleDbFiledsRuleEntity.setUpdate(); + mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + if (entity.getMdmModuleDbFiledsRuleEntities() != null && entity.getMdmModuleDbFiledsRuleEntities().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDbFiledsRuleEntities().size(); i++) { + entity.getMdmModuleDbFiledsRuleEntities().get(i).setDbId(entity.getDbId()); + entity.getMdmModuleDbFiledsRuleEntities().get(i).setMdmId(entity.getId()); + entity.getMdmModuleDbFiledsRuleEntities().get(i).setFiledId(entity.getFieldId()); + entity.getMdmModuleDbFiledsRuleEntities().get(i).setSts("Y"); + if (entity.getMdmModuleDbFiledsRuleEntities().get(i).getId() != null) { + entity.getMdmModuleDbFiledsRuleEntities().get(i).setUpdate(); + mdmModuleDbFiledsRuleDao.update(entity.getMdmModuleDbFiledsRuleEntities().get(i)); + } else { + entity.getMdmModuleDbFiledsRuleEntities().get(i).setCreate(); + mdmModuleDbFiledsRuleDao.save(entity.getMdmModuleDbFiledsRuleEntities().get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("保存字段规则成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示类型获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmView(JSONObject object) { + MdmModuleViewEntity entity = getData("jsonStr", object, MdmModuleViewEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List moduleViewEntities = mdmModuleViewDao.queryBase(entity); + + if(moduleViewEntities == null || moduleViewEntities.size() == 0){ + return BaseResult.getSuccessMessageEntity("获取显示类型成功"); + }else if (moduleViewEntities != null && moduleViewEntities.size() > 1) { + return BaseResult.getFailureMessageEntity("获取显示类型失败"); + } else { + return BaseResult.getSuccessMessageEntity("获取显示类型成功", moduleViewEntities.get(0)); + } + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示类型保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveMdmView(JSONObject object) { + MdmModuleViewEntity entity = getData("jsonStr", object, MdmModuleViewEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getMdmId()); + + entity.setCreate(); + mdmModuleViewDao.save(entity); + SysMenuConfigEntity module = new SysMenuConfigEntity(); + module.setCreate(); + module.setFormId(mdmModuleEntity.getId()); + if("1".equals(mdmModuleEntity.getMdmType())){ + //1、档案 + module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); + }else { + //2、单据 + module.setParentMenuId("58714ddb7ec94f5da91df74efada042f"); + } + module.setMenuName(mdmModuleEntity.getMdmName()); + module.setMenuEnglishName("integrationOptionAdmin" + mdmModuleEntity.getMdmCode()); + module.setMenuIcon(null);//模块图标 + module.setRoute("integrationOptionAdmin/" + mdmModuleEntity.getMdmCode());//路由地址 + module.setMenuPage("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component + module.setRemark("主数据生成菜单"); + module.setVisibles("0"); + module.setShowType("1"); + JSONObject object1 = new JSONObject(); + object1.put("mdmId", mdmModuleEntity.getId());//主数据id + object1.put("mdmCode", mdmModuleEntity.getMdmCode());//主数据编码 + object1.put("viewType", entity.getViewName());//1、树 2、列表 + module.setOptions(object1.toString());//菜单mate参数 + sysMenuConfigDao.save(module); + return BaseResult.getSuccessMessageEntity("保存显示类型成功"); + + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示类型修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmView(JSONObject object) { + MdmModuleViewEntity entity = getData("jsonStr", object, MdmModuleViewEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getMdmId()); + + entity.setUpdate(); + mdmModuleViewDao.update(entity); + SysMenuConfigEntity module = new SysMenuConfigEntity(); + module.setFormId(mdmModuleEntity.getId()); + List sysMenuConfigEntities = sysMenuConfigDao.queryBase(module); + + if(sysMenuConfigEntities != null && sysMenuConfigEntities.size() == 1){ + module = sysMenuConfigEntities.get(0); + module.setUpdate(); + module.setFormId(mdmModuleEntity.getId()); + if("1".equals(mdmModuleEntity.getMdmType())){ + //1、档案 + module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); + }else { + //2、单据 + module.setParentMenuId("58714ddb7ec94f5da91df74efada042f"); + } + module.setMenuName(mdmModuleEntity.getMdmName()); + module.setMenuEnglishName("integrationOptionAdmin" + mdmModuleEntity.getMdmCode()); + module.setMenuIcon(null);//模块图标 + module.setRoute("integrationOptionAdmin/" + mdmModuleEntity.getMdmCode());//路由地址 + module.setMenuPage("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component + module.setRemark("主数据生成菜单"); + module.setVisibles("0"); + module.setShowType("1"); + JSONObject object1 = new JSONObject(); + object1.put("mdmId", mdmModuleEntity.getId());//主数据id + object1.put("mdmCode", mdmModuleEntity.getMdmCode());//主数据编码 + object1.put("viewType", entity.getViewName());//1、树 2、列表 + module.setOptions(object1.toString());//菜单mate参数 + sysMenuConfigDao.update(module); + } + return BaseResult.getSuccessMessageEntity("修改显示类型成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示字段获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmViewField(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleViewVo mdmModuleViewVo = new MdmModuleViewVo(); + //查询设置各种类型字段 + //查询模版数据源 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(entity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(entity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + setFiledType(mdmModuleViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList); + } + mdmModuleViewVo.setDbAddFiled(new ArrayList<>()); + mdmModuleViewVo.setDbEditFiled(new ArrayList<>()); + mdmModuleViewVo.setDbShowFiled(new ArrayList<>()); + mdmModuleViewVo.setDbQueryFiled(new ArrayList<>()); + mdmModuleViewVo.setDbListFiled(new ArrayList<>()); + + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + List mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + setDbFiledType(mdmModuleViewVo, mdmModuleViewDetailEntityList); + + + return BaseResult.getSuccessMessageEntity("查询视图成功", mdmModuleViewVo); + } + + private void setDbFiledType(MdmModuleViewVo mdmModuleViewVo, List mdmModuleViewDetailEntityList) { + //新增 + List addFiled = new ArrayList<>(); + //修改 + List editFiled = new ArrayList<>(); + //查看 + List showFiled = new ArrayList<>(); + //查询 + List queryFiled = new ArrayList<>(); + //列表 + List listFiled = new ArrayList<>(); + if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { + for (int i = 0; i < mdmModuleViewDetailEntityList.size(); i++) { + switch (mdmModuleViewDetailEntityList.get(i).getViewType()) { + //1、查询2、列表3、新增4、修改 5、查看 + case "1": + if(mdmModuleViewVo.getQueryFiled() != null && mdmModuleViewVo.getQueryFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getQueryFiled().size(); i1++) { + if(mdmModuleViewVo.getQueryFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getQueryFiled().get(i1).getName()); + queryFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "2": + if(mdmModuleViewVo.getListFiled() != null && mdmModuleViewVo.getListFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getListFiled().size(); i1++) { + if(mdmModuleViewVo.getListFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getListFiled().get(i1).getName()); + listFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "3": + if(mdmModuleViewVo.getAddFiled() != null && mdmModuleViewVo.getAddFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getAddFiled().size(); i1++) { + if(mdmModuleViewVo.getAddFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getAddFiled().get(i1).getName()); + addFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "4": + if(mdmModuleViewVo.getEditFiled() != null && mdmModuleViewVo.getEditFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getEditFiled().size(); i1++) { + if(mdmModuleViewVo.getEditFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getEditFiled().get(i1).getName()); + editFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + case "5": + if(mdmModuleViewVo.getShowFiled() != null && mdmModuleViewVo.getShowFiled().size() > 0 ){ + for (int i1 = 0; i1 < mdmModuleViewVo.getShowFiled().size(); i1++) { + if(mdmModuleViewVo.getShowFiled().get(i1).getId().equals(mdmModuleViewDetailEntityList.get(i).getViewFiled())){ + mdmModuleViewDetailEntityList.get(i).setViewName(mdmModuleViewVo.getShowFiled().get(i1).getName()); + showFiled.add(mdmModuleViewDetailEntityList.get(i)); + } + } + } + break; + default: + } + } + } + mdmModuleViewVo.setDbAddFiled(addFiled); + mdmModuleViewVo.setDbEditFiled(editFiled); + mdmModuleViewVo.setDbShowFiled(showFiled); + mdmModuleViewVo.setDbQueryFiled(queryFiled); + mdmModuleViewVo.setDbListFiled(listFiled); + } + + /** + * @param mdmModuleViewVo + * @param mdmModuleDbEntityList + * @param mdmModuleDbFiledsEntityList + * @return void + * @Author lvleigang + * @Description 设置对应的字段类型 + * @Date 2023/10/25 + **/ + private void setFiledType(MdmModuleViewVo mdmModuleViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList) { + //新增 + List addFiled = new ArrayList<>(); + //修改 + List editFiled = new ArrayList<>(); + //查看 + List showFiled = new ArrayList<>(); + //查询 + List queryFiled = new ArrayList<>(); + //列表 + List listFiled = new ArrayList<>(); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if("3".equals(mdmModuleDbEntityList.get(i).getDbType()) || "4".equals(mdmModuleDbEntityList.get(i).getDbType())){ + continue; + } + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + if("document_rule".equals(mdmModuleDbFiledsEntityList.get(i1).getEnName())){ + continue; + } + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getAddType())){ + addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getUpdateType())){ + editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getShowType())){ + showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getQueryType())){ + queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getListType())){ + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } else { + //2、明细 + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getQueryType())){ + queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getAddType())){ + addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getUpdateType())){ + editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + if("1".equals(mdmModuleDbFiledsEntityList.get(i1).getShowType())){ + showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } + } + } + } + } + } + mdmModuleViewVo.setAddFiled(addFiled); + mdmModuleViewVo.setEditFiled(editFiled); + mdmModuleViewVo.setShowFiled(showFiled); + mdmModuleViewVo.setQueryFiled(queryFiled); + mdmModuleViewVo.setListFiled(listFiled); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示字段设置保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveOrUpdateMdmViewField(JSONObject object) { + MdmModuleViewVo entity = getData("jsonStr", object, MdmModuleViewVo.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getViewType() == null || "".equals(entity.getViewType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //1、查询2、列表3、新增4、修改 5、查看 + if ("1".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbQueryFiled() != null && entity.getDbQueryFiled().size() > 0) { + for (int i = 0; i < entity.getDbQueryFiled().size(); i++) { + entity.getDbQueryFiled().get(i).setViewType(entity.getViewType()); + entity.getDbQueryFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbQueryFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbQueryFiled().get(i)); + } + } + + } else if ("2".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbListFiled() != null && entity.getDbListFiled().size() > 0) { + for (int i = 0; i < entity.getDbListFiled().size(); i++) { + entity.getDbListFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbListFiled().get(i).setViewType(entity.getViewType()); + entity.getDbListFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbListFiled().get(i)); + } + } + + } else if ("3".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbAddFiled() != null && entity.getDbAddFiled().size() > 0) { + for (int i = 0; i < entity.getDbAddFiled().size(); i++) { + entity.getDbAddFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbAddFiled().get(i).setViewType(entity.getViewType()); + entity.getDbAddFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbAddFiled().get(i)); + } + } + + } else if ("4".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbEditFiled() != null && entity.getDbEditFiled().size() > 0) { + for (int i = 0; i < entity.getDbEditFiled().size(); i++) { + entity.getDbEditFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbEditFiled().get(i).setViewType(entity.getViewType()); + entity.getDbEditFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbEditFiled().get(i)); + } + } + + } else if ("5".equals(entity.getViewType())) { + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleViewDetailEntity.setViewType(entity.getViewType()); + mdmModuleViewDetailEntity.setUpdate(); + mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + if (entity.getDbShowFiled() != null && entity.getDbShowFiled().size() > 0) { + for (int i = 0; i < entity.getDbShowFiled().size(); i++) { + entity.getDbShowFiled().get(i).setMdmId(entity.getMdmId()); + entity.getDbShowFiled().get(i).setViewType(entity.getViewType()); + entity.getDbShowFiled().get(i).setCreate(); + mdmModuleViewDetailDao.save(entity.getDbShowFiled().get(i)); + } + } + + } + return BaseResult.getSuccessMessageEntity("修改成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmViewButton(JSONObject object) { + MdmModuleViewButtonEntity entity = getData("jsonStr", object, MdmModuleViewButtonEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List moduleViewButtonEntities = mdmModuleViewButtonDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取显示按钮成功", moduleViewButtonEntities); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-显示信息-显示按钮保存 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity saveOrUpdateMdmViewButton(JSONObject object) { + MdmModuleViewVo entity = getData("jsonStr", object, MdmModuleViewVo.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); + mdmModuleViewButtonEntity.setMdmId(entity.getMdmId()); + mdmModuleViewButtonEntity.setUpdate(); + mdmModuleViewButtonDao.logicRemoveMultiCondition(mdmModuleViewButtonEntity); + if (entity.getDbButtonFiled() != null && entity.getDbButtonFiled().size() > 0) { + for (int i = 0; i < entity.getDbButtonFiled().size(); i++) { + entity.getDbButtonFiled().get(i).setMdmId(entity.getMdmId()); + if (entity.getDbButtonFiled().get(i).getId() != null) { + entity.getDbButtonFiled().get(i).setUpdate(); + mdmModuleViewButtonDao.update(entity.getDbButtonFiled().get(i)); + } else { + entity.getDbButtonFiled().get(i).setCreate(); + mdmModuleViewButtonDao.save(entity.getDbButtonFiled().get(i)); + } + } + } + MdmModuleEntity mdmModuleEntity = mdmModuleDao.get(entity.getMdmId()); + SysMenuConfigEntity module = new SysMenuConfigEntity(); + module.setFormId(mdmModuleEntity.getId()); + List sysMenuConfigEntities = sysMenuConfigDao.queryBase(module); + if(sysMenuConfigEntities != null && sysMenuConfigEntities.size() == 1){ + module = sysMenuConfigEntities.get(0); + SysButtonConfigEntity buttonConfigEntity = new SysButtonConfigEntity(); + buttonConfigEntity.setMenuId(module.getId()); + buttonConfigEntity.setSts("Y"); + List sysButtonConfigEntities = sysButtonConfigDao.queryBase(buttonConfigEntity); + //1、查询按钮权限 + SysPopedomOperateEntity sysPopedomOperateEntity = new SysPopedomOperateEntity(); + sysPopedomOperateEntity.setMenuId(module.getId()); + sysPopedomOperateEntity.setSts("Y"); + List sysPopedomOperateEntities = sysPopedomOperateDao.queryBase(sysPopedomOperateEntity); + //删除按钮和删除按钮权限 + sysButtonConfigDao.logicRemoveMultiCondition(buttonConfigEntity); + sysPopedomOperateDao.logicRemoveMultiCondition(sysPopedomOperateEntity); + //删除处理权限 + doMdmModuleButton(module,entity.getDbButtonFiled(),sysButtonConfigEntities,sysPopedomOperateEntities); + } + return BaseResult.getSuccessMessageEntity("修改显示按钮成功"); + } + /** + * @Author lvleigang + * @Description + * @Date 3:29 下午 2024/6/4 + * @param module 菜单 + * @param mdmModuleViewButtonEntities 主数据按钮 + * @param sysButtonConfigEntities 菜单按钮 + * @param sysPopedomOperateEntities 按钮权限 + * @return void + **/ + private void doMdmModuleButton(SysMenuConfigEntity module,List mdmModuleViewButtonEntities, List sysButtonConfigEntities, List sysPopedomOperateEntities) { + //循环设置的按钮,再循环菜单的按钮,如果有把原先的修改状态,如果没有新增 + if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ + for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { + boolean flag = false; + if(sysButtonConfigEntities != null && sysButtonConfigEntities.size() > 0){ + for (int i1 = 0; i1 < sysButtonConfigEntities.size(); i1++) { + if(mdmModuleViewButtonEntities.get(i).getButtonValue().equals(sysButtonConfigEntities.get(i1).getCode())){ + flag = true; + sysButtonConfigEntities.get(i1).setSts("Y"); + sysButtonConfigEntities.get(i1).setUpdate(); + sysButtonConfigDao.update(sysButtonConfigEntities.get(i1)); + if(sysPopedomOperateEntities != null && sysPopedomOperateEntities.size() > 0){ + for (int i2 = 0; i2 < sysPopedomOperateEntities.size(); i2++) { + if(sysPopedomOperateEntities.get(i2).getOperate().equals(sysButtonConfigEntities.get(i1).getId())){ + sysPopedomOperateEntities.get(i2).setSts("Y"); + sysPopedomOperateEntities.get(i2).setUpdate(); + sysPopedomOperateDao.update(sysPopedomOperateEntities.get(i2)); + } + } + } + break; + } + } + } + //原先没有需要新增 + if(!flag){ + if("new".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ + SysButtonConfigEntity xz = new SysButtonConfigEntity(); + xz.setCode("new"); + xz.setNameCh("新建"); + xz.setNameEn("new"); + xz.setMenuId(module.getId()); + xz.setIconName(""); + xz.setStyles(""); + xz.setBtnFunction("new"); + xz.setRemark("主数据新建按钮"); + xz.setCreate(); + sysButtonConfigDao.save(xz); + } + if("resize".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())){ + + SysButtonConfigEntity cz = new SysButtonConfigEntity(); + cz.setCode("resize"); + cz.setNameCh("重置"); + cz.setNameEn("resize"); + cz.setMenuId(module.getId()); + cz.setIconName(""); + cz.setStyles(""); + cz.setBtnFunction("resize"); + cz.setRemark("主数据重置按钮"); + cz.setCreate(); + sysButtonConfigDao.save(cz); + } + if("search".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity cx = new SysButtonConfigEntity(); + cx.setCode("search"); + cx.setNameCh("查询"); + cx.setNameEn("search"); + cx.setMenuId(module.getId()); + cx.setIconName(""); + cx.setStyles(""); + cx.setBtnFunction("search"); + cx.setRemark("主数据查询按钮"); + cx.setCreate(); + sysButtonConfigDao.save(cx); + } + if("edit".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity xg = new SysButtonConfigEntity(); + xg.setCode("edit"); + xg.setNameCh("修改"); + xg.setNameEn("edit"); + xg.setMenuId(module.getId()); + xg.setIconName(""); + xg.setStyles(""); + xg.setBtnFunction("edit"); + xg.setRemark("主数据修改按钮"); + xg.setCreate(); + sysButtonConfigDao.save(xg); + } + if("dele".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity sc = new SysButtonConfigEntity(); + sc.setCode("dele"); + sc.setNameCh("删除"); + sc.setNameEn("dele"); + sc.setMenuId(module.getId()); + sc.setIconName(""); + sc.setStyles(""); + sc.setBtnFunction("dele"); + sc.setRemark("主数据删除按钮"); + sc.setCreate(); + sysButtonConfigDao.save(sc); + } + if("view".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + + SysButtonConfigEntity ck = new SysButtonConfigEntity(); + ck.setCode("view"); + ck.setNameCh("查看"); + ck.setNameEn("view"); + ck.setMenuId(module.getId()); + ck.setIconName(""); + ck.setStyles(""); + ck.setBtnFunction("view"); + ck.setRemark("主数据查看按钮"); + ck.setCreate(); + sysButtonConfigDao.save(ck); + } + if("send".equals(mdmModuleViewButtonEntities.get(i).getButtonValue())) { + SysButtonConfigEntity xf = new SysButtonConfigEntity(); + xf.setCode("send"); + xf.setNameCh("下发"); + xf.setNameEn("send"); + xf.setMenuId(module.getId()); + xf.setIconName(""); + xf.setStyles(""); + xf.setBtnFunction("send"); + xf.setRemark("主数据下发按钮"); + xf.setCreate(); + sysButtonConfigDao.save(xf); + } + + + } + } + } + } + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List list = mdmModuleSourceDao.queryBase(entity); + 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 saveMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setCreate(); + mdmModuleSourceDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = mdmModuleSourceDao.get(entity.getId()); + return BaseResult.getSuccessMessageEntity("获取数据来源成功", entity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleSourceDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-数据来源删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmSource(JSONObject object) { + MdmModuleSourceEntity entity = getData("jsonStr", object, MdmModuleSourceEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleSourceDao.logicRemoveMultiCondition(entity); + return BaseResult.getSuccessMessageEntity("删除数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List list = mdmModuleDistributeDao.queryBase(entity); + if(list != null && list.size() > 0){ + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setMdmId(entity.getMdmId()); + mdmModuleDistributeDetailEntity.setSts("Y"); + List listDetail = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + if(listDetail != null && listDetail.size() > 0){ + for (int i = 0; i < list.size(); i++) { + List mdmModuleDistributeDetailEntities = new ArrayList<>(); + for (int i1 = 0; i1 < listDetail.size(); i1++) { + if(listDetail.get(i1).getDistributeId().equals(list.get(i).getId())){ + mdmModuleDistributeDetailEntities.add(listDetail.get(i1) ); + } + } + list.get(i).setMdmModuleDistributeDetailEntities(mdmModuleDistributeDetailEntities); + } + } + + } + 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 saveMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setCreate(); + mdmModuleDistributeDao.save(entity); + if (entity.getMdmModuleDistributeDetailEntities() != null && entity.getMdmModuleDistributeDetailEntities().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDistributeDetailEntities().size(); i++) { + entity.getMdmModuleDistributeDetailEntities().get(i).setCreate(); + entity.getMdmModuleDistributeDetailEntities().get(i).setDistributeId(entity.getId()); + entity.getMdmModuleDistributeDetailEntities().get(i).setMdmId(entity.getMdmId()); + mdmModuleDistributeDetailDao.save(entity.getMdmModuleDistributeDetailEntities().get(i)); + } + } + return BaseResult.getSuccessMessageEntity("保存分发设置成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity getMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = mdmModuleDistributeDao.get(entity.getId()); + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setDistributeId(entity.getId()); + List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + entity.setMdmModuleDistributeDetailEntities(mdmModuleDistributeDetailEntities); + return BaseResult.getSuccessMessageEntity("获取分发设置成功", entity); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置修改 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity updateMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleDistributeDao.update(entity); + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setDistributeId(entity.getId()); + mdmModuleDistributeDetailEntity.setUpdate(); + mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + if (entity.getMdmModuleDistributeDetailEntities() != null && entity.getMdmModuleDistributeDetailEntities().size() > 0) { + for (int i = 0; i < entity.getMdmModuleDistributeDetailEntities().size(); i++) { + entity.getMdmModuleDistributeDetailEntities().get(i).setSts("Y"); + entity.getMdmModuleDistributeDetailEntities().get(i).setMdmId(entity.getMdmId()); + entity.getMdmModuleDistributeDetailEntities().get(i).setSts("Y"); + if (entity.getMdmModuleDistributeDetailEntities().get(i).getId() != null) { + entity.getMdmModuleDistributeDetailEntities().get(i).setUpdate(); + entity.getMdmModuleDistributeDetailEntities().get(i).setDistributeId(entity.getId()); + mdmModuleDistributeDetailDao.update(entity.getMdmModuleDistributeDetailEntities().get(i)); + } else { + entity.getMdmModuleDistributeDetailEntities().get(i).setCreate(); + entity.getMdmModuleDistributeDetailEntities().get(i).setDistributeId(entity.getId()); + mdmModuleDistributeDetailDao.save(entity.getMdmModuleDistributeDetailEntities().get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("修改数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-分发设置删除 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity deleteMdmDistribute(JSONObject object) { + MdmModuleDistributeEntity entity = getData("jsonStr", object, MdmModuleDistributeEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + mdmModuleDistributeDao.logicRemoveMultiCondition(entity); + MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + mdmModuleDistributeDetailEntity.setDistributeId(entity.getId()); + mdmModuleDistributeDetailEntity.setUpdate(); + mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); + + return BaseResult.getSuccessMessageEntity("删除数据来源成功"); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-写入日志-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmOptionLogPage(JSONObject object) { + MdmModuleOptionLogEntity entity = getData("jsonStr", object, MdmModuleOptionLogEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if(mdmModuleEntity == null || mdmModuleEntity.getId() == null){ + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0 ){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + entity.setTableName(mdmModuleDbEntities.get(i).getDbName()+"_option_log"); + break; + } + } + }else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = mdmModuleOptionLogDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据-下发日志-列表获取 + * @Date 11:43 上午 2024/6/11 + **/ + @Override + public JsonResultEntity queryMdmDistributeLogPage(JSONObject object) { + MdmModuleSendLogEntity entity = getData("jsonStr", object, MdmModuleSendLogEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0) { + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if ("1".equals(mdmModuleDbEntities.get(i).getDbType())) { + entity.setTableName(mdmModuleDbEntities.get(i).getDbName() + "_send_log"); + break; + } + } + } else { + return BaseResult.getFailureMessageEntity("请先设置数据源"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = mdmModuleSendLogDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务获取(只获取主表) + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmService(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setDbType("1"); + List mdmModuleDbEntities = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleDbEntities); + } + + + /** + * @Author lvleigang + * @Description 主数据-数据源-服务字段获取 + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmServiceField(JSONObject object) { + MdmModuleDbFiledsEntity entity = getData("jsonStr", object, MdmModuleDbFiledsEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getDbId() == null || "".equals(entity.getDbId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + List list = new ArrayList<>(); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if(entity.getDbId().equals(mdmModuleDbEntities.get(i).getDbId()) && "1".equals(mdmModuleDbEntities.get(i).getViewType())){ + list.add(mdmModuleDbEntities.get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } + + /** + * @Author lvleigang + * @Description 主数据-分发-只获取主表 + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmMainDB(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + List list = new ArrayList<>(); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + list.add(mdmModuleDbEntities.get(i)); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } + + /** + * @Author lvleigang + * @Description 主数据-数据源-只获取主表字段 + * @Date 11:43 上午 2024/6/11 + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + @Override + public JsonResultEntity queryMdmMainDBField(JSONObject object) { + MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setSts("Y"); + mdmModuleDbEntity.setMdmId(entity.getMdmId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setMdmId(entity.getMdmId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + + List list = new ArrayList<>(); + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDbType())){ + if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ + for (int i1 = 0; i1 < mdmModuleDbFiledsEntities.size(); i1++) { + if(mdmModuleDbEntities.get(i).getId().equals(mdmModuleDbFiledsEntities.get(i1).getDbId()) && "1".equals(mdmModuleDbFiledsEntities.get(i1).getViewType())){ + list.add(mdmModuleDbFiledsEntities.get(i1)); + } + } + } + } + } + } + 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 list = mdmModuleDistributeDao.queryBase(entity); + return BaseResult.getSuccessMessageEntity("获取分发设置成功", list); + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java index 92b955dd..75785b1a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/IMdmModuleDbDao.java @@ -1,7 +1,11 @@ package com.hzya.frame.mdm.mdmModuleDb.dao; import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; -import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 模版数据库表(mdm_module_db: table)表数据库访问层 @@ -10,6 +14,10 @@ import com.hzya.frame.basedao.dao.IBaseDao; * @since 2024-06-03 08:46:48 */ public interface IMdmModuleDbDao extends IBaseDao { + HashMap getServiceDataById(Map queryData); + List> getServiceByFormmainId(Map queryData); + List> getServiceByDistributeId(Map queryData); + int deleteMdmModuleDb(MdmModuleDbEntity mdmModuleDbEntity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java index 77d8c8bb..85351316 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/dao/impl/MdmModuleDbDaoImpl.java @@ -4,6 +4,11 @@ import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity; import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 模版数据库表(MdmModuleDb)表数据库访问层 * @@ -12,6 +17,31 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleDbDaoImpl") public class MdmModuleDbDaoImpl extends MybatisGenericDao implements IMdmModuleDbDao{ - + @Override + public HashMap getServiceDataById(Map maps) { + HashMap o = (HashMap) super.selectOne(getSqlIdPrifx() + "getServiceDataById", maps); + return o; + + } + + @Override + public List> getServiceByFormmainId(Map maps) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "getServiceByFormmainId", maps); + return o; + + } + @Override + public List> getServiceByDistributeId(Map maps) { + List> o = (List>) super.selectList(getSqlIdPrifx() + "getServiceByDistributeId", maps); + return o; + + } + + @Override + public int deleteMdmModuleDb(MdmModuleDbEntity entity) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteMdmModuleDb", entity); + return o; + } + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml index 383d4ca7..ce49938a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDb/entity/MdmModuleDbEntity.xml @@ -2,23 +2,23 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + id ,mdm_id ,db_name @@ -33,211 +33,288 @@ ,org_id ,company_id - - + select + + from mdm_module_db + + and id = #{id} + and mdm_id = #{mdmId} + and db_name = #{dbName} + and db_type = #{dbType} + and remark = #{remark} + and sorts = #{sorts} + and create_user_id = #{create_user_id} + and create_time = #{create_time} + and modify_user_id = #{modify_user_id} + and modify_time = #{modify_time} + and sts = #{sts} + and org_id = #{org_id} + and company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - - - - + + + - + select + + from mdm_module_db + + and id like concat('%',#{id},'%') + and mdm_id like concat('%',#{mdmId},'%') + and db_name like concat('%',#{dbName},'%') + and db_type like concat('%',#{dbType},'%') + and remark like concat('%',#{remark},'%') + and sorts like concat('%',#{sorts},'%') + and create_user_id like + concat('%',#{create_user_id},'%') + + and create_time like concat('%',#{create_time},'%') + and modify_user_id like + concat('%',#{modify_user_id},'%') + + and modify_time like concat('%',#{modify_time},'%') + and sts like concat('%',#{sts},'%') + and org_id like concat('%',#{org_id},'%') + and company_id like concat('%',#{companyId},'%') and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - + select + + from mdm_module_db + + or id = #{id} + or mdm_id = #{mdmId} + or db_name = #{dbName} + or db_type = #{dbType} + or remark = #{remark} + or sorts = #{sorts} + or create_user_id = #{create_user_id} + or create_time = #{create_time} + or modify_user_id = #{modify_user_id} + or modify_time = #{modify_time} + or sts = #{sts} + or org_id = #{org_id} + or company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - - insert into mdm_module_db( - - id , - mdm_id , - db_name , - db_type , - remark , - sorts , - create_user_id , - create_time , - modify_user_id , - modify_time , - sts , - org_id , - company_id , - sts, - - )values( - - #{id} , - #{mdmId} , - #{dbName} , - #{dbType} , - #{remark} , - #{sorts} , - #{create_user_id} , - #{create_time} , - #{modify_user_id} , - #{modify_time} , - #{sts} , - #{org_id} , - #{companyId} , - 'Y', - - ) - - - - insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) - values - - (#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - - - - - insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) - values - - (#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) - - on duplicate key update - mdm_id = values(mdm_id), - db_name = values(db_name), - db_type = values(db_type), - remark = values(remark), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id), - company_id = values(company_id) - - -update mdm_module_db set - - mdm_id = #{mdmId}, - db_name = #{dbName}, - db_type = #{dbType}, - remark = #{remark}, - create_user_id = #{create_user_id}, - create_time = #{create_time}, - modify_user_id = #{modify_user_id}, - modify_time = #{modify_time}, - sts = #{sts}, - org_id = #{org_id}, - company_id = #{companyId}, - -where id = #{id} - - - + + + insert into mdm_module_db( + + id , + mdm_id , + db_name , + db_type , + remark , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sts, + + )values( + + #{id} , + #{mdmId} , + #{dbName} , + #{dbType} , + #{remark} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + 'Y', + + ) + + + + insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id, + modify_time, sts, org_id, company_id, sts) + values + + (#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, + 'Y') + + + + + insert into mdm_module_db(mdm_id, db_name, db_type, remark, create_user_id, create_time, modify_user_id, + modify_time, sts, org_id, company_id) + values + + (#{entity.mdmId},#{entity.dbName},#{entity.dbType},#{entity.remark},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + mdm_id = values(mdm_id), + db_name = values(db_name), + db_type = values(db_type), + remark = values(remark), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + + + update mdm_module_db set + + mdm_id = #{mdmId}, + db_name = #{dbName}, + db_type = #{dbType}, + remark = #{remark}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + + where id = #{id} + + + update mdm_module_db set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} where id = #{id} - - -update mdm_module_db set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} - - and id = #{id} - and mdm_id = #{mdmId} - and db_name = #{dbName} - and db_type = #{dbType} - and remark = #{remark} - and sorts = #{sorts} - and sts = #{sts} - and company_id = #{companyId} + + + update mdm_module_db set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and db_name = #{dbName} + and db_type = #{dbType} + and remark = #{remark} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} and sts='Y' - - - - + + + + delete from mdm_module_db where id = #{id} + + + + + + + + + + delete from mdm_module_db where mdm_id = #{mdmId} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java index 9bbd8915..9cf1ab43 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/IMdmModuleDbFiledsDao.java @@ -11,5 +11,6 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface IMdmModuleDbFiledsDao extends IBaseDao { + int deleteMdmModuleDbFileds(MdmModuleDbFiledsEntity entity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java index 1e32d5a9..054270b4 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/dao/impl/MdmModuleDbFiledsDaoImpl.java @@ -12,6 +12,11 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleDbFiledsDaoImpl") public class MdmModuleDbFiledsDaoImpl extends MybatisGenericDao implements IMdmModuleDbFiledsDao{ - + + @Override + public int deleteMdmModuleDbFileds(MdmModuleDbFiledsEntity entity) { + Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteMdmModuleDbFileds", entity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java index 194a0ace..3e1debd5 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.java @@ -1,10 +1,10 @@ package com.hzya.frame.mdm.mdmModuleDbFileds.entity; -import java.util.Date; import java.util.List; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.web.entity.BaseEntity; + /** * 模版数据库字段表(MdmModuleDbFileds)实体类 * @@ -13,6 +13,8 @@ import com.hzya.frame.web.entity.BaseEntity; */ public class MdmModuleDbFiledsEntity extends BaseEntity { + /** 主数据模版ID */ + private String dbName; /** 主数据模版ID */ private String mdmId; /** 模版数据库id */ @@ -41,8 +43,20 @@ public class MdmModuleDbFiledsEntity extends BaseEntity { private String companyId; /** 数据类型 1、新增 2、修改 */ private String dataType; + /** 类型 1、主表 2、明细 3、操作日志 4、下发日志 */ + private String dbType; + /** + * roletype + */ + private String roletype; + /** + * roletype + */ + private String roleValue; private List mdmModuleDbFiledsRules; + //1、查询2、列表3、新增4、修改 5、查看 + private String fieldType; public String getMdmId() { return mdmId; } @@ -162,5 +176,45 @@ public class MdmModuleDbFiledsEntity extends BaseEntity { public void setDataType(String dataType) { this.dataType = dataType; } + + public String getRoletype() { + return roletype; + } + + public void setRoletype(String roletype) { + this.roletype = roletype; + } + + public String getRoleValue() { + return roleValue; + } + + public void setRoleValue(String roleValue) { + this.roleValue = roleValue; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getFieldType() { + return fieldType; + } + + public void setFieldType(String fieldType) { + this.fieldType = fieldType; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml index 8e4d37a4..540c0e9f 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFileds/entity/MdmModuleDbFiledsEntity.xml @@ -76,6 +76,14 @@ and sts = #{sts} and org_id = #{org_id} and company_id = #{companyId} + + and id in ( + select + filed_id + from mdm_module_db_fileds_rule + where sts='Y' and rule_code = #{roletype} and rule_value = #{roleValue} + ) + and sts='Y' order by sorts asc @@ -326,6 +334,9 @@ update mdm_module_db_fileds set sts= 'N' ,modify_time = #{modify_time},modify_u delete from mdm_module_db_fileds where id = #{id} - + + + delete from mdm_module_db_fileds where mdm_id = #{mdmId} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java index 7e29594b..ab7def4b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/IMdmModuleDbFiledsRuleDao.java @@ -11,5 +11,6 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface IMdmModuleDbFiledsRuleDao extends IBaseDao { + Integer queryUserMdm(MdmModuleDbFiledsRuleEntity queryCount); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java index d3c4f630..2f11bed8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/dao/impl/MdmModuleDbFiledsRuleDaoImpl.java @@ -12,6 +12,11 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleDbFiledsRuleDaoImpl") public class MdmModuleDbFiledsRuleDaoImpl extends MybatisGenericDao implements IMdmModuleDbFiledsRuleDao{ - + + @Override + public Integer queryUserMdm(MdmModuleDbFiledsRuleEntity queryCount) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryUserMdm", queryCount); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml index 2d1e1e9f..2c2213f8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDbFiledsRule/entity/MdmModuleDbFiledsRuleEntity.xml @@ -283,5 +283,17 @@ update mdm_module_db_fileds_rule set sts= 'N' ,modify_time = #{modify_time},mod delete from mdm_module_db_fileds_rule where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java index 2e2f90f5..44cc5cec 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/IMdmModuleDistributeDao.java @@ -7,9 +7,10 @@ import com.hzya.frame.basedao.dao.IBaseDao; * 主数据功能应用分发表(mdm_module_distribute: table)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-18 11:39:46 */ public interface IMdmModuleDistributeDao extends IBaseDao { + Integer queryCountUse(MdmModuleDistributeEntity mdmModuleDistributeEntity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java index 3318c2c2..3f9560f8 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/dao/impl/MdmModuleDistributeDaoImpl.java @@ -4,14 +4,22 @@ 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)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-18 11:39:46 */ @Repository(value = "MdmModuleDistributeDaoImpl") public class MdmModuleDistributeDaoImpl extends MybatisGenericDao implements IMdmModuleDistributeDao{ - + + @Override + public Integer queryCountUse(MdmModuleDistributeEntity mdmModuleDistributeEntity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryCountUse", mdmModuleDistributeEntity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java index 23df5360..02783ec9 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.java @@ -1,12 +1,15 @@ package com.hzya.frame.mdm.mdmModuleDistribute.entity; import java.util.Date; +import java.util.List; + +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; import com.hzya.frame.web.entity.BaseEntity; /** * 主数据功能应用分发表(MdmModuleDistribute)实体类 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-18 11:39:46 */ public class MdmModuleDistributeEntity extends BaseEntity { @@ -14,17 +17,38 @@ public class MdmModuleDistributeEntity extends BaseEntity { private String mdmId; /** 应用id */ private String appId; + /** 应用id */ + private Long mdmCode; + /** 触发类型 0、手动1、自动 */ + private String enabledType; /** 修改接口 */ private String updateApi; + /** 修改插件 */ + private String updateScript; /** 新增接口 */ private String addApi; + /** 新增插件 */ + private String addScript; /** 删除接口 */ private String deleteApi; + /** 删除插件 */ + private String deleteScript; /** 启用停用 0、停用1、启用 */ private String enabledState; + /** 主表ID */ + private String dbId; /** 公司id */ private String companyId; + /** 公司id */ + private List mdmModuleDistributeDetailEntities; + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } public String getMdmId() { return mdmId; @@ -42,6 +66,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.appId = appId; } + public String getEnabledType() { + return enabledType; + } + + public void setEnabledType(String enabledType) { + this.enabledType = enabledType; + } + public String getUpdateApi() { return updateApi; } @@ -50,6 +82,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.updateApi = updateApi; } + public String getUpdateScript() { + return updateScript; + } + + public void setUpdateScript(String updateScript) { + this.updateScript = updateScript; + } + public String getAddApi() { return addApi; } @@ -58,6 +98,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.addApi = addApi; } + public String getAddScript() { + return addScript; + } + + public void setAddScript(String addScript) { + this.addScript = addScript; + } + public String getDeleteApi() { return deleteApi; } @@ -66,6 +114,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.deleteApi = deleteApi; } + public String getDeleteScript() { + return deleteScript; + } + + public void setDeleteScript(String deleteScript) { + this.deleteScript = deleteScript; + } + public String getEnabledState() { return enabledState; } @@ -74,6 +130,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.enabledState = enabledState; } + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + public String getCompanyId() { return companyId; } @@ -82,5 +146,14 @@ public class MdmModuleDistributeEntity extends BaseEntity { this.companyId = companyId; } + public List getMdmModuleDistributeDetailEntities() { + return mdmModuleDistributeDetailEntities; + } + + public void setMdmModuleDistributeDetailEntities(List mdmModuleDistributeDetailEntities) { + this.mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailEntities; + } + + } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml index 82243342..03266e78 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/entity/MdmModuleDistributeEntity.xml @@ -6,10 +6,15 @@ + + + + + @@ -24,10 +29,15 @@ id ,mdm_id ,app_id + ,enabled_type ,update_api + ,update_script ,add_api + ,add_script ,delete_api + ,delete_script ,enabled_state + ,db_id ,sorts ,create_user_id ,create_time @@ -37,6 +47,13 @@ ,org_id ,company_id + + + - + insert into mdm_module_distribute( id , mdm_id , app_id , + enabled_type , update_api , + update_script , add_api , + add_script , delete_api , + delete_script , enabled_state , + db_id , sorts , create_user_id , create_time , @@ -162,6 +204,7 @@ sts , org_id , company_id , + sorts, sts, )values( @@ -169,10 +212,15 @@ #{id} , #{mdmId} , #{appId} , + #{enabledType} , #{updateApi} , + #{updateScript} , #{addApi} , + #{addScript} , #{deleteApi} , + #{deleteScript} , #{enabledState} , + #{dbId} , #{sorts} , #{create_user_id} , #{create_time} , @@ -181,32 +229,38 @@ #{sts} , #{org_id} , #{companyId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute a WHERE a.sts = 'Y' ), 'Y', ) - - insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + + insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values - (#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + (#{entity.mdmId},#{entity.appId},#{entity.enabledType},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - - insert into mdm_module_distribute(mdm_id, app_id, update_api, add_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + + insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values - (#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.addApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + (#{entity.mdmId},#{entity.appId},#{entity.enabledType},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) on duplicate key update mdm_id = values(mdm_id), app_id = values(app_id), + enabled_type = values(enabled_type), update_api = values(update_api), + update_script = values(update_script), add_api = values(add_api), + add_script = values(add_script), delete_api = values(delete_api), + delete_script = values(delete_script), enabled_state = values(enabled_state), + db_id = values(db_id), create_user_id = values(create_user_id), create_time = values(create_time), modify_user_id = values(modify_user_id), @@ -220,10 +274,15 @@ update mdm_module_distribute set mdm_id = #{mdmId}, app_id = #{appId}, + enabled_type = #{enabledType}, update_api = #{updateApi}, + update_script = #{updateScript}, add_api = #{addApi}, + add_script = #{addScript}, delete_api = #{deleteApi}, + delete_script = #{deleteScript}, enabled_state = #{enabledState}, + db_id = #{dbId}, create_user_id = #{create_user_id}, create_time = #{create_time}, modify_user_id = #{modify_user_id}, @@ -246,10 +305,15 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_ and id = #{id} and mdm_id = #{mdmId} and app_id = #{appId} + and enabled_type = #{enabledType} and update_api = #{updateApi} + and update_script = #{updateScript} and add_api = #{addApi} + and add_script = #{addScript} and delete_api = #{deleteApi} + and delete_script = #{deleteScript} and enabled_state = #{enabledState} + and db_id = #{dbId} and sorts = #{sorts} and sts = #{sts} and company_id = #{companyId} @@ -260,6 +324,16 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_ delete from mdm_module_distribute where id = #{id} - + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java index 577b0e3c..46befe7b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/IMdmModuleDistributeService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 主数据功能应用分发表(MdmModuleDistribute)表服务接口 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-18 11:39:46 */ public interface IMdmModuleDistributeService extends IBaseService{ } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java index 24fe61e3..29bbea60 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistribute/service/impl/MdmModuleDistributeServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 主数据功能应用分发表(MdmModuleDistribute)表服务实现类 * * @author makejava - * @since 2024-06-03 08:47:33 + * @since 2024-06-18 11:39:46 */ @Service(value = "mdmModuleDistributeService") public class MdmModuleDistributeServiceImpl extends BaseService implements IMdmModuleDistributeService { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java index 2b55a63a..962a0d5a 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/IMdmModuleDistributeDetailDao.java @@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao; * 主数据功能应用分发明细表(mdm_module_distribute_detail: table)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-19 10:34:58 */ public interface IMdmModuleDistributeDetailDao extends IBaseDao { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java index 68878631..8507d00c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/dao/impl/MdmModuleDistributeDetailDaoImpl.java @@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表数据库访问层 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-19 10:34:58 */ @Repository(value = "MdmModuleDistributeDetailDaoImpl") public class MdmModuleDistributeDetailDaoImpl extends MybatisGenericDao implements IMdmModuleDistributeDetailDao{ diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java index b0438ba8..d1acefd1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.java @@ -6,7 +6,7 @@ import com.hzya.frame.web.entity.BaseEntity; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)实体类 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-19 10:34:58 */ public class MdmModuleDistributeDetailEntity extends BaseEntity { @@ -18,12 +18,20 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { private String apiId; /** 数据类型 1、新增2、修改3、删除 */ private String dataType; + /** 左括号 */ + private String leftBracket; + /** 字段id */ + private String filedId; /** 字段名 */ private String filedName; - /** 对比类型 1、等于 */ + /** 对比类型 1、等于 2、不等于 3、大于 4、小于 */ private String compareType; /** 目标API字段默认值 */ private String filedVaule; + /** 连接符号 1\and 2\or */ + private String connectionSymbol; + /** 右括号 */ + private String rightParenthesis; /** 公司id */ private String companyId; @@ -60,6 +68,22 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { this.dataType = dataType; } + public String getLeftBracket() { + return leftBracket; + } + + public void setLeftBracket(String leftBracket) { + this.leftBracket = leftBracket; + } + + public String getFiledId() { + return filedId; + } + + public void setFiledId(String filedId) { + this.filedId = filedId; + } + public String getFiledName() { return filedName; } @@ -84,6 +108,22 @@ public class MdmModuleDistributeDetailEntity extends BaseEntity { this.filedVaule = filedVaule; } + public String getConnectionSymbol() { + return connectionSymbol; + } + + public void setConnectionSymbol(String connectionSymbol) { + this.connectionSymbol = connectionSymbol; + } + + public String getRightParenthesis() { + return rightParenthesis; + } + + public void setRightParenthesis(String rightParenthesis) { + this.rightParenthesis = rightParenthesis; + } + public String getCompanyId() { return companyId; } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml index 15113e4f..df6e705c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/entity/MdmModuleDistributeDetailEntity.xml @@ -2,34 +2,43 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + id ,mdm_id ,distribute_id ,api_id ,data_type + ,left_bracket + ,filed_id ,filed_name ,compare_type ,filed_vaule + ,connection_symbol + ,right_parenthesis ,sorts ,create_user_id ,create_time @@ -39,236 +48,311 @@ ,org_id ,company_id - - + select + + from mdm_module_distribute_detail + + and id = #{id} + and mdm_id = #{mdmId} + and distribute_id = #{distributeId} + and api_id = #{apiId} + and data_type = #{dataType} + and left_bracket = #{leftBracket} + and filed_id = #{filedId} + and filed_name = #{filedName} + and compare_type = #{compareType} + and filed_vaule = #{filedVaule} + and connection_symbol = #{connectionSymbol} + + and right_parenthesis = #{rightParenthesis} + + and sorts = #{sorts} + and create_user_id = #{create_user_id} + and create_time = #{create_time} + and modify_user_id = #{modify_user_id} + and modify_time = #{modify_time} + and sts = #{sts} + and org_id = #{org_id} + and company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - - - - + + + - + select + + from mdm_module_distribute_detail + + and id like concat('%',#{id},'%') + and mdm_id like concat('%',#{mdmId},'%') + and distribute_id like + concat('%',#{distributeId},'%') + + and api_id like concat('%',#{apiId},'%') + and data_type like concat('%',#{dataType},'%') + and left_bracket like concat('%',#{leftBracket},'%') + + and filed_id like concat('%',#{filedId},'%') + and filed_name like concat('%',#{filedName},'%') + and compare_type like concat('%',#{compareType},'%') + + and filed_vaule like concat('%',#{filedVaule},'%') + and connection_symbol like + concat('%',#{connectionSymbol},'%') + + and right_parenthesis like + concat('%',#{rightParenthesis},'%') + + and sorts like concat('%',#{sorts},'%') + and create_user_id like + concat('%',#{create_user_id},'%') + + and create_time like concat('%',#{create_time},'%') + and modify_user_id like + concat('%',#{modify_user_id},'%') + + and modify_time like concat('%',#{modify_time},'%') + and sts like concat('%',#{sts},'%') + and org_id like concat('%',#{org_id},'%') + and company_id like concat('%',#{companyId},'%') and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - + select + + from mdm_module_distribute_detail + + or id = #{id} + or mdm_id = #{mdmId} + or distribute_id = #{distributeId} + or api_id = #{apiId} + or data_type = #{dataType} + or left_bracket = #{leftBracket} + or filed_id = #{filedId} + or filed_name = #{filedName} + or compare_type = #{compareType} + or filed_vaule = #{filedVaule} + or connection_symbol = #{connectionSymbol} + + or right_parenthesis = #{rightParenthesis} + + or sorts = #{sorts} + or create_user_id = #{create_user_id} + or create_time = #{create_time} + or modify_user_id = #{modify_user_id} + or modify_time = #{modify_time} + or sts = #{sts} + or org_id = #{org_id} + or company_id = #{companyId} and sts='Y' - - order by sorts asc - order by ${sort} ${order} - + + order by sorts asc + order by ${sort} ${order} + - - - insert into mdm_module_distribute_detail( - - id , - mdm_id , - distribute_id , - api_id , - data_type , - filed_name , - compare_type , - filed_vaule , - sorts , - create_user_id , - create_time , - modify_user_id , - modify_time , - sts , - org_id , - company_id , - sts, - - )values( - - #{id} , - #{mdmId} , - #{distributeId} , - #{apiId} , - #{dataType} , - #{filedName} , - #{compareType} , - #{filedVaule} , - #{sorts} , - #{create_user_id} , - #{create_time} , - #{modify_user_id} , - #{modify_time} , - #{sts} , - #{org_id} , - #{companyId} , - 'Y', - - ) - - - - insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, filed_name, compare_type, filed_vaule, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) - values - - (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') - - - - - insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, filed_name, compare_type, filed_vaule, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) - values - - (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) - - on duplicate key update - mdm_id = values(mdm_id), - distribute_id = values(distribute_id), - api_id = values(api_id), - data_type = values(data_type), - filed_name = values(filed_name), - compare_type = values(compare_type), - filed_vaule = values(filed_vaule), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id), - company_id = values(company_id) - - -update mdm_module_distribute_detail set - - mdm_id = #{mdmId}, - distribute_id = #{distributeId}, - api_id = #{apiId}, - data_type = #{dataType}, - filed_name = #{filedName}, - compare_type = #{compareType}, - filed_vaule = #{filedVaule}, - create_user_id = #{create_user_id}, - create_time = #{create_time}, - modify_user_id = #{modify_user_id}, - modify_time = #{modify_time}, - sts = #{sts}, - org_id = #{org_id}, - company_id = #{companyId}, - -where id = #{id} - - - + + + insert into mdm_module_distribute_detail( + + id , + mdm_id , + distribute_id , + api_id , + data_type , + left_bracket , + filed_id , + filed_name , + compare_type , + filed_vaule , + connection_symbol , + right_parenthesis , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{distributeId} , + #{apiId} , + #{dataType} , + #{leftBracket} , + #{filedId} , + #{filedName} , + #{compareType} , + #{filedVaule} , + #{connectionSymbol} , + #{rightParenthesis} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute_detail + a WHERE a.sts = 'Y' ), + + 'Y', + + ) + + + + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_id, + filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedId},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, + 'Y') + + + + + insert into mdm_module_distribute_detail(mdm_id, distribute_id, api_id, data_type, left_bracket, filed_id, + filed_name, compare_type, filed_vaule, connection_symbol, right_parenthesis, create_user_id, create_time, + modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.mdmId},#{entity.distributeId},#{entity.apiId},#{entity.dataType},#{entity.leftBracket},#{entity.filedId},#{entity.filedName},#{entity.compareType},#{entity.filedVaule},#{entity.connectionSymbol},#{entity.rightParenthesis},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + mdm_id = values(mdm_id), + distribute_id = values(distribute_id), + api_id = values(api_id), + data_type = values(data_type), + left_bracket = values(left_bracket), + filed_id = values(filed_id), + filed_name = values(filed_name), + compare_type = values(compare_type), + filed_vaule = values(filed_vaule), + connection_symbol = values(connection_symbol), + right_parenthesis = values(right_parenthesis), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + + + update mdm_module_distribute_detail set + + mdm_id = #{mdmId}, + distribute_id = #{distributeId}, + api_id = #{apiId}, + data_type = #{dataType}, + left_bracket = #{leftBracket}, + filed_id = #{filedId}, + filed_name = #{filedName}, + compare_type = #{compareType}, + filed_vaule = #{filedVaule}, + connection_symbol = #{connectionSymbol}, + right_parenthesis = #{rightParenthesis}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + + where id = #{id} + + + update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} where id = #{id} - - -update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} - - and id = #{id} - and mdm_id = #{mdmId} - and distribute_id = #{distributeId} - and api_id = #{apiId} - and data_type = #{dataType} - and filed_name = #{filedName} - and compare_type = #{compareType} - and filed_vaule = #{filedVaule} - and sorts = #{sorts} - and sts = #{sts} - and company_id = #{companyId} + + + update mdm_module_distribute_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = + #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and distribute_id = #{distributeId} + and api_id = #{apiId} + and data_type = #{dataType} + and left_bracket = #{leftBracket} + and filed_id = #{filedId} + and filed_name = #{filedName} + and compare_type = #{compareType} + and filed_vaule = #{filedVaule} + and connection_symbol = #{connectionSymbol} + + and right_parenthesis = #{rightParenthesis} + + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} and sts='Y' - - - - + + + + delete from mdm_module_distribute_detail where id = #{id} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java index 9b2fb7f8..cafa6b20 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/IMdmModuleDistributeDetailService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务接口 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-19 10:34:58 */ public interface IMdmModuleDistributeDetailService extends IBaseService{ } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java index 6dd4b505..5957bc4c 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleDistributeDetail/service/impl/MdmModuleDistributeDetailServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 主数据功能应用分发明细表(MdmModuleDistributeDetail)表服务实现类 * * @author makejava - * @since 2024-06-03 08:48:18 + * @since 2024-06-19 10:34:58 */ @Service(value = "mdmModuleDistributeDetailService") public class MdmModuleDistributeDetailServiceImpl extends BaseService implements IMdmModuleDistributeDetailService { diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/IMdmModuleOptionLogDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/IMdmModuleOptionLogDao.java new file mode 100644 index 00000000..a65bb1bc --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/IMdmModuleOptionLogDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleOptionLog.dao; + +import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据模版(mdm_module_option_log: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:10:31 + */ +public interface IMdmModuleOptionLogDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/impl/MdmModuleOptionLogDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/impl/MdmModuleOptionLogDaoImpl.java new file mode 100644 index 00000000..b0fc4626 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/dao/impl/MdmModuleOptionLogDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmModuleOptionLog.dao.impl; + +import com.hzya.frame.mdm.mdmModuleOptionLog.entity.MdmModuleOptionLogEntity; +import com.hzya.frame.mdm.mdmModuleOptionLog.dao.IMdmModuleOptionLogDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 主数据模版(MdmModuleOptionLog)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:10:31 + */ +@Repository(value = "MdmModuleOptionLogDaoImpl") +public class MdmModuleOptionLogDaoImpl extends MybatisGenericDao implements IMdmModuleOptionLogDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java new file mode 100644 index 00000000..525fce33 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.java @@ -0,0 +1,124 @@ +package com.hzya.frame.mdm.mdmModuleOptionLog.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 主数据模版(MdmModuleOptionLog)实体类 + * + * @author makejava + * @since 2024-06-05 16:10:32 + */ +public class MdmModuleOptionLogEntity extends BaseEntity { + //主数据表名 + private String tableName; + //主数据编码 + private Long mdmCode; + /** 主表id */ + private String formmainId; + /** 来源名称 */ + private String sourceName; + /** 状态 1、成功2、失败 */ + private String dataType; + /** 备注 */ + private String remark; + /** 编码 */ + private String code; + /** source_data */ + private String sourceData; + /** 操作类型 */ + private String optionType; + /** 操作人 */ + private String optionName; + /** 公司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; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getSourceData() { + return sourceData; + } + + public void setSourceData(String sourceData) { + this.sourceData = sourceData; + } + + public String getOptionType() { + return optionType; + } + + public void setOptionType(String optionType) { + this.optionType = optionType; + } + + public String getOptionName() { + return optionName; + } + + public void setOptionName(String optionName) { + this.optionName = optionName; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml new file mode 100644 index 00000000..c4df7ee5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleOptionLog/entity/MdmModuleOptionLogEntity.xml @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,formmain_id + ,source_name + ,data_type + ,code + ,remark + ,source_data + ,option_type + ,option_name + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + + insert into ${tableName}( + + id , + formmain_id , + source_name , + data_type , + code , + remark , + source_data , + option_type , + option_name , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sts, + + )values( + + #{id} , + #{formmainId} , + #{sourceName} , + #{dataType} , + #{code} , + #{remark} , + #{sourceData} , + #{optionType} , + #{optionName} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + 'Y', + + ) + + + + 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 + + (#{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') + + + + + 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 + + (#{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}) + + 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), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + +update ${tableName} set + + formmain_id = #{formmainId}, + source_name = #{sourceName}, + data_type = #{dataType}, + code = #{code}, + remark = #{remark}, + source_data = #{sourceData}, + option_type = #{optionType}, + option_name = #{optionName}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + +where id = #{id} + + + +update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and formmain_id = #{formmainId} + and source_name = #{sourceName} + and data_type = #{dataType} + and code = #{code} + and remark = #{remark} + and source_data = #{sourceData} + and option_type = #{optionType} + and option_name = #{optionName} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from ${tableName} where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/IMdmModuleSendLogDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/IMdmModuleSendLogDao.java new file mode 100644 index 00000000..156977bb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/IMdmModuleSendLogDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.mdm.mdmModuleSendLog.dao; + +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 主数据模版(mdm_module_send_log: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:11:09 + */ +public interface IMdmModuleSendLogDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/impl/MdmModuleSendLogDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/impl/MdmModuleSendLogDaoImpl.java new file mode 100644 index 00000000..9e59822d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/dao/impl/MdmModuleSendLogDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.mdm.mdmModuleSendLog.dao.impl; + +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 主数据模版(MdmModuleSendLog)表数据库访问层 + * + * @author makejava + * @since 2024-06-05 16:11:09 + */ +@Repository(value = "MdmModuleSendLogDaoImpl") +public class MdmModuleSendLogDaoImpl extends MybatisGenericDao implements IMdmModuleSendLogDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java new file mode 100644 index 00000000..1a09ceed --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.java @@ -0,0 +1,113 @@ +package com.hzya.frame.mdm.mdmModuleSendLog.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 主数据模版(MdmModuleSendLog)实体类 + * + * @author makejava + * @since 2024-06-05 16:11:10 + */ +public class MdmModuleSendLogEntity extends BaseEntity { + //主数据表名 + private String tableName; + //主数据编码 + private Long mdmCode; + /** 主表id */ + private String formmainId; + /** 目标应用 */ + private String targetApp; + /** 目标api */ + 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; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getTargetApp() { + return targetApp; + } + + public void setTargetApp(String targetApp) { + this.targetApp = targetApp; + } + + public String getTargetApi() { + return targetApi; + } + + public void setTargetApi(String targetApi) { + this.targetApi = targetApi; + } + + public String getSourceData() { + return sourceData; + } + + public void setSourceData(String sourceData) { + this.sourceData = sourceData; + } + + public String getOptionType() { + return optionType; + } + + public void setOptionType(String optionType) { + this.optionType = optionType; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public Long getMdmCode() { + return mdmCode; + } + + public void setMdmCode(Long mdmCode) { + this.mdmCode = mdmCode; + } +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml new file mode 100644 index 00000000..718563ca --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSendLog/entity/MdmModuleSendLogEntity.xml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + id + ,formmain_id + ,target_app + ,target_api + ,source_data + ,option_type + ,remark + ,data_type + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + + + insert into ${tableName}( + + id , + formmain_id , + target_app , + target_api , + source_data , + option_type , + remark , + data_type , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sts, + + )values( + + #{id} , + #{formmainId} , + #{targetApp} , + #{targetApi} , + #{sourceData} , + #{optionType} , + #{remark} , + #{dataType} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + 'Y', + + ) + + + + 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 + + (#{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') + + + + + 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 + + (#{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}) + + on duplicate key update + formmain_id = values(formmain_id), + target_app = values(target_app), + 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), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + +update ${tableName} set + + formmain_id = #{formmainId}, + target_app = #{targetApp}, + target_api = #{targetApi}, + source_data = #{sourceData}, + option_type = #{optionType}, + remark = #{remark}, + data_type = #{dataType}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + +where id = #{id} + + + +update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update ${tableName} set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and formmain_id = #{formmainId} + and target_app = #{targetApp} + and target_api = #{targetApi} + and source_data = #{sourceData} + and option_type = #{optionType} + and remark = #{remark} + and data_type = #{dataType} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from ${tableName} where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/IMdmModuleSourceDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/IMdmModuleSourceDao.java new file mode 100644 index 00000000..6d290781 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/IMdmModuleSourceDao.java @@ -0,0 +1,25 @@ +package com.hzya.frame.mdm.mdmModuleSource.dao; + +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.List; + +/** + * 主数据数据来源(mdm_module_source: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-19 09:11:50 + */ +public interface IMdmModuleSourceDao extends IBaseDao { + /** + * + * @content 根据数据来源内类型是插件的应用类型做分组 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/6 10:43 + * **/ + List MdmModuleSourceentityGroupByType(); +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/impl/MdmModuleSourceDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/impl/MdmModuleSourceDaoImpl.java new file mode 100644 index 00000000..3392fd01 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/dao/impl/MdmModuleSourceDaoImpl.java @@ -0,0 +1,27 @@ +package com.hzya.frame.mdm.mdmModuleSource.dao.impl; + +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.mdm.mdmModuleSource.dao.IMdmModuleSourceDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + +/** + * 主数据数据来源(MdmModuleSource)表数据库访问层 + * + * @author makejava + * @since 2024-06-19 09:11:50 + */ +@Repository(value = "MdmModuleSourceDaoImpl") +public class MdmModuleSourceDaoImpl extends MybatisGenericDao implements IMdmModuleSourceDao{ + + //根据数据来源内类型是插件的应用类型做分组 + @Override + public List MdmModuleSourceentityGroupByType() { + List list =(List) super.selectList(getSqlIdPrifx() + "queryMdmModuleSourceentityGroupByType", ""); + return list; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.java new file mode 100644 index 00000000..40af0a2c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.java @@ -0,0 +1,125 @@ +package com.hzya.frame.mdm.mdmModuleSource.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 主数据数据来源(MdmModuleSource)实体类 + * + * @author makejava + * @since 2024-06-19 09:11:50 + */ +public class MdmModuleSourceEntity extends BaseEntity { + + /** 主数据模版ID */ + private String mdmId; + /** 来源类型1、插件2、api */ + private String sourceType; + /** 来源应用 */ + private String sourceName; + /** 触发类型 1、手动 2、自动 */ + private String triggerType; + /** 来源编码 */ + private String sourceCode; + /** 新增接口 */ + private String addApi; + /** 修改接口 */ + private String updateApi; + /** 删除接口 */ + private String deleteApi; + /** 启用停用 0、停用1、启用 */ + private String enabledState; + /** 公司id */ + private String companyId; + /** 公司id */ + private String pluginCode; + + public String getPluginCode() { + return pluginCode; + } + + public void setPluginCode(String pluginCode) { + this.pluginCode = pluginCode; + } + + public String getMdmId() { + return mdmId; + } + + public void setMdmId(String mdmId) { + this.mdmId = mdmId; + } + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getTriggerType() { + return triggerType; + } + + public void setTriggerType(String triggerType) { + this.triggerType = triggerType; + } + + public String getSourceCode() { + return sourceCode; + } + + public void setSourceCode(String sourceCode) { + this.sourceCode = sourceCode; + } + + public String getAddApi() { + return addApi; + } + + public void setAddApi(String addApi) { + this.addApi = addApi; + } + + public String getUpdateApi() { + return updateApi; + } + + public void setUpdateApi(String updateApi) { + this.updateApi = updateApi; + } + + public String getDeleteApi() { + return deleteApi; + } + + public void setDeleteApi(String deleteApi) { + this.deleteApi = deleteApi; + } + + public String getEnabledState() { + return enabledState; + } + + public void setEnabledState(String enabledState) { + this.enabledState = enabledState; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml new file mode 100644 index 00000000..1918707d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/entity/MdmModuleSourceEntity.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,mdm_id + ,source_type + ,source_name + ,trigger_type + ,source_code + ,add_api + ,update_api + ,delete_api + ,enabled_state + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + + + insert into mdm_module_source( + + id , + mdm_id , + source_type , + source_name , + trigger_type , + source_code , + add_api , + update_api , + delete_api , + enabled_state , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sorts, + sts, + + )values( + + #{id} , + #{mdmId} , + #{sourceType} , + #{sourceName} , + #{triggerType} , + #{sourceCode} , + #{addApi} , + #{updateApi} , + #{deleteApi} , + #{enabledState} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_source a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.mdmId},#{entity.sourceType},#{entity.sourceName},#{entity.triggerType},#{entity.sourceCode},#{entity.addApi},#{entity.updateApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + + + + + insert into mdm_module_source(mdm_id, source_type, source_name, trigger_type, source_code, add_api, update_api, delete_api, enabled_state, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.mdmId},#{entity.sourceType},#{entity.sourceName},#{entity.triggerType},#{entity.sourceCode},#{entity.addApi},#{entity.updateApi},#{entity.deleteApi},#{entity.enabledState},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + mdm_id = values(mdm_id), + source_type = values(source_type), + source_name = values(source_name), + trigger_type = values(trigger_type), + source_code = values(source_code), + add_api = values(add_api), + update_api = values(update_api), + delete_api = values(delete_api), + enabled_state = values(enabled_state), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + +update mdm_module_source set + + mdm_id = #{mdmId}, + source_type = #{sourceType}, + source_name = #{sourceName}, + trigger_type = #{triggerType}, + source_code = #{sourceCode}, + add_api = #{addApi}, + update_api = #{updateApi}, + delete_api = #{deleteApi}, + enabled_state = #{enabledState}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + +where id = #{id} + + + +update mdm_module_source set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update mdm_module_source set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and mdm_id = #{mdmId} + and source_type = #{sourceType} + and source_name = #{sourceName} + and trigger_type = #{triggerType} + and source_code = #{sourceCode} + and add_api = #{addApi} + and update_api = #{updateApi} + and delete_api = #{deleteApi} + and enabled_state = #{enabledState} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from mdm_module_source where id = #{id} + + + + + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/IMdmModuleSourceService.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/IMdmModuleSourceService.java new file mode 100644 index 00000000..990da6bd --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/IMdmModuleSourceService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.mdm.mdmModuleSource.service; + +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 主数据数据来源(MdmModuleSource)表服务接口 + * + * @author makejava + * @since 2024-06-19 09:11:50 + */ +public interface IMdmModuleSourceService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/impl/MdmModuleSourceServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/impl/MdmModuleSourceServiceImpl.java new file mode 100644 index 00000000..206df786 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleSource/service/impl/MdmModuleSourceServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.mdm.mdmModuleSource.service.impl; + +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.mdm.mdmModuleSource.dao.IMdmModuleSourceDao; +import com.hzya.frame.mdm.mdmModuleSource.service.IMdmModuleSourceService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 主数据数据来源(MdmModuleSource)表服务实现类 + * + * @author makejava + * @since 2024-06-19 09:11:50 + */ +@Service(value = "mdmModuleSourceService") +public class MdmModuleSourceServiceImpl extends BaseService implements IMdmModuleSourceService { + + private IMdmModuleSourceDao mdmModuleSourceDao; + + @Autowired + public void setMdmModuleSourceDao(IMdmModuleSourceDao dao) { + this.mdmModuleSourceDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java index c1daba93..bf04e65d 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/IMdmModuleViewDao.java @@ -1,5 +1,6 @@ package com.hzya.frame.mdm.mdmModuleView.dao; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.basedao.dao.IBaseDao; @@ -11,5 +12,6 @@ import com.hzya.frame.basedao.dao.IBaseDao; */ public interface IMdmModuleViewDao extends IBaseDao { + Integer queryUserMdm(MdmModuleViewEntity mdmModuleViewEntity); } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java index 453f7b44..cf3aace2 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/dao/impl/MdmModuleViewDaoImpl.java @@ -1,5 +1,6 @@ package com.hzya.frame.mdm.mdmModuleView.dao.impl; +import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; import org.springframework.stereotype.Repository; @@ -12,6 +13,14 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; */ @Repository(value = "MdmModuleViewDaoImpl") public class MdmModuleViewDaoImpl extends MybatisGenericDao implements IMdmModuleViewDao{ - + + + + + @Override + public Integer queryUserMdm(MdmModuleViewEntity mdmModuleViewEntity) { + Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "queryUserMdm", mdmModuleViewEntity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java index 9c1344ba..e8232cc1 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.java @@ -12,7 +12,7 @@ public class MdmModuleViewEntity extends BaseEntity { /** 主数据模版ID */ private String mdmId; - /** 显示类型 */ + /** 显示类型 1、树2、列表*/ private String viewName; /** 显示字段 */ private String viewFiled; @@ -21,6 +21,8 @@ public class MdmModuleViewEntity extends BaseEntity { /** 公司id */ private String companyId; + /** 数据类型 1、新增 2、修改 */ + private String dataType; public String getMdmId() { return mdmId; @@ -62,5 +64,12 @@ public class MdmModuleViewEntity extends BaseEntity { this.companyId = companyId; } + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml index 0e990f0d..f6af148b 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleView/entity/MdmModuleViewEntity.xml @@ -238,6 +238,14 @@ update mdm_module_view set sts= 'N' ,modify_time = #{modify_time},modify_user_i delete from mdm_module_view where id = #{id} - + + diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java index 261b8bdf..19949393 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewButton/entity/MdmModuleViewButtonEntity.java @@ -14,14 +14,15 @@ public class MdmModuleViewButtonEntity extends BaseEntity { private String mdmId; /** 视图id */ private String viewId; - /** 类型1、新建2、重置3、查询4、修改 5、删除 6、查看 */ + /** 类型1、新建2、重置3、查询4、修改 5、删除 6、查看 7、下发 */ private String buttonType; /** 按钮值 */ private String buttonValue; /** 公司id */ private String companyId; - + /** 数据类型 1、新增 2、修改 */ + private String dataType; public String getMdmId() { return mdmId; } @@ -62,5 +63,12 @@ public class MdmModuleViewButtonEntity extends BaseEntity { this.companyId = companyId; } + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java index e49e3044..5b5295d9 100644 --- a/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java +++ b/service/src/main/java/com/hzya/frame/mdm/mdmModuleViewDetail/entity/MdmModuleViewDetailEntity.java @@ -16,11 +16,14 @@ public class MdmModuleViewDetailEntity extends BaseEntity { private String viewId; /** 字段 */ private String viewFiled; + /** 字段 */ + private String viewName; /** 类型1、查询2、列表3、新增4、修改 5、查看 */ private String viewType; /** 公司id */ private String companyId; - + /** 数据类型 1、新增 2、修改 */ + private String dataType; public String getMdmId() { return mdmId; @@ -62,5 +65,20 @@ public class MdmModuleViewDetailEntity extends BaseEntity { this.companyId = companyId; } + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public String getViewName() { + return viewName; + } + + public void setViewName(String viewName) { + this.viewName = viewName; + } } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java index 40968767..557009fe 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/IMdmService.java @@ -12,180 +12,35 @@ public interface IMdmService { * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity * @Author lvleigang - * @Description 主数据列表查询接口分页 + * @Description 主数据列表显示 树、查询条件、列表字段、按钮 * @Date 9:40 上午 2023/10/18 **/ - JsonResultEntity queryMdmPage(JSONObject jsonObject); - + JsonResultEntity queryMdmShow(JSONObject jsonObject); + // /** * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity * @Author lvleigang - * @Description 主数据列表查询接口列表 + * @Description 主数据查询所有字段 * @Date 9:40 上午 2023/10/18 **/ - JsonResultEntity queryMdmList(JSONObject jsonObject); - - + JsonResultEntity queryMdmShowAll(JSONObject jsonObject); + /** + * @Author lvleigang + * @Description 查询模版数据(list 或者 分页) + * @Date 1:33 下午 2023/7/12 + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + **/ + JsonResultEntity queryTemplateData(JSONObject jsonObject); /** * @param jsonObject * @return com.hzya.frame.web.entity.JsonResultEntity * @Author lvleigang - * @Description 主数据新增 + * @Description 主数据列表显示 业务数据 * @Date 9:40 上午 2023/10/18 **/ - JsonResultEntity addMdm(JSONObject jsonObject); - - - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息获取 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModule(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息保存 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity doSaveMdmModule(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity queryMdmModuleDb(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源的服务 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleServer(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源字段的服务 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleServerFiled(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询主表字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleServerMainFiled(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存数据源 - * @Date 9:40 上午 2023/10/18 - **/ - JsonResultEntity saveMdmModuleDb(JSONObject jsonObject); - // - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询显示信息 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleView(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置修改显示信息 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity doSaveMdmModuleView(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleRule(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity doSaveMdmModuleRule(JSONObject jsonObject); - // - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmModuleDistribute(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity doSaveMdmModuleDistribute(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 树、查询条件、列表字段、按钮 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShow(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据查询所有字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowAll(JSONObject jsonObject); - ///** - // * @Author lvleigang - // * @Description 查询模版数据(list 或者 分页) - // * @Date 1:33 下午 2023/7/12 - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // **/ - //JsonResultEntity queryTemplateData(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 业务数据 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowData(JSONObject jsonObject); + JsonResultEntity queryMdmShowData(JSONObject jsonObject); // ///** // * @param jsonObject @@ -195,14 +50,14 @@ public interface IMdmService { // * @Date 9:40 上午 2023/10/18 // **/ //JsonResultEntity queryMdmShowDistribute(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据业务数据树结构 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowTreeData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据业务数据树结构 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowTreeData(JSONObject jsonObject); ///** // * @param jsonObject // * @return com.hzya.frame.web.entity.JsonResultEntity @@ -212,57 +67,57 @@ public interface IMdmService { // **/ //JsonResultEntity queryMdmOptionData(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowDetails(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowDetails(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity queryMdmShowDetailsData(JSONObject jsonObject); // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据修改 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity updateMdmShowDetailsData(JSONObject jsonObject); - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据新增 - // * @Date 9:40 上午 2023/10/18 - // **/ - //JsonResultEntity saveMdmShowDetailsData(JSONObject jsonObject); - // - ///** - // * @param jsonObject - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据删除业务数据 - // * @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 updateMdmShowDetailsData(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据新增 + * @Date 9:40 上午 2023/10/18 + **/ + JsonResultEntity saveMdmShowDetailsData(JSONObject jsonObject); + + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据删除业务数据 + * @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); + } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java b/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java index 56dc07d0..ef527337 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/IMdmServiceCache.java @@ -5,8 +5,16 @@ 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.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; +import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity; +import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; +import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import java.util.List; @@ -15,7 +23,6 @@ import java.util.List; */ public interface IMdmServiceCache { - /** * @Author lvleigang * @Description 获取模版主表 @@ -25,13 +32,75 @@ public interface IMdmServiceCache { **/ MdmModuleEntity getMdmModuleEntity(Long mdmCode); + /** + * @Author lvleigang + * @Description 修改模版主表 + * @Date 10:13 上午 2024/6/3 + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ void updateMdmModuleEntity(MdmModuleEntity entity); - List queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity mdmTableCodeRuleEntity); - + /** + * @Author lvleigang + * @Description 删除模版主表 + * @Date 10:13 上午 2024/6/3 + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ + void deleteMdmModuleEntity(MdmModuleEntity entity); + /** + * @Author lvleigang + * @Description 获取模版表数据 + * @Date 10:13 上午 2024/6/3 + * @param queryDb + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ List queryMdmModuleDb(MdmModuleDbEntity queryDb); + /** + * @Author lvleigang + * @Description 修改模版表数据 + * @Date 4:23 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbEntities + * @return void + **/ + void saveOrUpdateMdmModuleDb(String mdmId, List mdmModuleDbEntities); + + + /** + * @Author lvleigang + * @Description 删除模版表数据 + * @Date 4:23 下午 2024/6/11 + * @param mdmId + * @return void + **/ + void deleteMdmModuleDb(String mdmId,String dbID); + /** + * @Author lvleigang + * @Description 获取模版字段表数据 + * @Date 10:13 上午 2024/6/3 + * @param queryDbFiled + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ List queryMdmModuleDbFileds(MdmModuleDbFiledsEntity queryDbFiled); - List queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity queryDbFiledRule); + /** + * @Author lvleigang + * @Description 修改数据源db的字段 + * @Date 4:25 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbFiledsEntities + * @return void + **/ + void saveOrUpdateMdmModuleDbFileds(String mdmId, List mdmModuleDbFiledsEntities); + /** + * @Author lvleigang + * @Description 删除数据源db的字段 + * @Date 4:25 下午 2024/6/11 + * @param mdmId + * @return void + **/ + void deleteMdmModuleDbFileds(String mdmId,String dbID); } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java index dcafef9a..759aaa10 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceCache.java @@ -1,5 +1,6 @@ package com.hzya.frame.mdm.service.impl; +import cn.dev33.satoken.stp.StpUtil; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -12,15 +13,23 @@ import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; 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.mdmModuleSource.dao.IMdmModuleSourceDao; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; +import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.mdm.mdmModuleViewButton.dao.IMdmModuleViewButtonDao; +import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; +import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; import com.hzya.frame.mdm.service.IMdmService; import com.hzya.frame.mdm.service.IMdmServiceCache; import com.hzya.frame.sysnew.integtationTask.entity.IntegrationTaskEntity; +import com.hzya.frame.uuid.UUIDUtils; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; import org.slf4j.Logger; @@ -30,6 +39,8 @@ import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Date; import java.util.List; @@ -52,6 +63,8 @@ public class MdmServiceCache implements IMdmServiceCache { @Resource private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; @Resource + private IMdmModuleSourceDao mdmModuleSourceDao; + @Resource private IMdmModuleViewDao mdmModuleViewDao; @Resource private IMdmModuleViewButtonDao mdmModuleViewButtonDao; @@ -60,44 +73,393 @@ public class MdmServiceCache implements IMdmServiceCache { @Resource private IMdmTableCodeRuleDao mdmTableCodeRuleDao; + /** + * @Author lvleigang + * @Description 缓存主数据 + * @Date 4:03 下午 2024/6/11 + * @param mdmCode + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ @Override @Cacheable(cacheNames="mdmModule",key = "#mdmCode") public MdmModuleEntity getMdmModuleEntity(Long mdmCode) { MdmModuleEntity entity = mdmModuleDao.getByMdmCode(mdmCode); return entity; } - + /** + * @Author lvleigang + * @Description 缓存删除主数据 + * @Date 4:03 下午 2024/6/11 + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ @Override @CacheEvict(cacheNames="mdmModule",key = "#entity.mdmCode") public void updateMdmModuleEntity(MdmModuleEntity entity) { mdmModuleDao.update(entity); } + /** + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + * @Author lvleigang + * @Description 删除模版主表 + * @Date 10:13 上午 2024/6/3 + **/ @Override - @Cacheable(cacheNames="mdmTableCodeRule",key = "#mdmId") - public List queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity entity) { - List mdmTableCodeRuleEntityList = mdmTableCodeRuleDao.queryBase(entity); - return mdmTableCodeRuleEntityList; + @CacheEvict(cacheNames="mdmModule",key = "#entity.mdmCode") + public void deleteMdmModuleEntity(MdmModuleEntity entity) { + entity.setUpdate(); + mdmModuleDao.logicRemoveMultiCondition(entity); } + /** + * @Author lvleigang + * @Description 缓存主数据DB + * @Date 4:03 下午 2024/6/11 + * @param entity + * @return com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity + **/ @Override - @Cacheable(cacheNames="mdmModuleDb",key = "#mdmId") + @Cacheable(cacheNames="mdmModuleDb",key = "#entity.mdmId") public List queryMdmModuleDb(MdmModuleDbEntity entity) { List mdmModuleDbEntities = mdmModuleDbDao.queryBase(entity); return mdmModuleDbEntities; } + /** + * @Author lvleigang + * @Description 修改模版表数据 + * @Date 4:23 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbEntities + * @return void + **/ @Override - @Cacheable(cacheNames="mdmModuleDbFileds",key = "#mdmId") + @CacheEvict(cacheNames="mdmModuleDb",key = "#mdmId") + public void saveOrUpdateMdmModuleDb(String mdmId, List mdmModuleDbEntities) { + if(mdmModuleDbEntities != null && mdmModuleDbEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + if("1".equals(mdmModuleDbEntities.get(i).getDataType())){ + mdmModuleDbDao.save(mdmModuleDbEntities.get(i)); + }else { + mdmModuleDbDao.update(mdmModuleDbEntities.get(i)); + } + } + } + } + + /** + * @param mdmId + * @return void + * @Author lvleigang + * @Description 删除模版表数据 + * @Date 4:23 下午 2024/6/11 + **/ + @Override + @CacheEvict(cacheNames="mdmModuleDb",key = "#mdmId") + public void deleteMdmModuleDb(String mdmId,String dbID) { + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmId); + mdmModuleDbEntity.setId(dbID); + mdmModuleDbEntity.setUpdate(); + mdmModuleDbDao.logicRemoveMultiCondition(mdmModuleDbEntity); + } + + /** + * @Author lvleigang + * @Description 缓存主数据DB的所有字段 + * @Date 4:11 下午 2024/6/11 + * @param entity + * @return java.util.List + **/ + @Override + @Cacheable(cacheNames="mdmModuleDbFileds",key = "#entity.mdmId") public List queryMdmModuleDbFileds(MdmModuleDbFiledsEntity entity) { List mdmModuleDbFiledsEntities = mdmModuleDbFiledsDao.queryBase(entity); return mdmModuleDbFiledsEntities; } + /** + * @Author lvleigang + * @Description 修改数据源db的字段 + * @Date 4:25 下午 2024/6/11 + * @param mdmId + * @param mdmModuleDbFiledsEntities + * @return void + **/ @Override - @Cacheable(cacheNames="mdmModuleDbFiledsRule",key = "#mdmId") - public List queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity entity) { - List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(entity); - return mdmModuleDbFiledsRuleEntities; + @CacheEvict(cacheNames="mdmModuleDbFileds",key = "#mdmId") + public void saveOrUpdateMdmModuleDbFileds(String mdmId, List mdmModuleDbFiledsEntities) { + if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){ + for (int i = 0; i < mdmModuleDbFiledsEntities.size(); i++) { + if("1".equals(mdmModuleDbFiledsEntities.get(i).getDataType())){ + mdmModuleDbFiledsDao.save(mdmModuleDbFiledsEntities.get(i)); + }else if ("2".equals(mdmModuleDbFiledsEntities.get(i).getDataType())) { + mdmModuleDbFiledsDao.update(mdmModuleDbFiledsEntities.get(i)); + }else if ("3".equals(mdmModuleDbFiledsEntities.get(i).getDataType())) { + mdmModuleDbFiledsDao.logicRemoveMultiCondition(mdmModuleDbFiledsEntities.get(i)); + } + } + } } + + /** + * @param mdmId + * @return void + * @Author lvleigang + * @Description 删除数据源db的字段 + * @Date 4:25 下午 2024/6/11 + **/ + @Override + @CacheEvict(cacheNames="mdmModuleDbFileds",key = "#mdmId") + public void deleteMdmModuleDbFileds(String mdmId,String dbID) { + MdmModuleDbFiledsEntity entity = new MdmModuleDbFiledsEntity(); + entity.setMdmId(mdmId); + entity.setDbId(dbID); + entity.setUpdate(); + mdmModuleDbFiledsDao.logicRemoveMultiCondition(entity); + } + + // + ///** + // * @Author lvleigang + // * @Description 缓存主数据DB的所有字段的规则 + // * @Date 4:11 下午 2024/6/11 + // * @param entity + // * @return java.util.List + // **/ + //@Override + //@Cacheable(cacheNames="mdmModuleDbFiledsRule",key = "#entity.mdmId") + //public List queryMdmModuleDbFiledsRule(MdmModuleDbFiledsRuleEntity entity) { + // List mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(entity); + // return mdmModuleDbFiledsRuleEntities; + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleDistribute",key = "#mdmId") + //public List queryMdmModuleDistribute(String mdmId,MdmModuleDistributeEntity mdmModuleDistributeEntity) { + // List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); + // //查询模块下的应用列表 + // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); + // mdmModuleDistributeDetailEntity.setSts("Y"); + // mdmModuleDistributeDetailEntity.setMdmId(mdmId); + // List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); + // if(mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0){ + // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + // List moduleDistributeDetailEntities = new ArrayList<>(); + // if(mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0){ + // for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { + // if(mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())){ + // moduleDistributeDetailEntities.add(mdmModuleDistributeDetailEntities.get(i1)); + // } + // } + // } + // mdmModuleDistributeEntities.get(i).setMdmModuleDistributeDetailEntities(moduleDistributeDetailEntities); + // } + // } + // return mdmModuleDistributeEntities; + //} + // + // + + // + //@Override + //@Cacheable(cacheNames="mdmTableCodeRule",key = "#entity.mdmId") + //public List queryMdmTableCodeRuleEntity(MdmTableCodeRuleEntity entity) { + // List mdmTableCodeRuleEntityList = mdmTableCodeRuleDao.queryBase(entity); + // return mdmTableCodeRuleEntityList; + //} + // + // + // + //@Override + //@CacheEvict(cacheNames="mdmTableCodeRule",key = "#mdmId") + //public void saveMdmTableCodeRule(String mdmId, List mdmTableCodeRuleEntities) { + // MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + // mdmTableCodeRuleEntity.setMdmId(mdmId); + // mdmTableCodeRuleEntity.setSts("Y"); + // mdmTableCodeRuleEntity.setUpdate(); + // mdmTableCodeRuleDao.logicRemoveMultiCondition(mdmTableCodeRuleEntity); + // if(mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0){ + // for (int i = 0; i < mdmTableCodeRuleEntities.size(); i++) { + // mdmTableCodeRuleDao.save(mdmTableCodeRuleEntities.get(i)); + // } + // } + //} + // + + + //@Override + //@CacheEvict(cacheNames="mdmModuleDbFiledsRule",key = "#mdmId") + //public void saveMdmModuleDbFiledsRule(String mdmId, List mdmModuleDbFiledsRuleEntities) { + // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + // mdmModuleDbFiledsRuleEntity.setMdmId(mdmId); + // mdmModuleDbFiledsRuleEntity.setSts("Y"); + // mdmModuleDbFiledsRuleEntity.setUpdate(); + // mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(mdmModuleDbFiledsRuleEntity); + // if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){ + // for (int i = 0; i < mdmModuleDbFiledsRuleEntities.size(); i++) { + // if("1".equals(mdmModuleDbFiledsRuleEntities.get(i).getDataType())){ + // mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntities.get(i)); + // }else { + // mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntities.get(i)); + // } + // } + // } + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleViewDetail",key = "#entity.mdmId") + //public List queryMdmModuleViewDetail(MdmModuleViewDetailEntity entity) { + // List mdmModuleViewDetailEntities = mdmModuleViewDetailDao.queryBase(entity); + // return mdmModuleViewDetailEntities; + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleView",key = "#entity.mdmId") + //public List queryMdmModuleView(MdmModuleViewEntity entity) { + // List moduleViewEntities = mdmModuleViewDao.queryBase(entity); + // return moduleViewEntities; + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleViewButton",key = "#entity.mdmId") + //public List queryMdmModuleViewButton(MdmModuleViewButtonEntity entity) { + // List mdmModuleViewButtonEntities = mdmModuleViewButtonDao.queryBase(entity); + // return mdmModuleViewButtonEntities; + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleView",key = "#mdmId") + //public void saveMdmModuleView(String mdmId, MdmModuleViewEntity mdmModuleViewEntity) { + // mdmModuleViewDao.update(mdmModuleViewEntity); + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleViewDetail",key = "#mdmId") + //public void saveMdmModuleViewDetail(String mdmId, List mdmModuleViewDetailEntities) { + // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + // mdmModuleViewDetailEntity.setMdmId(mdmId); + // mdmModuleViewDetailEntity.setUpdate(); + // mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); + // if(mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0){ + // for (int i = 0; i < mdmModuleViewDetailEntities.size(); i++) { + // if("1".equals(mdmModuleViewDetailEntities.get(i).getDataType())){ + // mdmModuleViewDetailDao.save(mdmModuleViewDetailEntities.get(i)); + // }else { + // mdmModuleViewDetailDao.update(mdmModuleViewDetailEntities.get(i)); + // } + // } + // } + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleViewButton",key = "#mdmId") + //public void saveMdmModuleViewButton(String mdmId, List mdmModuleViewButtonEntities) { + // MdmModuleViewButtonEntity mdmModuleViewButtonEntity = new MdmModuleViewButtonEntity(); + // mdmModuleViewButtonEntity.setMdmId(mdmId); + // mdmModuleViewButtonEntity.setUpdate(); + // mdmModuleViewButtonDao.logicRemoveMultiCondition(mdmModuleViewButtonEntity); + // if(mdmModuleViewButtonEntities != null && mdmModuleViewButtonEntities.size() > 0){ + // for (int i = 0; i < mdmModuleViewButtonEntities.size(); i++) { + // if("1".equals(mdmModuleViewButtonEntities.get(i).getDataType())){ + // mdmModuleViewButtonDao.save(mdmModuleViewButtonEntities.get(i)); + // }else { + // mdmModuleViewButtonDao.update(mdmModuleViewButtonEntities.get(i)); + // } + // } + // } + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleDistributeDetail",key = "#entity.mdmId") + //public List queryMdmModuleDistributeDetail(MdmModuleDistributeDetailEntity entity){ + // List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(entity); + // return mdmModuleDistributeDetailEntities; + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleDistribute",key = "#mdmId") + //public void saveMdmModuleDistribute(String mdmId, List mdmModuleDistributeEntities) { + // //先删除 + // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); + // mdmModuleDistributeEntity.setMdmId(mdmId); + // mdmModuleDistributeEntity.setUpdate(); + // mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); + // //保存主数据 + // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { + // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { + // MdmModuleDistributeEntity moduleDistributeEntity = mdmModuleDistributeEntities.get(i); + // moduleDistributeEntity.setMdmId(mdmId); + // if (moduleDistributeEntity.getId() != null && !"".equals(moduleDistributeEntity.getId())) { + // moduleDistributeEntity.setUpdate(); + // //修改 + // mdmModuleDistributeDao.update(moduleDistributeEntity); + // } else { + // //新增 + // moduleDistributeEntity.setCreate(); + // mdmModuleDistributeDao.save(moduleDistributeEntity); + // } + // if(moduleDistributeEntity.getMdmModuleDistributeDetailEntities() != null && moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size() > 0){ + // for (int i1 = 0; i1 < moduleDistributeEntity.getMdmModuleDistributeDetailEntities().size(); i1++) { + // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = moduleDistributeEntity.getMdmModuleDistributeDetailEntities().get(i1); + // mdmModuleDistributeDetailEntity.setMdmId(mdmId); + // mdmModuleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); + // if (mdmModuleDistributeDetailEntity.getId() != null && !"".equals(mdmModuleDistributeDetailEntity.getId())) { + // mdmModuleDistributeDetailEntity.setUpdate(); + // //修改 + // mdmModuleDistributeDetailDao.update(mdmModuleDistributeDetailEntity); + // } else { + // //新增 + // mdmModuleDistributeDetailEntity.setCreate(); + // mdmModuleDistributeDetailDao.save(mdmModuleDistributeDetailEntity); + // } + // } + // } + // } + // } + //} + // + //@Override + //@Cacheable(cacheNames="mdmModuleSource",key = "#entity.mdmId") + //public List queryMdmModuleSource(MdmModuleSourceEntity entity) { + // List mdmModuleSourceEntities = mdmModuleSourceDao.queryBase(entity); + // return mdmModuleSourceEntities; + //} + // + //@Override + //@CacheEvict(cacheNames="mdmModuleSource",key = "#mdmId") + //public void saveMdmModuleSource(String mdmId, List mdmModuleSourceEntities) { + // //先删除 + // MdmModuleSourceEntity mdmModuleSourceEntity = new MdmModuleSourceEntity(); + // mdmModuleSourceEntity.setMdmId(mdmId); + // mdmModuleSourceEntity.setUpdate(); + // mdmModuleSourceDao.logicRemoveMultiCondition(mdmModuleSourceEntity); + // //保存主数据 + // if (mdmModuleSourceEntities != null && mdmModuleSourceEntities.size() > 0) { + // for (int i = 0; i < mdmModuleSourceEntities.size(); i++) { + // MdmModuleSourceEntity mdmModuleSourceEntity1 = mdmModuleSourceEntities.get(i); + // mdmModuleSourceEntity1.setMdmId(mdmId); + // if (mdmModuleSourceEntity1.getId() != null && !"".equals(mdmModuleSourceEntity1.getId())) { + // mdmModuleSourceEntity1.setUpdate(); + // //修改 + // mdmModuleSourceDao.update(mdmModuleSourceEntity1); + // } else { + // //新增 + // mdmModuleSourceEntity1.setCreate(); + // mdmModuleSourceDao.save(mdmModuleSourceEntity1); + // } + // } + // } + //} + + + + + + + + + } diff --git a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java index 99506fb6..05fd7920 100644 --- a/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/mdm/service/impl/MdmServiceImpl.java @@ -1,13 +1,26 @@ 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; +import com.hzya.frame.mdm.entity.MdmDbFiledVo; import com.hzya.frame.mdm.entity.MdmDbVo; +import com.hzya.frame.mdm.entity.MdmDetailViewVo; +import com.hzya.frame.mdm.entity.MdmDistributeDto; import com.hzya.frame.mdm.entity.MdmDto; +import com.hzya.frame.mdm.entity.MdmModuleViewDto; +import com.hzya.frame.mdm.entity.MdmModuleViewVo; +import com.hzya.frame.mdm.entity.MdmQuery; +import com.hzya.frame.mdm.entity.MdmSourceDto; +import com.hzya.frame.mdm.entity.MdmViewFiledVo; +import com.hzya.frame.mdm.entity.MdmViewVo; import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao; import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity; import com.hzya.frame.mdm.mdmModuleDb.dao.IMdmModuleDbDao; @@ -20,39 +33,69 @@ 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; +import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; import com.hzya.frame.mdm.mdmModuleView.dao.IMdmModuleViewDao; import com.hzya.frame.mdm.mdmModuleView.entity.MdmModuleViewEntity; import com.hzya.frame.mdm.mdmModuleViewButton.dao.IMdmModuleViewButtonDao; +import com.hzya.frame.mdm.mdmModuleViewButton.entity.MdmModuleViewButtonEntity; import com.hzya.frame.mdm.mdmModuleViewDetail.dao.IMdmModuleViewDetailDao; import com.hzya.frame.mdm.mdmModuleViewDetail.entity.MdmModuleViewDetailEntity; +import com.hzya.frame.mdm.mdmTableCodeRule.dao.IMdmTableCodeRuleDao; import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity; 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.sys.entity.ModuleDto; -import com.hzya.frame.sys.module.entity.Module; -import com.hzya.frame.sys.roleModule.entity.RoleModule; +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; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; /** @@ -62,17 +105,40 @@ import java.util.stream.Collectors; 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 + private IMdmModuleOptionLogDao mdmModuleOptionLogDao; @Resource private IMdmServiceCache mdmServiceCache; @Resource + private ISysMenuConfigDao sysMenuConfigDao; + @Resource + private ISysButtonConfigDao sysButtonConfigDao; + @Resource + private ISysPopedomOperateDao sysPopedomOperateDao; + @Resource private IMdmModuleDbDao mdmModuleDbDao; @Resource + private ISysUserDao sysUserDao; + @Resource private IMdmModuleDbFiledsDao mdmModuleDbFiledsDao; @Resource private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao; @Resource + private IMdmTableCodeRuleDao mdmTableCodeRuleDao; + @Resource private IMdmModuleDistributeDao mdmModuleDistributeDao; @Resource private IMdmModuleDistributeDetailDao mdmModuleDistributeDetailDao; @@ -82,242 +148,20 @@ public class MdmServiceImpl implements IMdmService { private IMdmModuleViewButtonDao mdmModuleViewButtonDao; @Resource private IMdmModuleViewDetailDao mdmModuleViewDetailDao; + //多线程请求加锁 HttpRequest 构造方法是静态的 + private final Object lock = new Object(); + @Value("${zt.url}") + private String url; /** * @param object * @return com.hzya.frame.web.entity.JsonResultEntity * @Author lvleigang - * @Description 主数据列表查询接口分页 + * @Description 主数据列表显示 树、查询条件、列表字段、按钮 * @Date 9:40 上午 2023/10/18 **/ @Override - public JsonResultEntity queryMdmPage(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List mdmVos = mdmModuleDao.queryMdm(entity); - PageInfo pageInfo = new PageInfo(mdmVos); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据列表查询接口列表 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmList(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - List mdmVos = mdmModuleDao.queryMdm(entity); - return BaseResult.getSuccessMessageEntity("查询数据成功", mdmVos); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据新增 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity addMdm(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmName() == null || "".equals(entity.getMdmName())) { - return BaseResult.getFailureMessageEntity("请先输入主数据名称"); - } - if (entity.getMdmType() == null || "".equals(entity.getMdmType())) { - return BaseResult.getFailureMessageEntity("请先选择主数据类型"); - } - //新增 - entity.setCreate(); - mdmModuleDao.save(entity); - return BaseResult.getSuccessMessageEntity("保存数据成功", entity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息获取 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModule(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - //使用缓存 - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleEntity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据基本信息保存 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity doSaveMdmModule(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getMdmName() == null || "".equals(entity.getMdmName())) { - return BaseResult.getFailureMessageEntity("请先输入主数据名称"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - //修改 - entity.setUpdate(); - mdmServiceCache.updateMdmModuleEntity(entity); - return BaseResult.getSuccessMessageEntity("修改主数据成功", entity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置查询数据源 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity queryMdmModuleDb(JSONObject object) { - MdmModuleEntity entity = getData("jsonStr", object, MdmModuleEntity.class); - //判断分页 - if (entity == null) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - MdmDbVo mdmDbVo = new MdmDbVo(); - //获取主数据 - MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - //查询设置的规则表 - MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); - mdmTableCodeRuleEntity.setSts("Y"); - mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); - List mdmTableCodeRuleEntityList = mdmServiceCache.queryMdmTableCodeRuleEntity(mdmTableCodeRuleEntity); - mdmDbVo.setMdmTableCodeRuleEntityList(mdmTableCodeRuleEntityList); - //查询数据源表 - MdmModuleDbEntity queryDb = new MdmModuleDbEntity(); - queryDb.setMdmId(mdmModuleEntity.getId()); - queryDb.setSts("Y"); - List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(queryDb); - //数据源字段 - MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity(); - queryDbFiled.setMdmId(mdmModuleEntity.getId()); - queryDbFiled.setSts("Y"); - List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(queryDbFiled); - //数据源字段规则 - MdmModuleDbFiledsRuleEntity queryDbFiledRule = new MdmModuleDbFiledsRuleEntity(); - queryDbFiledRule.setMdmId(mdmModuleEntity.getId()); - queryDbFiledRule.setSts("Y"); - List mdmModuleDbFiledsRuleEntityList = mdmServiceCache.queryMdmModuleDbFiledsRule(queryDbFiledRule); - //组装数据 - setMdmDb(mdmDbVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList); - return BaseResult.getSuccessMessageEntity("查询数据成功", mdmDbVo); - } - /** - * @param mdmDbVo 返回对象 - * @param mdmModuleDbEntityList 数据表 - * @param mdmModuleDbFiledsEntityList 字段 - * @param mdmModuleDbFiledsRuleEntityList 字段属性 - * @return void - * @Author lvleigang - * @Description 组装返回数据 - * @Date 4:51 下午 2023/10/18 - **/ - private void setMdmDb(MdmDbVo mdmDbVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList) { - //主数据主表 - MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); - //主数据子表 - List sublistMdmModuleDb = new ArrayList<>(); - //主数据主表字段 - List mainMdmModuleDbFileds = new ArrayList<>(); - - - if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - //1、主表 2、明细 - mainMdmModuleDb = mdmModuleDbEntityList.get(i); - //循环字段表 - if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - List mdmModuleDbFiledsRules = new ArrayList<>(); - //循环字段属性 - if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - } - } - } - mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - } - } - } - } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { - //2、明细 - sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); - //循环字段表 - if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - List sublistMdmModuleDbFileds = new ArrayList<>(); - for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - List mdmModuleDbFiledsRules = new ArrayList<>(); - //循环字段属性 - if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - } - } - } - mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - } - } - mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); - } - } - } - } - mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); - mdmDbVo.setMainMdmModuleDb(mainMdmModuleDb); - mdmDbVo.setSublistMdmModuleDb(sublistMdmModuleDb); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 主数据设置保存数据源 - * @Date 9:40 上午 2023/10/18 - **/ - @Override - public JsonResultEntity saveMdmModuleDb(JSONObject object) { - //判断新增还是修改,保存数据生成表结构 + public JsonResultEntity queryMdmShow(JSONObject object) { MdmDto entity = getData("jsonStr", object, MdmDto.class); if (entity == null) { return BaseResult.getFailureMessageEntity("参数不允许为空"); @@ -325,1350 +169,266 @@ public class MdmServiceImpl implements IMdmService { if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { return BaseResult.getFailureMessageEntity("系统错误"); } - //单据规则校验 - if(entity.getMdmTableCodeRuleEntityList() == null || entity.getMdmTableCodeRuleEntityList().size() == 0){ - return BaseResult.getFailureMessageEntity("请先设置单据规则"); - } - //主表校验 - if (entity.getMainMdmModuleDb() == null || entity.getMainMdmModuleDb().getDbName() == null || "".equals(entity.getMainMdmModuleDb().getDbName())) { - return BaseResult.getFailureMessageEntity("请先输入主表名称"); - } + //查询模版 MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); - //主数据主表 - MdmModuleDbEntity mainMdmModuleDb = entity.getMainMdmModuleDb(); - //主数据主表字段 - List mainMdmModuleDbFileds = mainMdmModuleDb.getSublistMdmModuleDbFileds(); - //主数据子表 - List sublistMdmModuleDb = entity.getSublistMdmModuleDb(); - //单据规则 - List mdmTableCodeRuleEntities = entity.getMdmTableCodeRuleEntityList(); - // 需要校验表是否存在 - if (checkTable(mainMdmModuleDb.getDbName())) { - return BaseResult.getFailureMessageEntity("主表表名已经存在"); - } - if(mainMdmModuleDbFileds == null || mainMdmModuleDbFileds.size() == 0){ - return BaseResult.getFailureMessageEntity("请先设置主表字段"); - } - //判断明细表 - if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { - for (int i = 0; i < sublistMdmModuleDb.size(); i++) { - // 需要校验表是否存在 - if (checkTable(sublistMdmModuleDb.get(i).getDbName())) { - return BaseResult.getFailureMessageEntity("子表" + sublistMdmModuleDb.get(i).getDbName() + "已经存在"); - } - if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() == null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() == 0) { - return BaseResult.getFailureMessageEntity("请先设置子表" + sublistMdmModuleDb.get(i).getDbName() + "的字段"); - } - - } - } - //处理数据 - //分别设置成 数据源 数据源字段 数据源规则表 设置是否新增修改 没有id新增,有ID修改 - List mdmModuleDbEntities = new ArrayList<>(); - List mdmModuleDbFiledsEntities = new ArrayList<>(); - List mdmModuleDbFiledsRuleEntities = new ArrayList<>(); - - - //保存主数据单据编号规则 - if (mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0) { - for (int i = 0; i < mdmTableCodeRuleEntities.size(); i++) { - MdmTableCodeRuleEntity mdmTableCodeRuleEntity = mdmTableCodeRuleEntities.get(i); - mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); - mdmTableCodeRuleEntity.setDbId(mainMdmModuleDb.getId()); - mdmTableCodeRuleEntity.setId(UUIDUtils.getUUID()); - mdmTableCodeRuleEntity.setSts("Y"); - mdmTableCodeRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - mdmTableCodeRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - mdmTableCodeRuleEntity.setCreate_time(new Date()); - mdmTableCodeRuleEntity.setModify_time(new Date()); - //mdmTableCodeRuleDao.save(mdmTableCodeRuleEntity); - } - } - //主表 - if(mainMdmModuleDb.getId() != null && !"".equals(mainMdmModuleDb.getId())){ - + if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("系统错误"); } + //设置模版 + MdmViewVo mdmViewVo = new MdmViewVo(); + mdmViewVo.setMdmModuleEntity(mdmModuleEntity); + //查询展示类型 + MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewEntity.setSts("Y"); + List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); + if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleViewEntity = moduleViewEntityList.get(0); + mdmViewVo.setMdmModuleViewEntity(mdmModuleViewEntity); - //明细表 + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表下面的字段 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询字段下的规则 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); + if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } - - - ////设置保存主表和字段以及字段的属性 - //setMainTable(entity, mainMdmModuleDb, mainMdmModuleDbFileds); - ////设置保存子表数据 - //setsublistTable(entity, mainMdmModuleDb, sublistMdmModuleDb); - ////保存规则 - //List mdmTableCodeRuleEntityList = entity.getMdmTableCodeRuleEntityList(); - //MdmTableCodeRuleEntity deleteOldData = new MdmTableCodeRuleEntity(); - //deleteOldData.setDbId(mainMdmModuleDb.getId()); - //deleteOldData.setMdmId(entity.getId()); - //deleteOldData.setSts("Y"); - //deleteOldData.setModify_user_id(StpUtil.getLoginIdAsString()); - //deleteOldData.setModify_time(new Date()); - //mdmTableCodeRuleDao.logicRemoveMultiCondition(deleteOldData); - - return BaseResult.getSuccessMessageEntity("保存数据源成功"); + //查询设置的查询字段 + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + List mdmModuleViewDetailEntities = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + if (mdmModuleViewDetailEntities == null || mdmModuleViewDetailEntities.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + List queryList = getFiledByType("1", mdmModuleViewDetailEntities, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList); + mdmViewVo.setQueryList(queryList); + List listList = getFiledByType("2", mdmModuleViewDetailEntities, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList); + mdmViewVo.setListList(listList); + return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); } - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源的服务 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleServer(JSONObject object) { - // MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - // //判断分页 - // if (entity == null) { - // entity = new MdmModuleDbEntity(); - // } - // //查询数据源表 - // entity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryByLike(entity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", mdmModuleDbEntityList); - //} - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询数据源的服务的字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleServerFiled(JSONObject object) { - // MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - // //判断分页 - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getDbName() == null || "".equals(entity.getDbName())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表 - // entity.setSts("Y"); - // List dblist = mdmModuleDbDao.queryBase(entity); - // if (dblist != null && dblist.size() == 1) { - // MdmModuleDbFiledsEntity queryDbFiled = new MdmModuleDbFiledsEntity(); - // queryDbFiled.setSts("Y"); - // queryDbFiled.setDbId(dblist.get(0).getId()); - // List list = mdmModuleDbFiledsDao.queryBase(queryDbFiled); - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setChName("id"); - // mdmModuleDbFiledsEntity.setEnName("id"); - // list.add(0, mdmModuleDbFiledsEntity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", list); - // } else { - // return BaseResult.getFailureMessageEntity("服务不存在"); - // } - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询主表字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleServerMainFiled(JSONObject object) { - // MdmModuleDbEntity entity = getData("jsonStr", object, MdmModuleDbEntity.class); - // //判断分页 - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmId() == null || "".equals(entity.getMdmId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表 - // entity.setSts("Y"); - // entity.setDbType("1"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(entity); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 1) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntityList.get(0).getId()); - // List list = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", list); - // } else if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("请先配置数据源"); - // } else { - // return BaseResult.getFailureMessageEntity("查询数据失败"); - // } - //} - - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存数据源 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity saveMdmModuleDb(JSONObject object) { - // //判断新增还是修改,保存数据生成表结构 - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getMainMdmModuleDb() == null || entity.getMainMdmModuleDb().getDbName() == null || "".equals(entity.getMainMdmModuleDb().getDbName())) { - // return BaseResult.getFailureMessageEntity("请先输入主表名称"); - // } - // //主数据主表 - // MdmModuleDbEntity mainMdmModuleDb = entity.getMainMdmModuleDb(); - // //主数据主表字段 - // List mainMdmModuleDbFileds = mainMdmModuleDb.getSublistMdmModuleDbFileds(); - // //主数据子表 - // List sublistMdmModuleDb = entity.getSublistMdmModuleDb(); - // //判断主表新增还是修改 - // if (mainMdmModuleDb.getId() == null || "".equals(mainMdmModuleDb.getId())) { - // //新增 需要校验表是否存在 - // if (checkTable(mainMdmModuleDb.getDbName())) { - // return BaseResult.getFailureMessageEntity("主表表名已经存在"); - // } - // } - // //判断明细表 - // if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { - // for (int i = 0; i < sublistMdmModuleDb.size(); i++) { - // if (sublistMdmModuleDb.get(i).getId() == null || "".equals(sublistMdmModuleDb.get(i).getId())) { - // if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() == null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() == 0) { - // return BaseResult.getFailureMessageEntity("请先设置子表" + sublistMdmModuleDb.get(i).getDbName() + "的字段"); - // } - // //新增 需要校验表是否存在 - // if (checkTable(sublistMdmModuleDb.get(i).getDbName())) { - // return BaseResult.getFailureMessageEntity("子表" + sublistMdmModuleDb.get(i).getDbName() + "已经存在"); - // } - // } - // } - // } - // //设置保存主表和字段以及字段的属性 - // setMainTable(entity, mainMdmModuleDb, mainMdmModuleDbFileds); - // //设置保存子表数据 - // setsublistTable(entity, mainMdmModuleDb, sublistMdmModuleDb); - // //保存规则 - // List mdmTableCodeRuleEntityList = entity.getMdmTableCodeRuleEntityList(); - // MdmTableCodeRuleEntity deleteOldData = new MdmTableCodeRuleEntity(); - // deleteOldData.setDbId(mainMdmModuleDb.getId()); - // deleteOldData.setMdmId(entity.getId()); - // deleteOldData.setSts("Y"); - // deleteOldData.setModify_user_id(StpUtil.getLoginIdAsString()); - // deleteOldData.setModify_time(new Date()); - // mdmTableCodeRuleDao.logicRemoveMultiCondition(deleteOldData); - // if (mdmTableCodeRuleEntityList != null && mdmTableCodeRuleEntityList.size() > 0) { - // for (int i = 0; i < mdmTableCodeRuleEntityList.size(); i++) { - // MdmTableCodeRuleEntity mdmTableCodeRuleEntity = mdmTableCodeRuleEntityList.get(i); - // mdmTableCodeRuleEntity.setMdmId(entity.getId()); - // mdmTableCodeRuleEntity.setDbId(mainMdmModuleDb.getId()); - // mdmTableCodeRuleEntity.setId(UUIDUtils.getUUID()); - // mdmTableCodeRuleEntity.setSts("Y"); - // mdmTableCodeRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmTableCodeRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmTableCodeRuleEntity.setCreate_time(new Date()); - // mdmTableCodeRuleEntity.setModify_time(new Date()); - // mdmTableCodeRuleDao.save(mdmTableCodeRuleEntity); - // } - // } - // return BaseResult.getSuccessMessageEntity("保存数据源成功"); - //} - // - ///** - // * @param entity - // * @param mainMdmModuleDb - // * @param sublistMdmModuleDb - // * @return void - // * @Author lvleigang - // * @Description 设置保存子表数据 - // * @Date 11:08 上午 2023/10/19 - // **/ - //private void setsublistTable(MdmDto entity, MdmModuleDbEntity mainMdmModuleDb, List sublistMdmModuleDb) { - // //存在明细表 - // if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { - // for (int i = 0; i < sublistMdmModuleDb.size(); i++) { - // MdmModuleDbEntity mdmModuleDbEntity = sublistMdmModuleDb.get(i); - // mdmModuleDbEntity.setMdmId(entity.getId()); - // mdmModuleDbEntity.setDbType("2"); - // boolean flag = false; - // - // //新增还是修改 - // if (mdmModuleDbEntity.getId() != null && !"".equals(mdmModuleDbEntity.getId())) { - // mdmModuleDbEntity.setSts("Y"); - // mdmModuleDbEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbEntity.setModify_time(new Date()); - // mdmModuleDbDao.update(mdmModuleDbEntity); - // } else { - // flag = true; - // mdmModuleDbEntity.setId(UUIDUtils.getUUID()); - // mdmModuleDbEntity.setSts("Y"); - // mdmModuleDbEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbEntity.setCreate_time(new Date()); - // mdmModuleDbEntity.setModify_time(new Date()); - // mdmModuleDbDao.save(mdmModuleDbEntity); - // } - // List dbFiledsDtos = new ArrayList<>(); - // - // //字段 - // List sublistMdmModuleDbFileds = mdmModuleDbEntity.getSublistMdmModuleDbFileds(); - // if (sublistMdmModuleDbFileds != null && sublistMdmModuleDbFileds.size() > 0) { - // for (int i1 = 0; i1 < sublistMdmModuleDbFileds.size(); i1++) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = sublistMdmModuleDbFileds.get(i1); - // mdmModuleDbFiledsEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsEntity.setDbId(mdmModuleDbEntity.getId()); - // if (mdmModuleDbFiledsEntity.getId() != null && !"".equals(mdmModuleDbFiledsEntity.getId())) { - // DbFiledsDto dbFiledsDto = new DbFiledsDto("1", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); - // dbFiledsDtos.add(dbFiledsDto); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setModify_time(new Date()); - // mdmModuleDbFiledsDao.update(mdmModuleDbFiledsEntity); - // } else { - // DbFiledsDto dbFiledsDto = new DbFiledsDto("2", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); - // dbFiledsDtos.add(dbFiledsDto); - // mdmModuleDbFiledsEntity.setId(UUIDUtils.getUUID()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setCreate_time(new Date()); - // mdmModuleDbFiledsEntity.setModify_time(new Date()); - // mdmModuleDbFiledsDao.save(mdmModuleDbFiledsEntity); - // } - // //修改或保存属性 - // List mdmModuleDbFiledsRules = mdmModuleDbFiledsEntity.getMdmModuleDbFiledsRules(); - // if (mdmModuleDbFiledsRules != null && mdmModuleDbFiledsRules.size() > 0) { - // for (int a = 0; a < mdmModuleDbFiledsRules.size(); a++) { - // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = mdmModuleDbFiledsRules.get(a); - // mdmModuleDbFiledsRuleEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsRuleEntity.setDbId(mdmModuleDbEntity.getId()); - // mdmModuleDbFiledsRuleEntity.setFiledId(mdmModuleDbFiledsEntity.getId()); - // if (mdmModuleDbFiledsRuleEntity.getId() != null && !"".equals(mdmModuleDbFiledsRuleEntity.getId())) { - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntity); - // } else { - // mdmModuleDbFiledsRuleEntity.setId(UUIDUtils.getUUID()); - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // mdmModuleDbFiledsRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setCreate_time(new Date()); - // mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntity); - // } - // } - // } - // } - // } - // - // if (flag) { - // //新增 - // Map maps = new HashMap<>(); - // maps.put("dbType", "2");//表类型 - // maps.put("tableName", mdmModuleDbEntity.getDbName());//表名 - // maps.put("tableRemark", mdmModuleDbEntity.getRemark());//表备注 - // maps.put("databaseFields", dbFiledsDtos);//字段 - // DbFiledsDto dbFiledsDto = new DbFiledsDto("1", "上级id", "formmain_id", "3", "50"); - // dbFiledsDtos.add(dbFiledsDto); - // mdmModuleDao.createTable(maps); - // } else { - // //修改 - // Map tablename = new HashMap<>(); - // tablename.put("tableName", mdmModuleDbEntity.getDbName());//表名 - // tablename.put("tableRemark", mdmModuleDbEntity.getRemark());//表备注 - // mdmModuleDao.alterTableName(tablename); - // Map maps = new HashMap<>(); - // maps.put("tableName", mdmModuleDbEntity.getDbName());//表名 - // maps.put("tableRemark", mdmModuleDbEntity.getRemark());//表备注 - // maps.put("databaseFields", dbFiledsDtos);//字段 - // mdmModuleDao.alterTable(maps); - // } - // } - // } - //} - // - ///** - // * @param entity - // * @param mainMdmModuleDb - // * @param mainMdmModuleDbFileds - // * @return void - // * @Author lvleigang - // * @Description 设置保存主表和字段以及字段的属性 - // * @Date 10:34 上午 2023/10/19 - // **/ - //private void setMainTable(MdmDto entity, MdmModuleDbEntity mainMdmModuleDb, List mainMdmModuleDbFileds) { - // //先保存或修改主表数据 - // mainMdmModuleDb.setMdmId(entity.getId()); - // mainMdmModuleDb.setDbType("1"); - // boolean flag = false; - // - // if (mainMdmModuleDb.getId() != null && !"".equals(mainMdmModuleDb.getId())) { - // mainMdmModuleDb.setSts("Y"); - // mainMdmModuleDb.setModify_user_id(StpUtil.getLoginIdAsString()); - // mainMdmModuleDb.setModify_time(new Date()); - // mdmModuleDbDao.update(mainMdmModuleDb); - // //删除规则表 - // MdmModuleDbFiledsRuleEntity delectFiledsRule = new MdmModuleDbFiledsRuleEntity(); - // delectFiledsRule.setMdmId(entity.getId()); - // delectFiledsRule.setModify_user_id(StpUtil.getLoginIdAsString()); - // delectFiledsRule.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.logicRemoveMultiCondition(delectFiledsRule); - // } else { - // flag = true; - // mainMdmModuleDb.setId(UUIDUtils.getUUID()); - // mainMdmModuleDb.setSts("Y"); - // mainMdmModuleDb.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mainMdmModuleDb.setModify_user_id(StpUtil.getLoginIdAsString()); - // mainMdmModuleDb.setCreate_time(new Date()); - // mainMdmModuleDb.setModify_time(new Date()); - // mdmModuleDbDao.save(mainMdmModuleDb); - // } - // List dbFiledsDtos = new ArrayList<>(); - // - // //保存主表字段 因为字段不允许删除,所以不用先删除再新增 - // if (mainMdmModuleDbFileds != null && mainMdmModuleDbFileds.size() > 0) { - // for (int i = 0; i < mainMdmModuleDbFileds.size(); i++) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = mainMdmModuleDbFileds.get(i); - // mdmModuleDbFiledsEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsEntity.setDbId(mainMdmModuleDb.getId()); - // if (mdmModuleDbFiledsEntity.getId() != null && !"".equals(mdmModuleDbFiledsEntity.getId())) { - // DbFiledsDto dbFiledsDto = new DbFiledsDto("1", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); - // dbFiledsDtos.add(dbFiledsDto); - // - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setModify_time(new Date()); - // mdmModuleDbFiledsDao.update(mdmModuleDbFiledsEntity); - // } else { - // DbFiledsDto dbFiledsDto = new DbFiledsDto("2", mdmModuleDbFiledsEntity.getChName(), mdmModuleDbFiledsEntity.getEnName(), mdmModuleDbFiledsEntity.getFiledType(), mdmModuleDbFiledsEntity.getFiledLength()); - // dbFiledsDtos.add(dbFiledsDto); - // mdmModuleDbFiledsEntity.setId(UUIDUtils.getUUID()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsEntity.setCreate_time(new Date()); - // mdmModuleDbFiledsEntity.setModify_time(new Date()); - // mdmModuleDbFiledsDao.save(mdmModuleDbFiledsEntity); - // } - // //修改或保存属性 - // List mdmModuleDbFiledsRules = mdmModuleDbFiledsEntity.getMdmModuleDbFiledsRules(); - // if (mdmModuleDbFiledsRules != null && mdmModuleDbFiledsRules.size() > 0) { - // for (int a = 0; a < mdmModuleDbFiledsRules.size(); a++) { - // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = mdmModuleDbFiledsRules.get(a); - // mdmModuleDbFiledsRuleEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsRuleEntity.setDbId(mainMdmModuleDb.getId()); - // mdmModuleDbFiledsRuleEntity.setFiledId(mdmModuleDbFiledsEntity.getId()); - // if (mdmModuleDbFiledsRuleEntity.getId() != null && !"".equals(mdmModuleDbFiledsRuleEntity.getId())) { - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.update(mdmModuleDbFiledsRuleEntity); - // } else { - // mdmModuleDbFiledsRuleEntity.setId(UUIDUtils.getUUID()); - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // mdmModuleDbFiledsRuleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDbFiledsRuleEntity.setCreate_time(new Date()); - // mdmModuleDbFiledsRuleEntity.setModify_time(new Date()); - // mdmModuleDbFiledsRuleDao.save(mdmModuleDbFiledsRuleEntity); - // } - // } - // } - // } - // } - // if (flag) { - // //新增 - // Map maps = new HashMap<>(); - // maps.put("dbType", "1");//表类型 - // maps.put("tableName", mainMdmModuleDb.getDbName());//表名 - // maps.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 - // maps.put("databaseFields", dbFiledsDtos);//字段 - // mdmModuleDao.createTable(maps); - // Map mapsDistribute = new HashMap<>(); - // mapsDistribute.put("tableName", mainMdmModuleDb.getDbName() + "_distribute");//表名 - // List distribute = getDistribute(); - // maps.put("databaseFields", distribute);//字段 - // mapsDistribute.put("tableRemark", mainMdmModuleDb.getRemark() + "分发表");//表备注 - // mdmModuleDao.createTableDistribute(mapsDistribute); - // } else { - // //修改 - // Map tablename = new HashMap<>(); - // tablename.put("tableName", mainMdmModuleDb.getDbName());//表名 - // tablename.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 - // mdmModuleDao.alterTableName(tablename); - // Map maps = new HashMap<>(); - // maps.put("tableName", mainMdmModuleDb.getDbName());//表名 - // maps.put("tableRemark", mainMdmModuleDb.getRemark());//表备注 - // maps.put("databaseFields", dbFiledsDtos);//字段 - // mdmModuleDao.alterTable(maps); - // } - //} - // - ///** - // * @param - // * @return java.util.List - // * @Author lvleigang - // * @Description 设置分发表字段 - // * @Date 8:49 上午 2023/11/9 - // **/ - //private List getDistribute() { - // List dbFiledsDtos = new ArrayList<>(); - // dbFiledsDtos.add(new DbFiledsDto("1", "数据id", "formmain_id", "3", "50")); - // dbFiledsDtos.add(new DbFiledsDto("1", "应用id", "app_id", "3", "50")); - // dbFiledsDtos.add(new DbFiledsDto("1", "状态1、发送成功 2、发送中 3、发送失败", "status", "3", "50")); - // dbFiledsDtos.add(new DbFiledsDto("1", "描述", "msg", "3", "50")); - // return dbFiledsDtos; - //} - // /** - * @param tableName - * @return java.lang.Long + * @param viewType 类型 + * @param mdmModuleViewDetailEntities 显示设置的字段 + * @param mdmModuleDbEntityList 表 + * @param mdmModuleDbFiledsEntityList 表字段 + * @param mdmModuleDbFiledsRuleEntityList 字段规则 + * @return java.util.List * @Author lvleigang - * @Description 校验表是否存在 - * @Date 3:58 下午 2023/7/11 + * @Description 根据类型获取字段 + * @Date 9:18 上午 2024/6/6 **/ - private boolean checkTable(String tableName) { - Map maps = new HashMap<>(); - maps.put("tableName", tableName); - Integer i = mdmModuleDao.checkTable(maps); - if (i != null && i > 0) { - return true; + private List getFiledByType(String viewType, List mdmModuleViewDetailEntities, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList) { + List mdmViewFiledVos = new ArrayList<>(); + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + MdmViewFiledVo rule = new MdmViewFiledVo(); + rule.setDbName(mdmModuleDbEntityList.get(i).getDbName()); + rule.setDbType("1"); + rule.setMdmId(mdmModuleDbEntityList.get(i).getMdmId()); + rule.setDbId(mdmModuleDbEntityList.get(i).getId()); + rule.setChName("单据规则"); + rule.setEnName("document_rule"); + mdmViewFiledVos.add(rule); + List msgRule = new ArrayList<>(); + MdmModuleDbFiledsRuleEntity msgRuleTitie = new MdmModuleDbFiledsRuleEntity(); + msgRuleTitie.setFormName("optionRuleForm"); + msgRuleTitie.setRuleCode("title"); + msgRuleTitie.setRuleName("显示名"); + msgRuleTitie.setRuleType("2"); + msgRuleTitie.setRuleValue("单据编码"); + MdmModuleDbFiledsRuleEntity msgRulerow = new MdmModuleDbFiledsRuleEntity(); + msgRulerow.setFormName("optionRuleForm"); + msgRulerow.setRuleCode("row"); + msgRulerow.setRuleName("宽度"); + msgRulerow.setRuleType("2"); + msgRulerow.setRuleValue("12"); + MdmModuleDbFiledsRuleEntity msgRuletype = new MdmModuleDbFiledsRuleEntity(); + msgRuletype.setFormName("optionRuleForm"); + msgRuletype.setRuleCode("type"); + msgRuletype.setRuleName("数据类型"); + msgRuletype.setRuleType("2"); + msgRuletype.setRuleValue("input"); + MdmModuleDbFiledsRuleEntity msgRulerequired = new MdmModuleDbFiledsRuleEntity(); + msgRulerequired.setFormName("optionRuleForm"); + msgRulerequired.setRuleCode("required"); + msgRulerequired.setRuleName("必填"); + msgRulerequired.setRuleType("2"); + MdmModuleDbFiledsRuleEntity withs = new MdmModuleDbFiledsRuleEntity(); + withs.setFormName("optionRuleForm"); + withs.setRuleCode("width"); + withs.setRuleName("宽度"); + withs.setRuleType("2"); + withs.setRuleValue("200"); + msgRule.add(withs); + msgRule.add(msgRulerequired); + msgRule.add(msgRuletype); + msgRule.add(msgRulerow); + msgRule.add(msgRuleTitie); + rule.setRuleList(msgRule); + } } - return false; + if (mdmModuleViewDetailEntities != null && mdmModuleViewDetailEntities.size() > 0) { + for (int i = 0; i < mdmModuleViewDetailEntities.size(); i++) { + 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())) { + for (int i2 = 0; i2 < mdmModuleDbEntityList.size(); i2++) { + 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()); + mdmViewFiledVo.setDbId(mdmModuleDbEntityList.get(i2).getId()); + + break; + } + } + mdmViewFiledVo.setChName(mdmModuleDbFiledsEntityList.get(i1).getChName()); + mdmViewFiledVo.setEnName(mdmModuleDbFiledsEntityList.get(i1).getEnName()); + + mdmViewFiledVo.setFiledType(mdmModuleDbFiledsEntityList.get(i1).getFiledType()); + //字段规则 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + List ruleList = new ArrayList<>(); + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + 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())) { + List a = new ArrayList<>(); + + MdmModuleDbFiledsRuleEntity msgRuleTitie = new MdmModuleDbFiledsRuleEntity(); + msgRuleTitie.setFormName("optionRuleForm"); + msgRuleTitie.setRuleCode("title"); + msgRuleTitie.setRuleName("显示名"); + msgRuleTitie.setRuleType("2"); + msgRuleTitie.setRuleValue("数据状态"); + MdmModuleDbFiledsRuleEntity msgRulerow = new MdmModuleDbFiledsRuleEntity(); + msgRulerow.setFormName("optionRuleForm"); + msgRulerow.setRuleCode("row"); + msgRulerow.setRuleName("宽度"); + msgRulerow.setRuleType("2"); + msgRulerow.setRuleValue("12"); + MdmModuleDbFiledsRuleEntity msgRuletype = new MdmModuleDbFiledsRuleEntity(); + msgRuletype.setFormName("optionRuleForm"); + msgRuletype.setRuleCode("type"); + msgRuletype.setRuleName("数据类型"); + msgRuletype.setRuleType("2"); + msgRuletype.setRuleValue("input"); + MdmModuleDbFiledsRuleEntity msgRulerequired = new MdmModuleDbFiledsRuleEntity(); + msgRulerequired.setFormName("optionRuleForm"); + msgRulerequired.setRuleCode("required"); + msgRulerequired.setRuleName("必填"); + msgRulerequired.setRuleType("2"); + MdmModuleDbFiledsRuleEntity withs = new MdmModuleDbFiledsRuleEntity(); + withs.setFormName("optionRuleForm"); + withs.setRuleCode("width"); + withs.setRuleName("宽度"); + withs.setRuleType("2"); + withs.setRuleValue("200"); + a.add(withs); + a.add(msgRulerequired); + a.add(msgRuletype); + a.add(msgRulerow); + a.add(msgRuleTitie); + mdmViewFiledVo.setRuleList(a); + } + } + break; + } + } + mdmViewFiledVos.add(mdmViewFiledVo); + } + } + } + if (mdmViewFiledVos != null && mdmViewFiledVos.size() > 0) { + for (int i = 0; i < mdmViewFiledVos.size(); i++) { + mdmViewFiledVos.get(i).setSorts(i); + } + } + return mdmViewFiledVos; } // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询显示信息 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleView(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // MdmModuleViewVo mdmModuleViewVo = new MdmModuleViewVo(); - // //查询设置各种类型字段 - // //查询模版数据源 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(entity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // setFiledType(mdmModuleViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList); - // } - // //查询数据库设置的字段 - // MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); - // mdmModuleViewEntity.setMdmId(entity.getId()); - // mdmModuleViewEntity.setSts("Y"); - // List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); - // if (moduleViewEntityList != null && moduleViewEntityList.size() == 1) { - // mdmModuleViewVo.setMdmModuleViewEntity(moduleViewEntityList.get(0)); - // //查询明细 - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setMdmId(entity.getId()); - // mdmModuleViewDetailEntity.setViewId(moduleViewEntityList.get(0).getId()); - // mdmModuleViewDetailEntity.setSts("Y"); - // List mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); - // setDbFiledType(mdmModuleViewVo, mdmModuleViewDetailEntityList); - // } else { - // mdmModuleViewVo.setMdmModuleViewEntity(new MdmModuleViewEntity()); - // mdmModuleViewVo.setDbAddFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbEditFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbShowFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbQueryFiled(new ArrayList<>()); - // mdmModuleViewVo.setDbListFiled(new ArrayList<>()); - // } - // return BaseResult.getSuccessMessageEntity("查询视图成功", mdmModuleViewVo); - //} - // - //private void setDbFiledType(MdmModuleViewVo mdmModuleViewVo, List mdmModuleViewDetailEntityList) { - // //新增 - // List addFiled = new ArrayList<>(); - // //修改 - // List editFiled = new ArrayList<>(); - // //查看 - // List showFiled = new ArrayList<>(); - // //查询 - // List queryFiled = new ArrayList<>(); - // //列表 - // List listFiled = new ArrayList<>(); - // if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleViewDetailEntityList.size(); i++) { - // switch (mdmModuleViewDetailEntityList.get(i).getViewType()) { - // //1、查询2、列表3、新增4、修改 5、查看 - // case "1": - // queryFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "2": - // listFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "3": - // addFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "4": - // editFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // case "5": - // showFiled.add(mdmModuleViewDetailEntityList.get(i)); - // break; - // default: - // } - // } - // } - // mdmModuleViewVo.setDbAddFiled(addFiled); - // mdmModuleViewVo.setDbEditFiled(editFiled); - // mdmModuleViewVo.setDbShowFiled(showFiled); - // mdmModuleViewVo.setDbQueryFiled(queryFiled); - // mdmModuleViewVo.setDbListFiled(listFiled); - //} - // - ///** - // * @param mdmModuleViewVo - // * @param mdmModuleDbEntityList - // * @param mdmModuleDbFiledsEntityList - // * @return void - // * @Author lvleigang - // * @Description 设置对应的字段类型 - // * @Date 2023/10/25 - // **/ - //private void setFiledType(MdmModuleViewVo mdmModuleViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList) { - // //新增 - // List addFiled = new ArrayList<>(); - // //修改 - // List editFiled = new ArrayList<>(); - // //查看 - // List showFiled = new ArrayList<>(); - // //查询 - // List queryFiled = new ArrayList<>(); - // //列表 - // List listFiled = new ArrayList<>(); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //1、主表 - // addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } else { - // //2、明细 - // queryFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // addFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // editFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // showFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } - // } - // } - // } - // } - // } - // mdmModuleViewVo.setAddFiled(addFiled); - // mdmModuleViewVo.setEditFiled(editFiled); - // mdmModuleViewVo.setShowFiled(showFiled); - // mdmModuleViewVo.setQueryFiled(queryFiled); - // mdmModuleViewVo.setListFiled(listFiled); - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置修改显示信息 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity doSaveMdmModuleView(JSONObject object) { - // MdmModuleViewDto entity = getData("jsonStr", object, MdmModuleViewDto.class); - // //判断是否有数据 - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getMdmModuleViewEntity() == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // boolean flag = false; - // //保存主数据视图表 - // MdmModuleViewEntity mdmModuleViewEntity = entity.getMdmModuleViewEntity(); - // mdmModuleViewEntity.setMdmId(entity.getId()); - // mdmModuleViewEntity.setSts("Y"); - // mdmModuleViewEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleViewEntity.setModify_time(new Date()); - // if (mdmModuleViewEntity.getId() != null && !"".equals(mdmModuleViewEntity.getId())) { - // flag = false; - // //修改 - // mdmModuleViewDao.update(mdmModuleViewEntity); - // } else { - // flag = true; - // //新增 - // mdmModuleViewEntity.setId(UUIDUtils.getUUID()); - // mdmModuleViewEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleViewEntity.setCreate_time(new Date()); - // mdmModuleViewDao.save(mdmModuleViewEntity); - // } - // //保存视图字段表 - // //先删除明细表 - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setMdmId(entity.getId()); - // mdmModuleViewDetailEntity.setSts("Y"); - // mdmModuleViewDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleViewDetailEntity.setModify_time(new Date()); - // mdmModuleViewDetailDao.logicRemoveMultiCondition(mdmModuleViewDetailEntity); - // //1、查询2、列表3、新增4、修改 5、查看 - // saveDbViewFiled(entity, mdmModuleViewEntity, entity.getQueryFiled(), "1"); - // saveDbViewFiled(entity, mdmModuleViewEntity, entity.getListFiled(), "2"); - // saveDbViewFiled(entity, mdmModuleViewEntity, entity.getAddFiled(), "3"); - // saveDbViewFiled(entity, mdmModuleViewEntity, entity.getEditFiled(), "4"); - // saveDbViewFiled(entity, mdmModuleViewEntity, entity.getShowFiled(), "5"); - // MdmModuleEntity moduleEntity = new MdmModuleEntity(); - // moduleEntity.setId(entity.getId()); - // moduleEntity.setSts("Y"); - // - // moduleEntity = mdmModuleDao.queryOne(moduleEntity); - // if (flag) { - // //新增菜单 - // SysMenuConfigEntity module = new SysMenuConfigEntity(); - // module.setCreate(); - // module.setFormId(entity.getId()); - // module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c"); - // module.setMenuName(moduleEntity.getMdmName()); - // module.setMenuEnglishName("integrationOptionAdmin" + moduleEntity.getMdmCode()); - // module.setMenuIcon(null);//模块图标 - // module.setRoute("integrationOptionAdmin/" + moduleEntity.getMdmCode());//路由地址 - // module.setMenuPage("integrationOptionV2/index");//一级Layout 二级 ParntView 三级component - // module.setRemark("主数据生成菜单"); - // module.setVisibles("0"); - // module.setShowType("1"); - // JSONObject object1 = new JSONObject(); - // object1.put("mdmId", moduleEntity.getId());//主数据id - // object1.put("mdmCode", moduleEntity.getMdmCode());//主数据编码 - // object1.put("viewType", mdmModuleViewEntity.getViewName());//1、树 2、列表 - // module.setOptions(object1.toString());//菜单mate参数 - // sysMenuConfigDao.save(module); - // //todo 新增按钮 - // SysButtonConfigEntity xz = new SysButtonConfigEntity(); - // xz.setCode("new"); - // xz.setNameCh("新建"); - // xz.setNameEn("new"); - // xz.setMenuId(module.getId()); - // xz.setIconName(""); - // xz.setStyles(""); - // xz.setBtnFunction("new"); - // xz.setRemark("主数据新建按钮"); - // xz.setCreate(); - // sysButtonConfigDao.save(xz); - // SysButtonConfigEntity cz = new SysButtonConfigEntity(); - // cz.setCode("resize"); - // cz.setNameCh("重置"); - // cz.setNameEn("resize"); - // cz.setMenuId(module.getId()); - // cz.setIconName(""); - // cz.setStyles(""); - // cz.setBtnFunction("resize"); - // cz.setRemark("主数据重置按钮"); - // cz.setCreate(); - // sysButtonConfigDao.save(cz); - // SysButtonConfigEntity cx = new SysButtonConfigEntity(); - // cx.setCode("search"); - // cx.setNameCh("查询"); - // cx.setNameEn("search"); - // cx.setMenuId(module.getId()); - // cx.setIconName(""); - // cx.setStyles(""); - // cx.setBtnFunction("search"); - // cx.setRemark("主数据查询按钮"); - // cx.setCreate(); - // sysButtonConfigDao.save(cx); - // SysButtonConfigEntity xg = new SysButtonConfigEntity(); - // xg.setCode("edit"); - // xg.setNameCh("修改"); - // xg.setNameEn("edit"); - // xg.setMenuId(module.getId()); - // xg.setIconName(""); - // xg.setStyles(""); - // xg.setBtnFunction("edit"); - // xg.setRemark("主数据修改按钮"); - // xg.setCreate(); - // sysButtonConfigDao.save(xg); - // SysButtonConfigEntity sc = new SysButtonConfigEntity(); - // sc.setCode("dele"); - // sc.setNameCh("删除"); - // sc.setNameEn("dele"); - // sc.setMenuId(module.getId()); - // sc.setIconName(""); - // sc.setStyles(""); - // sc.setBtnFunction("dele"); - // sc.setRemark("主数据删除按钮"); - // sc.setCreate(); - // sysButtonConfigDao.save(sc); - // SysButtonConfigEntity ck = new SysButtonConfigEntity(); - // ck.setCode("view"); - // ck.setNameCh("查看"); - // ck.setNameEn("view"); - // ck.setMenuId(module.getId()); - // ck.setIconName(""); - // ck.setStyles(""); - // ck.setBtnFunction("view"); - // ck.setRemark("主数据查看按钮"); - // ck.setCreate(); - // sysButtonConfigDao.save(ck); - // SysButtonConfigEntity xf = new SysButtonConfigEntity(); - // xf.setCode("send"); - // xf.setNameCh("下发"); - // xf.setNameEn("send"); - // xf.setMenuId(module.getId()); - // xf.setIconName(""); - // xf.setStyles(""); - // xf.setBtnFunction("send"); - // xf.setRemark("主数据下发按钮"); - // xf.setCreate(); - // sysButtonConfigDao.save(xf); - // //module.setServiceName("mdmService");//Spring bean名称 - // //module.setLvl("2");//等级 - // //module.setName("integrationOptionAdmin"+moduleEntity.getMdmCode());//名称 - // //module.setCode(moduleEntity.getMdmCode().toString());//编码 - // //module.setFormType("0");//类型 0、menu 1、tree 2、list 3、view - // //module.setLevel("2");//模块操作级别Superadministrator - // //module.setIcon(null);//模块图标 - // //module.setUpIds("c3dda399207843eeac91770ac18e91e3");//上级id - // //module.setTableName(null);//bean表名称映射key - // //module.setKeyModular(null);//是否关键模块(Y是N否) - // //module.setTarget(null);//跳转目标 - // //module.setRemark("主数据" + moduleEntity.getMdmName());//备注 - // //module.setOpenType("1");//菜单打开方式 - // //module.setFormId(entity.getId());//表单ID - // //module.setAppId(null);//应用id - // ////module.setPath("integrationOptionAdmin");//路由地址 - // //module.setHidden("false");//隐藏 - // //module.setRedirect(null);//redirevt - // //module.setAlwaysShow(null);//alwaysShow - // //module.setTitle(moduleEntity.getMdmName());//标题 - // //module.setNoCache(null);//nocache缓存 - // //module.setLabel(moduleEntity.getMdmName());//label - // - // //moduleMapper.entity_insert(module); - // } else { - // //修改菜单 注意因为可能修改显示类型,所以需要修改菜单的属性 - // SysMenuConfigEntity module = new SysMenuConfigEntity(); - // module.setFormId(entity.getId()); - // module.setSts("Y"); - // List moduleList = sysMenuConfigDao.queryBase(module); - // if (moduleList != null && moduleList.size() == 1) { - // module = moduleList.get(0); - // module.setUpdate(); - // module.setMenuName(moduleEntity.getMdmName()); - // //module.setLabel(moduleEntity.getMdmName());//label - // JSONObject object1 = new JSONObject(); - // object1.put("mdmId", moduleEntity.getId());//主数据id - // object1.put("mdmCode", moduleEntity.getMdmCode());//主数据id - // object1.put("viewType", mdmModuleViewEntity.getViewName());//1、树 2、列表 - // module.setOptions(object1.toString());//菜单mate参数 - // sysMenuConfigDao.update(module); - // } else { - // return BaseResult.getFailureMessageEntity("显示信息保存成功,菜单配置失败请检查"); - // } - // } - // return BaseResult.getSuccessMessageEntity("保存显示信息成功"); - //} - // - ///** - // * @param entity - // * @param mdmModuleViewEntity - // * @param mdmDbFiledVoList - // * @param type - // * @return void - // * @Author lvleigang - // * @Description 保存数据 - // * @Date 1:37 下午 2023/10/25 - // **/ - //private void saveDbViewFiled(MdmModuleViewDto entity, MdmModuleViewEntity mdmModuleViewEntity, List mdmDbFiledVoList, String type) { - // if (mdmDbFiledVoList != null && mdmDbFiledVoList.size() > 0) { - // for (int i = 0; i < mdmDbFiledVoList.size(); i++) { - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setId(UUIDUtils.getUUID()); - // mdmModuleViewDetailEntity.setSts("Y"); - // mdmModuleViewDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleViewDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleViewDetailEntity.setCreate_time(new Date()); - // mdmModuleViewDetailEntity.setModify_time(new Date()); - // mdmModuleViewDetailEntity.setMdmId(entity.getId()); - // mdmModuleViewDetailEntity.setViewId(mdmModuleViewEntity.getId()); - // mdmModuleViewDetailEntity.setViewFiled(mdmDbFiledVoList.get(i).getId()); - // mdmModuleViewDetailEntity.setViewType(type); - // mdmModuleViewDetailEntity.setSort(String.valueOf(i + 1)); - // mdmModuleViewDetailDao.save(mdmModuleViewDetailEntity); - // } - // } - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleRule(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模块下的角色列表 - // MdmModuleRoleEntity mdmModuleRoleEntity = new MdmModuleRoleEntity(); - // mdmModuleRoleEntity.setSts("Y"); - // mdmModuleRoleEntity.setMdmId(entity.getId()); - // List mdmModuleRoleEntities = mdmModuleRoleDao.queryBase(mdmModuleRoleEntity); - // if (mdmModuleRoleEntities != null && mdmModuleRoleEntities.size() > 0) { - // MdmModuleRoleButtonEntity mdmModuleRoleButtonEntity = new MdmModuleRoleButtonEntity(); - // mdmModuleRoleButtonEntity.setSts("Y"); - // mdmModuleRoleButtonEntity.setMdmId(entity.getId()); - // List mdmModuleRoleButtonEntities = mdmModuleRoleButtonDao.queryBase(mdmModuleRoleButtonEntity); - // if (mdmModuleRoleButtonEntities != null && mdmModuleRoleButtonEntities.size() > 0) { - // for (int i = 0; i < mdmModuleRoleEntities.size(); i++) { - // List list = new ArrayList<>(); - // for (int i1 = 0; i1 < mdmModuleRoleButtonEntities.size(); i1++) { - // if (mdmModuleRoleEntities.get(i).getRoleId().equals(mdmModuleRoleButtonEntities.get(i1).getRoleId())) { - // list.add(mdmModuleRoleButtonEntities.get(i1)); - // } - // } - // mdmModuleRoleEntities.get(i).setMdmModuleRoleButtonEntities(list); - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleRoleEntities); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存权限配置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity doSaveMdmModuleRule(JSONObject object) { - // MdmRoleDto entity = getData("jsonStr", object, MdmRoleDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询菜单 - // Module module = new Module(); - // module.setFormId(entity.getId()); - // List moduleList = moduleMapper.entity_list_base(module); - // if (moduleList != null && moduleList.size() == 1) { - // module = moduleList.get(0); - // } else { - // return BaseResult.getFailureMessageEntity("菜单错误请检查菜单"); - // } - // //先删除 - // RoleModule roleModule = new RoleModule(); - // roleModule.setSts("Y"); - // roleModule.setUpdate(); - // roleModule.setModuleId(module.getId()); - // roleModuleMapper.entity_logicDelete_Multi_Condition(roleModule); - // MdmModuleRoleEntity mdmModuleRoleEntity = new MdmModuleRoleEntity(); - // mdmModuleRoleEntity.setMdmId(entity.getId()); - // mdmModuleRoleEntity.setSts("Y"); - // mdmModuleRoleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleRoleEntity.setModify_time(new Date()); - // mdmModuleRoleDao.logicRemoveMultiCondition(mdmModuleRoleEntity); - // MdmModuleRoleButtonEntity mdmModuleRoleButtonEntity = new MdmModuleRoleButtonEntity(); - // mdmModuleRoleButtonEntity.setMdmId(entity.getId()); - // mdmModuleRoleButtonEntity.setSts("Y"); - // mdmModuleRoleButtonEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleRoleButtonEntity.setModify_time(new Date()); - // mdmModuleRoleButtonDao.logicRemoveMultiCondition(mdmModuleRoleButtonEntity); - // - // if (entity.getMdmModuleRoleEntities() != null && entity.getMdmModuleRoleEntities().size() > 0) { - // for (int i = 0; i < entity.getMdmModuleRoleEntities().size(); i++) { - // - // MdmModuleRoleEntity moduleRoleEntity = entity.getMdmModuleRoleEntities().get(i); - // moduleRoleEntity.setMdmId(entity.getId()); - // moduleRoleEntity.setSts("Y"); - // moduleRoleEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleEntity.setModify_time(new Date()); - // if (moduleRoleEntity.getId() != null && !"".equals(moduleRoleEntity.getId())) { - // //修改 - // mdmModuleRoleDao.update(moduleRoleEntity); - // } else { - // //新增 - // moduleRoleEntity.setId(UUIDUtils.getUUID()); - // moduleRoleEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleEntity.setCreate_time(new Date()); - // mdmModuleRoleDao.save(moduleRoleEntity); - // } - // if (moduleRoleEntity.getMdmModuleRoleButtonEntities() != null && moduleRoleEntity.getMdmModuleRoleButtonEntities().size() > 0) { - // for (int i1 = 0; i1 < moduleRoleEntity.getMdmModuleRoleButtonEntities().size(); i1++) { - // MdmModuleRoleButtonEntity moduleRoleButtonEntity = moduleRoleEntity.getMdmModuleRoleButtonEntities().get(i1); - // moduleRoleButtonEntity.setMdmId(entity.getId()); - // moduleRoleButtonEntity.setSts("Y"); - // moduleRoleButtonEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleButtonEntity.setModify_time(new Date()); - // moduleRoleButtonEntity.setModuleRoleId(moduleRoleEntity.getRoleId()); - // moduleRoleButtonEntity.setRoleId(moduleRoleEntity.getRoleId()); - // if (moduleRoleButtonEntity.getId() != null && !"".equals(moduleRoleButtonEntity.getId())) { - // //修改 - // mdmModuleRoleButtonDao.update(moduleRoleButtonEntity); - // } else { - // //新增 - // moduleRoleButtonEntity.setId(UUIDUtils.getUUID()); - // moduleRoleButtonEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleRoleButtonEntity.setCreate_time(new Date()); - // mdmModuleRoleButtonDao.save(moduleRoleButtonEntity); - // } - // } - // } - // //再添加 - // RoleModule saveRole = new RoleModule(); - // saveRole.setCreate(); - // saveRole.setRoleId(moduleRoleEntity.getRoleId()); - // saveRole.setModuleId(module.getId()); - // roleModuleMapper.entity_insert(saveRole); - // } - // } - // return BaseResult.getSuccessMessageEntity("保存成功"); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置查询分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmModuleDistribute(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模块下的应用列表 - // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - // mdmModuleDistributeEntity.setSts("Y"); - // mdmModuleDistributeEntity.setMdmId(entity.getId()); - // List mdmModuleDistributeEntities = mdmModuleDistributeDao.queryBase(mdmModuleDistributeEntity); - // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { - // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); - // mdmModuleDistributeDetailEntity.setSts("Y"); - // mdmModuleDistributeDetailEntity.setMdmId(entity.getId()); - // List mdmModuleDistributeDetailEntities = mdmModuleDistributeDetailDao.queryBase(mdmModuleDistributeDetailEntity); - // if (mdmModuleDistributeDetailEntities != null && mdmModuleDistributeDetailEntities.size() > 0) { - // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { - // List addlist = new ArrayList<>(); - // List deletelist = new ArrayList<>(); - // for (int i1 = 0; i1 < mdmModuleDistributeDetailEntities.size(); i1++) { - // if (mdmModuleDistributeEntities.get(i).getAddApi().equals(mdmModuleDistributeDetailEntities.get(i1).getApiId()) - // && mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())) { - // addlist.add(mdmModuleDistributeDetailEntities.get(i1)); - // } - // if (mdmModuleDistributeEntities.get(i).getDeleteApi().equals(mdmModuleDistributeDetailEntities.get(i1).getApiId()) - // && mdmModuleDistributeEntities.get(i).getId().equals(mdmModuleDistributeDetailEntities.get(i1).getDistributeId())) { - // deletelist.add(mdmModuleDistributeDetailEntities.get(i1)); - // } - // } - // mdmModuleDistributeEntities.get(i).setAddList(addlist); - // mdmModuleDistributeEntities.get(i).setDeleteList(deletelist); - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询成功", mdmModuleDistributeEntities); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据设置保存分发设置 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity doSaveMdmModuleDistribute(JSONObject object) { - // MdmDistributeDto entity = getData("jsonStr", object, MdmDistributeDto.class); - // //判断是否有数据 - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //if(entity.getMdmModuleDistributeEntities() == null ){ - // // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // //} - // //先删除 - // MdmModuleDistributeEntity mdmModuleDistributeEntity = new MdmModuleDistributeEntity(); - // mdmModuleDistributeEntity.setMdmId(entity.getId()); - // mdmModuleDistributeEntity.setSts("Y"); - // mdmModuleDistributeEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDistributeEntity.setModify_time(new Date()); - // mdmModuleDistributeDao.logicRemoveMultiCondition(mdmModuleDistributeEntity); - // - // MdmModuleDistributeDetailEntity mdmModuleDistributeDetailEntity = new MdmModuleDistributeDetailEntity(); - // mdmModuleDistributeDetailEntity.setMdmId(entity.getId()); - // mdmModuleDistributeDetailEntity.setSts("Y"); - // mdmModuleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // mdmModuleDistributeDetailEntity.setModify_time(new Date()); - // mdmModuleDistributeDetailDao.logicRemoveMultiCondition(mdmModuleDistributeDetailEntity); - // - // //保存主数据 - // List mdmModuleDistributeEntities = entity.getMdmModuleDistributeEntities(); - // - // if (mdmModuleDistributeEntities != null && mdmModuleDistributeEntities.size() > 0) { - // for (int i = 0; i < mdmModuleDistributeEntities.size(); i++) { - // MdmModuleDistributeEntity moduleDistributeEntity = mdmModuleDistributeEntities.get(i); - // moduleDistributeEntity.setMdmId(entity.getId()); - // moduleDistributeEntity.setSts("Y"); - // moduleDistributeEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeEntity.setModify_time(new Date()); - // if (moduleDistributeEntity.getId() != null && !"".equals(moduleDistributeEntity.getId())) { - // //修改 - // mdmModuleDistributeDao.update(moduleDistributeEntity); - // } else { - // //新增 - // moduleDistributeEntity.setId(UUIDUtils.getUUID()); - // moduleDistributeEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeEntity.setCreate_time(new Date()); - // mdmModuleDistributeDao.save(moduleDistributeEntity); - // } - // if (moduleDistributeEntity.getAddList() != null && moduleDistributeEntity.getAddList().size() > 0) { - // for (int i1 = 0; i1 < moduleDistributeEntity.getAddList().size(); i1++) { - // MdmModuleDistributeDetailEntity moduleDistributeDetailEntity = moduleDistributeEntity.getAddList().get(i1); - // moduleDistributeDetailEntity.setMdmId(entity.getId()); - // moduleDistributeDetailEntity.setSts("Y"); - // moduleDistributeDetailEntity.setApiId(moduleDistributeEntity.getAddApi()); - // moduleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); - // moduleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setModify_time(new Date()); - // if (moduleDistributeDetailEntity.getId() != null && !"".equals(moduleDistributeDetailEntity.getId())) { - // //修改 - // mdmModuleDistributeDetailDao.update(moduleDistributeDetailEntity); - // } else { - // //新增 - // moduleDistributeDetailEntity.setId(UUIDUtils.getUUID()); - // moduleDistributeDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setCreate_time(new Date()); - // mdmModuleDistributeDetailDao.save(moduleDistributeDetailEntity); - // } - // } - // } - // if (moduleDistributeEntity.getDeleteList() != null && moduleDistributeEntity.getDeleteList().size() > 0) { - // for (int i1 = 0; i1 < moduleDistributeEntity.getDeleteList().size(); i1++) { - // MdmModuleDistributeDetailEntity moduleDistributeDetailEntity = moduleDistributeEntity.getDeleteList().get(i1); - // moduleDistributeDetailEntity.setMdmId(entity.getId()); - // moduleDistributeDetailEntity.setSts("Y"); - // moduleDistributeDetailEntity.setApiId(moduleDistributeEntity.getDeleteApi()); - // moduleDistributeDetailEntity.setDistributeId(moduleDistributeEntity.getId()); - // moduleDistributeDetailEntity.setModify_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setModify_time(new Date()); - // if (moduleDistributeDetailEntity.getId() != null && !"".equals(moduleDistributeDetailEntity.getId())) { - // //修改 - // mdmModuleDistributeDetailDao.update(moduleDistributeDetailEntity); - // } else { - // //新增 - // moduleDistributeDetailEntity.setId(UUIDUtils.getUUID()); - // moduleDistributeDetailEntity.setCreate_user_id(StpUtil.getLoginIdAsString()); - // moduleDistributeDetailEntity.setCreate_time(new Date()); - // mdmModuleDistributeDetailDao.save(moduleDistributeDetailEntity); - // } - // } - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("保存发布设置成功"); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 树、查询条件、列表字段、按钮 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShow(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // - // MdmViewVo mdmViewVo = new MdmViewVo(); - // mdmModuleEntity = mdmModuleEntities.get(0); - // mdmViewVo.setMdmModuleEntity(mdmModuleEntity); - // //查询展示类型 - // MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); - // mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewEntity.setSts("Y"); - // List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); - // if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleViewEntity = moduleViewEntityList.get(0); - // mdmViewVo.setMdmModuleViewEntity(mdmModuleViewEntity); - // - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表下面的字段 - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询字段下的规则 - // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); - // mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); - // if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询设置的查询字段 - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewDetailEntity.setSts("Y"); - // mdmModuleViewDetailEntity.setViewType("1"); - // List queryList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); - // //设置字段 - // List queryListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, queryList, false); - // mdmViewVo.setQueryList(queryListVo); - // - // //查询用户设置字段 - // MdmModuleUserViewEntity mdmModuleUserViewEntity = new MdmModuleUserViewEntity(); - // mdmModuleUserViewEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleUserViewEntity.setSts("Y"); - // mdmModuleUserViewEntity.setUserId(StpUtil.getLoginIdAsString()); - // List mdmModuleUserViewEntities = mdmModuleUserViewDao.queryBase(mdmModuleUserViewEntity); - // - // //查询设置的查询字段 - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity1 = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity1.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewDetailEntity1.setSts("Y"); - // mdmModuleViewDetailEntity1.setViewType("2"); - // List listList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity1); - // List dolistList = new ArrayList<>(); - // - // if (mdmModuleUserViewEntities != null && mdmModuleUserViewEntities.size() > 0) { - // dolistList = getDolist(listList, mdmModuleUserViewEntities); - // if (dolistList == null || dolistList.size() == 0) { - // dolistList = listList; - // } - // } else { - // dolistList = listList; - // } - // List listListVo = setQueryList(mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, dolistList, true); - // mdmViewVo.setListList(listListVo); - // - // List buttonList = new ArrayList<>(); - // buttonList.add(new MdmViewButtonVo("new", "新建")); - // buttonList.add(new MdmViewButtonVo("resize", "重置")); - // buttonList.add(new MdmViewButtonVo("search", "查询")); - // buttonList.add(new MdmViewButtonVo("edit", "修改")); - // buttonList.add(new MdmViewButtonVo("dele", "删除")); - // buttonList.add(new MdmViewButtonVo("view", "查看")); - // buttonList.add(new MdmViewButtonVo("send", "下发")); - // mdmViewVo.setButtonList(buttonList); - // return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); - //} - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据查询所有字段 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowAll(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询设置各种类型字段 - // //查询模版数据源 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(entity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // List listFiled = new ArrayList<>(); - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(entity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // // - // if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //1、主表 - // listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } else { - // //2、明细 - // listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); - // } - // } - // } - // } - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询视图成功", listFiled); - //} + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据查询所有字段 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowAll(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询设置各种类型字段 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + //查询模版数据源 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + List listFiled = new ArrayList<>(); + if (mdmModuleDbEntityList != null && mdmModuleDbEntityList.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + // + 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 (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【主表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } else { + //2、明细 + listFiled.add(new MdmDbFiledVo(mdmModuleDbFiledsEntityList.get(i1).getId(), "【子表:" + mdmModuleDbEntityList.get(i).getDbName() + "】" + mdmModuleDbFiledsEntityList.get(i1).getChName())); + } + } + } + } + } + } + } + } + return BaseResult.getSuccessMessageEntity("查询视图成功", listFiled); + } // ///** // * @param mdmModuleRoleButtonEntities @@ -1865,28 +625,48 @@ public class MdmServiceImpl implements IMdmService { // mdmViewFiledVos.add(mdmViewFiledVo); //} // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据列表显示 业务数据 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowData(JSONObject object) { - // MdmQuery entity = getData("jsonStr", object, MdmQuery.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // //判断分页 - // if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - // return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - // } - // PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - // List> businessResult = mdmModuleDao.queryMdmShowData(entity); - // PageInfo pageInfo = new PageInfo(businessResult); - // return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - //} + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据列表显示 业务数据 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowData(JSONObject object) { + MdmQuery entity = getData("jsonStr", object, MdmQuery.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){ + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntity == null || mdmModuleEntity.getId() == null) { + return BaseResult.getFailureMessageEntity("主数据设置错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0) { + return BaseResult.getFailureMessageEntity("主数据设置错误"); + } + for (int i = 0; i < mdmModuleDbEntities.size(); i++) { + 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("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List> businessResult = mdmModuleDao.queryMdmShowData(entity); + PageInfo pageInfo = new PageInfo(businessResult); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } // ///** // * @param object @@ -1971,143 +751,147 @@ public class MdmServiceImpl implements IMdmService { // return BaseResult.getSuccessMessageEntity("查询数据成功", returnData); //} // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 查询数据(list 或者 分页) - // * @Date 1:33 下午 2023/7/12 - // **/ - //@Override - //public JsonResultEntity queryTemplateData(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // //校验是否有servecr传参 - // if (!checkStr(entity.getTableName())) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkStr(entity.getValue())) { - // return BaseResult.getFailureMessageEntity("请先传递存储字段"); - // } - // if (!checkStr(entity.getLabel())) { - // return BaseResult.getFailureMessageEntity("请先传递显示字段"); - // } - // if (entity.getPageNum() != null && entity.getPageSize() != null) { - // PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - // List> mapList = mdmModuleDao.querySelectData(entity); - // PageInfo pageInfo = new PageInfo(mapList); - // return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - // } else { - // List> mapList = mdmModuleDao.querySelectData(entity); - // return BaseResult.getSuccessMessageEntity("查询数据成功", mapList); - // } - //} + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询数据(list 或者 分页) + * @Date 1:33 下午 2023/7/12 + **/ + @Override + public JsonResultEntity queryTemplateData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + //校验是否有servecr传参 + if (!checkStr(entity.getTableName())) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkStr(entity.getValue())) { + return BaseResult.getFailureMessageEntity("请先传递存储字段"); + } + if (!checkStr(entity.getLabel())) { + return BaseResult.getFailureMessageEntity("请先传递显示字段"); + } + if (entity.getPageNum() != null && entity.getPageSize() != null) { + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List> mapList = mdmModuleDao.querySelectData(entity); + PageInfo pageInfo = new PageInfo(mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } else { + List> mapList = mdmModuleDao.querySelectData(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", mapList); + } + } // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 业务数据树形结构,数据查询 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowTreeData(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // //if (entity.getTableName() == null || "".equals(entity.getTableName())) { - // // return BaseResult.getFailureMessageEntity("系统错误"); - // //} - // if (entity.getLabel() == null || "".equals(entity.getLabel())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getUpId() == null || "".equals(entity.getUpId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getMdmCode() != null && !"".equals(entity.getMdmCode())) { - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntities.get(0).getId()); - // mdmModuleDbEntity.setDbType("1"); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleDbEntity = mdmModuleDbEntityList.get(0); - // entity.setTableName(mdmModuleDbEntity.getDbName()); - // } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 业务数据树形结构,数据查询 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowTreeData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + //if (entity.getTableName() == null || "".equals(entity.getTableName())) { + // return BaseResult.getFailureMessageEntity("系统错误"); + //} + if (entity.getLabel() == null || "".equals(entity.getLabel())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getUpId() == null || "".equals(entity.getUpId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if(entity.getMdmCode() != null && !"".equals(entity.getMdmCode())){ + //查询模版 + MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntities == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + mdmModuleDbEntity = mdmModuleDbEntityList.get(i); + break; + } + } + entity.setTableName(mdmModuleDbEntity.getDbName()); + } + + if (checkStr(entity.getId())) { + if (!checkStr(entity.getValue())) { + return BaseResult.getFailureMessageEntity("请先传递存储字段"); + } + if (entity.getId().contains(",")) { + String[] strArray = entity.getId().split(","); // 使用逗号和空格作为分隔符 + entity.setIds(strArray); + List> mapList = mdmModuleDao.queryTemplateDataMore(entity); + if (mapList == null || mapList.size() == 0) { + List> returnList = new ArrayList<>(); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + List> returnList = gettochilder(strArray, 0, mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } else { + HashMap mapList = mdmModuleDao.queryTemplateDataOne(entity); + if (mapList == null || mapList.size() == 0) { + List> returnList = new ArrayList<>(); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + List> returnList = new ArrayList<>(); + returnList.add(mapList); + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + } else { + List> mapList = mdmModuleDao.queryDataAll(entity); + List> returnList = new ArrayList<>(); + + if (mapList != null && mapList.size() > 0) { + for (int i = 0; i < mapList.size(); i++) { + //默认为根 + if (mapList.get(i).get(entity.getUpId()) == null || "".equals(mapList.get(i).get(entity.getUpId()))) { + List> children = getchilder(mapList.get(i).get("qsdfg").toString(), mapList, entity); + HashMap re = new HashMap<>(); + re.put("id", mapList.get(i).get("qsdfg")); + re.put("label", mapList.get(i).get(entity.getLabel())); + re.put("upID", mapList.get(i).get(entity.getUpId())); + if (children != null && children.size() > 0) { + re.put("children", children); + } + returnList.add(re); + } + } + } + return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); + } + } + // - // - // if (checkStr(entity.getId())) { - // if (!checkStr(entity.getValue())) { - // return BaseResult.getFailureMessageEntity("请先传递存储字段"); - // } - // if (entity.getId().contains(",")) { - // String[] strArray = entity.getId().split(","); // 使用逗号和空格作为分隔符 - // entity.setIds(strArray); - // List> mapList = mdmModuleDao.queryTemplateDataMore(entity); - // if (mapList == null || mapList.size() == 0) { - // List> returnList = new ArrayList<>(); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - // List> returnList = gettochilder(strArray, 0, mapList); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } else { - // HashMap mapList = mdmModuleDao.queryTemplateDataOne(entity); - // if (mapList == null || mapList.size() == 0) { - // List> returnList = new ArrayList<>(); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - // List> returnList = new ArrayList<>(); - // returnList.add(mapList); - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - // } else { - // List> mapList = mdmModuleDao.queryDataAll(entity); - // List> returnList = new ArrayList<>(); - // - // if (mapList != null && mapList.size() > 0) { - // for (int i = 0; i < mapList.size(); i++) { - // //默认为根 - // if (mapList.get(i).get(entity.getUpId()) == null || "".equals(mapList.get(i).get(entity.getUpId()))) { - // List> children = getchilder(mapList.get(i).get("qsdfg").toString(), mapList, entity); - // HashMap re = new HashMap<>(); - // re.put("id", mapList.get(i).get("qsdfg")); - // re.put("label", mapList.get(i).get(entity.getLabel())); - // re.put("upID", mapList.get(i).get(entity.getUpId())); - // if (children != null && children.size() > 0) { - // re.put("children", children); - // } - // returnList.add(re); - // } - // } - // } - // return BaseResult.getSuccessMessageEntity("查询数据成功", returnList); - // } - //} - // - //private List> gettochilder(String[] strArray, int i, List> mapList) { - // List> maps = new ArrayList<>(); - // for (int i1 = 0; i1 < mapList.size(); i1++) { - // if (strArray[i].equals(mapList.get(i1).get("id").toString())) { - // if (strArray.length >= (i + 2)) { - // mapList.get(i1).put("children", gettochilder(strArray, i + 1, mapList)); - // } - // maps.add(mapList.get(i1)); - // break; - // } - // } - // return maps; - //} + private List> gettochilder(String[] strArray, int i, List> mapList) { + List> maps = new ArrayList<>(); + for (int i1 = 0; i1 < mapList.size(); i1++) { + if (strArray[i].equals(mapList.get(i1).get("id").toString())) { + if (strArray.length >= (i + 2)) { + mapList.get(i1).put("children", gettochilder(strArray, i + 1, mapList)); + } + maps.add(mapList.get(i1)); + break; + } + } + return maps; + } + // //private HashMap getFathers(List> mapListAll, HashMap mapList, MdmDto entity) { // if (mapList.get("upID") == null) { @@ -2132,198 +916,203 @@ public class MdmServiceImpl implements IMdmService { // return a; //} // - //private List> getchilder(String stringObjectHashMap, List> mapList, MdmDto entity) { - // List> returnList = new ArrayList<>(); - // if (mapList != null && mapList.size() > 0) { - // for (int i = 0; i < mapList.size(); i++) { - // //等于上级id的时候 - // if (stringObjectHashMap.equals(mapList.get(i).get(entity.getUpId()))) { - // List> children = getchilder(mapList.get(i).get(entity.getUpId()) + "," + mapList.get(i).get("qsdfg"), mapList, entity); - // HashMap re = new HashMap<>(); - // re.put("id", mapList.get(i).get("qsdfg")); - // re.put("label", mapList.get(i).get(entity.getLabel())); - // re.put("upID", mapList.get(i).get(entity.getUpId())); - // if (children != null && children.size() > 0) { - // re.put("children", children); - // } - // returnList.add(re); - // } - // } - // } - // return returnList; - //} + private List> getchilder(String stringObjectHashMap, List> mapList, MdmDto entity) { + List> returnList = new ArrayList<>(); + if (mapList != null && mapList.size() > 0) { + for (int i = 0; i < mapList.size(); i++) { + //等于上级id的时候 + if (stringObjectHashMap.equals(mapList.get(i).get(entity.getUpId()))) { + List> children = getchilder(mapList.get(i).get(entity.getUpId()) + "," + mapList.get(i).get("qsdfg"), mapList, entity); + HashMap re = new HashMap<>(); + re.put("id", mapList.get(i).get("qsdfg")); + re.put("label", mapList.get(i).get(entity.getLabel())); + re.put("upID", mapList.get(i).get(entity.getUpId())); + if (children != null && children.size() > 0) { + re.put("children", children); + } + returnList.add(re); + } + } + } + return returnList; + } // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowDetails(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getShowType() == null || "".equals(entity.getShowType())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // MdmDetailViewVo mdmViewVo = new MdmDetailViewVo(); - // mdmModuleEntity = mdmModuleEntities.get(0); - // mdmViewVo.setMdmModuleEntity(mdmModuleEntity); - // - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询数据源表下面的字段 - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询字段下的规则 - // MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); - // mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsRuleEntity.setSts("Y"); - // List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); - // if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); - // mdmModuleViewDetailEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewDetailEntity.setSts("Y"); - // mdmModuleViewDetailEntity.setViewType(entity.getShowType());//设置显示字段类型 - // List mdmModuleViewDetailEntityList = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); - // //组装数据 - // assembleMdmShowDetails(mdmViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, mdmModuleViewDetailEntityList, entity.getShowType()); - // return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); - //} - // - ///** - // * @param mdmViewVo 返回对象 - // * @param mdmModuleDbEntityList 数据源表 - // * @param mdmModuleDbFiledsEntityList 数据源字段 - // * @param mdmModuleDbFiledsRuleEntityList 数据源字段规则 - // * @param mdmModuleViewDetailEntityList 数据源显示字段 - // * @return void - // * @Author lvleigang - // * @Description 组装显示字段 - // * @Date 9:10 上午 2023/11/6 - // **/ - //private void assembleMdmShowDetails(MdmDetailViewVo mdmViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList, List mdmModuleViewDetailEntityList, String showType) { - // //主数据主表 - // MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); - // List mainMdmModuleDbFileds = new ArrayList<>(); - // //主数据子表 - // List sublistMdmModuleDb = new ArrayList<>(); - // - // if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { - // //先循环数据源表,设置出数据字段 - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //1、主表 2、明细 - // mainMdmModuleDb = mdmModuleDbEntityList.get(i); - // //循环字段表 - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { - // if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { - // mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - // List mdmModuleDbFiledsRules = new ArrayList<>(); - // //循环字段属性 - // if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - // for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - // && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - // mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - // } - // } - // } - // mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - // } - // } - // } - // } - // } - // } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //2、明细 - // sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); - // //循环字段表 - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // List sublistMdmModuleDbFileds = new ArrayList<>(); - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { - // for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { - // if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { - // sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); - // List mdmModuleDbFiledsRules = new ArrayList<>(); - // //循环字段属性 - // if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { - // for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) - // && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { - // mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); - // } - // } - // } - // mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); - // } - // } - // - // } - // } - // mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); - // } - // } - // } - // mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); - // mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); - // //主数据子表 - // List mdmModuleDb = new ArrayList<>(); - // if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { - // for (int i = 0; i < sublistMdmModuleDb.size(); i++) { - // if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() != null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() > 0) { - // mdmModuleDb.add(sublistMdmModuleDb.get(i)); - // } - // } - // } - // if ("5".equals(showType)) { - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setDbName(mainMdmModuleDb.getDbName() + "_distribute"); - // mdmModuleDbEntity.setRemark(mainMdmModuleDb.getRemark() + "分发表"); - // mdmModuleDbEntity.setDbType("2"); - // List mdmModuleDbFiledsEntityList1 = getDistributeRole(); - // mdmModuleDbEntity.setSublistMdmModuleDbFileds(mdmModuleDbFiledsEntityList1); - // mdmModuleDb.add(mdmModuleDbEntity); - // } - // mdmViewVo.setSublistMdmModuleDb(mdmModuleDb); - // - // - // } else { - // mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); - // mdmViewVo.setSublistMdmModuleDb(sublistMdmModuleDb); - // } - //} + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowDetails(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getShowType() == null || "".equals(entity.getShowType())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + //List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + MdmModuleEntity mdmModuleEntities = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntities == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmDetailViewVo mdmViewVo = new MdmDetailViewVo(); + mdmViewVo.setMdmModuleEntity(mdmModuleEntities); + + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源表下面的字段 + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + List mdmModuleDbFiledsEntityList = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + if (mdmModuleDbFiledsEntityList == null || mdmModuleDbFiledsEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询字段下的规则 + MdmModuleDbFiledsRuleEntity mdmModuleDbFiledsRuleEntity = new MdmModuleDbFiledsRuleEntity(); + mdmModuleDbFiledsRuleEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleDbFiledsRuleEntity.setSts("Y"); + List mdmModuleDbFiledsRuleEntityList = mdmModuleDbFiledsRuleDao.queryBase(mdmModuleDbFiledsRuleEntity); + if (mdmModuleDbFiledsRuleEntityList == null || mdmModuleDbFiledsRuleEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleViewDetailEntity mdmModuleViewDetailEntity = new MdmModuleViewDetailEntity(); + mdmModuleViewDetailEntity.setMdmId(mdmModuleEntities.getId()); + mdmModuleViewDetailEntity.setSts("Y"); + mdmModuleViewDetailEntity.setViewType(entity.getShowType());//设置显示字段类型 + List queryAll = mdmModuleViewDetailDao.queryBase(mdmModuleViewDetailEntity); + List mdmModuleViewDetailEntityList = new ArrayList<>(); + if (queryAll != null && queryAll.size() > 0) { + for (int i = 0; i < queryAll.size(); i++) { + if (entity.getShowType().equals(queryAll.get(i).getViewType())) { + mdmModuleViewDetailEntityList.add(queryAll.get(i)); + } + } + } + //组装数据 + assembleMdmShowDetails(mdmViewVo, mdmModuleDbEntityList, mdmModuleDbFiledsEntityList, mdmModuleDbFiledsRuleEntityList, mdmModuleViewDetailEntityList, entity.getShowType()); + return BaseResult.getSuccessMessageEntity("获取字段成功", mdmViewVo); + } + + /** + * @param mdmViewVo 返回对象 + * @param mdmModuleDbEntityList 数据源表 + * @param mdmModuleDbFiledsEntityList 数据源字段 + * @param mdmModuleDbFiledsRuleEntityList 数据源字段规则 + * @param mdmModuleViewDetailEntityList 数据源显示字段 + * @return void + * @Author lvleigang + * @Description 组装显示字段 + * @Date 9:10 上午 2023/11/6 + **/ + private void assembleMdmShowDetails(MdmDetailViewVo mdmViewVo, List mdmModuleDbEntityList, List mdmModuleDbFiledsEntityList, List mdmModuleDbFiledsRuleEntityList, List mdmModuleViewDetailEntityList, String showType) { + //主数据主表 + MdmModuleDbEntity mainMdmModuleDb = new MdmModuleDbEntity(); + List mainMdmModuleDbFileds = new ArrayList<>(); + //主数据子表 + List sublistMdmModuleDb = new ArrayList<>(); + + if (mdmModuleViewDetailEntityList != null && mdmModuleViewDetailEntityList.size() > 0) { + //先循环数据源表,设置出数据字段 + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //1、主表 2、明细 + mainMdmModuleDb = mdmModuleDbEntityList.get(i); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { + if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { + mainMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + } + } + } + } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //2、明细 + sublistMdmModuleDb.add(mdmModuleDbEntityList.get(i)); + //循环字段表 + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + List sublistMdmModuleDbFileds = new ArrayList<>(); + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(mdmModuleDbFiledsEntityList.get(i1).getDbId())) { + for (int b = 0; b < mdmModuleViewDetailEntityList.size(); b++) { + if (mdmModuleViewDetailEntityList.get(b).getViewFiled().equals(mdmModuleDbFiledsEntityList.get(i1).getId())) { + sublistMdmModuleDbFileds.add(mdmModuleDbFiledsEntityList.get(i1)); + List mdmModuleDbFiledsRules = new ArrayList<>(); + //循环字段属性 + if (mdmModuleDbFiledsRuleEntityList != null && mdmModuleDbFiledsRuleEntityList.size() > 0) { + for (int i2 = 0; i2 < mdmModuleDbFiledsRuleEntityList.size(); i2++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getDbId()) + && mdmModuleDbFiledsEntityList.get(i1).getId().equals(mdmModuleDbFiledsRuleEntityList.get(i2).getFiledId())) { + mdmModuleDbFiledsRules.add(mdmModuleDbFiledsRuleEntityList.get(i2)); + } + } + } + mdmModuleDbFiledsEntityList.get(i1).setMdmModuleDbFiledsRules(mdmModuleDbFiledsRules); + } + } + + } + } + mdmModuleDbEntityList.get(i).setSublistMdmModuleDbFileds(sublistMdmModuleDbFileds); + } + } + } + mainMdmModuleDb.setSublistMdmModuleDbFileds(mainMdmModuleDbFileds); + mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); + //主数据子表 + List mdmModuleDb = new ArrayList<>(); + if (sublistMdmModuleDb != null && sublistMdmModuleDb.size() > 0) { + for (int i = 0; i < sublistMdmModuleDb.size(); i++) { + if (sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds() != null && sublistMdmModuleDb.get(i).getSublistMdmModuleDbFileds().size() > 0) { + mdmModuleDb.add(sublistMdmModuleDb.get(i)); + } + } + } + //if ("5".equals(showType)) { + // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + // mdmModuleDbEntity.setDbName(mainMdmModuleDb.getDbName() + "_distribute"); + // mdmModuleDbEntity.setRemark(mainMdmModuleDb.getRemark() + "分发表"); + // mdmModuleDbEntity.setDbType("2"); + // List mdmModuleDbFiledsEntityList1 = getDistributeRole(); + // mdmModuleDbEntity.setSublistMdmModuleDbFileds(mdmModuleDbFiledsEntityList1); + // mdmModuleDb.add(mdmModuleDbEntity); + //} + mdmViewVo.setSublistMdmModuleDb(mdmModuleDb); + + } else { + mdmViewVo.setMainMdmModuleDb(mainMdmModuleDb); + mdmViewVo.setSublistMdmModuleDb(sublistMdmModuleDb); + } + } // //private List getDistributeRole() { // List mdmModuleDbFiledsEntityList = new ArrayList<>(); @@ -2503,668 +1292,916 @@ public class MdmServiceImpl implements IMdmService { // } //} // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据 区分类型 新增、修改、查看 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity queryMdmShowDetailsData(JSONObject object) { - // MdmDto entity = getData("jsonStr", object, MdmDto.class); - // if (entity == null) { - // return BaseResult.getFailureMessageEntity("参数不允许为空"); - // } - // if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // if (entity.getId() == null || "".equals(entity.getId())) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // //查询模版 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(entity.getMdmCode()); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // //查询数据源主表 - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // String tablename = null; - // JSONObject jsonObject = new JSONObject(); - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // //查询数据 - // Map queryData = new HashMap<>(); - // queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // queryData.put("detailFlag", false);//是否明细 - // queryData.put("id", entity.getId());//字段 - // HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); - // jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); - // tablename = mdmModuleDbEntityList.get(i).getDbName() + "_distribute"; - // } else { - // queryData.put("detailFlag", true);//是否明细 - // queryData.put("id", entity.getId());//字段 - // List> datas = mdmModuleDbDao.getServiceByFormmainId(queryData); - // jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); - // } - // } - // if (tablename != null && !"".equals(tablename)) { - // Map queryData = new HashMap<>(); - // queryData.put("tableName", tablename);//表名 - // queryData.put("id", entity.getId());//字段 - // List> datas = mdmModuleDbDao.getServiceByDistributeId(queryData); - // jsonObject.put(tablename, datas); - // } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据 区分类型 新增、修改、查看 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity queryMdmShowDetailsData(JSONObject object) { + MdmDto entity = getData("jsonStr", object, MdmDto.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getMdmCode() == null || "".equals(entity.getMdmCode())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询模版 + + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(entity.getMdmCode()); + if (mdmModuleEntity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询数据源主表 + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //String tablename = null; + JSONObject jsonObject = new JSONObject(); + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + //查询数据 + Map queryData = new HashMap<>(); + queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + queryData.put("detailFlag", false);//是否明细 + queryData.put("id", entity.getId());//字段 + HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); + jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); + //tablename = mdmModuleDbEntityList.get(i).getDbName() + "_distribute"; + } else { + queryData.put("detailFlag", true);//是否明细 + queryData.put("id", entity.getId());//字段 + List> datas = mdmModuleDbDao.getServiceByFormmainId(queryData); + jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas); + } + } + //if (tablename != null && !"".equals(tablename)) { + // Map queryData = new HashMap<>(); + // queryData.put("tableName", tablename);//表名 + // queryData.put("id", entity.getId());//字段 + // List> datas = mdmModuleDbDao.getServiceByDistributeId(queryData); + // jsonObject.put(tablename, datas); + //} + + + return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject); + } + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据修改 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity updateMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "data")) { + return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); + } + JSONObject saveData = jsonObject.getJSONObject("data"); + //校验唯一 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(jsonObject.getLong("mdmCode")); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList,"界面修改"); + + if (res == null || "".equals(res)) { + return BaseResult.getSuccessMessageEntity("修改数据成功"); + } else { + return BaseResult.getFailureMessageEntity(res); + } + } + + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据新增 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity saveMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "data")) { + return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); + } + JSONObject saveData = jsonObject.getJSONObject("data"); + //校验唯一 + MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); + mdmModuleEntity.setMdmCode(jsonObject.getLong("mdmCode")); + mdmModuleEntity.setSts("Y"); + List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); + if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleEntity = mdmModuleEntities.get(0); + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); + if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + + + String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList,"界面新增"); + + if (res == null || "".equals(res)) { + return BaseResult.getSuccessMessageEntity("保存数据成功"); + } else { + 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); + + } // // - // return BaseResult.getSuccessMessageEntity("获取数据成功", jsonObject); - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据修改 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity updateMdmShowDetailsData(JSONObject object) { - // JSONObject jsonObject = getstrObj("jsonStr", object); - // //校验是否有servecr传参 - // if (!checkData(jsonObject, "mdmCode")) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkData(jsonObject, "data")) { - // return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); - // } - // JSONObject saveData = jsonObject.getJSONObject("data"); - // //校验唯一 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, true, mdmModuleEntity, mdmModuleDbEntityList); - // - // if (res == null || "".equals(res)) { - // return BaseResult.getSuccessMessageEntity("修改数据成功"); - // } else { - // return BaseResult.getFailureMessageEntity(res); - // } - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据新增 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity saveMdmShowDetailsData(JSONObject object) { - // JSONObject jsonObject = getstrObj("jsonStr", object); - // //校验是否有servecr传参 - // if (!checkData(jsonObject, "mdmCode")) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkData(jsonObject, "data")) { - // return BaseResult.getFailureMessageEntity("请先传递要修改的数据"); - // } - // JSONObject saveData = jsonObject.getJSONObject("data"); - // //校验唯一 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // String res = checkDataOnly(jsonObject.getInteger("mdmCode"), saveData, false, mdmModuleEntity, mdmModuleDbEntityList); - // - // if (res == null || "".equals(res)) { - // return BaseResult.getSuccessMessageEntity("保存数据成功"); - // } else { - // return BaseResult.getFailureMessageEntity(res); - // } - //} - // - // - ///** - // * @param object - // * @return com.hzya.frame.web.entity.JsonResultEntity - // * @Author lvleigang - // * @Description 主数据详情数据修改 - // * @Date 9:40 上午 2023/10/18 - // **/ - //@Override - //public JsonResultEntity deleteMdmShowDetailsData(JSONObject object) { - // JSONObject jsonObject = getstrObj("jsonStr", object); - // //校验是否有servecr传参 - // if (!checkData(jsonObject, "mdmCode")) { - // return BaseResult.getFailureMessageEntity("请先传递服务名"); - // } - // if (!checkData(jsonObject, "id")) { - // return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); - // } - // //校验唯一 - // MdmModuleEntity mdmModuleEntity = new MdmModuleEntity(); - // mdmModuleEntity.setMdmCode(jsonObject.getInteger("mdmCode")); - // mdmModuleEntity.setSts("Y"); - // List mdmModuleEntities = mdmModuleDao.queryBase(mdmModuleEntity); - // if (mdmModuleEntities == null || mdmModuleEntities.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleEntity = mdmModuleEntities.get(0); - // MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); - // mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbEntity.setSts("Y"); - // List mdmModuleDbEntityList = mdmModuleDbDao.queryBase(mdmModuleDbEntity); - // if (mdmModuleDbEntityList == null || mdmModuleDbEntityList.size() == 0) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // - // //查询视图,如果树形,删除下级及子集 - // //查询展示类型 - // MdmModuleViewEntity mdmModuleViewEntity = new MdmModuleViewEntity(); - // mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleViewEntity.setSts("Y"); - // List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); - // if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { - // return BaseResult.getFailureMessageEntity("系统错误"); - // } - // mdmModuleViewEntity = moduleViewEntityList.get(0); - // - // - // //删除自己 - // FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); - // formmainDeleteDto.setId(jsonObject.getString("id")); - // formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); - // formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // if (mdmModuleViewEntity != null && mdmModuleViewEntity.getViewName() != null && "1".equals(mdmModuleViewEntity.getViewName()) && - // mdmModuleViewEntity.getUpIdFiled() != null && !"".equals(mdmModuleViewEntity.getUpIdFiled())) { - // formmainDeleteDto.setUpIdFiled(mdmModuleViewEntity.getUpIdFiled()); - // - // Map queryData = new HashMap<>(); - // queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 - // queryData.put("detailFlag", false);//是否明细 - // queryData.put("id", jsonObject.getString("id"));//字段 - // HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); - // String upValue = null; - // if (datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != null) { - // upValue = datas.get(mdmModuleViewEntity.getUpIdFiled()).toString(); - // } - // if (upValue != null) { - // formmainDeleteDto.setUpIdFiledValue(upValue + "," + jsonObject.getString("id")); - // } else { - // formmainDeleteDto.setUpIdFiledValue(jsonObject.getString("id")); - // } - // mdmModuleDao.deleteChilder(formmainDeleteDto); - // } - // mdmModuleDao.deleteTemplateById(formmainDeleteDto); - // - // } else { - // //删除明细 - // FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); - // formmainDeleteDto.setFormmain_id(jsonObject.getString("id")); - // formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); - // formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // mdmModuleDao.deleteTemplateById(formmainDeleteDto); - // } - // } - // 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 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 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 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 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 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 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 mdmCode - // * @param saveData - // * @param mdmModuleEntity - // * @param mdmModuleDbEntityList - // * @param flag 修改 新增 - // * @return java.lang.String - // * @Author lvleigang - // * @Description 校验数据 - // * @Date 11:20 上午 2023/11/6 - // **/ - //private String checkDataOnly(Integer mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List mdmModuleDbEntityList) { - // StringBuffer str = new StringBuffer(); - // - // //查询字段 - // //查询字段下的必填规则 - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity.setSts("Y"); - // mdmModuleDbFiledsEntity.setRoletype("required"); - // mdmModuleDbFiledsEntity.setRoleValue("true"); - // List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); - // - // if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); - // } - // } - // } - // } else { - // JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); - // if (jsonArray != null && jsonArray.size() > 0) { - // for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { - // if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // for (int i2 = 0; i2 < jsonArray.size(); i2++) { - // JSONObject jsonObject = jsonArray.getJSONObject(i2); - // if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); - // break; - // } - // } - // } - // } - // } - // } - // } - // } - // - // if (str == null || "".equals(str.toString())) { - // //校验数据 - // MdmModuleDbFiledsEntity onlyFiledsEntity = new MdmModuleDbFiledsEntity(); - // onlyFiledsEntity.setMdmId(mdmModuleEntity.getId()); - // onlyFiledsEntity.setSts("Y"); - // onlyFiledsEntity.setRoletype("fieldsSole"); - // onlyFiledsEntity.setRoleValue("true"); - // - // List onlyEntityList = mdmModuleDbFiledsDao.queryBase(onlyFiledsEntity); - // - // if (onlyEntityList != null && onlyEntityList.size() > 0) { - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); - // for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { - // if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // //校验唯一 - // Map map = new HashMap<>(); - // map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); - // if (flag) { - // map.put("id", jsonObject.getString("id")); - // } - // map.put("filedName", onlyEntityList.get(i1).getEnName()); - // map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); - // Integer count = mdmModuleDao.checkData(map); - // if (count > 0) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); - // } - // } - // } - // } else { - // JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); - // if (jsonArray != null && jsonArray.size() > 0) { - // for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { - // if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { - // for (int i2 = 0; i2 < jsonArray.size(); i2++) { - // JSONObject jsonObject = jsonArray.getJSONObject(i2); - // - // //校验唯一 - // Map map = new HashMap<>(); - // map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); - // if (flag) { - // map.put("id", jsonObject.getString("id")); - // } - // map.put("filedName", onlyEntityList.get(i1).getEnName()); - // map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); - // Integer count = mdmModuleDao.checkData(map); - // if (count > 0) { - // if (str.toString() != null && !"".equals(str.toString())) { - // str.append(";"); - // } - // str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); - // break; - // } - // } - // } - // } - // } - // } - // } - // } - // } - // - // - // //保存数据 - // if (str == null || "".equals(str.toString())) { - // String id = UUIDUtils.getUUID(); - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); - // //保存数据 - // MdmDataDto mdmDataDto = new MdmDataDto(); - // mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); - // mdmModuleDbFiledsEntity1.setSts("Y"); - // List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); - // //查询单据规则 - // MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); - // mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); - // mdmTableCodeRuleEntity.setDbId(mdmModuleDbEntityList.get(i).getId()); - // mdmTableCodeRuleEntity.setSts("Y"); - // List mdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity); - // StringBuffer document_rule = new StringBuffer(); - // Integer document_rule_num = 0; - // if (mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0) { - // for (int i1 = 0; i1 < mdmTableCodeRuleEntities.size(); i1++) { - // //1、连接符号 2、字符串 3、日期 4、流水号 - // if ("1".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // document_rule.append("-"); - // } else if ("2".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // document_rule.append(mdmTableCodeRuleEntities.get(i1).getDbValue()); - // } else if ("3".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // SimpleDateFormat sdf = new SimpleDateFormat(mdmTableCodeRuleEntities.get(i1).getDbValue());//要转换的时间格式 - // String stra = sdf.format(new Date()); - // document_rule.append(stra); - // } else if ("4".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { - // document_rule_num = mdmTableCodeRuleEntities.get(i1).getDbValue().length(); - // } - // } - // } - // List mdmDataFiledDtos = new ArrayList<>(); - // for (int i1 = 0; i1 < fileds.size(); i1++) { - // if (jsonObject.get(fileds.get(i1).getEnName()) != null) { - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); - // mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // } - // } - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName("logid"); - // mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // if (flag) { - // mdmDataDto.setId(jsonObject.getString("id")); - // id = jsonObject.getString("id"); - // int a = mdmModuleDao.updateForm(mdmDataDto); - // } else { - // - // mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); - // mdmDataDto.setDocumentRule(document_rule.toString()); - // mdmDataDto.setDocumentRuleNum(document_rule_num); - // MdmDataFiledDto ids = new MdmDataFiledDto(); - // ids.setFiledsName("id"); - // ids.setFiledsValue(id); - // mdmDataFiledDtos.add(ids); - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // int a = mdmModuleDao.saveForm(mdmDataDto); - // } - // } - // } - // - // for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { - // if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { - // //删除明细 - // FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); - // formmainDeleteDto.setFormmain_id(id); - // formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); - // formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // mdmModuleDao.deleteTemplateById(formmainDeleteDto); - // - // JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); - // if (jsonArray != null && jsonArray.size() > 0) { - // MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); - // mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); - // mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); - // mdmModuleDbFiledsEntity1.setSts("Y"); - // List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); - // - // for (int i2 = 0; i2 < jsonArray.size(); i2++) { - // JSONObject jsonObject = jsonArray.getJSONObject(i2); - // //保存数据 - // MdmDataDto mdmDataDto = new MdmDataDto(); - // mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); - // List mdmDataFiledDtos = new ArrayList<>(); - // for (int i1 = 0; i1 < fileds.size(); i1++) { - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); - // mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // } - // MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); - // mdmDataFiledDto.setFiledsName("logid"); - // mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); - // mdmDataFiledDtos.add(mdmDataFiledDto); - // - // MdmDataFiledDto formain_id = new MdmDataFiledDto(); - // formain_id.setFiledsName("formmain_id"); - // formain_id.setFiledsValue(id); - // mdmDataFiledDtos.add(formain_id); - // - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // if (jsonObject.getString("id") != null) { - // MdmDataFiledDto sts = new MdmDataFiledDto(); - // sts.setFiledsName("sts"); - // sts.setFiledsValue("Y"); - // mdmDataFiledDtos.add(sts); - // mdmDataDto.setId(jsonObject.getString("id")); - // int a = mdmModuleDao.updateForm(mdmDataDto); - // } else { - // MdmDataFiledDto ids = new MdmDataFiledDto(); - // ids.setFiledsName("id"); - // ids.setFiledsValue(UUIDUtils.getUUID()); - // mdmDataFiledDtos.add(ids); - // mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); - // mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); - // int a = mdmModuleDao.saveForm(mdmDataDto); - // } - // } - // } - // } - // } - // } - // return str.toString(); - //} - // + + /** + * @param object + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 主数据详情数据修改 + * @Date 9:40 上午 2023/10/18 + **/ + @Override + public JsonResultEntity deleteMdmShowDetailsData(JSONObject object) { + JSONObject jsonObject = getstrObj("jsonStr", object); + //校验是否有servecr传参 + if (!checkData(jsonObject, "mdmCode")) { + return BaseResult.getFailureMessageEntity("请先传递服务名"); + } + if (!checkData(jsonObject, "id")) { + return BaseResult.getFailureMessageEntity("请先传递要删除的数据"); + } + //校验唯一 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(jsonObject.getLong("mdmCode")); + if (mdmModuleEntity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbEntity.setSts("Y"); + List mdmModuleDbEntityList = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + 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(); + mdmModuleViewEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleViewEntity.setSts("Y"); + List moduleViewEntityList = mdmModuleViewDao.queryBase(mdmModuleViewEntity); + if (moduleViewEntityList == null || moduleViewEntityList.size() != 1) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + mdmModuleViewEntity = moduleViewEntityList.get(0); + + + //删除自己 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setId(jsonObject.getString("id")); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + if (mdmModuleViewEntity != null && mdmModuleViewEntity.getViewName() != null && "1".equals(mdmModuleViewEntity.getViewName()) && + mdmModuleViewEntity.getUpIdFiled() != null && !"".equals(mdmModuleViewEntity.getUpIdFiled())) { + formmainDeleteDto.setUpIdFiled(mdmModuleViewEntity.getUpIdFiled()); + + Map queryData = new HashMap<>(); + queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名 + queryData.put("detailFlag", false);//是否明细 + queryData.put("id", jsonObject.getString("id"));//字段 + HashMap datas = mdmModuleDbDao.getServiceDataById(queryData); + String upValue = null; + if (datas != null && datas.get(mdmModuleViewEntity.getUpIdFiled()) != null) { + upValue = datas.get(mdmModuleViewEntity.getUpIdFiled()).toString(); + } + if (upValue != null) { + formmainDeleteDto.setUpIdFiledValue(upValue + "," + jsonObject.getString("id")); + } else { + formmainDeleteDto.setUpIdFiledValue(jsonObject.getString("id")); + } + mdmModuleDao.deleteChilder(formmainDeleteDto); + } + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + + } else if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //删除明细 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setFormmain_id(jsonObject.getString("id")); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + } + + + } + saveOption(dbname,mdmModuleEntity.getMdmCode(),jsonObject,jsonObject.getString("id"),"界面删除"); + return BaseResult.getSuccessMessageEntity("删除数据成功"); + } + + /** + * @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 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 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 mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild); + MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity(); + queryFildRule.setMdmId(mdmModuleEntity.getId()); + queryFildRule.setRuleCode("service"); + List 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 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 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 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 map = new HashMap<>(); + map.put("tableName", mdmModuleDbEntities.get(i).getDbName()); + map.put("formmainId", object.getString("id")); + List 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 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 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 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 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 + * @param mdmModuleEntity + * @param mdmModuleDbEntityList + * @param flag 修改 新增 + * @return java.lang.String + * @Author lvleigang + * @Description 校验数据 + * @Date 11:20 上午 2023/11/6 + **/ + private String checkDataOnly(long mdmCode, JSONObject saveData, boolean flag, MdmModuleEntity mdmModuleEntity, List 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(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity.setSts("Y"); + mdmModuleDbFiledsEntity.setRoletype("required"); + mdmModuleDbFiledsEntity.setRoleValue("true"); + List mdmModuleDbFiledsEntityList = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity); + + if (mdmModuleDbFiledsEntityList != null && mdmModuleDbFiledsEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); + } + } + } + } else { + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if (jsonArray != null && jsonArray.size() > 0) { + for (int i1 = 0; i1 < mdmModuleDbFiledsEntityList.size(); i1++) { + if (mdmModuleDbFiledsEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + if (jsonObject.get(mdmModuleDbFiledsEntityList.get(i1).getEnName()) == null || "".equals(jsonObject.getString(mdmModuleDbFiledsEntityList.get(i1).getEnName()))) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "不为空"); + break; + } + } + } + } + } + } + } + } + + if (str == null || "".equals(str.toString())) { + //校验数据 + MdmModuleDbFiledsEntity onlyFiledsEntity = new MdmModuleDbFiledsEntity(); + onlyFiledsEntity.setMdmId(mdmModuleEntity.getId()); + onlyFiledsEntity.setSts("Y"); + onlyFiledsEntity.setRoletype("fieldsSole"); + onlyFiledsEntity.setRoleValue("true"); + + List onlyEntityList = mdmModuleDbFiledsDao.queryBase(onlyFiledsEntity); + + if (onlyEntityList != null && onlyEntityList.size() > 0) { + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { + if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + //校验唯一 + Map map = new HashMap<>(); + map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); + if (flag) { + map.put("id", jsonObject.getString("id")); + } + map.put("filedName", onlyEntityList.get(i1).getEnName()); + map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); + Integer count = mdmModuleDao.checkData(map); + if (count > 0) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); + } + } + } + } else { + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if (jsonArray != null && jsonArray.size() > 0) { + for (int i1 = 0; i1 < onlyEntityList.size(); i1++) { + if (onlyEntityList.get(i1).getDbId().equals(mdmModuleDbEntityList.get(i).getId())) { + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + + //校验唯一 + Map map = new HashMap<>(); + map.put("tableName", mdmModuleDbEntityList.get(i).getDbName()); + if (flag) { + map.put("id", jsonObject.getString("id")); + } + map.put("filedName", onlyEntityList.get(i1).getEnName()); + map.put("filedValue", jsonObject.getString(onlyEntityList.get(i1).getEnName())); + Integer count = mdmModuleDao.checkData(map); + if (count > 0) { + if (str.toString() != null && !"".equals(str.toString())) { + str.append(";"); + } + str.append(mdmModuleDbEntityList.get(i).getRemark() + "的" + mdmModuleDbFiledsEntityList.get(i1).getChName() + "已存在"); + break; + } + } + } + } + } + } + } + } + } + + + //保存数据 + if (str == null || "".equals(str.toString())) { + String id = UUIDUtils.getUUID(); + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("1".equals(mdmModuleDbEntityList.get(i).getDbType())) { + JSONObject jsonObject = saveData.getJSONObject(mdmModuleDbEntityList.get(i).getDbName()); + //保存数据 + MdmDataDto mdmDataDto = new MdmDataDto(); + mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity1.setDbId(mdmModuleDbEntityList.get(i).getId()); + mdmModuleDbFiledsEntity1.setSts("Y"); + List fileds = mdmModuleDbFiledsDao.queryBase(mdmModuleDbFiledsEntity1); + //查询单据规则 + MdmTableCodeRuleEntity mdmTableCodeRuleEntity = new MdmTableCodeRuleEntity(); + mdmTableCodeRuleEntity.setMdmId(mdmModuleEntity.getId()); + //mdmTableCodeRuleEntity.setDbId(mdmModuleDbEntityList.get(i).getId()); + mdmTableCodeRuleEntity.setSts("Y"); + List allMdmTableCodeRuleEntities = mdmTableCodeRuleDao.queryBase(mdmTableCodeRuleEntity); + List mdmTableCodeRuleEntities = new ArrayList<>(); + 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())){ + // mdmTableCodeRuleEntities.add(allMdmTableCodeRuleEntities.get(i1)); + // } + //} + } + StringBuffer document_rule = new StringBuffer(); + Integer document_rule_num = 0; + if (mdmTableCodeRuleEntities != null && mdmTableCodeRuleEntities.size() > 0) { + for (int i1 = 0; i1 < mdmTableCodeRuleEntities.size(); i1++) { + //1、连接符号 2、字符串 3、日期 4、流水号 + if ("1".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + document_rule.append("-"); + } else if ("2".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + document_rule.append(mdmTableCodeRuleEntities.get(i1).getDbValue()); + } else if ("3".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + SimpleDateFormat sdf = new SimpleDateFormat(mdmTableCodeRuleEntities.get(i1).getDbValue());//要转换的时间格式 + String stra = sdf.format(new Date()); + document_rule.append(stra); + } else if ("4".equals(mdmTableCodeRuleEntities.get(i1).getDbType())) { + document_rule_num = mdmTableCodeRuleEntities.get(i1).getDbValue().length(); + } + } + } + List mdmDataFiledDtos = new ArrayList<>(); + for (int i1 = 0; i1 < fileds.size(); i1++) { + if (jsonObject.get(fileds.get(i1).getEnName()) != null) { + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); + mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); + mdmDataFiledDtos.add(mdmDataFiledDto); + } + } + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName("logid"); + mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); + mdmDataFiledDtos.add(mdmDataFiledDto); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + if (flag) { + mdmDataDto.setId(jsonObject.getString("id")); + id = jsonObject.getString("id"); + MdmDataFiledDto update_status = new MdmDataFiledDto(); + update_status.setFiledsName("update_status"); + update_status.setFiledsValue("0"); + mdmDataFiledDtos.add(update_status); + MdmDataFiledDto data_status = new MdmDataFiledDto(); + data_status.setFiledsName("data_status"); + data_status.setFiledsValue("F"); + ; + mdmDataFiledDtos.add(data_status); + int a = mdmModuleDao.updateForm(mdmDataDto); + } else { + + mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); + mdmDataDto.setDocumentRule(document_rule.toString()); + mdmDataDto.setDocumentRuleNum(document_rule_num); + MdmDataFiledDto ids = new MdmDataFiledDto(); + ids.setFiledsName("id"); + ids.setFiledsValue(id); + mdmDataFiledDtos.add(ids); + MdmDataFiledDto data_status = new MdmDataFiledDto(); + data_status.setFiledsName("data_status"); + data_status.setFiledsValue("Y"); + ; + mdmDataFiledDtos.add(data_status); + MdmDataFiledDto org_id = new MdmDataFiledDto(); + org_id.setFiledsName("org_id"); + org_id.setFiledsValue("Y"); + ; + mdmDataFiledDtos.add(org_id); + MdmDataFiledDto company_id = new MdmDataFiledDto(); + company_id.setFiledsName("company_id"); + company_id.setFiledsValue("Y"); + ; + mdmDataFiledDtos.add(company_id); + + MdmDataFiledDto add_status = new MdmDataFiledDto(); + add_status.setFiledsName("add_status"); + add_status.setFiledsValue("0"); + mdmDataFiledDtos.add(add_status); + MdmDataFiledDto update_status = new MdmDataFiledDto(); + update_status.setFiledsName("update_status"); + update_status.setFiledsValue("1"); + mdmDataFiledDtos.add(update_status); + MdmDataFiledDto delete_status = new MdmDataFiledDto(); + delete_status.setFiledsName("delete_status"); + delete_status.setFiledsValue("1"); + mdmDataFiledDtos.add(delete_status); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + int a = mdmModuleDao.saveForm(mdmDataDto); + } + } + } + + for (int i = 0; i < mdmModuleDbEntityList.size(); i++) { + if ("2".equals(mdmModuleDbEntityList.get(i).getDbType())) { + //删除明细 + FormmainDeleteDto formmainDeleteDto = new FormmainDeleteDto(); + formmainDeleteDto.setFormmain_id(id); + formmainDeleteDto.setLoginId(StpUtil.getLoginIdAsString()); + formmainDeleteDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + mdmModuleDao.deleteTemplateById(formmainDeleteDto); + + JSONArray jsonArray = saveData.getJSONArray(mdmModuleDbEntityList.get(i).getDbName()); + if (jsonArray != null && jsonArray.size() > 0) { + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity1 = new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity1.setMdmId(mdmModuleEntity.getId()); + mdmModuleDbFiledsEntity1.setSts("Y"); + List allfileds = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity1); + List fileds = new ArrayList<>(); + if (allfileds != null && allfileds.size() > 0) { + for (int i1 = 0; i1 < allfileds.size(); i1++) { + if (mdmModuleDbEntityList.get(i).getId().equals(allfileds.get(i1).getDbId())) { + fileds.add(allfileds.get(i1)); + } + } + } + + for (int i2 = 0; i2 < jsonArray.size(); i2++) { + JSONObject jsonObject = jsonArray.getJSONObject(i2); + //保存数据 + MdmDataDto mdmDataDto = new MdmDataDto(); + mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName()); + List mdmDataFiledDtos = new ArrayList<>(); + for (int i1 = 0; i1 < fileds.size(); i1++) { + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName()); + mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName())); + mdmDataFiledDtos.add(mdmDataFiledDto); + } + MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto(); + mdmDataFiledDto.setFiledsName("logid"); + mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString()); + mdmDataFiledDtos.add(mdmDataFiledDto); + + MdmDataFiledDto formain_id = new MdmDataFiledDto(); + formain_id.setFiledsName("formmain_id"); + formain_id.setFiledsValue(id); + mdmDataFiledDtos.add(formain_id); + + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + if (jsonObject.getString("id") != null) { + MdmDataFiledDto sts = new MdmDataFiledDto(); + sts.setFiledsName("sts"); + sts.setFiledsValue("Y"); + mdmDataFiledDtos.add(sts); + mdmDataDto.setId(jsonObject.getString("id")); + int a = mdmModuleDao.updateForm(mdmDataDto); + } else { + MdmDataFiledDto ids = new MdmDataFiledDto(); + ids.setFiledsName("id"); + ids.setFiledsValue(UUIDUtils.getUUID()); + mdmDataFiledDtos.add(ids); + mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos); + mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType()); + int a = mdmModuleDao.saveForm(mdmDataDto); + } + } + } + } + } + + saveOption(dbname,mdmCode,saveData,id,msg); + + } + return str.toString(); + } + /** * @param jsonObject @@ -3219,18 +2256,4 @@ public class MdmServiceImpl implements IMdmService { return flag; } - /** - * @param str - * @return void - * @Author lvleigang - * @Description 校验字符串 - * @Date 11:41 上午 2022/12/7 - **/ - protected Boolean checkInt(Integer str) { - Boolean flag = true; - if (str == null) { - flag = false; - } - return flag; - } } diff --git a/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java b/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java index 044dcd40..eccc4f7a 100644 --- a/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/report/reportManage/service/impl/ReportManageServiceImpl.java @@ -3,21 +3,15 @@ package com.hzya.frame.report.reportManage.service.impl; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.report.reportManage.dao.IReportManageDao; import com.hzya.frame.report.reportManage.entity.JimuReportEntity; import com.hzya.frame.report.reportManage.entity.ReportManageEntity; -import com.hzya.frame.report.reportManage.dao.IReportManageDao; import com.hzya.frame.report.reportManage.service.IReportManageService; -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.AESUtil; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; -import dm.jdbc.d.U; -import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.Resource; -import com.hzya.frame.basedao.service.impl.BaseService; +import org.springframework.stereotype.Service; import java.util.List; @@ -29,272 +23,269 @@ import java.util.List; */ @Service(value = "reportManageService") public class ReportManageServiceImpl extends BaseService implements IReportManageService { - + private IReportManageDao reportManageDao; - + @Autowired - public void setReportManageDao(IReportManageDao dao) { - this.reportManageDao = dao; - this.dao = dao; - } + public void setReportManageDao(IReportManageDao dao) { + this.reportManageDao = dao; + this.dao = dao; + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表列表分页 - * @Date 11:52 上午 2024/3/27 - **/ - @Override - public JsonResultEntity queryEntityPage(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List list = reportManageDao.queryByLikeClassify(entity); - PageInfo pageInfo = new PageInfo(list); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表列表分页 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public JsonResultEntity queryEntityPage(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = reportManageDao.queryByLikeClassify(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表列表 - * @Date 11:52 上午 2024/3/27 - **/ - @Override - public JsonResultEntity queryEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - entity = new ReportManageEntity(); - } - List list = reportManageDao.queryByLike(entity); - return BaseResult.getSuccessMessageEntity("查询数据成功", list); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表列表 + * @Date 11:52 上午 2024/3/27 + **/ + @Override + public JsonResultEntity queryEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + entity = new ReportManageEntity(); + } + List list = reportManageDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", list); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 保存报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity saveEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getReportId() == null || "".equals(entity.getReportId())) { - return BaseResult.getFailureMessageEntity("请先选择报表"); - } - if (entity.getReportName() == null || "".equals(entity.getReportName())) { - return BaseResult.getFailureMessageEntity("请先输入报表名称"); - } - if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { - return BaseResult.getFailureMessageEntity("请先选择分类"); - } - if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setState("0"); - if (!checkIsUse(entity)) { - return BaseResult.getFailureMessageEntity("当前报表已经配置,请勿重复配置"); - } - entity.setCreate(); - //保存 - reportManageDao.save(entity); - return BaseResult.getSuccessMessageEntity("保存报表成功", entity); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 保存报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity saveEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getReportId() == null || "".equals(entity.getReportId())) { + return BaseResult.getFailureMessageEntity("请先选择报表"); + } + if (entity.getReportName() == null || "".equals(entity.getReportName())) { + return BaseResult.getFailureMessageEntity("请先输入报表名称"); + } + if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { + return BaseResult.getFailureMessageEntity("请先选择分类"); + } + if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setState("0"); + if (!checkIsUse(entity)) { + return BaseResult.getFailureMessageEntity("当前报表已经配置,请勿重复配置"); + } + entity.setCreate(); + //保存 + reportManageDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存报表成功", entity); + } + private boolean checkIsUse(ReportManageEntity entity) { + ReportManageEntity checkUse = new ReportManageEntity(); + checkUse.setReportId(entity.getReportId()); + return reportManageDao.getCount(checkUse) <= 0; + } - private boolean checkIsUse(ReportManageEntity entity) { - ReportManageEntity checkUse = new ReportManageEntity(); - checkUse.setReportId(entity.getReportId()); - if (reportManageDao.getCount(checkUse) > 0) { - return false; - } - return true; - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 获取报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity getEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = reportManageDao.get(entity.getId()); + if (entity == null) { + return BaseResult.getFailureMessageEntity("获取报表失败"); + } + return BaseResult.getSuccessMessageEntity("获取报表成功", entity); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity getEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity = reportManageDao.get(entity.getId()); - if (entity == null) { - return BaseResult.getFailureMessageEntity("获取报表失败"); - } - return BaseResult.getSuccessMessageEntity("获取报表成功", entity); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 修改报表 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity updateEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getReportId() == null || "".equals(entity.getReportId())) { + return BaseResult.getFailureMessageEntity("请先选择报表"); + } + if (entity.getReportName() == null || "".equals(entity.getReportName())) { + return BaseResult.getFailureMessageEntity("请先输入报表名称"); + } + if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { + return BaseResult.getFailureMessageEntity("请先选择分类"); + } + if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + //保存 + reportManageDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改报表成功"); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 修改报表 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity updateEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getReportId() == null || "".equals(entity.getReportId())) { - return BaseResult.getFailureMessageEntity("请先选择报表"); - } - if (entity.getReportName() == null || "".equals(entity.getReportName())) { - return BaseResult.getFailureMessageEntity("请先输入报表名称"); - } - if (entity.getClassifyId() == null || "".equals(entity.getClassifyId())) { - return BaseResult.getFailureMessageEntity("请先选择分类"); - } - if (entity.getPreviewAddress() == null || "".equals(entity.getPreviewAddress())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setUpdate(); - //保存 - reportManageDao.update(entity); - return BaseResult.getSuccessMessageEntity("修改报表成功"); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 删除报表 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity deleteEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + reportManageDao.logicRemove(entity); + return BaseResult.getSuccessMessageEntity("删除报表成功"); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除报表 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity deleteEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setUpdate(); - reportManageDao.logicRemove(entity); - return BaseResult.getSuccessMessageEntity("删除报表成功"); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 启用停用报表 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity enableDisableEntity(JSONObject jsonObject) { + ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getState() == null || "".equals(entity.getState())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + reportManageDao.update(entity); + //0启用 1 停用 + if ("0".equals(entity.getState())) { + return BaseResult.getSuccessMessageEntity("启用用户成功"); + } else { + return BaseResult.getSuccessMessageEntity("停用用户成功"); + } + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 启用停用报表 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity enableDisableEntity(JSONObject jsonObject) { - ReportManageEntity entity = getData("jsonStr", jsonObject, ReportManageEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - if (entity.getState() == null || "".equals(entity.getState())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity.setUpdate(); - reportManageDao.update(entity); - //0启用 1 停用 - if ("0".equals(entity.getState())) { - return BaseResult.getSuccessMessageEntity("启用用户成功"); - } else { - return BaseResult.getSuccessMessageEntity("停用用户成功"); - } - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity queryReport(JSONObject jsonObject) { + JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); + //判断分页 + if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { + return BaseResult.getFailureMessageEntity("分页查询参数不存在"); + } + PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); + List list = reportManageDao.queryReportNotUse(entity); + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity queryReport(JSONObject jsonObject) { - JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); - //判断分页 - if (entity == null || entity.getPageNum() == null || entity.getPageSize() == null) { - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List list = reportManageDao.queryReportNotUse(entity); - PageInfo pageInfo = new PageInfo(list); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 查询报表 + * @Date 2:36 下午 2024/3/27 + **/ + @Override + public JsonResultEntity queryReportEntity(JSONObject jsonObject) { + JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity = reportManageDao.queryReportEntity(entity); + if (entity == null) { + return BaseResult.getFailureMessageEntity("获取报表失败"); + } + return BaseResult.getSuccessMessageEntity("获取报表成功", entity); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询报表 - * @Date 2:36 下午 2024/3/27 - **/ - @Override - public JsonResultEntity queryReportEntity(JSONObject jsonObject) { - JimuReportEntity entity = getData("jsonStr", jsonObject, JimuReportEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - entity = reportManageDao.queryReportEntity(entity); - if (entity == null) { - return BaseResult.getFailureMessageEntity("获取报表失败"); - } - return BaseResult.getSuccessMessageEntity("获取报表成功", entity); + } - } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 权限查询 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity jurisdiction(JSONObject jsonObject) { + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 权限查询 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity jurisdiction(JSONObject jsonObject) { - return null; - } + return null; + } - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 保存权限查询 - * @Date 2:37 下午 2024/3/27 - **/ - @Override - public JsonResultEntity saveJurisdiction(JSONObject jsonObject) { + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 保存权限查询 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity saveJurisdiction(JSONObject jsonObject) { - return null; - } + return null; + } } diff --git a/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java b/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java index 693c62e5..b88c5880 100644 --- a/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java +++ b/service/src/main/java/com/hzya/frame/serviceUtil/DsDataSourceUtil.java @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException; import com.hzya.frame.datasource.DataSourceUtilProperties; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; +import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; import com.hzya.frame.sysnew.application.entity.SysApplicationDatasourceDto; import com.hzya.frame.util.AESUtil; import org.slf4j.Logger; @@ -24,21 +24,20 @@ public class DsDataSourceUtil { @Resource private DataSource dataSource; - public void addDataSource(SysDataSourceEntity sysDataSourceVo) throws Exception { + public void addDataSource(SysApplicationDatabaseEntity sysDataSourceVo) throws Exception { DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource; JSONObject defaultDataSourceProperties = new JSONObject(); defaultDataSourceProperties.put("datasource_code", sysDataSourceVo.getSourceCode()); defaultDataSourceProperties.put("source_url", sysDataSourceVo.getSourceUrl()); defaultDataSourceProperties.put("source_type", sysDataSourceVo.getSourceTypeName()); defaultDataSourceProperties.put("login_name", sysDataSourceVo.getLoginName()); - defaultDataSourceProperties.put("password", sysDataSourceVo.getPassword()); + defaultDataSourceProperties.put("password", AESUtil.decrypt(sysDataSourceVo.getPassword())); defaultDataSourceProperties.put("db_name", sysDataSourceVo.getDbName()); logger.info("***初始化数据源-{}:*********", sysDataSourceVo.getSourceName()); DruidDataSource dataSource = createDefaultDataSource(defaultDataSourceProperties); ds.addDataSource(sysDataSourceVo.getSourceCode(), dataSource); logger.info("***初始化数据源-{}成功:*********", sysDataSourceVo.getSourceName()); } - /** * @param code * @return boolean @@ -57,16 +56,16 @@ public class DsDataSourceUtil { } /** - * @param sysDataSourceVo + * @param sysApplicationDatabaseEntity * @return boolean * @Author lvleigang * @Description 修改数据源 * @Date 11:40 上午 2023/9/6 **/ - public void editDataSource(SysDataSourceEntity sysDataSourceVo) throws Exception { + public void editDataSource(SysApplicationDatabaseEntity sysApplicationDatabaseEntity) throws Exception { //先删除后添加 - removeDataSource(sysDataSourceVo.getSourceCode()); - addDataSource(sysDataSourceVo); + removeDataSource(sysApplicationDatabaseEntity.getSourceCode()); + addDataSource(sysApplicationDatabaseEntity); } diff --git a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml index 67e6d489..36518c9d 100644 --- a/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/contrastTask/entity/SysContrastTaskEntity.xml @@ -161,7 +161,7 @@ + keyProperty=""> insert into sys_contrast_task( id , @@ -209,7 +209,7 @@ ) - + insert into sys_contrast_task(id, service_name, left_app_id, left_api_id, right_app_id, right_api_id, task_status, task_msg, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, match_mode, sts) @@ -220,7 +220,7 @@ - + insert into sys_contrast_task(id, service_name, left_app_id, left_api_id, right_app_id, right_api_id, task_status, task_msg, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, match_mode) values diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/ISysDataSourceDao.java b/service/src/main/java/com/hzya/frame/sys/dataSource/dao/ISysDataSourceDao.java deleted file mode 100644 index acfcaf47..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/ISysDataSourceDao.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hzya.frame.sys.dataSource.dao; - -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.basedao.dao.IBaseDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; - -import java.util.List; - -/** - * 数据源表(sys_data_source: table)表数据库访问层 - * - * @author makejava - * @since 2023-09-05 16:07:01 - */ -public interface ISysDataSourceDao extends IBaseDao { - - List queryVoList(SysDataSourceEntity entity); - int queryVoList_COUNT(SysDataSourceEntity entity); - - Integer entity_count_not_id(SysDataSourceEntity checkEntity); - - List queryDSBase(SysDataSourceEntity entity); -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/impl/SysDataSourceDaoImpl.java b/service/src/main/java/com/hzya/frame/sys/dataSource/dao/impl/SysDataSourceDaoImpl.java deleted file mode 100644 index 0f9948f1..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/dao/impl/SysDataSourceDaoImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.hzya.frame.sys.dataSource.dao.impl; - -import com.baomidou.dynamic.datasource.annotation.DS; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; -import org.springframework.stereotype.Repository; -import com.hzya.frame.basedao.dao.MybatisGenericDao; - -import java.util.List; - -/** - * 数据源表(SysDataSource)表数据库访问层 - * - * @author makejava - * @since 2023-09-05 16:07:03 - */ -@Repository(value = "SysDataSourceDaoImpl") -public class SysDataSourceDaoImpl extends MybatisGenericDao implements ISysDataSourceDao{ - - - @DS("master") - @Override - public List queryVoList(SysDataSourceEntity entity) { - List o = (List) super.selectList(getSqlIdPrifx() + "queryVoList", entity); - return o; - } - @Override - public int queryVoList_COUNT(SysDataSourceEntity entity) { - int o = (int) super.selectOne(getSqlIdPrifx() + "queryVoList_COUNT", entity); - return o; - } - - @Override - public Integer entity_count_not_id(SysDataSourceEntity entity) { - Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "entity_count_not_id", entity); - return o; - } - - @DS("master") - @Override - public List queryDSBase(SysDataSourceEntity entity) { - List o = (List) super.selectList(getSqlIdPrifx() + "queryDSBase", entity); - return o; - } -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.java b/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.java deleted file mode 100644 index d830b13b..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.hzya.frame.sys.dataSource.entity; - -import java.util.Date; -import com.hzya.frame.web.entity.BaseEntity; -/** - * 数据源表(SysDataSource)实体类 - * - * @author makejava - * @since 2023-09-05 16:07:06 - */ -public class SysDataSourceEntity extends BaseEntity { - - /** 数据源唯一编码 */ - private String sourceCode; - /** 数据源名称 */ - private String sourceName; - /** ip */ - private String sourceIp; - /** 端口 */ - private String sourcePort; - /** 数据库名称 */ - private String dbName; - /** 数据源类型 1oracle 2sqlsever 3mysql */ - private String sourceType; - /** 登录名 */ - private String loginName; - /** 密码 */ - private String password; - /** 选择oracle下服务名称 */ - private String serviceName; - /** 使用状态1启用0锁定 */ - private Integer useState; - /** 数据源状态 1校验成功0校验失败 */ - private String dataState; - - public String getSourceCode() { - return sourceCode; - } - - public void setSourceCode(String sourceCode) { - this.sourceCode = sourceCode; - } - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getSourceIp() { - return sourceIp; - } - - public void setSourceIp(String sourceIp) { - this.sourceIp = sourceIp; - } - - public String getSourcePort() { - return sourcePort; - } - - public void setSourcePort(String sourcePort) { - this.sourcePort = sourcePort; - } - - public String getDbName() { - return dbName; - } - - public void setDbName(String dbName) { - this.dbName = dbName; - } - - public String getSourceType() { - return sourceType; - } - - public void setSourceType(String sourceType) { - this.sourceType = sourceType; - } - - public String getLoginName() { - return loginName; - } - - public void setLoginName(String loginName) { - this.loginName = loginName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public Integer getUseState() { - return useState; - } - - public void setUseState(Integer useState) { - this.useState = useState; - } - public String getSourceUrl() { - StringBuffer sourceUrl = new StringBuffer(); - if(sourceType != null){ - switch (sourceType) { - case "1": //oracle - //jdbc:oracle:thin:@60.204.132.91:1521:ORCL - sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName); - break; - case "2": //sqlsever - //jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true - sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true"); - break; - case "3": //mysql - //jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true - sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true"); - break; - case "4": //dm - //jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8 - sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8"); - break; - default: - } - } - return sourceUrl.toString(); - } - public String getSourceTypeName() { - String sourceTypeName = null; - if(sourceType != null){ - switch (sourceType) { - case "1": //oracle - sourceTypeName = "oracle"; - break; - case "2": //sqlsever - sourceTypeName = "sqlServer"; - break; - case "3": //mysql - sourceTypeName = "mysql"; - break; - default: - } - } - - return sourceTypeName; - } - - public String getDataState() { - return dataState; - } - - public void setDataState(String dataState) { - this.dataState = dataState; - } -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.xml b/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.xml deleted file mode 100644 index 54bbc98d..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceEntity.xml +++ /dev/null @@ -1,484 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - id - ,source_code - ,source_name - ,source_ip - ,source_port - ,db_name - ,source_type - ,login_name - ,password - ,service_name - ,use_state - ,data_state - ,sorts - ,create_user_id - ,create_time - ,modify_user_id - ,modify_time - ,sts - ,org_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into sys_data_source( - - id , - source_code , - source_name , - source_ip , - source_port , - db_name , - source_type , - login_name , - password , - service_name , - use_state , - data_state , - sorts , - create_user_id , - create_time , - modify_user_id , - modify_time , - sts , - org_id , - sorts, - sts, - - )values( - - #{id} , - #{sourceCode} , - #{sourceName} , - #{sourceIp} , - #{sourcePort} , - #{dbName} , - #{sourceType} , - #{loginName} , - #{password} , - #{serviceName} , - #{useState} , - #{dataState} , - #{sorts} , - #{create_user_id} , - #{create_time} , - #{modify_user_id} , - #{modify_time} , - #{sts} , - #{org_id} , - (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_data_source a WHERE a.sts - = 'Y' ), - - 'Y', - - ) - - - - insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name, - password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, - sts) - values - - (#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, - 'Y') - - - - - insert into sys_data_source(source_code, source_name, source_ip, source_port, db_name, source_type, login_name, - password, service_name, use_state, data_state, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) - values - - (#{entity.sourceCode},#{entity.sourceName},#{entity.sourceIp},#{entity.sourcePort},#{entity.dbName},#{entity.sourceType},#{entity.loginName},#{entity.password},#{entity.serviceName},#{entity.useState},#{entity.dataState},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) - - on duplicate key update - source_code = values(source_code), - source_name = values(source_name), - source_ip = values(source_ip), - source_port = values(source_port), - db_name = values(db_name), - source_type = values(source_type), - login_name = values(login_name), - password = values(password), - service_name = values(service_name), - use_state = values(use_state), - data_state = values(data_state), - sorts = values(sorts), - create_user_id = values(create_user_id), - create_time = values(create_time), - modify_user_id = values(modify_user_id), - modify_time = values(modify_time), - sts = values(sts), - org_id = values(org_id) - - - - update sys_data_source set - - source_code = #{sourceCode}, - source_name = #{sourceName}, - source_ip = #{sourceIp}, - source_port = #{sourcePort}, - db_name = #{dbName}, - source_type = #{sourceType}, - login_name = #{loginName}, - password = #{password}, - service_name = #{serviceName}, - use_state = #{useState}, - data_state = #{dataState}, - sorts = #{sorts}, - create_user_id = #{create_user_id}, - create_time = #{create_time}, - modify_user_id = #{modify_user_id}, - modify_time = #{modify_time}, - sts = #{sts}, - org_id = #{org_id}, - - where id = #{id} - - - -update sys_data_source set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} -where id = #{id} - - - - update sys_data_source set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} - - and id = #{id} - and source_code = #{sourceCode} - and source_name = #{sourceName} - and source_ip = #{sourceIp} - and source_port = #{sourcePort} - and db_name = #{dbName} - and source_type = #{sourceType} - and login_name = #{loginName} - and password = #{password} - and service_name = #{serviceName} - and use_state = #{useState} - and data_state = #{dataState} - and sorts = #{sorts} - and sts = #{sts} - and sts='Y' - - - - - delete from sys_data_source where id = #{id} - - - - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceVo.java b/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceVo.java deleted file mode 100644 index ed00d0d2..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/entity/SysDataSourceVo.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.hzya.frame.sys.dataSource.entity; - - -import com.hzya.frame.web.exception.BaseSystemException; - -public class SysDataSourceVo { - - /** 主键ID */ - private String id; - /** 数据源编码 */ - private String sourceCode; - /** 数据源名称 */ - private String sourceName; - /** ip */ - private String sourceIp; - /** 端口 */ - private String sourcePort; - /** 数据库名称 */ - private String dbName; - /** 数据源类型 1oracle 2sqlsever 3mysql 4dm*/ - private String sourceType; - /** 登录名 */ - private String loginName; - /** 密码 */ - private String password; - /** 选择oracle下服务名称 */ - private String serviceName; - /** 使用状态1启用0锁定 */ - private Integer useState; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getSourceCode() { - return sourceCode; - } - - public void setSourceCode(String sourceCode) { - this.sourceCode = sourceCode; - } - - public String getSourceName() { - return sourceName; - } - - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getSourceIp() { - return sourceIp; - } - - public void setSourceIp(String sourceIp) { - this.sourceIp = sourceIp; - } - - public String getSourcePort() { - return sourcePort; - } - - public void setSourcePort(String sourcePort) { - this.sourcePort = sourcePort; - } - - public String getDbName() { - return dbName; - } - - public void setDbName(String dbName) { - this.dbName = dbName; - } - - public String getSourceType() { - return sourceType; - } - - public void setSourceType(String sourceType) { - this.sourceType = sourceType; - } - - public String getLoginName() { - return loginName; - } - - public void setLoginName(String loginName) { - this.loginName = loginName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public Integer getUseState() { - return useState; - } - - public void setUseState(Integer useState) { - this.useState = useState; - } - - public String getSourceUrl() { - StringBuffer sourceUrl = new StringBuffer(); - switch (sourceType) { - case "1": //oracle - //jdbc:oracle:thin:@60.204.132.91:1521:ORCL - sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName); - break; - case "2": //sqlsever - //jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true - sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true"); - break; - case "3": //mysql - //jdbc:mysql://hzya.ufyct.com:9096/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false - sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false"); - break; - case "4": //dm - //jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8 - sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8"); - break; - default: - } - return sourceUrl.toString(); - } - public String getSourceTypeName() { - String sourceTypeName = null; - switch (sourceType) { - case "1": //oracle - sourceTypeName = "oracle"; - break; - case "2": //sqlsever - sourceTypeName = "sqlServer"; - break; - case "3": //mysql - sourceTypeName = "mysql"; - break; - case "4": //mysql - sourceTypeName = "dm"; - break; - default: - } - return sourceTypeName; - } -} - diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/service/ISysDataSourceService.java b/service/src/main/java/com/hzya/frame/sys/dataSource/service/ISysDataSourceService.java deleted file mode 100644 index 841841a5..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/service/ISysDataSourceService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.hzya.frame.sys.dataSource.service; - -import com.alibaba.fastjson.JSONObject; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.basedao.service.IBaseService; -import com.hzya.frame.web.entity.JsonResultEntity; - -/** - * 数据源表(SysDataSource)表服务接口 - * - * @author makejava - * @since 2023-09-05 16:07:10 - */ -public interface ISysDataSourceService extends IBaseService{ - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity queryList(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity queryPage(JSONObject jsonObject); - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity queryEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 新增数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity addEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 修改数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity editEntity(JSONObject jsonObject); - - /** - * @param jsonObject - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除数据 - * @Date 2:18 下午 2023/7/17 - **/ - JsonResultEntity deleteEntity(JSONObject jsonObject); - /** - * @Author lvleigang - * @Description 数据源测试接口 测试当前页面数据源是否配置正确 - * @Date 2:08 下午 2023/9/23 - * @param jsonObject - * @return - **/ - JsonResultEntity testDatabase(JSONObject jsonObject); -} diff --git a/service/src/main/java/com/hzya/frame/sys/dataSource/service/impl/SysDataSourceServiceImpl.java b/service/src/main/java/com/hzya/frame/sys/dataSource/service/impl/SysDataSourceServiceImpl.java deleted file mode 100644 index 504cca64..00000000 --- a/service/src/main/java/com/hzya/frame/sys/dataSource/service/impl/SysDataSourceServiceImpl.java +++ /dev/null @@ -1,256 +0,0 @@ -package com.hzya.frame.sys.dataSource.service.impl; - -import cn.dev33.satoken.stp.StpUtil; -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.hzya.frame.serviceUtil.DsDataSourceUtil; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; -import com.hzya.frame.sys.dataSource.service.ISysDataSourceService; -import com.hzya.frame.sysnew.application.entity.SysApplicationDatasourceDto; -import com.hzya.frame.util.AESUtil; -import com.hzya.frame.uuid.UUIDUtils; -import com.hzya.frame.web.entity.BaseResult; -import com.hzya.frame.web.entity.JsonResultEntity; -import org.springframework.stereotype.Service; -import org.springframework.beans.factory.annotation.Autowired; -import javax.annotation.Resource; -import com.hzya.frame.basedao.service.impl.BaseService; - -import java.util.Date; -import java.util.List; - -/** - * 数据源表(SysDataSource)表服务实现类 - * - * @author makejava - * @since 2023-09-05 16:07:13 - */ -@Service(value = "sysDataSourceService") -public class SysDataSourceServiceImpl extends BaseService implements ISysDataSourceService { - - private ISysDataSourceDao sysDataSourceDao; - @Resource - private DsDataSourceUtil dsDataSourceUtil; - - @Autowired - public void setSysDataSourceDao(ISysDataSourceDao dao) { - this.sysDataSourceDao = dao; - this.dao = dao; - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity queryList(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - List sysDataSourceEntities = sysDataSourceDao.queryVoList(entity); - return BaseResult.getSuccessMessageEntity("查询数据成功", sysDataSourceEntities); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 查询列表 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity queryPage(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - //判断分页 - if(entity == null || entity.getPageNum() == null || entity.getPageSize() == null){ - return BaseResult.getFailureMessageEntity("分页查询参数不存在"); - } - PageHelper.startPage(entity.getPageNum(), entity.getPageSize()); - List sysDataSourceEntities = sysDataSourceDao.queryVoList(entity); - if(sysDataSourceEntities != null && sysDataSourceEntities.size() > 0){ - for (int i = 0; i < sysDataSourceEntities.size(); i++) { - sysDataSourceEntities.get(i).setPassword(AESUtil.decrypt(sysDataSourceEntities.get(i).getPassword())); - } - } - PageInfo pageInfo = new PageInfo(sysDataSourceEntities); - return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 获取数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity queryEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - //判断分页 - if(entity == null || entity.getId() == null || "".equals(entity.getId())){ - return BaseResult.getFailureMessageEntity("请先传递请求主键"); - } - SysDataSourceEntity sysDataSourceEntity = sysDataSourceDao.queryOne(entity); - sysDataSourceEntity.setPassword(AESUtil.decrypt(sysDataSourceEntity.getPassword())); - return BaseResult.getSuccessMessageEntity("查询数据成功", sysDataSourceEntity); - } - - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 新增数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity addEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - if(entity == null){ - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if(entity.getSourceName() == null || "".equals(entity.getSourceName())){ - return BaseResult.getFailureMessageEntity("请先输入数据源名称"); - } - if(entity.getSourceCode() == null || "".equals(entity.getSourceCode())){ - return BaseResult.getFailureMessageEntity("请先输入数据源编码"); - } - SysDataSourceEntity checkEntity = new SysDataSourceEntity(); - checkEntity.setSts("Y"); - checkEntity.setSourceCode(entity.getSourceCode()); - int checkCount = sysDataSourceDao.getCount(checkEntity); - if(checkCount > 0){ - return BaseResult.getFailureMessageEntity("数据源编码已存在"); - } - setCreate(entity); - if(entity.getUseState() == 1){ - try { - dsDataSourceUtil.addDataSource(entity); - entity.setDataState("1"); - } catch (Exception e) { - entity.setDataState("0"); - //return BaseResult.getFailureMessageEntity("初始化数据源失败,请检查数据源配置是否正确"); - } - } - entity.setPassword(AESUtil.encrypt(entity.getPassword())); - sysDataSourceDao.save(entity); - return BaseResult.getSuccessMessageEntity("保存数据源成功",entity.getId()); - } - private void setCreate(SysDataSourceEntity entity) { - entity.setId(UUIDUtils.getUUID()); - entity.setSts("Y"); - entity.setCreate_user_id(StpUtil.getLoginIdAsString()); - entity.setModify_user_id(StpUtil.getLoginIdAsString()); - entity.setCreate_time(new Date()); - entity.setModify_time(new Date()); - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 修改数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity editEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - if(entity == null){ - return BaseResult.getFailureMessageEntity("参数不允许为空"); - } - if(entity.getId() == null || "".equals(entity.getId())){ - return BaseResult.getFailureMessageEntity("系统错误"); - } - if(entity.getSourceName() == null || "".equals(entity.getSourceName())){ - return BaseResult.getFailureMessageEntity("请先输入数据源名称"); - } - if(entity.getSourceCode() == null || "".equals(entity.getSourceCode())){ - return BaseResult.getFailureMessageEntity("请先输入数据源编码"); - } - SysDataSourceEntity checkEntity = new SysDataSourceEntity(); - checkEntity.setSts("Y"); - checkEntity.setId(entity.getId()); - checkEntity.setSourceCode(entity.getSourceCode()); - int checkCount = sysDataSourceDao.entity_count_not_id(checkEntity); - if(checkCount > 0){ - return BaseResult.getFailureMessageEntity("接口编码已存在"); - } - entity.setModify_user_id(StpUtil.getLoginIdAsString()); - entity.setModify_time(new Date()); - entity.setSts("Y"); - if(entity.getUseState() == 1){ - try { - dsDataSourceUtil.editDataSource(entity); - } catch (Exception e) { - //return BaseResult.getSuccessMessageEntity("修改数据源失败,请检查数据源配置是否正确"); - } - }else { - try { - dsDataSourceUtil.removeDataSource(entity.getSourceCode()); - } catch (Exception e) { - return BaseResult.getSuccessMessageEntity("修改数据源失败"); - } - } - if(entity.getPassword() != null ){ - entity.setPassword(AESUtil.encrypt(entity.getPassword())); - } - sysDataSourceDao.update(entity); - return BaseResult.getSuccessMessageEntity("修改数据源成功",entity.getId()); - - } - /** - * @param object - * @return - * @Author lvleigang - * @Description 数据源测试接口 测试当前页面数据源是否配置正确 - * @Date 2:08 下午 2023/9/23 - **/ - @Override - public JsonResultEntity testDatabase(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - if (entity == null) { - return BaseResult.getFailureMessageEntity("系统错误"); - } - SysApplicationDatasourceDto sysApplicationDatasourceDto = new SysApplicationDatasourceDto(); - sysApplicationDatasourceDto.setSourceType(entity.getSourceType()); - sysApplicationDatasourceDto.setSourceUrl(entity.getSourceUrl()); - sysApplicationDatasourceDto.setLoginName(entity.getLoginName()); - sysApplicationDatasourceDto.setPassword(entity.getPassword()); - if (dsDataSourceUtil.testConnection(sysApplicationDatasourceDto)) { - return BaseResult.getSuccessMessageEntity("测试连接数据源成功",true); - } else { - return BaseResult.getSuccessMessageEntity("测试连接数据源失败",false); - } - } - /** - * @param object - * @return com.hzya.frame.web.entity.JsonResultEntity - * @Author lvleigang - * @Description 删除数据 - * @Date 2:18 下午 2023/7/17 - **/ - @Override - public JsonResultEntity deleteEntity(JSONObject object) { - SysDataSourceEntity entity = getData("jsonStr", object, SysDataSourceEntity.class); - //判断编码是否重复 - if (entity == null) { - return BaseResult.getFailureMessageEntity("请先填写内容"); - } - if (entity.getId() == null || "".equals(entity.getId())) { - return BaseResult.getFailureMessageEntity("请先选择数据"); - } - SysDataSourceEntity deleteEntity = sysDataSourceDao.queryOne(entity); - //删除主表和明细表 - entity.setModify_user_id(StpUtil.getLoginIdAsString()); - entity.setModify_time(new Date()); - entity.setSts("Y"); - try { - dsDataSourceUtil.removeDataSource(deleteEntity.getSourceCode()); - } catch (Exception e) { - return BaseResult.getSuccessMessageEntity("删除数据源失败"); - } - sysDataSourceDao.logicRemoveMultiCondition(entity); - return BaseResult.getSuccessMessageEntity("删除成功"); - } -} diff --git a/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml b/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml index 514d0581..edea0765 100644 --- a/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/file/download/entity/FileDownloadEntity.xml @@ -179,7 +179,7 @@ 'Y' ) - + select last_insert_id() as id diff --git a/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml b/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml index 8863b52f..bd928cd1 100644 --- a/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/moduleNew/entity/SysModuleNewEntity.xml @@ -272,7 +272,7 @@ 'Y' ) - + select last_insert_id() as id diff --git a/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml b/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml index ef755315..e7435715 100644 --- a/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/serviceMethod/entity/SysServiceMethodEntity.xml @@ -120,7 +120,7 @@ - + insert into sys_service_method( id , @@ -156,7 +156,7 @@ ) - + insert into sys_service_method(service_key, service_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -164,7 +164,7 @@ - + insert into sys_service_method(service_key, service_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml b/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml index e6c368dc..3d57717c 100644 --- a/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/templateButton/entity/SysTemplateButtonEntity.xml @@ -169,8 +169,8 @@ + parameterType="com.hzya.frame.sys.templateButton.entity.SysTemplateButtonEntity" + > insert into sys_template_button( id , @@ -218,7 +218,7 @@ ) - + insert into sys_template_button(template_id, service_name, table_name, button_type, button_title, button_style, button_sort, button_icon, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -228,7 +228,7 @@ - + insert into sys_template_button(template_id, service_name, table_name, button_type, button_title, button_style, button_sort, button_icon, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml b/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml index 8faa1f95..b5771031 100644 --- a/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml +++ b/service/src/main/java/com/hzya/frame/sys/userTemplateButton/entity/SysUserTemplateButtonEntity.xml @@ -126,7 +126,7 @@ - + insert into sys_user_template_button( id , @@ -164,7 +164,7 @@ ) - + insert into sys_user_template_button(template_id, service_name, button_id, user_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -172,7 +172,7 @@ - + insert into sys_user_template_button(template_id, service_name, button_id, user_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java index e0fc5061..5218cabe 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java @@ -1,6 +1,11 @@ package com.hzya.frame.sysnew.application.api.entity; +import java.util.ArrayList; import java.util.Date; +import java.util.List; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.hzya.frame.web.entity.BaseEntity; /** * 应用api(SysApplicationApi)实体类 @@ -20,6 +25,8 @@ public class SysApplicationApiEntity extends BaseEntity { private String appId; /** api应用名称 */ private String appName; + /** api应用地址 **/ + private String appUrl; /** 目录 */ private String catalogueId; /** 目录名称 */ @@ -291,5 +298,46 @@ public class SysApplicationApiEntity extends BaseEntity { public void setReturnSuccessValue(String returnSuccessValue) { this.returnSuccessValue = returnSuccessValue; } + + public String getAppUrl() { + return appUrl; + } + + public void setAppUrl(String appUrl) { + this.appUrl = appUrl; + } + + public List getHeaderInValue() { + List jsonObjects = new ArrayList<>(); + if(headerIn != null && !"".equals(headerIn)){ + JSONArray headers = JSONArray.parseArray(headerIn); + if(headers != null && headers.size() > 0){ + for (int i = 0; i < headers.size(); i++) { + JSONObject object = new JSONObject(); + object.put(headers.getJSONObject(i).getString("parameterName"),headers.getJSONObject(i).getString("example")); + jsonObjects.add(object); + } + } + } + return jsonObjects; + } + + public String getQueryInValue() { + StringBuffer jsonObjects = new StringBuffer(); + if(queryIn != null && !"".equals(queryIn)){ + JSONArray querys = JSONArray.parseArray(queryIn); + if(querys != null && querys.size() > 0){ + for (int i = 0; i < querys.size(); i++) { + if(i != 0){ + jsonObjects.append("&"); + } + jsonObjects.append(querys.getJSONObject(i).getString("parameterName")); + jsonObjects.append("="); + jsonObjects.append(querys.getJSONObject(i).getString("example")); + } + } + } + return jsonObjects.toString(); + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml index d180eef9..0f46b8fa 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml @@ -10,6 +10,7 @@ + @@ -84,6 +85,7 @@ a.id, a.api_status, b.name as app_name, + b.interface_address as app_url, a.app_id, a.catalogue_id, c.name as catalogue_name, @@ -352,7 +354,7 @@ WHERE + > insert into sys_application_api( id , @@ -440,7 +442,7 @@ WHERE ) - + insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark, need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method, timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out, bean_name,return_msg,return_success_field,return_success_value, fun_name, extension_api, sorts, create_user_id, @@ -452,7 +454,7 @@ WHERE - + insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark, need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method, timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out,bean_name,return_msg,return_success_field,return_success_value,fun_name,extension_api, sorts, create_user_id, @@ -702,7 +704,7 @@ where id = #{id} - select a.id, a.catalogue_id AS catalogueId, @@ -744,6 +746,48 @@ where id = #{id} order by a.sorts asc + - + insert into sys_application_api_auth_detail( id , @@ -170,7 +170,7 @@ ) - + insert into sys_application_api_auth_detail(app_id, catalogue_id, api_id, tripartite_system_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -178,7 +178,7 @@ - + insert into sys_application_api_auth_detail(app_id, catalogue_id, api_id, tripartite_system_id, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml index 6229a63d..820be8f6 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/apiPara/entity/SysApplicationApiParaEntity.xml @@ -132,7 +132,7 @@ - + insert into sys_application_api_para( id , @@ -170,7 +170,7 @@ ) - + insert into sys_application_api_para(app_id, interface_key, interface_value, interface_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) values @@ -178,7 +178,7 @@ - + insert into sys_application_api_para(app_id, interface_key, interface_value, interface_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml index d0d9e9fe..2aff6d2c 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/apiType/entity/SysApplicationApiTypeEntity.xml @@ -138,7 +138,7 @@ - + insert into sys_application_api_type( id , @@ -172,7 +172,7 @@ ) - + insert into sys_application_api_type(app_id, name, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) values @@ -180,7 +180,7 @@ - + insert into sys_application_api_type(app_id, name, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java index 110ab6e0..14806c32 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/ISysApplicationDatabaseDao.java @@ -1,15 +1,18 @@ package com.hzya.frame.sysnew.application.database.dao; import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; -import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.List; /** * 数据源表(sys_application_database: table)表数据库访问层 * * @author makejava - * @since 2023-09-25 11:46:27 + * @since 2024-06-16 21:49:26 */ public interface ISysApplicationDatabaseDao extends IBaseDao { + List queryDSBase(SysApplicationDatabaseEntity entity); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java index 332f2092..6b523995 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/dao/impl/SysApplicationDatabaseDaoImpl.java @@ -1,17 +1,26 @@ package com.hzya.frame.sysnew.application.database.dao.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao; import org.springframework.stereotype.Repository; import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + /** * 数据源表(SysApplicationDatabase)表数据库访问层 * * @author makejava - * @since 2023-09-25 11:46:31 + * @since 2024-06-16 21:49:30 */ @Repository(value = "SysApplicationDatabaseDaoImpl") public class SysApplicationDatabaseDaoImpl extends MybatisGenericDao implements ISysApplicationDatabaseDao{ - + @DS("master") + @Override + public List queryDSBase(SysApplicationDatabaseEntity entity) { + List o = (List) super.selectList(getSqlIdPrifx() + "queryDSBase", entity); + return o; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java index 03aa04df..19aba575 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.java @@ -6,22 +6,30 @@ import com.hzya.frame.web.entity.BaseEntity; * 数据源表(SysApplicationDatabase)实体类 * * @author makejava - * @since 2023-09-25 11:46:34 + * @since 2024-06-16 21:49:31 */ public class SysApplicationDatabaseEntity extends BaseEntity { /** 应用id */ private String appId; + /** 数据源唯一编码 */ + private String sourceCode; + /** 数据源名称 */ + private String sourceName; /** 数据源类型(1、oracle 2、sqlServer3、mysql) */ private String sourceType; - /** 实例地址 */ - private String sourceUrl; - /** 账户 */ + /** ip */ + private String sourceIp; + /** 端口 */ + private String sourcePort; + /** 登录名 */ private String loginName; /** 密码 */ private String password; /** 库名 */ private String dbName; + /** 选择oracle下服务名称 */ + private String serviceName; /** 数据源是否启用(1、开启 2、关闭) */ private String dbStatus; @@ -34,6 +42,22 @@ public class SysApplicationDatabaseEntity extends BaseEntity { this.appId = appId; } + public String getSourceCode() { + return sourceCode; + } + + public void setSourceCode(String sourceCode) { + this.sourceCode = sourceCode; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + public String getSourceType() { return sourceType; } @@ -42,12 +66,20 @@ public class SysApplicationDatabaseEntity extends BaseEntity { this.sourceType = sourceType; } - public String getSourceUrl() { - return sourceUrl; + public String getSourceIp() { + return sourceIp; } - public void setSourceUrl(String sourceUrl) { - this.sourceUrl = sourceUrl; + public void setSourceIp(String sourceIp) { + this.sourceIp = sourceIp; + } + + public String getSourcePort() { + return sourcePort; + } + + public void setSourcePort(String sourcePort) { + this.sourcePort = sourcePort; } public String getLoginName() { @@ -74,6 +106,14 @@ public class SysApplicationDatabaseEntity extends BaseEntity { this.dbName = dbName; } + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + public String getDbStatus() { return dbStatus; } @@ -81,6 +121,52 @@ public class SysApplicationDatabaseEntity extends BaseEntity { public void setDbStatus(String dbStatus) { this.dbStatus = dbStatus; } + public String getSourceUrl() { + StringBuffer sourceUrl = new StringBuffer(); + if(sourceType != null){ + switch (sourceType) { + case "1": //oracle + //jdbc:oracle:thin:@60.204.132.91:1521:ORCL + sourceUrl.append("jdbc:oracle:thin:@").append(sourceIp).append(":").append(sourcePort).append(":").append(serviceName); + break; + case "2": //sqlsever + //jdbc:sqlserver://221.12.175.82:1433;DatabaseName=U8CLOUD;encrypt=false;trustServerCertificate=true + sourceUrl.append("jdbc:jtds:sqlserver://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append(";encrypt=false;trustServerCertificate=true"); + break; + case "3": //mysql + //jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true + sourceUrl.append("jdbc:mysql://").append(sourceIp).append(":").append(sourcePort).append("/").append(dbName).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true"); + break; + case "4": //dm + //jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&characterEncoding=UTF-8 + sourceUrl.append("jdbc:dm://").append(sourceIp).append(":").append(sourcePort).append("?schema=").append(dbName).append("&characterEncoding=UTF-8"); + break; + default: + } + } + return sourceUrl.toString(); + } + public String getSourceTypeName() { + String sourceTypeName = null; + if(sourceType != null){ + switch (sourceType) { + case "1": //oracle + sourceTypeName = "oracle"; + break; + case "2": //sqlsever + sourceTypeName = "sqlServer"; + break; + case "3": //mysql + sourceTypeName = "mysql"; + break; + case "4": //dm + sourceTypeName = "dm"; + break; + default: + } + } + return sourceTypeName; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml index 67637941..c9030192 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/entity/SysApplicationDatabaseEntity.xml @@ -5,44 +5,46 @@ + + - + + + - - - - + + + + id ,app_id + ,source_code + ,source_name ,source_type - ,source_url + ,source_ip + ,source_port ,login_name ,password ,db_name + ,service_name ,db_status ,sorts - ,org_id - ,sts - ,create_time ,create_user_id - ,modify_time + ,create_time ,modify_user_id + ,modify_time + ,sts + ,org_id - - - + insert into sys_application_database( id , app_id , + source_code , + source_name , source_type , - source_url , + source_ip , + source_port , login_name , password , db_name , + service_name , db_status , sorts , - org_id , - sts , - create_time , create_user_id , - modify_time , + create_time , modify_user_id , + modify_time , + sts , + org_id , sorts, sts, @@ -175,72 +197,82 @@ #{id} , #{appId} , + #{sourceCode} , + #{sourceName} , #{sourceType} , - #{sourceUrl} , + #{sourceIp} , + #{sourcePort} , #{loginName} , #{password} , #{dbName} , + #{serviceName} , #{dbStatus} , #{sorts} , - #{org_id} , - #{sts} , - #{create_time} , #{create_user_id} , - #{modify_time} , + #{create_time} , #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_database a WHERE a.sts = 'Y' ), 'Y', ) - - insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + + insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values - (#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + (#{entity.appId},#{entity.sourceCode},#{entity.sourceName},#{entity.sourceType},#{entity.sourceIp},#{entity.sourcePort},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.serviceName},#{entity.dbStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}, 'Y') - - insert into sys_application_database(app_id, source_type, source_url, login_name, password, db_name, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + + insert into sys_application_database(app_id, source_code, source_name, source_type, source_ip, source_port, login_name, password, db_name, service_name, db_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values - (#{entity.appId},#{entity.sourceType},#{entity.sourceUrl},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + (#{entity.appId},#{entity.sourceCode},#{entity.sourceName},#{entity.sourceType},#{entity.sourceIp},#{entity.sourcePort},#{entity.loginName},#{entity.password},#{entity.dbName},#{entity.serviceName},#{entity.dbStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id}) on duplicate key update app_id = values(app_id), + source_code = values(source_code), + source_name = values(source_name), source_type = values(source_type), - source_url = values(source_url), + source_ip = values(source_ip), + source_port = values(source_port), login_name = values(login_name), password = values(password), db_name = values(db_name), + service_name = values(service_name), db_status = values(db_status), - sorts = values(sorts), - org_id = values(org_id), - sts = values(sts), - create_time = values(create_time), create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), modify_time = values(modify_time), - modify_user_id = values(modify_user_id) + sts = values(sts), + org_id = values(org_id) update sys_application_database set app_id = #{appId}, + source_code = #{sourceCode}, + source_name = #{sourceName}, source_type = #{sourceType}, - source_url = #{sourceUrl}, + source_ip = #{sourceIp}, + source_port = #{sourcePort}, login_name = #{loginName}, password = #{password}, db_name = #{dbName}, + service_name = #{serviceName}, db_status = #{dbStatus}, - sorts = #{sorts}, - org_id = #{org_id}, - sts = #{sts}, - create_time = #{create_time}, - create_user_id = #{create_user_id}, - modify_time = #{modify_time}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, where id = #{id} @@ -255,21 +287,52 @@ update sys_application_database set sts= 'N' ,modify_time = #{modify_time},modi and id = #{id} and app_id = #{appId} + and source_code = #{sourceCode} + and source_name = #{sourceName} and source_type = #{sourceType} - and source_url = #{sourceUrl} + and source_ip = #{sourceIp} + and source_port = #{sourcePort} and login_name = #{loginName} and password = #{password} and db_name = #{dbName} + and service_name = #{serviceName} and db_status = #{dbStatus} and sorts = #{sorts} - and sts = #{sts} - and sts='Y' + and sts = #{sts} + and sts='Y' delete from sys_application_database where id = #{id} - + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java index 9f4ad126..c1d3776b 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/ISysApplicationDatabaseService.java @@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService; * 数据源表(SysApplicationDatabase)表服务接口 * * @author makejava - * @since 2023-09-25 11:46:39 + * @since 2024-06-16 21:49:32 */ public interface ISysApplicationDatabaseService extends IBaseService{ } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java index 1f799bc6..881a9151 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/database/service/impl/SysApplicationDatabaseServiceImpl.java @@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService; * 数据源表(SysApplicationDatabase)表服务实现类 * * @author makejava - * @since 2023-09-25 11:46:42 + * @since 2024-06-16 21:49:33 */ @Service(value = "sysApplicationDatabaseService") public class SysApplicationDatabaseServiceImpl extends BaseService implements ISysApplicationDatabaseService { diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationDto.java b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationDto.java index 5a797b9a..e619ae21 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationDto.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationDto.java @@ -59,7 +59,8 @@ public class SysApplicationDto { private String systemAddress; //api接口参数表 private List apiParas; - + /** 系统类型 1、致远OA 2、用友U8C 3、用友BIP */ + private String appType; //数据源 private SysApplicationDatabaseEntity databaseEntity; private Integer pageNum; @@ -262,5 +263,13 @@ public class SysApplicationDto { public void setSystemAddress(String systemAddress) { this.systemAddress = systemAddress; } + + public String getAppType() { + return appType; + } + + public void setAppType(String appType) { + this.appType = appType; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java index 0e9a8131..3eb1ff34 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.java @@ -43,6 +43,8 @@ public class SysApplicationEntity extends BaseEntity { /** 数据源是否启用(1、开启 2、关闭) */ private String dbStatus; + /** 系统类型 1、致远OA 2、用友U8C 3、用友BIP */ + private String appType; /** appid */ private Integer appId; /** ip白名单 */ @@ -191,5 +193,13 @@ public class SysApplicationEntity extends BaseEntity { public void setSystemAddress(String systemAddress) { this.systemAddress = systemAddress; } + + public String getAppType() { + return appType; + } + + public void setAppType(String appType) { + this.appType = appType; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml index 2187fa57..45b65b4d 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationEntity.xml @@ -22,6 +22,7 @@ + @@ -51,7 +52,8 @@ ,interface_address ,interface_status ,db_status - ,sorts + ,app_type + ,sorts ,org_id ,sts ,create_time @@ -90,6 +92,7 @@ and interface_address = #{interfaceAddress} and interface_status = #{interfaceStatus} and db_status = #{dbStatus} + and app_type = #{appType} and sorts = #{sorts} and org_id = #{org_id} and sts = #{sts} @@ -126,6 +129,7 @@ and interface_address = #{interfaceAddress} and interface_status = #{interfaceStatus} and db_status = #{dbStatus} + and app_type = #{appType} and sorts = #{sorts} and org_id = #{org_id} and sts = #{sts} @@ -164,6 +168,7 @@ and interface_address like concat('%',#{interfaceAddress},'%') and interface_status like concat('%',#{interfaceStatus},'%') and db_status like concat('%',#{dbStatus},'%') + and app_type like concat('%',#{appType},'%') and sorts like concat('%',#{sorts},'%') and org_id like concat('%',#{org_id},'%') and sts like concat('%',#{sts},'%') @@ -202,6 +207,7 @@ or interface_address = #{interfaceAddress} or interface_status = #{interfaceStatus} or db_status = #{dbStatus} + or app_type = #{appType} or sorts = #{sorts} or org_id = #{org_id} or sts = #{sts} @@ -216,7 +222,7 @@ - + insert into sys_application( id , @@ -239,6 +245,7 @@ interface_address , interface_status , db_status , + app_type , sorts , org_id , sts , @@ -271,6 +278,7 @@ #{interfaceAddress} , #{interfaceStatus} , #{dbStatus} , + #{appType} , #{sorts} , #{org_id} , #{sts} , @@ -284,19 +292,19 @@ ) - - insert into sys_application(app_logo, app_status, name, version_number, app_id, system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) + + insert into sys_application(app_logo, app_status, name, version_number, app_id, system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status,app_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) values - (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') + (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.appType},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') - - insert into sys_application(app_logo, app_status, name, version_number,app_id,system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) + + insert into sys_application(app_logo, app_status, name, version_number,app_id,system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status,app_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) values - (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) + (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.appType},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) on duplicate key update app_logo = values(app_logo), @@ -317,6 +325,7 @@ interface_address = values(interface_address), interface_status = values(interface_status), db_status = values(db_status), + app_type = values(app_type), sorts = values(sorts), org_id = values(org_id), sts = values(sts), @@ -346,6 +355,7 @@ update sys_application set interface_address = #{interfaceAddress}, interface_status = #{interfaceStatus}, db_status = #{dbStatus}, + app_type = #{appType}, sorts = #{sorts}, org_id = #{org_id}, sts = #{sts}, @@ -384,6 +394,7 @@ update sys_application set sts= 'N' ,modify_time = #{modify_time},modify_user_i and interface_address = #{interfaceAddress} and interface_status = #{interfaceStatus} and db_status = #{dbStatus} + and app_type = #{appType} and sorts = #{sorts} and sts = #{sts} and sts='Y' @@ -411,6 +422,7 @@ update sys_application set sts= 'N' ,modify_time = #{modify_time},modify_user_i ,a.app_introduction as appIntroduction ,a.interface_status as interfaceStatus ,a.db_status as dbStatus + ,a.app_type as appType from sys_application a and a.affiliation_field = #{affiliationField} diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationVo.java b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationVo.java index cb3bf8a6..2d6670ef 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationVo.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysApplicationVo.java @@ -37,6 +37,8 @@ public class SysApplicationVo { /** 应用是否启用(1、启用 2、停用) */ private String appStatus; + /** 系统类型 1、致远OA 2、用友U8C 3、用友BIP */ + private String appType; public String getId() { return id; } @@ -148,5 +150,13 @@ public class SysApplicationVo { public void setSystemAddress(String systemAddress) { this.systemAddress = systemAddress; } + + public String getAppType() { + return appType; + } + + public void setAppType(String appType) { + this.appType = appType; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysExtensionApiEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysExtensionApiEntity.java index 90c7ed64..baff9a85 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysExtensionApiEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/entity/SysExtensionApiEntity.java @@ -1,6 +1,8 @@ package com.hzya.frame.sysnew.application.entity; +import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity; + import java.util.Map; public class SysExtensionApiEntity { @@ -11,6 +13,14 @@ public class SysExtensionApiEntity { private String querys; /** body */ private String bodys; + //byteBodys + private byte[] byteBodys; + /** 发送方应用 */ + private SysApplicationEntity sendApp; + /** 接收方应用 */ + private SysApplicationEntity receiveApp; + /** 接收方api */ + private SysApplicationApiEntity receiveApi; public Map getHeaders() { return headers; @@ -35,5 +45,37 @@ public class SysExtensionApiEntity { public void setBodys(String bodys) { this.bodys = bodys; } + + public SysApplicationEntity getSendApp() { + return sendApp; + } + + public void setSendApp(SysApplicationEntity sendApp) { + this.sendApp = sendApp; + } + + public SysApplicationEntity getReceiveApp() { + return receiveApp; + } + + public void setReceiveApp(SysApplicationEntity receiveApp) { + this.receiveApp = receiveApp; + } + + public SysApplicationApiEntity getReceiveApi() { + return receiveApi; + } + + public void setReceiveApi(SysApplicationApiEntity receiveApi) { + this.receiveApi = receiveApi; + } + + public byte[] getByteBodys() { + return byteBodys; + } + + public void setByteBodys(byte[] byteBodys) { + this.byteBodys = byteBodys; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml index 1338856a..cff4a897 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/plugin/entity/SysApplicationPluginEntity.xml @@ -150,7 +150,7 @@ - + insert into sys_application_plugin( id , @@ -194,7 +194,7 @@ ) - + insert into sys_application_plugin(app_id, plugin_name, plugin_code, plugin_version, plugin_remark, release_date, plugin_status, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -202,7 +202,7 @@ - + insert into sys_application_plugin(app_id, plugin_name, plugin_code, plugin_version, plugin_remark, release_date, plugin_status, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/dao/ISysApplicationScriptDao.java b/service/src/main/java/com/hzya/frame/sysnew/application/script/dao/ISysApplicationScriptDao.java new file mode 100644 index 00000000..7fb5725a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/dao/ISysApplicationScriptDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.sysnew.application.script.dao; + +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +/** + * 脚本表(sys_application_script: table)表数据库访问层 + * + * @author makejava + * @since 2024-06-17 11:07:21 + */ +public interface ISysApplicationScriptDao extends IBaseDao { + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/dao/impl/SysApplicationScriptDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/script/dao/impl/SysApplicationScriptDaoImpl.java new file mode 100644 index 00000000..eba77367 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/dao/impl/SysApplicationScriptDaoImpl.java @@ -0,0 +1,17 @@ +package com.hzya.frame.sysnew.application.script.dao.impl; + +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +/** + * 脚本表(SysApplicationScript)表数据库访问层 + * + * @author makejava + * @since 2024-06-17 11:07:22 + */ +@Repository(value = "SysApplicationScriptDaoImpl") +public class SysApplicationScriptDaoImpl extends MybatisGenericDao implements ISysApplicationScriptDao{ + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/entity/SysApplicationScriptEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/script/entity/SysApplicationScriptEntity.java new file mode 100644 index 00000000..2502fd7e --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/entity/SysApplicationScriptEntity.java @@ -0,0 +1,116 @@ +package com.hzya.frame.sysnew.application.script.entity; + +import java.util.Date; +import com.hzya.frame.web.entity.BaseEntity; +/** + * 脚本表(SysApplicationScript)实体类 + * + * @author makejava + * @since 2024-06-17 11:07:22 + */ +public class SysApplicationScriptEntity extends BaseEntity { + + /** 应用id */ + private String appId; + /** 脚本名称 */ + private String scriptName; + /** 脚本编号 */ + private String scriptCode; + /** 脚本版本 */ + private String scriptVersion; + /** classname */ + private String className; + /** 脚本内容 */ + private String scriptData; + /** 描述 */ + private String scriptRemark; + /** 发布日期 */ + private Date releaseDate; + /** 启用停用(1启用2停用) */ + private String scriptStatus; + /** 公司id */ + private String companyId; + + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getScriptName() { + return scriptName; + } + + public void setScriptName(String scriptName) { + this.scriptName = scriptName; + } + + public String getScriptCode() { + return scriptCode; + } + + public void setScriptCode(String scriptCode) { + this.scriptCode = scriptCode; + } + + public String getScriptVersion() { + return scriptVersion; + } + + public void setScriptVersion(String scriptVersion) { + this.scriptVersion = scriptVersion; + } + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public String getScriptData() { + return scriptData; + } + + public void setScriptData(String scriptData) { + this.scriptData = scriptData; + } + + public String getScriptRemark() { + return scriptRemark; + } + + public void setScriptRemark(String scriptRemark) { + this.scriptRemark = scriptRemark; + } + + public Date getReleaseDate() { + return releaseDate; + } + + public void setReleaseDate(Date releaseDate) { + this.releaseDate = releaseDate; + } + + public String getScriptStatus() { + return scriptStatus; + } + + public void setScriptStatus(String scriptStatus) { + this.scriptStatus = scriptStatus; + } + + public String getCompanyId() { + return companyId; + } + + public void setCompanyId(String companyId) { + this.companyId = companyId; + } + +} + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/entity/SysApplicationScriptEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/script/entity/SysApplicationScriptEntity.xml new file mode 100644 index 00000000..2ce87f67 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/entity/SysApplicationScriptEntity.xml @@ -0,0 +1,304 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + id + ,app_id + ,script_name + ,script_code + ,script_version + ,class_name + ,script_data + ,script_remark + ,release_date + ,script_status + ,sorts + ,create_user_id + ,create_time + ,modify_user_id + ,modify_time + ,sts + ,org_id + ,company_id + + + + + + + + + + + + + + + + + + insert into sys_application_script( + + id , + app_id , + script_name , + script_code , + script_version , + class_name , + script_data , + script_remark , + release_date , + script_status , + sorts , + create_user_id , + create_time , + modify_user_id , + modify_time , + sts , + org_id , + company_id , + sts, + + )values( + + #{id} , + #{appId} , + #{scriptName} , + #{scriptCode} , + #{scriptVersion} , + CONCAT('g','_',LAST_INSERT_ID()) , + #{scriptData} , + #{scriptRemark} , + #{releaseDate} , + #{scriptStatus} , + #{sorts} , + #{create_user_id} , + #{create_time} , + #{modify_user_id} , + #{modify_time} , + #{sts} , + #{org_id} , + #{companyId} , + 'Y', + + ) + + + + insert into sys_application_script(app_id, script_name, script_code, script_version, class_name, script_data, script_remark, release_date, script_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) + values + + (#{entity.appId},#{entity.scriptName},#{entity.scriptCode},#{entity.scriptVersion},#{entity.className},#{entity.scriptData},#{entity.scriptRemark},#{entity.releaseDate},#{entity.scriptStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') + + + + + insert into sys_application_script(app_id, script_name, script_code, script_version, class_name, script_data, script_remark, release_date, script_status, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) + values + + (#{entity.appId},#{entity.scriptName},#{entity.scriptCode},#{entity.scriptVersion},#{entity.className},#{entity.scriptData},#{entity.scriptRemark},#{entity.releaseDate},#{entity.scriptStatus},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) + + on duplicate key update + app_id = values(app_id), + script_name = values(script_name), + script_code = values(script_code), + script_version = values(script_version), + class_name = values(class_name), + script_data = values(script_data), + script_remark = values(script_remark), + release_date = values(release_date), + script_status = values(script_status), + create_user_id = values(create_user_id), + create_time = values(create_time), + modify_user_id = values(modify_user_id), + modify_time = values(modify_time), + sts = values(sts), + org_id = values(org_id), + company_id = values(company_id) + + +update sys_application_script set + + app_id = #{appId}, + script_name = #{scriptName}, + script_code = #{scriptCode}, + script_version = #{scriptVersion}, + class_name = #{className}, + script_data = #{scriptData}, + script_remark = #{scriptRemark}, + release_date = #{releaseDate}, + script_status = #{scriptStatus}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId}, + +where id = #{id} + + + +update sys_application_script set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where id = #{id} + + + +update sys_application_script set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and id = #{id} + and app_id = #{appId} + and script_name = #{scriptName} + and script_code = #{scriptCode} + and script_version = #{scriptVersion} + and class_name = #{className} + and script_data = #{scriptData} + and script_remark = #{scriptRemark} + and release_date = #{releaseDate} + and script_status = #{scriptStatus} + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and sts='Y' + + + + + delete from sys_application_script where id = #{id} + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/service/ISysApplicationScriptService.java b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/ISysApplicationScriptService.java new file mode 100644 index 00000000..73d7588d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/ISysApplicationScriptService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.sysnew.application.script.service; + +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.basedao.service.IBaseService; +/** + * 脚本表(SysApplicationScript)表服务接口 + * + * @author makejava + * @since 2024-06-17 11:07:22 + */ +public interface ISysApplicationScriptService extends IBaseService{ +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/script/service/impl/SysApplicationScriptServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/impl/SysApplicationScriptServiceImpl.java new file mode 100644 index 00000000..59ef35e1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/application/script/service/impl/SysApplicationScriptServiceImpl.java @@ -0,0 +1,26 @@ +package com.hzya.frame.sysnew.application.script.service.impl; + +import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity; +import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao; +import com.hzya.frame.sysnew.application.script.service.ISysApplicationScriptService; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; +import com.hzya.frame.basedao.service.impl.BaseService; +/** + * 脚本表(SysApplicationScript)表服务实现类 + * + * @author makejava + * @since 2024-06-17 11:07:22 + */ +@Service(value = "sysApplicationScriptService") +public class SysApplicationScriptServiceImpl extends BaseService implements ISysApplicationScriptService { + + private ISysApplicationScriptDao sysApplicationScriptDao; + + @Autowired + public void setSysApplicationScriptDao(ISysApplicationScriptDao dao) { + this.sysApplicationScriptDao = dao; + this.dao = dao; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java b/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java index a4711b39..e1f3290a 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/service/ISysApplicationService.java @@ -357,4 +357,74 @@ public interface ISysApplicationService extends IBaseService 0) { sysApplicationDatabaseEntity = list.get(0); + sysApplicationDatabaseEntity.setPassword(AESUtil.decrypt(sysApplicationDatabaseEntity.getPassword())); } else { sysApplicationDatabaseEntity = null; } @@ -1725,6 +1735,9 @@ public class SysApplicationServiceImpl extends BaseService sysApplicationScriptEntities = sysApplicationScriptDao.queryByLike(entity); + PageInfo pageInfo = new PageInfo(sysApplicationScriptEntities); + return BaseResult.getSuccessMessageEntity("查询数据成功", pageInfo); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本查询接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity queryAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + List sysApplicationScriptEntities = sysApplicationScriptDao.queryByLike(entity); + return BaseResult.getSuccessMessageEntity("查询数据成功", sysApplicationScriptEntities); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本修改接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity saveAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getScriptCode() == null || "".equals(entity.getScriptCode())) { + return BaseResult.getFailureMessageEntity("请先输入脚本编号"); + } + if (entity.getScriptData() == null || "".equals(entity.getScriptData())) { + return BaseResult.getFailureMessageEntity("请先输入脚本内容"); + } + entity.setCreate(); + sysApplicationScriptDao.save(entity); + return BaseResult.getSuccessMessageEntity("保存脚本成功", entity.getId()); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本修改接口 + * @Date 2:09 下午 2023/9/23 + **/ + @Override + public JsonResultEntity updateAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getScriptCode() == null || "".equals(entity.getScriptCode())) { + return BaseResult.getFailureMessageEntity("请先输入脚本编号"); + } + if (entity.getScriptData() == null || "".equals(entity.getScriptData())) { + return BaseResult.getFailureMessageEntity("请先输入脚本内容"); + } + entity.setUpdate(); + sysApplicationScriptDao.update(entity); + return BaseResult.getSuccessMessageEntity("修改脚本成功"); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本删除接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity deleteAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + 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); + return BaseResult.getSuccessMessageEntity("删除脚本成功"); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 获取脚本接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity getAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + //查询接口 + SysApplicationScriptEntity sysApplicationScriptEntity = sysApplicationScriptDao.get(entity.getId()); + return BaseResult.getSuccessMessageEntity("查询数据成功", sysApplicationScriptEntity); + } + + /** + * @param object + * @return + * @Author lvleigang + * @Description 脚本启用停用接口 + * @Date 2:10 下午 2023/9/23 + **/ + @Override + public JsonResultEntity enableOrDisableAppScript(JSONObject object) { + SysApplicationScriptEntity entity = getData("jsonStr", object, SysApplicationScriptEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("参数不允许为空"); + } + if (entity.getId() == null || "".equals(entity.getId())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getScriptStatus() == null || "".equals(entity.getScriptStatus())) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + entity.setUpdate(); + sysApplicationScriptDao.update(entity); + if ("1".equals(entity.getScriptStatus())) {// 1启用2停用 + return BaseResult.getSuccessMessageEntity("启用成功"); + } else { + return BaseResult.getSuccessMessageEntity("停用成功"); + } + } + + @Override + public JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse) { + + //例如:A应用发送数据到中台,中台转发到B应用 + HttpServletRequest request = (HttpServletRequest) servletRequest; + String oldbodys = ServletUtil.getBody(servletRequest); + Map oldheaderMap = ServletUtil.getHeaderMap(request); + String oldquerys = request.getQueryString(); + //应用key + String publicKey = request.getHeader("publicKey"); + //应用密钥 + String secretKey = request.getHeader("secretKey"); + //appId + String appId = request.getHeader("appId"); + //apiCode + String apiCode = request.getHeader("apiCode"); + + String ip = IPHelper.getIpAddr(request); + if (publicKey == null || "".equals(publicKey)) { + return BaseResult.getFailureMessageEntity("请先传递公钥"); + } + if (secretKey == null || "".equals(secretKey)) { + return BaseResult.getFailureMessageEntity("请先传递密钥"); + } + if (appId == null || "".equals(appId)) { + return BaseResult.getFailureMessageEntity("请先传递接收方应用"); + } + if (apiCode == null || "".equals(apiCode)) { + return BaseResult.getFailureMessageEntity("请先传递发送接口"); + } + + logger.info("请求参数:publicKey:【" + publicKey + "】secretKey:【" + secretKey + "】appId:【" + appId + "】apiCode:【" + apiCode); + //根据请求a应用的公钥、密钥是否能查找到一条数据 + + SysApplicationEntity sendApp = getAppByPublicKeySecretKey(publicKey, secretKey); + if (sendApp == null) { + //saveLog(new SysApplicationEntity(), new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"公钥、密钥错误"); + return BaseResult.getFailureMessageEntity("公钥、密钥错误,请联系管理员"); + } + //判断应用是否启用 + if (sendApp.getAppStatus() == null || !"1".equals(sendApp.getAppStatus())) { + saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,sendApp.getName() + "应用未启用"); + return BaseResult.getFailureMessageEntity(sendApp.getName() + "应用未启用,请联系管理员"); + } + + + SysApplicationEntity receiveApp = getAppByAppId(appId); + if (receiveApp == null) { + saveLog(sendApp, new SysApplicationEntity(), new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,"根据appId:" + appId + "未匹配到应用"); + return BaseResult.getFailureMessageEntity("根据appId:" + appId + "未匹配到应用,请联系管理员"); + } + //判断应用是否启用 + if (receiveApp.getAppStatus() == null || !"1".equals(receiveApp.getAppStatus())) { + saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用未启用" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用未启用,请联系管理员"); + } + //判断应用接口是否启用 + if (receiveApp.getInterfaceStatus() == null || !"1".equals(receiveApp.getInterfaceStatus())) { + saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用接口环境未启用" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用接口环境未启用,请联系管理员"); + } + + SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode); + if (receiveApi == null) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + ":" + apiCode + "未启用或者未创建" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建"); + } + + SysApplicationApiAuthEntity sysApplicationApiAuthEntity = getApiAuthByNameAppId(sendApp.getId(), receiveApp.getId()); + if (sysApplicationApiAuthEntity == null) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "应用权限配置错误" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "应用权限配置错误"); + } + if (sysApplicationApiAuthEntity.getSystemAddress() != null && !"".equals(sysApplicationApiAuthEntity.getSystemAddress()) + && !sysApplicationApiAuthEntity.getSystemAddress().contains(ip)) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误" ); + return BaseResult.getFailureMessageEntity(receiveApp.getName() + "发送应用" + receiveApp.getName() + "的ip白名单配置错误"); + } + + SysApplicationApiAuthDetailEntity sysApplicationApiAuthDetailEntity = getApiAuthDetailByAppIdApiIdTripartiteSystemId(receiveApp.getId(), receiveApi.getId(), sysApplicationApiAuthEntity.getId()); + if (sysApplicationApiAuthDetailEntity == null) { + saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApi.getApiName() + "未授权给" + sendApp.getName() ); + return BaseResult.getFailureMessageEntity(receiveApi.getApiName() + "未授权给" + sendApp.getName() + ",请联系管理员"); + } + SysExtensionApiEntity sysExtensionApiEntity = new SysExtensionApiEntity(); + + + List a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"}); + Map headers = new HashMap<>(); + if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) { + JSONArray jsonArray = JSONArray.parseArray(receiveApi.getHeaderIn()); + if (jsonArray != null && jsonArray.size() > 0) { + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject object1 = jsonArray.getJSONObject(i); + headers.put(object1.getString("parameterName"), object1.getString("example")); + } + } + } + if (oldheaderMap != null && oldheaderMap.size() > 0) { + for (Map.Entry entry : oldheaderMap.entrySet()) { + if (!a.contains(entry.getKey())) { + headers.put(entry.getKey(), entry.getValue()); + } + } + } + + + + sysExtensionApiEntity.setSendApp(sendApp); + sysExtensionApiEntity.setReceiveApp(receiveApp); + sysExtensionApiEntity.setReceiveApi(receiveApi); + sysExtensionApiEntity.setHeaders(headers); + sysExtensionApiEntity.setQuerys(oldquerys); + sysExtensionApiEntity.setBodys(oldbodys); + Method[] methods = null; + Object object = null; + + + + + // 判断是否有内部api 是否扩展api 1、启用 2、停用 + if (receiveApi.getExtensionApi() != null && "1".equals(receiveApi.getExtensionApi()) + && receiveApi.getBeanName() != null && !"".equals(receiveApi.getBeanName()) + && receiveApi.getFunName() != null && !"".equals(receiveApi.getFunName()) + ) { + //获取类 + try { + object = ApplicationContextUtil.getBeanByName(receiveApi.getBeanName()); + } catch (SecurityException e) { + + } + //获取类下面的方法 + methods = object.getClass().getMethods(); + if (methods == null || methods.length == 0) { + return BaseResult.getFailureMessageEntity("未找到内部方法,请联系管理员"); + } + for (Method m : methods) { + if (null != m) { + if (m.getName().equals(receiveApi.getFunName().trim())) { + try { + logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + sysExtensionApiEntity = (SysExtensionApiEntity) m.invoke(object, sysExtensionApiEntity); + logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } catch (Exception e) { + logger.error("invokeException{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("内部方法执行错误,请联系管理员"); + } + } + } + } + + } + headers = sysExtensionApiEntity.getHeaders(); + String querys = sysExtensionApiEntity.getQuerys(); + + byte[] byteBodys = sysExtensionApiEntity.getByteBodys(); + //设置参数获取参数 + StringBuffer url = new StringBuffer(); + if(!receiveApi.getDestinationAddress().toLowerCase().startsWith("http")){ + url.append(receiveApp.getInterfaceAddress()); + } + url.append(receiveApi.getDestinationAddress()); + if (querys != null) { + url.append("?"); + url.append(querys); + } + Integer outTime = 6000; + if (receiveApi.getTimeoutPeriod() != null && !"".equals(receiveApi.getTimeoutPeriod())) { + outTime = Integer.valueOf(receiveApi.getTimeoutPeriod()); + } + //1、POST 2、GET + String method = "POST"; + if ("2".equals(receiveApi.getRequestMethod())) { + method = "GET"; + } + //List a = Arrays.asList(new String[]{"apicode", "appid", "secretkey", "publickey", "x-forwarded-for", "cookie", "x-forwarded-proto", "x-real-ip", "content-length", "accept-language", "host", "content-type", "connection", "cache-control", "accept-encoding", "pragma", "accept", "user-agent"}); + //Map headers = new HashMap<>(); + //if (receiveApi.getHeaderIn() != null && !"".equals(receiveApi.getHeaderIn())) { + // JSONArray jsonArray = JSONArray.parseArray(receiveApi.getHeaderIn()); + // if (jsonArray != null && jsonArray.size() > 0) { + // for (int i = 0; i < jsonArray.size(); i++) { + // JSONObject object1 = jsonArray.getJSONObject(i); + // headers.put(object1.getString("parameterName"), object1.getString("example")); + // } + // } + //} + //if (headerMap != null && headerMap.size() > 0) { + // for (Map.Entry entry : headerMap.entrySet()) { + // if (!a.contains(entry.getKey())) { + // headers.put(entry.getKey(), entry.getValue()); + // } + // } + //} + + + if ("POST".equals(method)) { + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpPost post = new HttpPost(url.toString()); + CloseableHttpResponse response = null; + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build(); + post.setConfig(requestConfig);//设置请求参数【超时时间】 + + if (headers != null && headers.size() > 0) { + for (String key : headers.keySet()) { + post.setHeader(key, headers.get(key)); + } + } + byte[] body = null; + boolean flag = true; + try { + if (byteBodys != null && !"".equals(byteBodys)) { + ByteArrayEntity entity = new ByteArrayEntity(byteBodys); + entity.setContentType("application/json"); + post.setEntity(entity); + } + response = closeableHttpClient.execute(post); + + HttpEntity entity = response.getEntity(); + synchronized (lock) { + body = EntityUtils.toByteArray(entity); + } + flag = true; + logger.info("返回结果:" +Base64.getEncoder().encodeToString(body)); + } catch (Exception e) { + logger.error("请求错误:" + e.getMessage()); + flag = false; + } finally { + try { + // 关闭响应对象 + if (response != null) { + response.close(); + } + // 关闭响应对象 + if (closeableHttpClient != null) { + closeableHttpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + } + logger.info("保存日志开始"); + SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(),true,null); + if (methods != null && methods.length > 0) { + for (Method m : methods) { + if (null != m) { + if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) { + try { + logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + m.invoke(object, sysMessageManageLogEntity); + logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } catch (Exception e) { + logger.error("invokeException{}", e.getMessage()); + } + } + } + } + } + logger.info("保存日志结束"); + if (flag) { + if (JSONUtil.isTypeJSON(body.toString())) { + JSONObject jsonObject = JSONObject.parseObject(body.toString()); + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", jsonObject); + }else { + return BaseResult.getFailureMessageEntity("转发失败", jsonObject); + } + } else { + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", body); + }else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + + } else {//GET + + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + // HttpClient + CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build(); + HttpGet get = new HttpGet(url.toString()); + CloseableHttpResponse response = null; + + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(outTime).build(); + get.setConfig(requestConfig);//设置请求参数【超时时间】 + if (headers != null && headers.size() > 0) { + for (String key : headers.keySet()) { + get.setHeader(key, headers.get(key)); + } + } + StringBuilder body = new StringBuilder(); + + boolean flag = true; + try { + response = closeableHttpClient.execute(get); + 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(); + } + } + logger.info("保存日志开始"); + SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(), true,null); + if (methods != null && methods.length > 0) { + for (Method m : methods) { + if (null != m) { + if (m.getName().equals(receiveApi.getFunName().trim()+"CallBack")) { + try { + logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + m.invoke(object, sysMessageManageLogEntity); + logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } catch (Exception e) { + logger.error("invokeException{}", e.getMessage()); + } + } + } + } + } + logger.info("保存日志结束"); + if (flag) { + if (JSONUtil.isTypeJSON(body.toString())) { + JSONObject jsonObject = JSONObject.parseObject(body.toString()); + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", jsonObject); + }else { + return BaseResult.getFailureMessageEntity("转发失败", jsonObject); + } + } else { + if(sysMessageManageLogEntity.getStatus() != null && "3".equals(sysMessageManageLogEntity.getStatus())){ + return BaseResult.getSuccessMessageEntity("转发成功", body); + }else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + } else { + return BaseResult.getFailureMessageEntity("转发失败", body); + } + } + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/IControlsLogDao.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/IControlsLogDao.java new file mode 100644 index 00000000..1ef9f35c --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/IControlsLogDao.java @@ -0,0 +1,20 @@ +package com.hzya.frame.sysnew.comparison.controlsLog.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity; + +public interface IControlsLogDao extends IBaseDao { + + /** + * + * @content 操作日志保存 + * @Param formmainId:主表id,sourceName:来源名称,code:来源编码,sourceData:源数据,optionType:操作类型,optionName:操作人,dbName:数据库名称 + * @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); + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/impl/ControlsLogDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/impl/ControlsLogDaoImpl.java new file mode 100644 index 00000000..7db1b35b --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/dao/impl/ControlsLogDaoImpl.java @@ -0,0 +1,32 @@ +package com.hzya.frame.sysnew.comparison.controlsLog.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sysnew.comparison.controlsLog.dao.IControlsLogDao; +import com.hzya.frame.sysnew.comparison.controlsLog.entity.ControlsLogEntity; +import com.hzya.frame.uuid.UUIDUtils; +import org.springframework.stereotype.Repository; + +@Repository(value = "controlsLogDaoImpl") +public class ControlsLogDaoImpl extends MybatisGenericDao implements IControlsLogDao { + + //操作日志新增 + @Override + @DS("master") + public ControlsLogEntity saveControlsLog(String formmainId,String sourceName,String code,String sourceData,String optionType,String optionName,String dbName) { + ControlsLogEntity controlsLogEntity=new ControlsLogEntity(); + controlsLogEntity.setId(UUIDUtils.getUUID()); + controlsLogEntity.setFormmainId(formmainId); + controlsLogEntity.setSourceName(sourceName); + controlsLogEntity.setCode(code); + controlsLogEntity.setSourceData(sourceData); + controlsLogEntity.setOptionType(optionType); + controlsLogEntity.setOptionName(optionName); + controlsLogEntity.setDbName(dbName); + controlsLogEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + controlsLogEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + controlsLogEntity.setOrg_id("0"); + ControlsLogEntity save = super.save(getSqlIdPrifx() + "saveControlsLog", controlsLogEntity); + return save; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/entity/ControlsLogEntity.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/entity/ControlsLogEntity.java new file mode 100644 index 00000000..68f0d3ae --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/entity/ControlsLogEntity.java @@ -0,0 +1,78 @@ +package com.hzya.frame.sysnew.comparison.controlsLog.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 操作日志实体类 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/5 11:58 + * **/ +public class ControlsLogEntity extends BaseEntity { + private String formmainId;//主表id + private String sourceName;//来源名称 + private String code;//编码 + private String sourceData;//源数据 + private String optionType;//操作类型 + private String optionName;//操作人 + + private String dbName;//表名称 + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getFormmainId() { + return formmainId; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getSourceName() { + return sourceName; + } + + public void setSourceName(String sourceName) { + this.sourceName = sourceName; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getSourceData() { + return sourceData; + } + + public void setSourceData(String sourceData) { + this.sourceData = sourceData; + } + + public String getOptionType() { + return optionType; + } + + public void setOptionType(String optionType) { + this.optionType = optionType; + } + + public String getOptionName() { + return optionName; + } + + public void setOptionName(String optionName) { + this.optionName = optionName; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/entity/ControlsLogEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/entity/ControlsLogEntity.xml new file mode 100644 index 00000000..7670ef99 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/controlsLog/entity/ControlsLogEntity.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into ${dbName} + + id, + formmain_id, + code , + source_name , + source_data , + option_type , + option_name , + sorts , + create_user_id , + modify_user_id , + org_id , + company_id , + create_time, + modify_time, + sts + + values + + #{id}, + #{formmainId}, + #{code} , + #{sourceName} , + #{sourceData} , + #{optionType} , + #{optionName} , + #{sorts} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from ${dbName} a WHERE a.sts = 'Y' ), + #{create_user_id} , + #{modify_user_id} , + #{org_id} , + #{companyId} , + #{create_time} , + now() , + #{modify_time} , + now() , + #{sts} , + 'Y' + + + + + + update ${dbName} set + + formmain_id = #{formmainId}, + source_name = #{sourceName}, + code = #{code}, + source_data = #{sourceData}, + option_type = #{optionType}, + option_name = #{optionName}, + sorts = #{sorts}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + modify_time = now(), + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId} + + where id=#{id} and sts='Y' + + + + + + update + ${dbName} + set sts= 'N' ,modify_time = now(),modify_user_id = #{modify_user_id} + + formmain_id = #{formmainId}, + source_name = #{sourceName}, + code = #{code}, + source_data = #{sourceData}, + option_type = #{optionType}, + option_name = #{optionName}, + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and id=#{id} and sts='Y' + + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/IComparisonDao.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/IComparisonDao.java new file mode 100644 index 00000000..97653c9a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/IComparisonDao.java @@ -0,0 +1,113 @@ +package com.hzya.frame.sysnew.comparison.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; + +import java.util.List; +import java.util.Map; + +public interface IComparisonDao extends IBaseDao { + + /** + * + * @content 根据主数据编码查询表名,字段名等信息 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/7 16:05 + * **/ + List queryComparison(ComparisonEntity comparison); + + /** + * + * @content 分页查询数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 15:11 + * **/ + List> queryComparisonPage(ComparisonEntity comparison); + + /** + * + * @content 保存通用数据数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/7 16:56 + * **/ + ComparisonEntity saveComparison(ComparisonEntity comparison); + + /** + * + * @content 生成单据规则 如:CK-yyyyMMdd-0001 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 9:42 + * **/ + ComparisonEntity queryComparisonRule(ComparisonEntity comparison); + + /** + * + * @content 更新通用数据数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 10:32 + * **/ + Integer updateComparisonByType(ComparisonEntity comparison); + + /** + * + * @content 删除通用数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 14:09 + * **/ + Integer deleteComparison(ComparisonEntity comparison); + + /** + * + * @content 查询单据规则 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/28 14:39 + * **/ + ComparisonEntity queryComparisonById(ComparisonEntity comparison); + + /** + * + * @content 根据主数据编码查询mdm_module数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/4 11:37 + * **/ + ComparisonEntity queryComparisonBymdmCode(ComparisonEntity comparison); + + /** + * + * @content 根据mdm_module得id查询mdm_module_db得数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/4 11:40 + * **/ + List queryComparisonBymdmId(ComparisonEntity comparison); + + /** + * + * @content 根据mdm_module得id查询mdm_module_db_fileds得数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/4 11:45 + * **/ + List queryComparisonBymdmIdFileds(ComparisonEntity comparison); + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/IComparisonDetailsDao.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/IComparisonDetailsDao.java new file mode 100644 index 00000000..36c66021 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/IComparisonDetailsDao.java @@ -0,0 +1,51 @@ +package com.hzya.frame.sysnew.comparison.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity; + +import java.util.List; +import java.util.Map; + +public interface IComparisonDetailsDao extends IBaseDao { + + /** + * + * @content 保存通用数据子表数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 10:41 + * **/ + ComparisonDetailsEntity saveComparisonDetails(ComparisonDetailsEntity comparisonDetailsEntity); + + /** + * + * @content 更新通用数据子表数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 10:41 + * **/ + Integer updateComparisonDetailsByType(ComparisonDetailsEntity comparisonDetailsEntity); + + /** + * + * @content 删除通用数据子表数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 14:11 + * **/ + Integer deleteComparisonDetails(ComparisonDetailsEntity comparisonDetailsEntity); + + /** + * + * @content 分页查询子表数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 15:34 + * **/ + List> queryComparisonDetailsPage(ComparisonDetailsEntity comparisonDetailsEntity); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/impl/ComparisonDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/impl/ComparisonDaoImpl.java new file mode 100644 index 00000000..d50098cb --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/impl/ComparisonDaoImpl.java @@ -0,0 +1,84 @@ +package com.hzya.frame.sysnew.comparison.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sysnew.comparison.dao.IComparisonDao; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Repository(value = "comparisonDaoImpl") +public class ComparisonDaoImpl extends MybatisGenericDao implements IComparisonDao { + //根据主数据编码查询表名,字段名等信息 + @Override + public List queryComparison(ComparisonEntity comparison) { + List query = super.query(getSqlIdPrifx() + "queryComparison", comparison); + return query; + } + + //分页查询 + @Override + public List> queryComparisonPage(ComparisonEntity comparison) { + List> query =(List>) super.selectList(getSqlIdPrifx() + "queryComparisonPage", comparison); + return query; + } + + //保存数据 + @Override + public ComparisonEntity saveComparison(ComparisonEntity comparison) { + ComparisonEntity comparisonEntity = super.save(getSqlIdPrifx() + "saveComparison", comparison); + return comparisonEntity; + } + + //生成单据规则 + @Override + public ComparisonEntity queryComparisonRule(ComparisonEntity comparison) { + List comparisonEntities = super.query(getSqlIdPrifx() + "queryComparisonRule", comparison); + return comparisonEntities.get(0); + } + + //更新通用数据数据 + @Override + public Integer updateComparisonByType(ComparisonEntity comparison) { + int update = super.update(getSqlIdPrifx() + "updateComparisonByType", comparison); + return update; + } + + //删除通用数据 + @Override + public Integer deleteComparison(ComparisonEntity comparison) { + int delete = super.delete(getSqlIdPrifx() + "deleteComparison", comparison); + return delete; + } + + //查询单据规则 + @Override + public ComparisonEntity queryComparisonById(ComparisonEntity comparison) { + List comparisonEntities = super.query(getSqlIdPrifx() + "queryComparisonById", comparison); + return comparisonEntities.get(0); + } + + //根据主数据编码查询mdm_module数据 + @Override + public ComparisonEntity queryComparisonBymdmCode(ComparisonEntity comparison) { + ComparisonEntity comparisonEntity =(ComparisonEntity) super.selectOne(getSqlIdPrifx() + "queryComparisonBymdmCode", comparison); + return comparisonEntity; + } + + //根据mdm_module得id查询mdm_module_db得数据 + @Override + public List queryComparisonBymdmId(ComparisonEntity comparison) { + List list =(List) super.selectList(getSqlIdPrifx() + "queryComparisonBymdmId", comparison); + return list; + } + + //根据mdm_module得id查询mdm_module_db_fileds得数据 + @Override + public List queryComparisonBymdmIdFileds(ComparisonEntity comparison) { + List list =(List) super.selectList(getSqlIdPrifx() + "queryComparisonBymdmIdFileds", comparison); + return list; + } + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/impl/ComparisonDetailsDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/impl/ComparisonDetailsDaoImpl.java new file mode 100644 index 00000000..cab43d0d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/dao/impl/ComparisonDetailsDaoImpl.java @@ -0,0 +1,46 @@ +package com.hzya.frame.sysnew.comparison.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sysnew.comparison.dao.IComparisonDao; +import com.hzya.frame.sysnew.comparison.dao.IComparisonDetailsDao; +import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +@Repository(value = "comparisonDetailsDaoImpl") +public class ComparisonDetailsDaoImpl extends MybatisGenericDao implements IComparisonDetailsDao { + + //保存通用数据子表数据 + @Override + public ComparisonDetailsEntity saveComparisonDetails(ComparisonDetailsEntity comparisonDetailsEntity) { + ComparisonDetailsEntity detailsEntity = super.save(getSqlIdPrifx() + "saveComparisonDetails", comparisonDetailsEntity); + return detailsEntity; + } + + //更新通用数据子表数据 + @Override + public Integer updateComparisonDetailsByType(ComparisonDetailsEntity comparisonDetailsEntity) { + int update = super.update(getSqlIdPrifx()+"updateComparisonDetailsByType", comparisonDetailsEntity); + return update; + } + + //删除通用数据子表的数据 + @Override + public Integer deleteComparisonDetails(ComparisonDetailsEntity comparisonDetailsEntity) { + int delete = super.delete(getSqlIdPrifx() + "deleteComparisonDetails", comparisonDetailsEntity); + return delete; + } + + //分页查询子表数据 + @Override + public List> queryComparisonDetailsPage(ComparisonDetailsEntity comparisonDetailsEntity) { + List> query =(List>) super.selectList(getSqlIdPrifx() + "queryComparisonDetailsPage", comparisonDetailsEntity); + return query; + } + + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonDetailsEntity.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonDetailsEntity.java new file mode 100644 index 00000000..5766ec65 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonDetailsEntity.java @@ -0,0 +1,131 @@ +package com.hzya.frame.sysnew.comparison.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.hzya.frame.web.entity.BaseEntity; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.Map; + +/** + * + * @content 通用数据明细实体类 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/7 15:50 + * **/ +public class ComparisonDetailsEntity extends BaseEntity { + + private String contrastType;//对照类型 + private String documentRule;//单据规则 + private Long documentRuleNum;//单据规则流水号 + + + private String mdmName;//主数据名称 + private String mdmCode;//主数据编码 + private String dbName;//表名 + private String dbType;//类型 1、主表 2、明细 + private String enName;//字段名 英文 + private String chName;// 字段名 中文 + private String filedType;//字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + private String formmainId;//上级id + + public String getFormmainId() { + return formmainId; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + private Map mapDetails; + + public String getContrastType() { + return contrastType; + } + + public void setContrastType(String contrastType) { + this.contrastType = contrastType; + } + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Long getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Long documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getMdmName() { + return mdmName; + } + + public void setMdmName(String mdmName) { + this.mdmName = mdmName; + } + + public String getMdmCode() { + return mdmCode; + } + + public void setMdmCode(String mdmCode) { + this.mdmCode = mdmCode; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } + + public Map getMapDetails() { + return mapDetails; + } + + public void setMapDetails(Map mapDetails) { + this.mapDetails = mapDetails; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonDetailsEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonDetailsEntity.xml new file mode 100644 index 00000000..0d1ca13f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonDetailsEntity.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + insert into ${dbName} + + + ${column}, + + + values + + + #{value}, + + + + + + + update ${dbName} + + + ${key} =#{value} + + + where formmain_id=#{formmainId} and sts='Y' + + + + + update + ${dbName} + set sts= 'N' ,modify_time = now(),modify_user_id = #{modify_user_id}, data_status= 'N',delete_status='0' + + + and formmain_id=#{formmainId} and sts='Y' + + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonEntity.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonEntity.java new file mode 100644 index 00000000..6a97f2b4 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonEntity.java @@ -0,0 +1,248 @@ +package com.hzya.frame.sysnew.comparison.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +import java.util.List; +import java.util.Map; + +/** + * + * @content 通用数据实体类 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/7 15:50 + * **/ +public class ComparisonEntity extends BaseEntity { + private String contrastType;//对照类型 + private String documentRule;//单据规则 + private Long documentRuleNum;//单据规则流水号 + + private String mdmName;//主数据名称 + private String mdmCode;//主数据编码 + private String dbName;//表名 + private String dbType;//类型 1、主表 2、明细 + private String enName;//字段名 英文 + private String chName;// 字段名 中文 + private String filedType;//字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME + + private Map map; + private ComparisonDetailsEntity comparisonDetailsEntity; + private String formmainId;//上级id + + private String rulePrefix;//规则前缀 CK-yyyyMMdd-0001中的CK + private String ruleMiddle;//规则中间 CK-yyyyMMdd-0001中的yyyyMMdd + private int ruleSuffix;//规则后缀 CK-yyyyMMdd-0001中的0001 + + private String mId;//mdm_module的id + private String dbId;//mdm_module_db的id + + private String addType;//显示类型:新增 + private String updateType;//显示类型:修改 + private String showType;//显示类型:查看 + private String queryType;//显示类型:查询 + private String listType;//显示类型:列表 + private String viewType;//显示类型:显示 + + public String getAddType() { + return addType; + } + + public void setAddType(String addType) { + this.addType = addType; + } + + public String getUpdateType() { + return updateType; + } + + public void setUpdateType(String updateType) { + this.updateType = updateType; + } + + public String getShowType() { + return showType; + } + + public void setShowType(String showType) { + this.showType = showType; + } + + public String getQueryType() { + return queryType; + } + + public void setQueryType(String queryType) { + this.queryType = queryType; + } + + public String getListType() { + return listType; + } + + public void setListType(String listType) { + this.listType = listType; + } + + public String getViewType() { + return viewType; + } + + public void setViewType(String viewType) { + this.viewType = viewType; + } + + public String getRuleMiddle() { + return ruleMiddle; + } + + public void setRuleMiddle(String ruleMiddle) { + this.ruleMiddle = ruleMiddle; + } + + public int getRuleSuffix() { + return ruleSuffix; + } + + public void setRuleSuffix(int ruleSuffix) { + this.ruleSuffix = ruleSuffix; + } + + public String getmId() { + return mId; + } + + public void setmId(String mId) { + this.mId = mId; + } + + public String getDbId() { + return dbId; + } + + public void setDbId(String dbId) { + this.dbId = dbId; + } + + private List comparisonDetailsEntityList; + + public List getComparisonDetailsEntityList() { + return comparisonDetailsEntityList; + } + + public void setComparisonDetailsEntityList(List comparisonDetailsEntityList) { + this.comparisonDetailsEntityList = comparisonDetailsEntityList; + } + + public String getContrastType() { + return contrastType; + } + + public void setContrastType(String contrastType) { + this.contrastType = contrastType; + } + + public String getDocumentRule() { + return documentRule; + } + + public void setDocumentRule(String documentRule) { + this.documentRule = documentRule; + } + + public Long getDocumentRuleNum() { + return documentRuleNum; + } + + public void setDocumentRuleNum(Long documentRuleNum) { + this.documentRuleNum = documentRuleNum; + } + + public String getMdmName() { + return mdmName; + } + + public void setMdmName(String mdmName) { + this.mdmName = mdmName; + } + + public String getMdmCode() { + return mdmCode; + } + + public void setMdmCode(String mdmCode) { + this.mdmCode = mdmCode; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbType() { + return dbType; + } + + public void setDbType(String dbType) { + this.dbType = dbType; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getChName() { + return chName; + } + + public void setChName(String chName) { + this.chName = chName; + } + + public String getFiledType() { + return filedType; + } + + public void setFiledType(String filedType) { + this.filedType = filedType; + } + + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + public ComparisonDetailsEntity getComparisonDetailsEntity() { + return comparisonDetailsEntity; + } + + public void setComparisonDetailsEntity(ComparisonDetailsEntity comparisonDetailsEntity) { + this.comparisonDetailsEntity = comparisonDetailsEntity; + } + + public String getFormmainId() { + return formmainId; + } + + public void setFormmainId(String formmainId) { + this.formmainId = formmainId; + } + + public String getRulePrefix() { + return rulePrefix; + } + + public void setRulePrefix(String rulePrefix) { + this.rulePrefix = rulePrefix; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonEntity.xml new file mode 100644 index 00000000..d24c345d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/entity/ComparisonEntity.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into ${dbName} + + + ${column}, + + + values + + + #{value}, + + + + + + + update ${dbName} + + + ${key} =#{value} + + + where id=#{id} and sts='Y' + + + + + + update + ${dbName} + set data_status= 'N' ,modify_time = now(),modify_user_id = #{modify_user_id},delete_status='0' + + + and ${key} =#{value} + + and id=#{id} and sts='Y' + + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/dao/IMasterDataDao.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/dao/IMasterDataDao.java new file mode 100644 index 00000000..8fb8ce73 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/dao/IMasterDataDao.java @@ -0,0 +1,23 @@ +package com.hzya.frame.sysnew.comparison.masterData.dao; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; + +import java.util.HashMap; +import java.util.List; + +public interface IMasterDataDao extends IBaseService { + + + /** + * + * @content 查询U8C档案 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/6 11:56 + * **/ + @DS("swu8c") + List> queryArchives(String str); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/dao/impl/MasterDataDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/dao/impl/MasterDataDaoImpl.java new file mode 100644 index 00000000..ad9f3588 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/dao/impl/MasterDataDaoImpl.java @@ -0,0 +1,31 @@ +package com.hzya.frame.sysnew.comparison.masterData.dao.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.execsql.service.IExecSqlService; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import com.hzya.frame.sysnew.comparison.masterData.dao.IMasterDataDao; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import java.util.HashMap; +import java.util.List; + +@Repository(value = "masterDataDaoImpl") +public class MasterDataDaoImpl extends BaseService implements IMasterDataDao { + + @Autowired + private IExecSqlService execSqlService; + + @DS("swu8c") + @Override + public List> queryArchives(String str) { + try { + List> hashMaps = execSqlService.execSelectSql(str, ""); + return hashMaps; + }catch (Exception e){ + logger.info("U8C主数据档案用户档案没有需要同步中台的数据"); + return null; + } + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/IMasterDataOrgsService.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/IMasterDataOrgsService.java new file mode 100644 index 00000000..1e08f408 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/IMasterDataOrgsService.java @@ -0,0 +1,19 @@ +package com.hzya.frame.sysnew.comparison.masterData.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IMasterDataOrgsService extends IBaseService { + /** + * + * @content 查询组织档案 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/4 16:57 + * **/ + JsonResultEntity queryOrgsArchives(JSONObject jsonObject); + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/IMasterDataProjectService.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/IMasterDataProjectService.java new file mode 100644 index 00000000..6b6799c1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/IMasterDataProjectService.java @@ -0,0 +1,19 @@ +package com.hzya.frame.sysnew.comparison.masterData.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IMasterDataProjectService extends IBaseService { + + /** + * + * @content 查询项目档案 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/6 16:10 + * **/ + JsonResultEntity queryProjectArchives(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataOrgsServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataOrgsServiceImpl.java new file mode 100644 index 00000000..e382aabf --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataOrgsServiceImpl.java @@ -0,0 +1,138 @@ +package com.hzya.frame.sysnew.comparison.masterData.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import com.hzya.frame.sysnew.comparison.masterData.dao.impl.MasterDataDaoImpl; +import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataOrgsService; +import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataProjectService; +import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +@Service("masterDataOrgsServiceImpl") +public class MasterDataOrgsServiceImpl extends BaseService implements IMasterDataOrgsService { + + @Autowired + private MasterDataDaoImpl masterDataDaoImpl; + @Autowired + private ComparisonServiceImpl comparisonServiceimpl; + @Autowired + private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl; + + private String ts = ""; + //查询用户档案并同步中台 + @Override + public JsonResultEntity queryOrgsArchives(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + //查询主数据来源表,根据来源类型为插件得进行分类,获取来源名称和编码 + List list = mdmModuleSourceDaoImpl.MdmModuleSourceentityGroupByType(); + if (CollectionUtils.isEmpty(list)) { + logger.info("数据来源表中没有类型为插件得数据,无法获取来源名称和来源编码"); + return BaseResult.getFailureMessageEntity("数据来源表无插件类型"); + } + for (MdmModuleSourceEntity mdmModuleSourceEntity : list) { + //此处应该根据来源编码进行case ,暂时测试使用U8C + switch (mdmModuleSourceEntity.getPluginCode()) { + case "MdmOrgPlugin": + if (null == ts || "".equals(ts)) { + ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"); + } + ts = "'" + ts + "'"; + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select pk_corp as id,unitcode as org_code,unitname as org_name,"); + stringBuffer.append("saleaddr as org_address,countryarea as org_countryzone,memo as org_memo,"); + stringBuffer.append("industry as org_ncindustry,fathercorp as org_fatherorg,legalbodycode as org_principal,"); + stringBuffer.append("phone1 as org_tel from bd_corp where dr='0' and ts>"+ts); + try { + List> hashMaps = masterDataDaoImpl.queryArchives(stringBuffer.toString()); + logger.info("查询出来的值为:{}",hashMaps); + if (null != hashMaps && hashMaps.size() > 0) { + ParametricAssembly(mdmModuleSourceEntity,hashMaps,"10001"); + } else { + logger.info("U8C主数据档案组织档案没有需要同步中台的数据"); + return null; + } + } catch (Exception e) { + logger.info("查询主数据档案组织档案错误:{}", e.getMessage()); + } + break; + default: + break; + } + } + return BaseResult.getSuccessMessageEntity("组织档案同步成功"); + } + + + + + + //查询档案参数组装 + private void ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List> hashMaps,String mdmCode){ + for (HashMap hashMap : hashMaps) { + JSONObject jsonObjectUser = new JSONObject(); + JSONObject jsonStr = new JSONObject(); + jsonObjectUser.put("id", hashMap.get("id")); + jsonObjectUser.put("mdmCode", mdmCode); + jsonStr.put("jsonStr", jsonObjectUser); + //先查询编码和名称查询是否存在 + JsonResultEntity jsonResultEntity = comparisonServiceimpl.queryEntityPage(jsonStr); + Object attribute = jsonResultEntity.getAttribute(); + logger.info("得到的attribute值为:{}", attribute); + JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute); + JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list"); + //如果jsonArrayList为null,说明没有值,在表中不存在 + if (jsonArrayList == null || jsonArrayList.size() == 0) { + //将查询出来得数据调用通用接口新增,保存到表中 + JSONObject main = new JSONObject(); + for(String key:hashMap.keySet()) { + main.put(key, hashMap.get(key)); + } + jsonObjectUser.put("main", main); + jsonObjectUser.put("appName","数智中台"); + jsonObjectUser.put("appCode","800004"); + jsonObjectUser.put("optionName", "数智中台"); + jsonStr.put("jsonStr", jsonObjectUser); + try { + comparisonServiceimpl.saveEntity(jsonStr); + } catch (Exception e) { + logger.info("U8C主数据档案新增档案失败,失败原因:{}",e.getMessage()); + } + } else { + for (Object o : jsonArrayList) { + JSONObject jsonObjectUpdate = JSON.parseObject(String.valueOf(o)); + String id = jsonObjectUpdate.getString("id"); + JSONObject main = new JSONObject(); + for(String key:hashMap.keySet()) { + main.put(key, hashMap.get(key)); + main.put("id",id); + } + jsonObjectUser.put("main", main); + jsonObjectUser.put("appName","数智中台"); + jsonObjectUser.put("appCode","800004"); + jsonObjectUser.put("optionName", "数智中台"); + jsonStr.put("jsonStr", jsonObjectUser); + try { + comparisonServiceimpl.updateEntity(jsonStr); + } catch (Exception e) { + logger.info("U8C主数据档案更新档案失败,失败原因:{}", e.getMessage()); + } + } + } + } + } + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataProjectServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataProjectServiceImpl.java new file mode 100644 index 00000000..ca6639a2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/masterData/service/impl/MasterDataProjectServiceImpl.java @@ -0,0 +1,132 @@ +package com.hzya.frame.sysnew.comparison.masterData.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.dateutil.DateUtil; +import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl; +import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import com.hzya.frame.sysnew.comparison.masterData.dao.impl.MasterDataDaoImpl; +import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataProjectService; +import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +@Service("masterDataProjectServiceImpl") +public class MasterDataProjectServiceImpl extends BaseService implements IMasterDataProjectService { + + @Autowired + private MasterDataDaoImpl masterDataDaoImpl; + @Autowired + private ComparisonServiceImpl comparisonServiceimpl; + @Autowired + private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl; + + private String ts = ""; + + //同步项目档案 + public JsonResultEntity queryProjectArchives(JSONObject json){ + JSONObject jsonObject = json.getJSONObject("jsonStr"); + //查询主数据来源表,根据来源类型为插件得进行分类,获取来源名称和编码 + List list = mdmModuleSourceDaoImpl.MdmModuleSourceentityGroupByType(); + if (CollectionUtils.isEmpty(list)) { + logger.info("数据来源表中没有类型为插件得数据,无法获取来源名称和来源编码"); + return BaseResult.getFailureMessageEntity("数据来源表无插件类型"); + } + for (MdmModuleSourceEntity mdmModuleSourceEntity : list) { + //此处应该根据来源编码进行case ,暂时测试使用U8C + switch (mdmModuleSourceEntity.getPluginCode()) { + case "MdmProjectPlugin": + if (null == ts || "".equals(ts)) { + ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss"); + } + ts = "'" + ts + "'"; + StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append("select pk_jobbasfil as id,jobcode as project_code, jobname as project_name from bd_jobbasfil where dr='0' and ts>" + ts); + try { + List> hashMaps = masterDataDaoImpl.queryArchives(stringBuffer.toString()); + logger.info("查询出来的值为:{}",hashMaps); + if (null != hashMaps && hashMaps.size() > 0) { + ParametricAssembly(mdmModuleSourceEntity,hashMaps,"10002"); + } else { + logger.info("U8C主数据档案项目档案没有需要同步中台的数据"); + return null; + } + } catch (Exception e) { + logger.info("查询主数据档案项目档案错误:{}", e.getMessage()); + } + break; + default: + break; + } + } + return BaseResult.getSuccessMessageEntity("项目档案同步成功"); + } + + + //查询档案参数组装 + public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List> hashMaps,String mdmCode){ + for (HashMap hashMap : hashMaps) { + JSONObject jsonObjectUser = new JSONObject(); + JSONObject jsonStr = new JSONObject(); + jsonObjectUser.put("id", hashMap.get("id")); + jsonObjectUser.put("mdmCode", mdmCode); + jsonStr.put("jsonStr", jsonObjectUser); + //先查询编码和名称查询是否存在 + JsonResultEntity jsonResultEntity = comparisonServiceimpl.queryEntityPage(jsonStr); + Object attribute = jsonResultEntity.getAttribute(); + logger.info("得到的attribute值为:{}", attribute); + JSONObject jsonObjectAttribute = (JSONObject) JSON.toJSON(attribute); + JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list"); + //如果jsonArrayList为null,说明没有值,在表中不存在 + if (jsonArrayList == null || jsonArrayList.size() == 0) { + //将查询出来得数据调用通用接口新增,保存到表中 + JSONObject main = new JSONObject(); + for(String key:hashMap.keySet()) { + main.put(key, hashMap.get(key)); + } + jsonObjectUser.put("main", main); + jsonObjectUser.put("appName","数智中台"); + jsonObjectUser.put("appCode","800004"); + jsonObjectUser.put("optionName", "数智中台"); + jsonStr.put("jsonStr", jsonObjectUser); + try { + comparisonServiceimpl.saveEntity(jsonStr); + } catch (Exception e) { + logger.info("U8C主数据档案新增用户档案失败,失败原因:{}",e.getMessage()); + } + } else { + for (Object o : jsonArrayList) { + JSONObject jsonObjectUpdate = JSON.parseObject(String.valueOf(o)); + String id = jsonObjectUpdate.getString("id"); + JSONObject main = new JSONObject(); + for(String key:hashMap.keySet()) { + main.put(key, hashMap.get(key)); + main.put("id",id); + } + jsonObjectUser.put("main", main); + jsonObjectUser.put("appName","数智中台"); + jsonObjectUser.put("appCode","800004"); + jsonObjectUser.put("optionName", "数智中台"); + jsonStr.put("jsonStr", jsonObjectUser); + try { + comparisonServiceimpl.updateEntity(jsonStr); + } catch (Exception e) { + logger.info("U8C主数据档案更新用户档案失败,失败原因:{}", e.getMessage()); + } + } + } + } + return null; + } + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/service/IComparisonDetailsService.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/IComparisonDetailsService.java new file mode 100644 index 00000000..ac5db9c0 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/IComparisonDetailsService.java @@ -0,0 +1,7 @@ +package com.hzya.frame.sysnew.comparison.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity; + +public interface IComparisonDetailsService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/service/IComparisonService.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/IComparisonService.java new file mode 100644 index 00000000..389458f5 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/IComparisonService.java @@ -0,0 +1,62 @@ +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; + +public interface IComparisonService extends IBaseService { + + /** + * + * @content 分页查询通用数据数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/7 15:55 + * **/ + JsonResultEntity queryEntityPage(JSONObject jsonObject); + + /** + * + * @content 新增通用数据数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/7 16:52 + * **/ + JsonResultEntity saveEntity(JSONObject jsonObject); + + /** + * + * @content 编辑通用数据数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 10:19 + * **/ + JsonResultEntity updateEntity(JSONObject jsonObject); + + /** + * + * @content 删除通用数据数据 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/9 13:59 + * **/ + JsonResultEntity deleteEntity(JSONObject jsonObject); + + /** + * + * @content 获取应用编码和应用名称 + * @Param + * @Return + * @Author hecan + * @Date 2024/6/11 11:37 + * **/ + SysExtensionApiEntity getAppNameAndCode(SysExtensionApiEntity sysExtensionApiEntity); + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/service/impl/ComparisonDetailsServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/impl/ComparisonDetailsServiceImpl.java new file mode 100644 index 00000000..64b6bfd9 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/impl/ComparisonDetailsServiceImpl.java @@ -0,0 +1,10 @@ +package com.hzya.frame.sysnew.comparison.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity; +import com.hzya.frame.sysnew.comparison.service.IComparisonDetailsService; +import org.springframework.stereotype.Service; + +@Service(value = "comparisonDetailsServiceImpl") +public class ComparisonDetailsServiceImpl extends BaseService implements IComparisonDetailsService { +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/comparison/service/impl/ComparisonServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/impl/ComparisonServiceImpl.java new file mode 100644 index 00000000..0045280f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/comparison/service/impl/ComparisonServiceImpl.java @@ -0,0 +1,631 @@ +package com.hzya.frame.sysnew.comparison.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.mdm.mdmModule.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; +import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity; +import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity; +import com.hzya.frame.sysnew.comparison.service.IComparisonService; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.apache.commons.collections.CollectionUtils; +import org.apache.ivy.Main; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import sun.java2d.pipe.AAShapePipe; + +import java.util.*; + +@Service(value = "comparisonServiceImpl") +public class ComparisonServiceImpl extends BaseService implements IComparisonService { + + private IComparisonDao comparisonDao; + + @Autowired + private IComparisonDetailsDao comparisonDetailsDao; + + @Autowired + private ControlsLogDaoImpl controlsLogDaoimpl; + + @Autowired + private MdmServiceCache mdmServiceCache; + + @Autowired + public void setGeneralDataDao(IComparisonDao dao) { + this.comparisonDao = dao; + this.dao = dao; + } + + //分页查询通用数据数据 + @DS("master") + @Override + public JsonResultEntity queryEntityPage(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if (jsonObject == null) { + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + if (!checkStr(jsonObject.getString("mdmCode"))) { + return BaseResult.getFailureMessageEntity("主数据编码为空"); + } + ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class); + ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity(); + List comparisonEntities=new ArrayList<>(); + try { + //根据主数据编码查询表名称,字段名称等信息 10001 + //comparisonEntities = comparisonDao.queryComparison(comparisonEntity); + + //comparisonEntities=getComparisonEntity(comparisonEntity); + comparisonEntities=getComparisonEntityCache(comparisonEntity,"main"); + }catch (Exception e){ + logger.info("根据主数据编码查询信息错误:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("查询失败"); + } + Map map = new HashMap<>();//将主表数据存到map中 + if (comparisonEntities != null && comparisonEntities.size() > 0) { + for (ComparisonEntity entity : comparisonEntities) { + //遍历主表下面的所有key,字段名 + for (String key : jsonObject.keySet()) { + if (entity.getDbType().equals("1")) { + comparisonEntity.setDbName(entity.getDbName()); + if(!"mdmCode".equals(key)){ + map.put(key, jsonObject.getString(key)); + map.remove("appName"); + map.remove("appCode"); + } + } + if (entity.getDbType().equals("2")) { + comparisonDetailsEntity.setDbName(entity.getDbName()); + } + } + } + comparisonEntity.setMap(map); + try { + List list=new ArrayList<>(); + //查询主表数据 + List> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparisonEntity); + if(CollectionUtils.isNotEmpty(comparisonEntitiePages)){ + for (Map comparisonEntitiePage : comparisonEntitiePages) { + JSONObject jsonObjects=new JSONObject(); + jsonObjects.put(comparisonEntity.getDbName(),comparisonEntitiePage); + comparisonDetailsEntity.setFormmainId(String.valueOf(comparisonEntitiePage.get("id"))); + //查询明细表数据 + List> maps = comparisonDetailsDao.queryComparisonDetailsPage(comparisonDetailsEntity); + if(CollectionUtils.isNotEmpty(maps)){ + jsonObjects.put(comparisonDetailsEntity.getDbName(),maps); + }else { + jsonObjects.put(comparisonDetailsEntity.getDbName(),new JSONArray()); + } + list.add(jsonObjects); + } + } + PageInfo pageInfo = new PageInfo(list); + return BaseResult.getSuccessMessageEntity("查询成功", pageInfo); + } catch (Exception e) { + logger.info("查询通用数据错误:{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("查询失败"); + } + } + return BaseResult.getFailureMessageEntity("查询失败","请检查传递参数"); + } + + //新增通用数据数据 + @DS("master") + @Override + public JsonResultEntity saveEntity(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if (jsonObject == null) { + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + if (!checkStr(jsonObject.getString("mdmCode"))) { + return BaseResult.getFailureMessageEntity("主数据编码为空"); + } + if (!checkStr(jsonObject.getString("optionName"))) { + return BaseResult.getFailureMessageEntity("操作人为空"); + } + /*if (!checkStr(jsonObject.getString("rulePrefix"))) { + return BaseResult.getFailureMessageEntity("规则为空"); + }*/ + ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class); + ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity(); + List comparisonEntities=new ArrayList<>(); + try { + //根据主数据编码查询表名称,字段名称等信息 10001 + // comparisonEntities = comparisonDao.queryComparison(comparisonEntity); + + //comparisonEntities=getComparisonEntity(comparisonEntity); + comparisonEntities=getComparisonEntityCache(comparisonEntity,"main"); + }catch (Exception e){ + logger.info("根据主数据编码查询信息错误:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("保存失败"); + } + String main = jsonObject.getString("main");//获取主表数据 + JSONArray jsonArray = jsonObject.getJSONArray("details");//获取子表数据 + JSONObject jsonObjectMain = JSONObject.parseObject(main); + if(jsonObjectMain != null ) { + Map map = new HashMap<>();//将主表数据存到map中 + Map mapDetails = new HashMap<>();//将子表数据存到map中 + if (comparisonEntities != null && comparisonEntities.size() > 0) { + map = spliceMainMap(comparisonEntities, jsonObjectMain, map, comparisonEntity); + mapDetails = spliceDetailMap(comparisonEntities, mapDetails, comparisonDetailsEntity, jsonArray); + String uuid = null; + if (jsonObjectMain.getString("id") == null) { + uuid = UUIDUtils.getUUID(); + map.put("id", uuid); + } else { + uuid = jsonObjectMain.getString("id"); + map.put("id", jsonObjectMain.getString("id")); + } + map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443"); + map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443"); + map.put("org_id", "0"); + map.put("create_time", new Date()); + map.put("modify_time", new Date()); + map.put("sts", "Y"); + map.put("data_status", "Y");//新增状态 + map.put("add_status", "0");//新增状态 + map.put("update_status", "1");//修改状态 + map.put("delete_status", "1");//删除状态 + ComparisonEntity comparisonEntityRule = comparisonEntities.get(0); + //查询单据规则 只查询主表得,明细表不用 + try { + ComparisonEntity comparisonEntityRules = comparisonDao.queryComparisonById(comparisonEntityRule); + String documentRule = comparisonEntityRules.getDocumentRule(); + ; //"KH-2024-05-30-1"; + logger.info("通用数据保存接口中根据mId查询出来的单据规则为:{}", documentRule); + if (documentRule != null) { + //获取规则前缀 CK + String rulePrefix = documentRule.substring(0, documentRule.indexOf("-")); + //获取规则中间日期 yyyy-MM-dd + String ruleDate = documentRule.substring(documentRule.indexOf("-") + 1, documentRule.lastIndexOf("-")); + String ruleMiddle = getRuleDate(ruleDate); + //获取规则后缀 + String ruleSuffixLength = documentRule.substring(documentRule.lastIndexOf("-") + 1); + int ruleSuffix = ruleSuffixLength.length(); + //生成单据规则 + comparisonEntityRule.setRulePrefix(rulePrefix); + comparisonEntityRule.setRuleMiddle(ruleMiddle); + comparisonEntityRule.setRuleSuffix(ruleSuffix); + try { + //新生成单据规则保存到数据库 + ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule); + map.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则 + map.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号 + comparisonEntityRule.setMap(map); + } catch (Exception e) { + logger.info("保存通用数据时候生成单据规则错误:{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("保存失败"); + } + } + } catch (Exception e) { + logger.info("通用数据保存接口中查询单据规则错误:{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("保存失败"); + } + try { + //保存主表数据 + ComparisonEntity comparisonEntityOne = comparisonDao.saveComparison(comparisonEntityRule); + //保存子表数据 + if (mapDetails != null && mapDetails.size() > 0) { + String uuidDetail = UUIDUtils.getUUID(); + mapDetails.put("id", uuidDetail); + mapDetails.put("formmain_id", uuid); + mapDetails.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443"); + mapDetails.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443"); + mapDetails.put("org_id", "0"); + mapDetails.put("create_time", new Date()); + mapDetails.put("modify_time", new Date()); + mapDetails.put("sts", "Y"); + mapDetails.put("data_status","Y");//新增状态 + comparisonDetailsEntity.setMapDetails(mapDetails); + ComparisonDetailsEntity comparisonDetailsEntityOne = comparisonDetailsDao.saveComparisonDetails(comparisonDetailsEntity); + //comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne); + map.put("details",mapDetails); + //保存操作日志 + //controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log"); + } + //保存操作日志 + controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonEntityRule.getDbName()+"_option_log"); + return BaseResult.getSuccessMessageEntity("保存成功", map); + } catch (Exception e) { + logger.info("保存通用数据时候错误:{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("保存失败"); + } + } + } + return BaseResult.getFailureMessageEntity("查询失败","请检查传递参数"); + } + + //更新通用数据数据 + @Override + public JsonResultEntity updateEntity(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if (jsonObject == null) { + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + 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");//获取主表数据 + JSONArray jsonArray = jsonObject.getJSONArray("details");//获取子表数据 + if(!checkStr(jsonObjectMain.getString("id"))){ + return BaseResult.getFailureMessageEntity("更新时候主表id不能为空"); + } + List comparisonEntities=new ArrayList<>(); + //根据主数据编码查询表名称,字段名称等信息 10001 + try { + // comparisonEntities = comparisonDao.queryComparison(comparisonEntity); + + //comparisonEntities=getComparisonEntity(comparisonEntity); + comparisonEntities=getComparisonEntityCache(comparisonEntity,"main"); + }catch (Exception e){ + logger.info("根据主数据编码查询信息错误:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("更新失败"); + } + Map map=new HashMap<>();//将主表数据存到map中 + Map mapDetails=new HashMap<>();//将子表数据存到map中 + if(comparisonEntities !=null && comparisonEntities.size()>0) { + map=spliceMainMap(comparisonEntities,jsonObjectMain,map,comparisonEntity); + mapDetails=spliceDetailMap(comparisonEntities,mapDetails,comparisonDetailsEntity,jsonArray); + 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");//修改状态 + comparisonEntity.setMap(map); + comparisonEntity.setId(jsonObjectMain.getString("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 { + //保存主表数据 + Integer integer = comparisonDao.updateComparisonByType(comparisonEntity); + if (integer > 0) { + //保存子表数据 + if (mapDetails != null && mapDetails.size() > 0) { + mapDetails.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443"); + mapDetails.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443"); + mapDetails.put("org_id", "0"); + mapDetails.put("modify_time", new Date()); + mapDetails.put("sts", "Y"); + mapDetails.put("data_status","F");//数据状态 + comparisonDetailsEntity.setFormmainId(jsonObjectMain.getString("id")); + comparisonDetailsEntity.setMapDetails(mapDetails); + comparisonDetailsDao.updateComparisonDetailsByType(comparisonDetailsEntity); + //保存操作日志 + // 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("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log"); + return BaseResult.getSuccessMessageEntity("更新成功", integer); + }else{ + return BaseResult.getFailureMessageEntity("更新失败"); + } + } catch (Exception e) { + logger.info("更新通用数据时候错误:{}", e.getMessage()); + return BaseResult.getFailureMessageEntity("更新失败"); + } + } + return BaseResult.getFailureMessageEntity("查询失败","请检查传递参数"); + } + + //删除通用数据 + @Override + public JsonResultEntity deleteEntity(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if (jsonObject == null) { + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + 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");//获取主表数据 + if(!checkStr(jsonObjectMain.getString("id"))){ + return BaseResult.getFailureMessageEntity("删除时候主表id不能为空"); + } + List comparisonEntities=new ArrayList<>(); + //根据主数据编码查询表名称,字段名称等信息 10001 + try { + // comparisonEntities = comparisonDao.queryComparison(comparisonEntity); + + //comparisonEntities=getComparisonEntity(comparisonEntity); + comparisonEntities=getComparisonEntityCache(comparisonEntity,"main"); + }catch (Exception e){ + logger.info("根据主数据编码查询信息错误:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("删除失败"); + } + Map map=new HashMap<>(); + if(comparisonEntities !=null && comparisonEntities.size()>0) { + for (ComparisonEntity entity : comparisonEntities) { + //遍历主表下面的所有key,字段名 + for (String key : jsonObjectMain.keySet()) { + if (entity.getDbType().equals("1")) { + comparisonEntity.setDbName(entity.getDbName()); + if(entity.getEnName().equals(key)){ + map.put(key, jsonObjectMain.getString(key)); + } + } + if(entity.getDbType().equals("2")){ + comparisonDetailsEntity.setDbName(entity.getDbName()); + } + } + } + comparisonEntity.setId(jsonObjectMain.getString("id")); + comparisonEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + comparisonEntity.setMap(map); + try { + Integer integer = comparisonDao.deleteComparison(comparisonEntity); + if(integer>0){ + if(comparisonDetailsEntity.getDbName()!=null){ + comparisonDetailsEntity.setFormmainId(jsonObjectMain.getString("id")); + comparisonDetailsEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443"); + 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"); + return BaseResult.getSuccessMessageEntity("删除成功",integer); + }else{ + return BaseResult.getFailureMessageEntity("删除失败","请查看id是否在表中存在"); + } + }catch (Exception e){ + logger.info("删除通用数据数据错误:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("删除失败"); + } + } + 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){ + case "yyyy-MM-dd": + return "%Y-%m-%d"; + case "yyyyMMdd": + return "%Y%m%d"; + case "yyyy-MM-dd HH:mm:ss": + return "Y-%m-%d %H:%i:%s"; + case "yyyyMMddHHmmss": + return "%Y%m%d%H%i%s"; + case "yyyyMMddHHmmssSSS": + return "%Y%m%d%H%i%s%f"; + default: + return null; + } + } + + //得到主表数据 + private Map spliceMainMap(List comparisonEntities,JSONObject jsonObjectMain,Map map,ComparisonEntity comparisonEntity){ + for (ComparisonEntity entity : comparisonEntities) { + //遍历主表下面的所有key,字段名 + for (String key : jsonObjectMain.keySet()) { + if (entity.getDbType().equals("1")) { + comparisonEntity.setDbName(entity.getDbName()); + //如果表中得字段与输入得字段相等,则存起来 + if(entity.getEnName().equals(key)){ + map.put(key, jsonObjectMain.getString(key)); + } + } + } + } + return map; + } + + //得到明细表数据 + private Map spliceDetailMap(List comparisonEntities,Map mapDetails,ComparisonDetailsEntity comparisonDetailsEntity,JSONArray jsonArray){ + if (jsonArray != null && jsonArray.size() > 0) { + for (Object object : jsonArray) { + JSONObject jsonObjectDetails = (JSONObject) JSON.toJSON(object); + for (ComparisonEntity entity : comparisonEntities) { + //遍历主表下面的所有key,字段名 + for (String key : jsonObjectDetails.keySet()) { + if (entity.getDbType().equals("2")) { + comparisonDetailsEntity.setDbName(entity.getDbName()); + if(entity.getEnName().equals(key)){ + mapDetails.put(key, jsonObjectDetails.getString(key)); + } + } + } + } + } + } + return mapDetails; + } + + //根据主数据编码获取主表和明细表表名称,表字段信息 + public List getComparisonEntityCache(ComparisonEntity comparison,String type){ + List comparisonEntities = new ArrayList<>(); + //根据主数据编号获取模板主表 + MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(Long.valueOf(comparison.getMdmCode())); + //根据模板主表id获取模版表数据 + if(mdmModuleEntity!=null){ + MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity(); + mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity); + if(CollectionUtils.isNotEmpty(mdmModuleDbEntities)){ + for (MdmModuleDbEntity moduleDbEntity : mdmModuleDbEntities) { + switch (type){ + case "main": + //获取主表和明细表的字段信息 + if(moduleDbEntity.getDbType().equals("1") || moduleDbEntity.getDbType().equals("2")){ + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity=new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setMdmId(mdmModuleEntity.getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + if(CollectionUtils.isNotEmpty(mdmModuleDbFiledsEntities)){ + for (MdmModuleDbFiledsEntity moduleDbFiledsEntity : mdmModuleDbFiledsEntities) { + if (moduleDbFiledsEntity.getDbId().equals(moduleDbEntity.getId())) { + ComparisonEntity comparisonEntityFile = new ComparisonEntity(); + comparisonEntityFile.setChName(moduleDbFiledsEntity.getChName()); + comparisonEntityFile.setEnName(moduleDbFiledsEntity.getEnName()); + comparisonEntityFile.setFiledType(moduleDbFiledsEntity.getFiledType()); + comparisonEntityFile.setAddType(moduleDbFiledsEntity.getAddType()); + comparisonEntityFile.setUpdateType(moduleDbFiledsEntity.getUpdateType()); + comparisonEntityFile.setShowType(moduleDbFiledsEntity.getShowType()); + comparisonEntityFile.setQueryType(moduleDbFiledsEntity.getQueryType()); + comparisonEntityFile.setListType(moduleDbFiledsEntity.getListType()); + comparisonEntityFile.setViewType(moduleDbFiledsEntity.getViewType()); + comparisonEntityFile.setDbName(moduleDbEntity.getDbName()); + comparisonEntityFile.setDbType(moduleDbEntity.getDbType()); + comparisonEntityFile.setDbId(moduleDbEntity.getId()); + comparisonEntityFile.setmId(mdmModuleEntity.getId()); + comparisonEntityFile.setMdmName(mdmModuleEntity.getMdmName()); + comparisonEntityFile.setMdmCode(String.valueOf(mdmModuleEntity.getMdmCode())); + comparisonEntities.add(comparisonEntityFile); + } + } + } + } + break; + case "option": + //获取主表和明细表的字段信息 + if(moduleDbEntity.getDbType().equals("3")){ + MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity=new MdmModuleDbFiledsEntity(); + mdmModuleDbFiledsEntity.setDbId(moduleDbEntity.getId()); + List mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(mdmModuleDbFiledsEntity); + if(CollectionUtils.isNotEmpty(mdmModuleDbFiledsEntities)){ + for (MdmModuleDbFiledsEntity moduleDbFiledsEntity : mdmModuleDbFiledsEntities) { + if (moduleDbFiledsEntity.getDbId().equals(moduleDbEntity.getId())) { + ComparisonEntity comparisonEntityFile = new ComparisonEntity(); + comparisonEntityFile.setChName(moduleDbFiledsEntity.getChName()); + comparisonEntityFile.setEnName(moduleDbFiledsEntity.getEnName()); + comparisonEntityFile.setFiledType(moduleDbFiledsEntity.getFiledType()); + comparisonEntityFile.setAddType(moduleDbFiledsEntity.getAddType()); + comparisonEntityFile.setUpdateType(moduleDbFiledsEntity.getUpdateType()); + comparisonEntityFile.setShowType(moduleDbFiledsEntity.getShowType()); + comparisonEntityFile.setQueryType(moduleDbFiledsEntity.getQueryType()); + comparisonEntityFile.setListType(moduleDbFiledsEntity.getListType()); + comparisonEntityFile.setViewType(moduleDbFiledsEntity.getViewType()); + comparisonEntityFile.setDbName(moduleDbEntity.getDbName()); + comparisonEntityFile.setDbType(moduleDbEntity.getDbType()); + comparisonEntityFile.setDbId(moduleDbEntity.getId()); + comparisonEntityFile.setmId(mdmModuleEntity.getId()); + comparisonEntityFile.setMdmName(mdmModuleEntity.getMdmName()); + comparisonEntityFile.setMdmCode(String.valueOf(mdmModuleEntity.getMdmCode())); + comparisonEntities.add(comparisonEntityFile); + } + } + } + } + break; + default: + break; + } + + } + } + return comparisonEntities; + } + return null; + } + + //根据主数据编码获取数据,表名称,字段名称等 + public List getComparisonEntity(ComparisonEntity comparisonEntity) { + List comparisonEntities = new ArrayList<>(); + //根据主数据编码查询mdm_module数据 + ComparisonEntity comparisonEntityModule = comparisonDao.queryComparisonBymdmCode(comparisonEntity); + if (comparisonEntityModule != null) { + //根据mdm_module得id查询mdm_module_db得数据 + List 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 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 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; + } + +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/generalData/dao/IGeneralDataDao.java b/service/src/main/java/com/hzya/frame/sysnew/generalData/dao/IGeneralDataDao.java new file mode 100644 index 00000000..e7f315c1 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/generalData/dao/IGeneralDataDao.java @@ -0,0 +1,49 @@ +package com.hzya.frame.sysnew.generalData.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.sysnew.generalData.entity.GeneralDataEntity; + +import java.util.List; + +public interface IGeneralDataDao extends IBaseDao { + + /** + * + * @content 新增档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 16:49 + * **/ + GeneralDataEntity saveGeneralDataByType(GeneralDataEntity generalDataEntity); + + /** + * + * @content 查询档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 16:51 + * **/ + List queryGeneralData(GeneralDataEntity generalDataEntity); + + /** + * + * @content 编辑档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 17:17 + * **/ + Integer updateGeneralDataByType(GeneralDataEntity generalDataEntity); + + /** + * + * @content 删除档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 17:20 + * **/ + Integer deleteGeneralDataByType(GeneralDataEntity generalDataEntity); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/generalData/dao/impl/GeneralDataDaoImpl.java b/service/src/main/java/com/hzya/frame/sysnew/generalData/dao/impl/GeneralDataDaoImpl.java new file mode 100644 index 00000000..914dacca --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/generalData/dao/impl/GeneralDataDaoImpl.java @@ -0,0 +1,40 @@ +package com.hzya.frame.sysnew.generalData.dao.impl; + +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.sysnew.generalData.dao.IGeneralDataDao; +import com.hzya.frame.sysnew.generalData.entity.GeneralDataEntity; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +@Repository(value = "generalDataDaoImpl") +public class GeneralDataDaoImpl extends MybatisGenericDao implements IGeneralDataDao { + //新增档案对照 + @Override + public GeneralDataEntity saveGeneralDataByType(GeneralDataEntity generalDataEntity) { + generalDataEntity = super.save(getSqlIdPrifx() + "saveGeneralDataByType", generalDataEntity); + return generalDataEntity; + } + + //查询档案对照 + @Override + public List queryGeneralData(GeneralDataEntity generalDataEntity) { + List query = super.query(getSqlIdPrifx() + "queryGeneralData", generalDataEntity); + return query; + } + + //编辑档案对照 + @Override + public Integer updateGeneralDataByType(GeneralDataEntity generalDataEntity) { + int update = super.update(getSqlIdPrifx() + "updateGeneralDataByType", generalDataEntity); + return update; + } + + //删除档案对照 + @Override + public Integer deleteGeneralDataByType(GeneralDataEntity generalDataEntity) { + int update = super.update(getSqlIdPrifx() + "deleteGeneralDataByType", generalDataEntity); + return update; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/generalData/entity/GeneralDataEntity.java b/service/src/main/java/com/hzya/frame/sysnew/generalData/entity/GeneralDataEntity.java new file mode 100644 index 00000000..ac9bc603 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/generalData/entity/GeneralDataEntity.java @@ -0,0 +1,169 @@ +package com.hzya.frame.sysnew.generalData.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * + * @content 档案对照实体类 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 16:21 + * **/ +public class GeneralDataEntity extends BaseEntity { + private String archivesType;//类型 + private String leftCode;//左编码 + private String rightCode;//右编码 + + private String leftAppId;//左应用id + private String leftAppCode;//左应用编码 + private String leftAppName;//左应用名称 + private String leftApiId;//左接口ID + private String leftId;//左id + private String leftName;//左名称 + private String rightAppId;//右应用id + private String rightAppCode;//右应用编码 + private String rightAppName;//右应用名称 + private String rightApiId;//右接口ID + private String rightId;//右id + private String rightName;//右名称 + + private String leftOrg;//左公司 + private String rightOrg;//右公司 + + public String getLeftOrg() { + return leftOrg; + } + + public void setLeftOrg(String leftOrg) { + this.leftOrg = leftOrg; + } + + public String getRightOrg() { + return rightOrg; + } + + public void setRightOrg(String rightOrg) { + this.rightOrg = rightOrg; + } + + public String getArchivesType() { + return archivesType; + } + + public void setArchivesType(String archivesType) { + this.archivesType = archivesType; + } + + public String getLeftCode() { + return leftCode; + } + + public void setLeftCode(String leftCode) { + this.leftCode = leftCode; + } + + public String getRightCode() { + return rightCode; + } + + public void setRightCode(String rightCode) { + this.rightCode = rightCode; + } + + public String getLeftAppId() { + return leftAppId; + } + + public void setLeftAppId(String leftAppId) { + this.leftAppId = leftAppId; + } + + public String getLeftAppCode() { + return leftAppCode; + } + + public void setLeftAppCode(String leftAppCode) { + this.leftAppCode = leftAppCode; + } + + public String getLeftAppName() { + return leftAppName; + } + + public void setLeftAppName(String leftAppName) { + this.leftAppName = leftAppName; + } + + public String getLeftApiId() { + return leftApiId; + } + + public void setLeftApiId(String leftApiId) { + this.leftApiId = leftApiId; + } + + public String getLeftId() { + return leftId; + } + + public void setLeftId(String leftId) { + this.leftId = leftId; + } + + public String getLeftName() { + return leftName; + } + + public void setLeftName(String leftName) { + this.leftName = leftName; + } + + public String getRightAppId() { + return rightAppId; + } + + public void setRightAppId(String rightAppId) { + this.rightAppId = rightAppId; + } + + public String getRightAppCode() { + return rightAppCode; + } + + public void setRightAppCode(String rightAppCode) { + this.rightAppCode = rightAppCode; + } + + public String getRightAppName() { + return rightAppName; + } + + public void setRightAppName(String rightAppName) { + this.rightAppName = rightAppName; + } + + public String getRightApiId() { + return rightApiId; + } + + public void setRightApiId(String rightApiId) { + this.rightApiId = rightApiId; + } + + public String getRightId() { + return rightId; + } + + public void setRightId(String rightId) { + this.rightId = rightId; + } + + public String getRightName() { + return rightName; + } + + public void setRightName(String rightName) { + this.rightName = rightName; + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/generalData/entity/GeneralDataEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/generalData/entity/GeneralDataEntity.xml new file mode 100644 index 00000000..50065a16 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/generalData/entity/GeneralDataEntity.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into + + sys_personnel_control + sys_org_control + sys_stock_control + sys_merchant_control + sys_taxrate_control + sys_project_control + sys_bank_control + sys_bankaccount_control + sys_assets_control + + ( + + id , + left_app_id , + left_app_code , + left_app_name , + left_api_id , + left_id , + left_code , + left_name , + right_app_id , + right_app_code , + right_app_name , + right_api_id , + right_id , + right_code , + right_name , + left_org , + right_org , + sorts , + create_user_id , + modify_user_id , + org_id , + company_id , + create_time, + modify_time, + sts + + )values( + + #{id} , + #{leftAppId} , + #{leftAppCode} , + #{leftAppName} , + #{leftApiId} , + #{leftId} , + #{leftCode} , + #{leftName} , + #{rightAppId} , + #{rightAppCode} , + #{rightAppName} , + #{rightApiId} , + #{rightId} , + #{rightCode} , + #{rightName} , + #{leftOrg} , + #{rightOrg} , + #{sorts} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from + + sys_personnel_control + sys_org_control + sys_stock_control + sys_merchant_control + sys_taxrate_control + sys_project_control + sys_bank_control + sys_bankaccount_control + sys_assets_control + + a WHERE a.sts = 'Y' ), + #{create_user_id} , + #{modify_user_id} , + #{org_id} , + #{companyId} , + #{create_time} , + now() , + #{modify_time} , + now() , + #{sts} , + 'Y' + + ) + + + + + update + + sys_personnel_control + sys_org_control + sys_stock_control + sys_merchant_control + sys_taxrate_control + sys_project_control + sys_bank_control + sys_bankaccount_control + sys_assets_control + + set + + left_app_id = #{leftAppId}, + left_app_code = #{leftAppCode}, + left_app_name = #{leftAppName}, + left_api_id = #{leftApiId}, + left_id = #{leftId}, + left_code = #{leftCode}, + left_name = #{leftName}, + right_app_id = #{rightAppId}, + right_app_code = #{rightAppCode}, + right_app_name = #{rightAppName}, + right_api_id = #{rightApiId}, + right_id = #{rightId}, + right_code = #{rightCode}, + right_name = #{rightName}, + left_org = #{leftOrg} , + right_org = #{rightOrg} , + sorts = #{sorts}, + create_user_id = #{create_user_id}, + create_time = #{create_time}, + modify_user_id = #{modify_user_id}, + modify_time = #{modify_time}, + modify_time = now(), + sts = #{sts}, + org_id = #{org_id}, + company_id = #{companyId} + + where id = #{id} + + + + + update + + sys_personnel_control + sys_org_control + sys_stock_control + sys_merchant_control + sys_taxrate_control + sys_project_control + sys_bank_control + sys_bankaccount_control + sys_assets_control + + set sts= 'N' ,modify_time = now(),modify_user_id = #{modify_user_id} + + and left_app_id = #{leftAppId} + and left_app_code = #{leftAppCode} + and left_app_name = #{leftAppName} + and left_api_id = #{leftApiId} + and left_id = #{leftId} + and left_code = #{leftCode} + and left_name = #{leftName} + and right_app_id = #{rightAppId} + and right_app_code = #{rightAppCode} + and right_app_name = #{rightAppName} + and right_api_id = #{rightApiId} + and right_id = #{rightId} + and right_code = #{rightCode} + and right_name = #{rightName} + left_org = #{leftOrg} , + right_org = #{rightOrg} , + and sorts = #{sorts} + and sts = #{sts} + and company_id = #{companyId} + and id=#{id} and sts='Y' + + + + + diff --git a/service/src/main/java/com/hzya/frame/sysnew/generalData/service/IGeneralDataService.java b/service/src/main/java/com/hzya/frame/sysnew/generalData/service/IGeneralDataService.java new file mode 100644 index 00000000..105511f6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/generalData/service/IGeneralDataService.java @@ -0,0 +1,59 @@ +package com.hzya.frame.sysnew.generalData.service; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.sysnew.generalData.entity.GeneralDataEntity; +import com.hzya.frame.web.entity.JsonResultEntity; + +public interface IGeneralDataService extends IBaseService { + + /** + * + * @content 新增档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 16:23 + * **/ + JsonResultEntity saveEntity(JSONObject jsonObject); + + /** + * + * @content 查询档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 17:00 + * **/ + JsonResultEntity queryEntityPage(JSONObject jsonObject); + + /** + * + * @content 编辑档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 17:16 + * **/ + JsonResultEntity updateEntity(JSONObject jsonObject); + + /** + * + * @content 删除档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 17:23 + * **/ + JsonResultEntity deleteEntity(JSONObject jsonObject); + + /** + * + * @content 查询单个档案对照 + * @Param + * @Return + * @Author hecan + * @Date 2024/5/6 17:26 + * **/ + JsonResultEntity getEntity(JSONObject jsonObject); +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/generalData/service/impl/GeneralDataServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/generalData/service/impl/GeneralDataServiceImpl.java new file mode 100644 index 00000000..16095bc6 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/sysnew/generalData/service/impl/GeneralDataServiceImpl.java @@ -0,0 +1,241 @@ +package com.hzya.frame.sysnew.generalData.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageInfo; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.sysnew.generalData.dao.IGeneralDataDao; +import com.hzya.frame.sysnew.generalData.entity.GeneralDataEntity; +import com.hzya.frame.sysnew.generalData.service.IGeneralDataService; +import com.hzya.frame.sysnew.homeComponent.dao.ISysHomeComponentDao; +import com.hzya.frame.uuid.UUIDLong; +import com.hzya.frame.uuid.UUIDUtils; +import com.hzya.frame.web.entity.BaseResult; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; + +@Service(value = "generalDataServiceImpl") +public class GeneralDataServiceImpl extends BaseService implements IGeneralDataService { + private IGeneralDataDao generalDataDao; + + @Autowired + public void setGeneralDataDao(IGeneralDataDao dao) { + this.generalDataDao = dao; + this.dao = dao; + } + + //新增档案对照 + @Override + public JsonResultEntity saveEntity(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if(jsonObject == null ){ + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + if(!checkStr(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案对照类型为空"); + } + if(!checkStr(jsonObject.getString("leftCode"))){ + return BaseResult.getFailureMessageEntity("左编码为空"); + } + if(!checkStr(jsonObject.getString("rightCode"))){ + return BaseResult.getFailureMessageEntity("右编码为空"); + } + if(!checkStr(jsonObject.getString("leftAppCode"))){ + return BaseResult.getFailureMessageEntity("左应用编码为空"); + } + if(!checkStr(jsonObject.getString("rightAppCode"))){ + return BaseResult.getFailureMessageEntity("右应用编码为空"); + } + List fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"}); + if(!fzhs.contains(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案类型错误,请联系管理员"); + } + /* switch (jsonObject.getString("archivesType")){ + case "1"://人员对照 + GeneralDataEntity generalDataEntityPersonnel = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityPersonnel); + break; + case "2"://部门档案 + GeneralDataEntity generalDataEntityOrg = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityOrg); + break; + case "6"://存货对照 + GeneralDataEntity generalDataEntityStock = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityStock); + break; + case "73"://客商辅助核算 + GeneralDataEntity generalDataEntityMerchant = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityMerchant); + break; + case "D01"://税率 + GeneralDataEntity generalDataEntityTaxrate = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityTaxrate); + break; + case "jobass"://项目辅助核算 + GeneralDataEntity generalDataEntityProject = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityProject); + break; + case "93"://银行类别 + GeneralDataEntity generalDataEntityBank = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityBank); + break; + case "96"://银行账户 + GeneralDataEntity generalDataEntityBankaccount = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityBankaccount); + break; + case "22"://资产类别 + GeneralDataEntity generalDataEntityAssets = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataDao.saveGeneralDataByType(generalDataEntityAssets); + break; + default: + break; + }*/ + GeneralDataEntity generalDataEntity = jsonObject.toJavaObject(GeneralDataEntity.class); + generalDataEntity.setId(UUIDUtils.getUUID()); + generalDataEntity.setCreate_user_id("1"); + generalDataEntity.setModify_user_id("1"); + generalDataEntity.setOrg_id("0"); + generalDataEntity.setCompanyId("0"); + try { + GeneralDataEntity generalDataEntitySave = generalDataDao.saveGeneralDataByType(generalDataEntity); + return BaseResult.getSuccessMessageEntity("新增成功",generalDataEntitySave); + }catch (Exception e){ + logger.info("档案对照新增错误:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("新增失败"); + } + } + + //查询档案对照 + @Override + public JsonResultEntity queryEntityPage(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if(jsonObject == null ){ + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + if(!checkStr(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案对照类型为空"); + } + /*if(!checkStr(jsonObject.getString("leftCode"))){ + return BaseResult.getFailureMessageEntity("左编码为空"); + } + if(!checkStr(jsonObject.getString("rightCode"))){ + return BaseResult.getFailureMessageEntity("右编码为空"); + }*/ + List fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"}); + if(!fzhs.contains(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案类型错误,请联系管理员"); + } + GeneralDataEntity generalDataEntity = jsonObject.toJavaObject(GeneralDataEntity.class); + try { + List generalDataEntities = generalDataDao.queryGeneralData(generalDataEntity); + PageInfo pageInfo=new PageInfo(generalDataEntities); + return BaseResult.getSuccessMessageEntity("查询成功",pageInfo); + }catch (Exception e){ + logger.info("档案对照查询错误:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("查询失败"); + } + } + + //编辑档案对照 + @Override + public JsonResultEntity updateEntity(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if(jsonObject == null ){ + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + if(!checkStr(jsonObject.getString("id"))){ + return BaseResult.getFailureMessageEntity("id为空"); + } + if(!checkStr(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案对照类型为空"); + } + /*if(!checkStr(jsonObject.getString("leftCode"))){ + return BaseResult.getFailureMessageEntity("左编码为空"); + } + if(!checkStr(jsonObject.getString("rightCode"))){ + return BaseResult.getFailureMessageEntity("右编码为空"); + } + if(!checkStr(jsonObject.getString("leftAppCode"))){ + return BaseResult.getFailureMessageEntity("左应用编码为空"); + } + if(!checkStr(jsonObject.getString("rightAppCode"))){ + return BaseResult.getFailureMessageEntity("右应用编码为空"); + }*/ + List fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"}); + if(!fzhs.contains(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案类型错误,请联系管理员"); + } + GeneralDataEntity generalDataEntity = jsonObject.toJavaObject(GeneralDataEntity.class); + try { + generalDataDao.updateGeneralDataByType(generalDataEntity); + return BaseResult.getSuccessMessageEntity("编辑成功"); + }catch (Exception e){ + logger.info("档案对照编辑失败:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("编辑失败"); + } + } + + //删除档案对照 + @Override + public JsonResultEntity deleteEntity(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if(jsonObject == null ){ + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + if(!checkStr(jsonObject.getString("id"))){ + return BaseResult.getFailureMessageEntity("id为空"); + } + if(!checkStr(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案对照类型为空"); + } + /*if(!checkStr(jsonObject.getString("leftCode"))){ + return BaseResult.getFailureMessageEntity("左编码为空"); + } + if(!checkStr(jsonObject.getString("rightCode"))){ + return BaseResult.getFailureMessageEntity("右编码为空"); + } + if(!checkStr(jsonObject.getString("leftAppCode"))){ + return BaseResult.getFailureMessageEntity("左应用编码为空"); + } + if(!checkStr(jsonObject.getString("rightAppCode"))){ + return BaseResult.getFailureMessageEntity("右应用编码为空"); + }*/ + List fzhs = Arrays.asList(new String[]{"1", "2", "6", "73", "D01" , "jobass" , "93" , "96", "22"}); + if(!fzhs.contains(jsonObject.getString("archivesType"))){ + return BaseResult.getFailureMessageEntity("档案类型错误,请联系管理员"); + } + GeneralDataEntity generalDataEntity = jsonObject.toJavaObject(GeneralDataEntity.class); + try { + generalDataEntity.setCreate_user_id("1"); + generalDataEntity.setModify_user_id("1"); + generalDataDao.deleteGeneralDataByType(generalDataEntity); + return BaseResult.getSuccessMessageEntity("删除成功"); + }catch (Exception e){ + logger.info("档案对照删除失败:{}",e.getMessage()); + return BaseResult.getFailureMessageEntity("删除失败"); + } + } + + //查询单个档案对照对象 + @Override + public JsonResultEntity getEntity(JSONObject json) { + JSONObject jsonObject = json.getJSONObject("jsonStr"); + if(jsonObject == null ){ + return BaseResult.getFailureMessageEntity("数据为空,请先传递数据"); + } + if(!checkStr(jsonObject.getString("id"))){ + return BaseResult.getFailureMessageEntity("id为空"); + } + GeneralDataEntity generalDataEntity = jsonObject.toJavaObject(GeneralDataEntity.class); + try { + GeneralDataEntity generalDataEntityOne = generalDataDao.queryOne(generalDataEntity); + return BaseResult.getSuccessMessageEntity("查询单个成功",generalDataEntityOne); + }catch (Exception e){ + logger.info("查询单个档案对照错误:{}",e.getMessage()); + return BaseResult.getSuccessMessageEntity("查询单个失败"); + } + } +} diff --git a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java index c28bd496..ae475ac4 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/IGroovyIntegrationService.java @@ -1,6 +1,7 @@ package com.hzya.frame.sysnew.grovy.service; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.web.entity.JsonResultEntity; /** @@ -21,5 +22,5 @@ public interface IGroovyIntegrationService { * @param jsonObject 请求参数对象 * @return com.hzya.frame.web.entity.JsonResultEntity **/ - JsonResultEntity groovyScriptExecution(JSONObject jsonObject); + SysExtensionApiEntity groovyScriptExecution(JSONObject jsonObject); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java index 580c718c..293d81c6 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/grovy/service/impl/GroovyIntegrationServiceImpl.java @@ -2,12 +2,11 @@ package com.hzya.frame.sysnew.grovy.service.impl; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService; import com.hzya.frame.util.GroovyUtil; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; -import groovy.lang.GroovyClassLoader; -import groovy.lang.GroovyObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -24,28 +23,41 @@ import org.springframework.stereotype.Service; public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService { private static final Logger logger = LoggerFactory.getLogger(GroovyIntegrationServiceImpl.class); -// public static void main(String[] args) { -// HelloWorld helloWorld = new HelloWorld(); -// System.out.println(helloWorld.sayHello()); -// } - - public static void main(String[] args) throws IllegalAccessException, InstantiationException { - GroovyClassLoader groovyClassLoader = new GroovyClassLoader(); - - // 动态编译和加载Groovy脚本 - Class groovyClass = groovyClassLoader.parseClass("println(\"1231231\")"); - - // 创建Groovy类的实例 - GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); - // 执行Groovy脚本 - JSONObject jsonObject = new JSONObject(); - jsonObject.put("name", "张三"); - Object returnObj = groovyObject.invokeMethod("run", jsonObject.toJSONString()); - } @Override - public JsonResultEntity groovyScriptExecution(JSONObject jsonObject) { + public SysExtensionApiEntity groovyScriptExecution(JSONObject jsonObject) { Object object = GroovyUtil.execute(jsonObject); - return BaseResult.getSuccessMessageEntity(object); + return new SysExtensionApiEntity(); } + + public static void main(String[] args) { + java.lang.String str = "{\"project_org\":\"\",\"modify_time\":\"2024-06-17 16:52:34\",\"project_duty_dept\":null,\"project_name\":\"凯伍德组织档案\",\"document_rule_num\":1,\"add_status\":\"0\",\"delete_status\":\"1\",\"project_dutier\":\"\",\"id\":\"fb12734c8267488b96833633e68a7abc\",\"data_status\":\"F\",\"modify_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"sorts\":1,\"project_memo\":\"\",\"document_rule\":\"XM-2024-06-17-00001\",\"create_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"create_time\":\"2024-06-17 16:42:18\",\"company_id\":null,\"project_sh_name\":\"\",\"project_code\":\"01004\",\"project_currtype\":\"\",\"update_status\":\"0\",\"sts\":\"Y\",\"org_id\":\"0\",\"project_parentpro\":\"\",\"project_bill_type\":\"\"}"; + + A88772 s = new A88772(); + s .execute(str); + } + static class A88772 { + String execute(String jsonStr) { + com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr); + com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject(); + ufinterfaceObject.put("billtype", "supplier"); ufinterfaceObject.put("isexchange", "Y"); + ufinterfaceObject.put("replace", "Y"); ufinterfaceObject.put("sender", "OA"); + ufinterfaceObject.put("account", "01"); ufinterfaceObject.put("groupcode", "00"); + com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject(); + com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject(); + billheadObject.put("code", reqData.get("project_code")); billheadObject.put("supprop", "0"); + billheadObject.put("custstate", "1"); billheadObject.put("pk_supplierclass", "S01"); + billheadObject.put("pk_country", "CN"); billheadObject.put("pk_timezone", "P0800"); + billheadObject.put("pk_format", "ZH-CN"); billheadObject.put("enablestate", "2"); + billheadObject.put("name", reqData.get("project_sh_name")); billheadObject.put("pk_group", "00"); + billheadObject.put("pk_org", "003"); billheadObject.put("taxpayerid", "087981489021135119"); + returnObject.put("ufinterface",ufinterfaceObject); billObject.put("billhead", billheadObject); returnObject.put("bill",billObject); + System.out.println( returnObject.toJSONString()); + return returnObject.toJSONString(); + } + } + + + } diff --git a/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml index fbd96673..2028853d 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/homeComponent/entity/SysHomeComponentEntity.xml @@ -142,7 +142,7 @@ + keyProperty=""> insert into sys_home_component( id , @@ -184,7 +184,7 @@ ) - + insert into sys_home_component(id, name, code, state, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) values @@ -194,7 +194,7 @@ - + insert into sys_home_component(id, name, code, state, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml index 78fd315d..19dcb1d6 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTask/entity/SysIntegratedForegroundTaskEntity.xml @@ -131,7 +131,7 @@ from sys_integrated_foreground_task where id = #{ id } and sts='Y' - + insert into sys_integrated_foreground_task( id , @@ -169,7 +169,7 @@ ) - + insert into sys_integrated_foreground_task(workshop_name, plug_id, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -177,7 +177,7 @@ - + insert into sys_integrated_foreground_task(workshop_name, plug_id, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml index f9c35743..9f15654d 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskDetail/entity/SysIntegratedForegroundTaskDetailEntity.xml @@ -138,7 +138,7 @@ - + insert into sys_integrated_foreground_task_detail( id , @@ -180,7 +180,7 @@ ) - + insert into sys_integrated_foreground_task_detail(formmain_id, arg_code, arg_name, arg_type, arg_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -188,7 +188,7 @@ - + insert into sys_integrated_foreground_task_detail(formmain_id, arg_code, arg_name, arg_type, arg_value, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml index c124271e..ca053452 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/integratedForegroundTaskParameter/entity/SysIntegratedForegroundTaskParameterEntity.xml @@ -120,7 +120,7 @@ - + insert into sys_integrated_foreground_task_parameter( id , @@ -156,7 +156,7 @@ ) - + insert into sys_integrated_foreground_task_parameter(formmain_id, in_parameter, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -164,7 +164,7 @@ - + insert into sys_integrated_foreground_task_parameter(formmain_id, in_parameter, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java index 48fb1f2c..bef5714c 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/login/impl/LoginServiceImpl.java @@ -3,6 +3,8 @@ package com.hzya.frame.sysnew.login.impl; import cn.dev33.satoken.stp.SaTokenInfo; import cn.dev33.satoken.stp.StpUtil; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.sysnew.application.dao.ISysApplicationDao; +import com.hzya.frame.sysnew.application.entity.SysApplicationEntity; import com.hzya.frame.sysnew.login.ILoginService; import com.hzya.frame.sysnew.organ.dao.ISysOrganDao; import com.hzya.frame.sysnew.organ.entity.SysOrganEntity; @@ -37,6 +39,8 @@ public class LoginServiceImpl implements ILoginService { @Resource private ISysOrganDao sysOrganDao; + @Resource + private ISysApplicationDao sysApplicationDao; @Resource private InterfaceCache interfaceCache; /** @@ -111,6 +115,9 @@ public class LoginServiceImpl implements ILoginService { res.put("token", token); res.put("userInfo", sysUserEntity); res.put("company", sysOrganEntities); + + + //切换数据源查询 return BaseResult.getSuccessMessageEntity("登录成功", res); } diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml index a4968ef5..e89991a8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManage/entity/SysMessageManageEntity.xml @@ -172,7 +172,7 @@ + > insert into sys_message_manage( id , @@ -216,7 +216,7 @@ ) - + insert into sys_message_manage(theme, code, send_app, send_api, data_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -226,7 +226,7 @@ - + insert into sys_message_manage(theme, code, send_app, send_api, data_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml index fde5ed64..8567830e 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageDetail/entity/SysMessageManageDetailEntity.xml @@ -162,8 +162,8 @@ + parameterType="com.hzya.frame.sysnew.messageManageDetail.entity.SysMessageManageDetailEntity" + > insert into sys_message_manage_detail( id , @@ -211,7 +211,7 @@ ) - + insert into sys_message_manage_detail(formmain_id, receive_name, receive_code, receive_app, receive_api, data_type, return_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -221,7 +221,7 @@ - + insert into sys_message_manage_detail(formmain_id, receive_name, receive_code, receive_app, receive_api, data_type, return_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml index a0135edf..52e822e8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLog/entity/SysMessageManageLogEntity.xml @@ -290,7 +290,7 @@ + > insert into @@ -357,7 +357,7 @@ ) - + insert into sys_message_manage_log(message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, @@ -369,7 +369,7 @@ - + insert into sys_message_manage_log(message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml index d8200586..99512ec8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/detail/entity/SysMessageManageLogDetailBackEntity.xml @@ -140,7 +140,7 @@ + > insert into sys_message_manage_log_detail_back( id , @@ -180,7 +180,7 @@ ) - + insert into sys_message_manage_log_detail_back(id,message_manage_id, source_data, target_data, return_data,sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values @@ -189,7 +189,7 @@ - + insert into sys_message_manage_log_detail_back(message_manage_id, source_data, target_data, return_data, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml index 4bd5ff28..b4f63096 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogBack/entity/SysMessageManageLogBackEntity.xml @@ -273,7 +273,7 @@ + > insert into sys_message_manage_log_back( id , @@ -335,7 +335,7 @@ ) - + insert into sys_message_manage_log_back(id,message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) @@ -345,7 +345,7 @@ - + insert into sys_message_manage_log_back(message_manage_id, theme, message_code, send_app, send_api, receive_code, receive_app, receive_api, source_data, target_data, return_data, return_type,error_status, status, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) diff --git a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml index c12fe5ed..b7ebe0b4 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/messageManageLogDetail/entity/SysMessageManageLogDetailEntity.xml @@ -140,7 +140,7 @@ + > insert into sys_message_manage_log_detail( id , @@ -176,7 +176,7 @@ ) - + insert into sys_message_manage_log_detail(message_manage_id, source_data, target_data, return_data,sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -186,7 +186,7 @@ - + insert into sys_message_manage_log_detail(message_manage_id, source_data, target_data, return_data, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml index e58a4c4f..69b3daf8 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/plugArg/entity/SysPlugArgEntity.xml @@ -131,7 +131,7 @@ - + insert into sys_plug_arg( id , @@ -169,7 +169,7 @@ ) - + insert into sys_plug_arg(id, plug_id, plug_code, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -177,7 +177,7 @@ - + insert into sys_plug_arg(id, plug_id, plug_code, plug_name, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml index 49543da7..91993353 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/plugArgDeatil/entity/SysPlugArgDetailEntity.xml @@ -142,7 +142,7 @@ + > insert into sys_plug_arg_detail( id , @@ -184,7 +184,7 @@ ) - + insert into sys_plug_arg_detail(formmain_id, arg_code, arg_name, arg_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, sts) values @@ -194,7 +194,7 @@ - + insert into sys_plug_arg_detail(formmain_id, arg_code, arg_name, arg_type, remark, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id) values diff --git a/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java index 7d9a333f..c552e1d2 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/user/entity/SysUserEntity.java @@ -27,6 +27,11 @@ public class SysUserEntity extends BaseEntity { * 登录密码 */ private String password; + + /** + * 老登录密码 + */ + private String OldPassword; /** * 盐 */ @@ -204,5 +209,13 @@ public class SysUserEntity extends BaseEntity { public void setOrganId(String organId) { this.organId = organId; } + + public String getOldPassword() { + return OldPassword; + } + + public void setOldPassword(String oldPassword) { + OldPassword = oldPassword; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java b/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java index fba89aba..559a5424 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java +++ b/service/src/main/java/com/hzya/frame/sysnew/user/service/ISysUserService.java @@ -84,6 +84,14 @@ public interface ISysUserService extends IBaseService { * @Date 2:37 下午 2024/3/27 **/ JsonResultEntity resetPassword(JSONObject jsonObject); + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 用户重置密码 + * @Date 2:37 下午 2024/3/27 + **/ + JsonResultEntity userResetPassword(JSONObject jsonObject); /** diff --git a/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java b/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java index 80655731..e7648cce 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/sysnew/user/service/impl/SysUserServiceImpl.java @@ -1,5 +1,6 @@ package com.hzya.frame.sysnew.user.service.impl; +import cn.dev33.satoken.stp.StpUtil; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -380,7 +381,43 @@ public class SysUserServiceImpl extends BaseService imple interfaceCache.reloadData("1"); return BaseResult.getSuccessMessageEntity("重置密码成功"); } - + /** + * @param jsonObject + * @return com.hzya.frame.web.entity.JsonResultEntity + * @Author lvleigang + * @Description 重置密码 + * @Date 2:37 下午 2024/3/27 + **/ + @Override + public JsonResultEntity userResetPassword(JSONObject jsonObject) { + SysUserEntity entity = getData("jsonStr", jsonObject, SysUserEntity.class); + if (entity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if (entity.getOldPassword() == null || "".equals(entity.getOldPassword())) { + return BaseResult.getFailureMessageEntity("请先输入原密码"); + } + if (entity.getPassword() == null || "".equals(entity.getPassword())) { + return BaseResult.getFailureMessageEntity("请先输入新密码"); + } + if(entity.getPassword().equals(entity.getOldPassword())){ + return BaseResult.getFailureMessageEntity("新密码和原密码不能一样"); + } + SysUserEntity oldEntity = sysUserDao.get(StpUtil.getLoginIdAsString()); + if (oldEntity == null) { + return BaseResult.getFailureMessageEntity("系统错误"); + } + if(!oldEntity.getPassword().equals(AESUtil.encrypt(oldEntity.getLoginCode()+"-"+entity.getOldPassword()))){ + return BaseResult.getFailureMessageEntity("原密码错误,请重新输入"); + } + oldEntity.setPassword(AESUtil.encrypt(oldEntity.getLoginCode()+"-"+entity.getPassword())); + oldEntity.setUpdate(); + //保存密码 + sysUserDao.update(oldEntity); + interfaceCache.reloadData("1"); + StpUtil.logoutByTokenValue(StpUtil.getTokenValue()); + return BaseResult.getSuccessMessageEntity("重置密码成功"); + } /** * @param jsonObject diff --git a/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java b/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java index f126e010..866b91a3 100644 --- a/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/u8c/ax/service/impl/AxServiceImpl.java @@ -1,16 +1,10 @@ package com.hzya.frame.u8c.ax.service.impl; -import cn.hutool.http.HttpRequest; -import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.basedao.service.impl.BaseService; import com.hzya.frame.u8c.ax.dao.IAxDao; -import com.hzya.frame.u8c.ax.entity.ArchivesEntity; -import com.hzya.frame.u8c.ax.entity.Ass; -import com.hzya.frame.u8c.ax.entity.Voucher; -import com.hzya.frame.u8c.ax.entity.VoucherDetails; -import com.hzya.frame.u8c.ax.entity.VoucherRoot; +import com.hzya.frame.u8c.ax.entity.*; import com.hzya.frame.u8c.ax.service.IAxService; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; @@ -22,14 +16,11 @@ 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.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.beans.factory.annotation.Autowired; -import com.hzya.frame.basedao.service.impl.BaseService; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -47,7 +38,7 @@ public class AxServiceImpl extends BaseService implement this.axDao = dao; this.dao = dao; } - @Value("${ax.url}") + @Value("${zt.url}") private String voucherUrl; private final String publicKey = "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj"; private final String secretKey = "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA="; @@ -218,6 +209,7 @@ public class AxServiceImpl extends BaseService implement post.setHeader("publicKey", publicKey); post.setHeader("secretKey", secretKey); post.setHeader("appId", appId); + post.setHeader("needStackTrace", jsonObject.getString("needStackTrace")); switch (jsonObject.getString("voucherType")){ case "add"://新增 post.setHeader("apiCode", pzApiCodexz); diff --git a/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java b/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java index 0ae99bfc..3fab59ec 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java @@ -164,5 +164,9 @@ public class EntranceController { public JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { return sysApplicationService.externalCallInterface(servletRequest,servletResponse); } - + @RequestMapping(value = "/externalCallInterfaceToESB") + @ResponseBody + public JsonResultEntity externalCallInterfaceToESB(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { + return sysApplicationService.externalCallInterfaceToESB(servletRequest,servletResponse); + } } diff --git a/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java b/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java index 093550aa..86d047b0 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java @@ -235,7 +235,7 @@ public class EntranceServiceImpl implements IEntranceService { public Object platformInterface(ServletRequest servletRequest, ServletResponse servletResponse) throws InvocationTargetException, IllegalAccessException { HttpServletRequest request = (HttpServletRequest) servletRequest; //tailuo 要访问的Bean名称 - String service = request.getHeader("tl"); + String service = request.getHeader("yatl"); //bean方法 String serviceMethod = request.getHeader("yadj"); String body = ServletUtil.getBody(servletRequest); diff --git a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java index 390c1f15..e4d9c3f1 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java @@ -6,9 +6,8 @@ import com.baomidou.dynamic.datasource.DynamicRoutingDataSource; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException; import com.hzya.frame.datasource.DataSourceUtilProperties; -import com.hzya.frame.sys.dataSource.dao.ISysDataSourceDao; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceEntity; -import com.hzya.frame.sys.dataSource.entity.SysDataSourceVo; +import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao; +import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity; import com.hzya.frame.util.AESUtil; import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.exception.BaseSystemException; @@ -38,7 +37,7 @@ public class AopDynamicRoutingDataSourceInit { @Resource private DataSource dataSource; @Resource - private ISysDataSourceDao sysDataSourceDao; + private ISysApplicationDatabaseDao sysApplicationDatabaseDao; @Before("@annotation(dsAnnotation)") @@ -64,12 +63,12 @@ public class AopDynamicRoutingDataSourceInit { dsDatasource = ds.getDataSource(dsValue); } catch (CannotFindDataSourceException exception) { //logger.info("beforeDynamicRoutingDataSourceInitMethod:根据ds获取dsDatasource失败!异常信息:" + "exception.getMessage()" + " 执行初始化数据源:" + dsValue); - SysDataSourceEntity entity = new SysDataSourceEntity(); + SysApplicationDatabaseEntity entity = new SysApplicationDatabaseEntity(); entity.setSts("Y"); - entity.setUseState(1); - entity.setDataState("1"); + entity.setDbStatus("1"); entity.setSourceCode(dsValue); - List sysDataSourceEntities = sysDataSourceDao.queryDSBase(entity); + entity.setDataSourceCode("master"); + List sysDataSourceEntities = sysApplicationDatabaseDao.queryDSBase(entity); //logger.info("beforeDynamicRoutingDataSourceInitMethod:根据dsValue获取数据源信息查询结果 sysDataSourceEntities.size:" + sysDataSourceEntities.size()); if (sysDataSourceEntities != null && sysDataSourceEntities.size() > 0) { for (int i = 0; i < sysDataSourceEntities.size(); i++) { @@ -117,9 +116,9 @@ public class AopDynamicRoutingDataSourceInit { } else if ("sqlServer".equalsIgnoreCase(source_type)) { driveClass = DataSourceUtilProperties.SQL2005DRIVER; } -// else if ("dm".equalsIgnoreCase(source_type)) { -// driveClass = DataSourceUtilProperties.dm; -// } + else if ("dm".equalsIgnoreCase(source_type)) { + driveClass = DataSourceUtilProperties.dm; + } try { //测试连接 Class.forName(driveClass);