Merge branch 'yuecheng-project' of http://192.168.2.237:3000/root/kangarooDataCenterV3 into yuecheng-project
This commit is contained in:
commit
5991883e53
|
@ -4,14 +4,13 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.base.PluginBaseEntity;
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
|
||||||
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
||||||
import com.hzya.frame.sysnew.comparison.masterData.service.impl.MasterDataOrgsServiceImpl;
|
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织档案(PayBill)表服务接口
|
* 付款单(PayBill)表服务接口
|
||||||
*
|
*
|
||||||
* @author makejava
|
* @author makejava
|
||||||
* @since 2024-06-07 18:30:05
|
* @since 2024-06-07 18:30:05
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.hzya.frame.plugin.a8bill.plugin;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
||||||
|
import com.hzya.frame.seeyon.recbill.service.IRecBillService;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收款单(RecBill)表服务接口
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-06-07 18:30:05
|
||||||
|
*/
|
||||||
|
public class RecBillPluginInitializer extends PluginBaseEntity{
|
||||||
|
Logger logger = LoggerFactory.getLogger(RecBillPluginInitializer.class);
|
||||||
|
@Autowired
|
||||||
|
private IRecBillService recBillService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginId() {
|
||||||
|
return "RecBillPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "RecBillPluginInitializer插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "RecBillPluginInitializer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPluginType() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||||
|
try {
|
||||||
|
logger.info("======开始执行收款单据信息同步========");
|
||||||
|
return recBillService.sendRecBillToBip(requestJson);
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("======执行收款单据同步失败:{}========",e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package com.hzya.frame.plugin.masterData.plugin;
|
package com.hzya.frame.plugin.masterData.plugin;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.base.PluginBaseEntity;
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataCustoMermanageService;
|
|
||||||
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataService;
|
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataService;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -91,8 +91,7 @@ mybatis-plus:
|
||||||
db-config:
|
db-config:
|
||||||
id-type: auto # 主键策略
|
id-type: auto # 主键策略
|
||||||
zt:
|
zt:
|
||||||
url:
|
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface
|
||||||
# 积木报表工具
|
|
||||||
#JimuReport[minidao配置]
|
#JimuReport[minidao配置]
|
||||||
minidao :
|
minidao :
|
||||||
base-package: org.jeecg.modules.jmreport.desreport.dao*
|
base-package: org.jeecg.modules.jmreport.desreport.dao*
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||||
<beans default-autowire="byName">
|
<beans default-autowire="byName">
|
||||||
<bean name="PayBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.PayBillPluginInitializer" />
|
<bean name="PayBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.PayBillPluginInitializer" />
|
||||||
|
<bean name="RecBillPluginInitializer" class="com.hzya.frame.plugin.a8bill.plugin.RecBillPluginInitializer" />
|
||||||
</beans>
|
</beans>
|
||||||
|
|
31
pom.xml
31
pom.xml
|
@ -29,7 +29,7 @@
|
||||||
<gson.version>2.8.5</gson.version>
|
<gson.version>2.8.5</gson.version>
|
||||||
<zxing.version>3.3.0</zxing.version>
|
<zxing.version>3.3.0</zxing.version>
|
||||||
<hutool.version>5.8.19</hutool.version>
|
<hutool.version>5.8.19</hutool.version>
|
||||||
<druid.version>1.2.0</druid.version>
|
<druid.version>1.1.22</druid.version>
|
||||||
<!-- <mybatis-spring-boot-starter.version>2.2.2</mybatis-spring-boot-starter.version>-->
|
<!-- <mybatis-spring-boot-starter.version>2.2.2</mybatis-spring-boot-starter.version>-->
|
||||||
<mybatis-plus-boot-starter.version>3.5.6</mybatis-plus-boot-starter.version>
|
<mybatis-plus-boot-starter.version>3.5.6</mybatis-plus-boot-starter.version>
|
||||||
<!-- <mysql-connector-j.version>8.0.33</mysql-connector-j.version>-->
|
<!-- <mysql-connector-j.version>8.0.33</mysql-connector-j.version>-->
|
||||||
|
@ -235,8 +235,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
<version>1.2.23</version>
|
<version>${druid-spring-boot-starter.version}</version>
|
||||||
<!-- <version>${druid-spring-boot-starter.version}</version>-->
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -246,12 +245,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 添加dm8 jdbc jar 包依赖-->
|
<!-- 添加dm8 jdbc jar 包依赖-->
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.dameng</groupId>-->
|
|
||||||
<!-- <artifactId>DmJdbcDriver18</artifactId>-->
|
|
||||||
<!-- <version>8.1.1.193</version>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dameng</groupId>
|
<groupId>com.dameng</groupId>
|
||||||
<artifactId>Dm8JdbcDriver18</artifactId>
|
<artifactId>Dm8JdbcDriver18</artifactId>
|
||||||
|
@ -259,7 +252,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-beanutils</groupId>
|
<groupId>commons-beanutils</groupId>
|
||||||
<artifactId>commons-beanutils</artifactId>
|
<artifactId>commons-beanutils</artifactId>
|
||||||
|
@ -346,21 +338,7 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-cache</artifactId>
|
<artifactId>spring-boot-starter-cache</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- postgresql驱动 -->
|
||||||
<!-- JimuReport 积木报表 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jeecgframework.jimureport</groupId>
|
|
||||||
<artifactId>jimureport-spring-boot-starter</artifactId>
|
|
||||||
<version>${jimureport.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- minio oss-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.minio</groupId>
|
|
||||||
<artifactId>minio</artifactId>
|
|
||||||
<version>${minio.version}</version>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
<!-- postgresql驱动 -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
|
@ -391,7 +369,6 @@
|
||||||
<artifactId>flyway-mysql</artifactId>
|
<artifactId>flyway-mysql</artifactId>
|
||||||
<version>8.5.13</version>
|
<version>8.5.13</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -441,7 +418,6 @@
|
||||||
<directory>src/main/resources</directory>
|
<directory>src/main/resources</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*.yml</include>
|
<include>**/*.yml</include>
|
||||||
<include>**/*.jar</include>
|
|
||||||
<include>**/*.properties</include>
|
<include>**/*.properties</include>
|
||||||
<include>**/*.xml</include>
|
<include>**/*.xml</include>
|
||||||
<include>**/*.xmreport</include>
|
<include>**/*.xmreport</include>
|
||||||
|
@ -460,7 +436,6 @@
|
||||||
<directory>src/</directory>
|
<directory>src/</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*.yml</include>
|
<include>**/*.yml</include>
|
||||||
<include>**/*.jar</include>
|
|
||||||
<include>**/*.properties</include>
|
<include>**/*.properties</include>
|
||||||
<include>**/*.xml</include>
|
<include>**/*.xml</include>
|
||||||
<include>**/*.json</include>
|
<include>**/*.json</include>
|
||||||
|
|
|
@ -342,6 +342,7 @@ where id = #{id}
|
||||||
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
||||||
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
||||||
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
||||||
|
`data_id` varchar(100) DEFAULT NULL COMMENT 'data_id',
|
||||||
</when>
|
</when>
|
||||||
<when test="tableType == '2'.toString()">
|
<when test="tableType == '2'.toString()">
|
||||||
`id` varchar(50) NOT NULL COMMENT '唯一标识码',
|
`id` varchar(50) NOT NULL COMMENT '唯一标识码',
|
||||||
|
@ -355,6 +356,7 @@ where id = #{id}
|
||||||
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
||||||
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
||||||
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
||||||
|
`data_id` varchar(100) DEFAULT NULL COMMENT 'data_id',
|
||||||
</when>
|
</when>
|
||||||
<when test="tableType == '3'.toString()">
|
<when test="tableType == '3'.toString()">
|
||||||
`id` varchar(50) NOT NULL COMMENT '唯一标识码',
|
`id` varchar(50) NOT NULL COMMENT '唯一标识码',
|
||||||
|
@ -372,6 +374,8 @@ where id = #{id}
|
||||||
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
||||||
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
||||||
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
||||||
|
`data_type` varchar(255) DEFAULT NULL COMMENT '状态 1、成功2、失败',
|
||||||
|
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||||
</when>
|
</when>
|
||||||
<when test="tableType == '4'.toString()">
|
<when test="tableType == '4'.toString()">
|
||||||
`id` varchar(50) NOT NULL COMMENT '唯一标识码',
|
`id` varchar(50) NOT NULL COMMENT '唯一标识码',
|
||||||
|
@ -388,6 +392,8 @@ where id = #{id}
|
||||||
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
`sts` varchar(1) DEFAULT NULL COMMENT '状态(Y正常N删除)',
|
||||||
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
`org_id` varchar(50) DEFAULT NULL COMMENT '组织机构ID',
|
||||||
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
`company_id` varchar(50) DEFAULT NULL COMMENT '公司id',
|
||||||
|
`data_type` varchar(50) DEFAULT NULL COMMENT '状态 1、成功2、失败',
|
||||||
|
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
PRIMARY KEY (`sorts`,`id`) USING BTREE
|
PRIMARY KEY (`sorts`,`id`) USING BTREE
|
||||||
|
@ -812,7 +818,7 @@ where id = #{id}
|
||||||
<if test="mdmModuleDistributeDetailEntities != null and mdmModuleDistributeDetailEntities.size>0">
|
<if test="mdmModuleDistributeDetailEntities != null and mdmModuleDistributeDetailEntities.size>0">
|
||||||
AND
|
AND
|
||||||
<foreach collection="mdmModuleDistributeDetailEntities" item="item" index="index" open="(" close=")" >
|
<foreach collection="mdmModuleDistributeDetailEntities" item="item" index="index" open="(" close=")" >
|
||||||
${item.leftBracket} ${item.filedName}
|
${item.leftBracket} ${item.filedId}
|
||||||
<choose>
|
<choose>
|
||||||
<when test="item.compareType == '1'.toString() ">
|
<when test="item.compareType == '1'.toString() ">
|
||||||
=
|
=
|
||||||
|
|
|
@ -582,6 +582,24 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
||||||
document_rule_num.setCreate();
|
document_rule_num.setCreate();
|
||||||
document_rule_num.setDataType("1");
|
document_rule_num.setDataType("1");
|
||||||
mdmModuleDbFiledsEntities.add(document_rule_num);
|
mdmModuleDbFiledsEntities.add(document_rule_num);
|
||||||
|
|
||||||
|
MdmModuleDbFiledsEntity data_id = new MdmModuleDbFiledsEntity();
|
||||||
|
data_id.setMdmId(entity.getMdmId());
|
||||||
|
data_id.setDbId(entity.getId());
|
||||||
|
data_id.setEnName("data_id");
|
||||||
|
data_id.setChName("第三方主键ID");
|
||||||
|
data_id.setFiledType("1");
|
||||||
|
data_id.setAddType("2");
|
||||||
|
data_id.setUpdateType("2");
|
||||||
|
data_id.setShowType("2");
|
||||||
|
data_id.setQueryType("2");
|
||||||
|
data_id.setListType("2");
|
||||||
|
data_id.setViewType("2");
|
||||||
|
data_id.setFiledLength("255");
|
||||||
|
data_id.setCreate();
|
||||||
|
data_id.setDataType("1");
|
||||||
|
mdmModuleDbFiledsEntities.add(data_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ("2".equals(entity.getDbType()) || "3".equals(entity.getDbType()) || "4".equals(entity.getDbType())) {
|
if ("2".equals(entity.getDbType()) || "3".equals(entity.getDbType()) || "4".equals(entity.getDbType())) {
|
||||||
MdmModuleDbFiledsEntity formmain_id = new MdmModuleDbFiledsEntity();
|
MdmModuleDbFiledsEntity formmain_id = new MdmModuleDbFiledsEntity();
|
||||||
|
@ -600,6 +618,24 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
||||||
formmain_id.setCreate();
|
formmain_id.setCreate();
|
||||||
formmain_id.setDataType("1");
|
formmain_id.setDataType("1");
|
||||||
mdmModuleDbFiledsEntities.add(formmain_id);
|
mdmModuleDbFiledsEntities.add(formmain_id);
|
||||||
|
|
||||||
|
MdmModuleDbFiledsEntity data_id = new MdmModuleDbFiledsEntity();
|
||||||
|
data_id.setMdmId(entity.getMdmId());
|
||||||
|
data_id.setDbId(entity.getId());
|
||||||
|
data_id.setEnName("data_id");
|
||||||
|
data_id.setChName("第三方主键ID");
|
||||||
|
data_id.setFiledType("1");
|
||||||
|
data_id.setAddType("2");
|
||||||
|
data_id.setUpdateType("2");
|
||||||
|
data_id.setShowType("2");
|
||||||
|
data_id.setQueryType("2");
|
||||||
|
data_id.setListType("2");
|
||||||
|
data_id.setViewType("2");
|
||||||
|
data_id.setFiledLength("255");
|
||||||
|
data_id.setCreate();
|
||||||
|
data_id.setDataType("1");
|
||||||
|
mdmModuleDbFiledsEntities.add(data_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
//写入日志字段:操作人
|
//写入日志字段:操作人
|
||||||
if ("3".equals(entity.getDbType())) {
|
if ("3".equals(entity.getDbType())) {
|
||||||
|
|
|
@ -173,25 +173,28 @@
|
||||||
|
|
||||||
<!-- 根据数据来源内类型是插件的应用类型做分组 -->
|
<!-- 根据数据来源内类型是插件的应用类型做分组 -->
|
||||||
<select id="queryMdmModuleSourceentityGroupByType" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity">
|
<select id="queryMdmModuleSourceentityGroupByType" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity">
|
||||||
SELECT
|
SELECT
|
||||||
plug.plugin_code,
|
plug.plugin_code,
|
||||||
plug.plugin_name,
|
plug.plugin_name,
|
||||||
source.source_name,
|
application.name as app_name,
|
||||||
source.source_code ,
|
source.source_name,
|
||||||
application.app_type,
|
source.source_code ,
|
||||||
applicationdatabase.source_code as db_code
|
application.app_type,
|
||||||
FROM
|
model.mdm_code,
|
||||||
mdm_module_source source
|
applicationdatabase.source_code as db_code
|
||||||
LEFT JOIN sys_application_plugin plug ON plug.id = source.source_code
|
FROM
|
||||||
LEFT JOIN sys_application application ON source.source_name = application.id
|
mdm_module_source source
|
||||||
left join sys_application_database applicationdatabase on applicationdatabase.app_id = source.source_name
|
LEFT JOIN sys_application_plugin plug ON plug.id = source.source_code
|
||||||
WHERE
|
LEFT JOIN sys_application application ON source.source_name = application.id
|
||||||
source.source_type = '1'
|
left join sys_application_database applicationdatabase on applicationdatabase.app_id = source.source_name
|
||||||
AND source.sts = 'Y'
|
LEFT JOIN mdm_module model on source.mdm_id = model.id
|
||||||
AND plug.sts = 'Y'
|
WHERE
|
||||||
and application.sts = 'Y'
|
source.source_type = '1'
|
||||||
AND applicationdatabase.sts = 'Y'
|
AND source.sts = 'Y'
|
||||||
AND applicationdatabase.db_status = '1'
|
AND plug.sts = 'Y'
|
||||||
|
and application.sts = 'Y'
|
||||||
|
AND applicationdatabase.sts = 'Y'
|
||||||
|
AND applicationdatabase.db_status = '1'
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -329,32 +332,7 @@ update mdm_module_source set sts= 'N' ,modify_time = #{modify_time},modify_user
|
||||||
<delete id="entity_delete">
|
<delete id="entity_delete">
|
||||||
delete from mdm_module_source where id = #{id}
|
delete from mdm_module_source where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
<!-- 根据数据来源内类型是插件的应用类型做分组 -->
|
|
||||||
<select id="queryMdmModuleSourceentityGroupByType" resultMap="get-MdmModuleSourceEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity">
|
|
||||||
SELECT
|
|
||||||
plug.plugin_code,
|
|
||||||
plug.plugin_name,
|
|
||||||
application.name as app_name,
|
|
||||||
source.source_name,
|
|
||||||
source.source_code ,
|
|
||||||
application.app_type,
|
|
||||||
model.mdm_code,
|
|
||||||
applicationdatabase.source_code as db_code
|
|
||||||
FROM
|
|
||||||
mdm_module_source source
|
|
||||||
LEFT JOIN sys_application_plugin plug ON plug.id = source.source_code
|
|
||||||
LEFT JOIN sys_application application ON source.source_name = application.id
|
|
||||||
left join sys_application_database applicationdatabase on applicationdatabase.app_id = source.source_name
|
|
||||||
LEFT JOIN mdm_module model on source.mdm_id = model.id
|
|
||||||
WHERE
|
|
||||||
source.source_type = '1'
|
|
||||||
AND source.sts = 'Y'
|
|
||||||
AND plug.sts = 'Y'
|
|
||||||
and application.sts = 'Y'
|
|
||||||
AND applicationdatabase.sts = 'Y'
|
|
||||||
AND applicationdatabase.db_status = '1'
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -1688,7 +1688,7 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
checkData.put("id", id);
|
checkData.put("id", id);
|
||||||
checkData.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
checkData.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
||||||
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
|
JSONObject object1 = mdmModuleDao.queryMdmST(checkData);
|
||||||
if (object1.getString("id") == null || "".equals(object1.getString("id"))) {
|
if (object1 == null || object1.getString("id") == null || "".equals(object1.getString("id"))) {
|
||||||
return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送");
|
return BaseResult.getFailureMessageEntity("当前数据不符合规则不发送");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2511,35 +2511,84 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName());
|
mdmDataDto.setTableName(mdmModuleDbEntityList.get(i).getDbName());
|
||||||
List<MdmDataFiledDto> mdmDataFiledDtos = new ArrayList<>();
|
List<MdmDataFiledDto> mdmDataFiledDtos = new ArrayList<>();
|
||||||
for (int i1 = 0; i1 < fileds.size(); i1++) {
|
for (int i1 = 0; i1 < fileds.size(); i1++) {
|
||||||
MdmDataFiledDto mdmDataFiledDto = new MdmDataFiledDto();
|
if("id".equals(fileds.get(i1).getEnName())){
|
||||||
mdmDataFiledDto.setFiledsName(fileds.get(i1).getEnName());
|
if (jsonObject.getString("id") != null) {
|
||||||
mdmDataFiledDto.setFiledsValue(jsonObject.getString(fileds.get(i1).getEnName()));
|
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
mdmDataFiledDtos.add(mdmDataFiledDto);
|
ids.setFiledsName("id");
|
||||||
|
ids.setFiledsValue(jsonObject.getString("id"));
|
||||||
|
mdmDataFiledDtos.add(ids);
|
||||||
|
} else {
|
||||||
|
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
|
ids.setFiledsName("id");
|
||||||
|
ids.setFiledsValue(UUIDUtils.getUUID());
|
||||||
|
mdmDataFiledDtos.add(ids);
|
||||||
|
}
|
||||||
|
}else if("formmain_id".equals(fileds.get(i1).getEnName())){
|
||||||
|
MdmDataFiledDto formain_id = new MdmDataFiledDto();
|
||||||
|
formain_id.setFiledsName("formmain_id");
|
||||||
|
formain_id.setFiledsValue(id);
|
||||||
|
mdmDataFiledDtos.add(formain_id);
|
||||||
|
}else if("data_status".equals(fileds.get(i1).getEnName())){
|
||||||
|
if (jsonObject.getString("id") != null) {
|
||||||
|
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
|
ids.setFiledsName("data_status");
|
||||||
|
ids.setFiledsValue("F");
|
||||||
|
mdmDataFiledDtos.add(ids);
|
||||||
|
} else {
|
||||||
|
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
|
ids.setFiledsName("data_status");
|
||||||
|
ids.setFiledsValue("Y");
|
||||||
|
mdmDataFiledDtos.add(ids);
|
||||||
|
}
|
||||||
|
}else if("sorts".equals(fileds.get(i1).getEnName())){
|
||||||
|
|
||||||
|
}else if("create_user_id".equals(fileds.get(i1).getEnName())){
|
||||||
|
//if (jsonObject.getString("id") != null) {
|
||||||
|
//
|
||||||
|
//} else {
|
||||||
|
// MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
|
// ids.setFiledsName("create_user_id");
|
||||||
|
// ids.setFiledsValue(UUIDUtils.getUUID());
|
||||||
|
// mdmDataFiledDtos.add(ids);
|
||||||
|
//}
|
||||||
|
}else if("create_time".equals(fileds.get(i1).getEnName())){
|
||||||
|
|
||||||
|
}else if("modify_user_id".equals(fileds.get(i1).getEnName())){
|
||||||
|
//MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
|
//ids.setFiledsName("modify_user_id");
|
||||||
|
//ids.setFiledsValue(UUIDUtils.getUUID());
|
||||||
|
//mdmDataFiledDtos.add(ids);
|
||||||
|
}else if("company_id".equals(fileds.get(i1).getEnName())){
|
||||||
|
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
|
ids.setFiledsName("company_id");
|
||||||
|
ids.setFiledsValue("0");
|
||||||
|
mdmDataFiledDtos.add(ids);
|
||||||
|
}else if("org_id".equals(fileds.get(i1).getEnName())){
|
||||||
|
MdmDataFiledDto ids = new MdmDataFiledDto();
|
||||||
|
ids.setFiledsName("org_id");
|
||||||
|
ids.setFiledsValue("0");
|
||||||
|
mdmDataFiledDtos.add(ids);
|
||||||
|
}else if("modify_time".equals(fileds.get(i1).getEnName())){
|
||||||
|
|
||||||
|
}else if("sts".equals(fileds.get(i1).getEnName())){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
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 mdmDataFiledDto = new MdmDataFiledDto();
|
||||||
mdmDataFiledDto.setFiledsName("logid");
|
mdmDataFiledDto.setFiledsName("logid");
|
||||||
mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString());
|
mdmDataFiledDto.setFiledsValue(StpUtil.getLoginIdAsString());
|
||||||
mdmDataFiledDtos.add(mdmDataFiledDto);
|
mdmDataFiledDtos.add(mdmDataFiledDto);
|
||||||
|
|
||||||
MdmDataFiledDto formain_id = new MdmDataFiledDto();
|
|
||||||
formain_id.setFiledsName("formmain_id");
|
|
||||||
formain_id.setFiledsValue(id);
|
|
||||||
mdmDataFiledDtos.add(formain_id);
|
|
||||||
|
|
||||||
mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos);
|
mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos);
|
||||||
if (jsonObject.getString("id") != null) {
|
if (jsonObject.getString("id") != null) {
|
||||||
MdmDataFiledDto sts = new MdmDataFiledDto();
|
|
||||||
sts.setFiledsName("sts");
|
|
||||||
sts.setFiledsValue("Y");
|
|
||||||
mdmDataFiledDtos.add(sts);
|
|
||||||
mdmDataDto.setId(jsonObject.getString("id"));
|
mdmDataDto.setId(jsonObject.getString("id"));
|
||||||
int a = mdmModuleDao.updateForm(mdmDataDto);
|
int a = mdmModuleDao.updateForm(mdmDataDto);
|
||||||
} else {
|
} else {
|
||||||
MdmDataFiledDto ids = new MdmDataFiledDto();
|
|
||||||
ids.setFiledsName("id");
|
|
||||||
ids.setFiledsValue(UUIDUtils.getUUID());
|
|
||||||
mdmDataFiledDtos.add(ids);
|
|
||||||
mdmDataDto.setMdmDataFiledDtos(mdmDataFiledDtos);
|
|
||||||
mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType());
|
mdmDataDto.setDbType(mdmModuleDbEntityList.get(i).getDbType());
|
||||||
int a = mdmModuleDao.saveForm(mdmDataDto);
|
int a = mdmModuleDao.saveForm(mdmDataDto);
|
||||||
}
|
}
|
||||||
|
@ -2547,9 +2596,7 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveOption(dbname,mdmCode,saveData,id,msg);
|
saveOption(dbname,mdmCode,saveData,id,msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,33 @@ public class PayBillEntity extends BaseEntity {
|
||||||
private String tableName;//表名称
|
private String tableName;//表名称
|
||||||
private String fieldName;//字段名称
|
private String fieldName;//字段名称
|
||||||
private String state;//推送状态
|
private String state;//推送状态
|
||||||
|
private String pkOrg;//组织
|
||||||
|
private String pkCustomer;//客户
|
||||||
|
private String pk_oppaccount;//付款账户
|
||||||
|
|
||||||
|
public String getPkCustomer() {
|
||||||
|
return pkCustomer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkCustomer(String pkCustomer) {
|
||||||
|
this.pkCustomer = pkCustomer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPk_oppaccount() {
|
||||||
|
return pk_oppaccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPk_oppaccount(String pk_oppaccount) {
|
||||||
|
this.pk_oppaccount = pk_oppaccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkOrg() {
|
||||||
|
return pkOrg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkOrg(String pkOrg) {
|
||||||
|
this.pkOrg = pkOrg;
|
||||||
|
}
|
||||||
|
|
||||||
public String getState() {
|
public String getState() {
|
||||||
return state;
|
return state;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<mapper namespace="com.hzya.frame.seeyon.paybill.dao.impl.PayBillDaoImpl">
|
<mapper namespace="com.hzya.frame.seeyon.paybill.dao.impl.PayBillDaoImpl">
|
||||||
<resultMap id="get-PayBillEntity-result" type="com.hzya.frame.seeyon.paybill.entity.PayBillEntity" >
|
<resultMap id="get-PayBillEntity-result" type="com.hzya.frame.seeyon.paybill.entity.PayBillEntity" >
|
||||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="pkOrg" column="pk_org" jdbcType="VARCHAR"/>
|
||||||
<result property="billDate" column="bill_date" jdbcType="VARCHAR"/>
|
<result property="billDate" column="bill_date" jdbcType="VARCHAR"/>
|
||||||
<result property="primalMoney" column="primal_money" jdbcType="VARCHAR"/>
|
<result property="primalMoney" column="primal_money" jdbcType="VARCHAR"/>
|
||||||
<result property="pkOppaccount" column="pk_oppaccount" jdbcType="VARCHAR"/>
|
<result property="pkOppaccount" column="pk_oppaccount" jdbcType="VARCHAR"/>
|
||||||
|
|
|
@ -93,7 +93,9 @@ public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implem
|
||||||
body.put("pay_primal",pay.getPrimalMoney());//付款原币金额
|
body.put("pay_primal",pay.getPrimalMoney());//付款原币金额
|
||||||
body.put("creationtime",pay.getBillDate());//创建时间
|
body.put("creationtime",pay.getBillDate());//创建时间
|
||||||
body.put("direction","-1");//方向 :1=收;-1=付;
|
body.put("direction","-1");//方向 :1=收;-1=付;
|
||||||
body.put("objecttype","");//交易对象
|
body.put("objecttype","0");//交易对象
|
||||||
|
body.put("pk_customer",pay.getPkCustomer());//客户
|
||||||
|
body.put("pk_account",pay.getPkOppaccount());//付款银行账号
|
||||||
detailsArr.add(body);
|
detailsArr.add(body);
|
||||||
JSONObject main = new JSONObject();
|
JSONObject main = new JSONObject();
|
||||||
main.put("head",head);//表头
|
main.put("head",head);//表头
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.hzya.frame.seeyon.recbill.dao;
|
||||||
|
|
||||||
|
import com.hzya.frame.seeyon.recbill.entity.RecBillEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @version 1.0
|
||||||
|
* @content
|
||||||
|
* @date 2023-08-30 10:27
|
||||||
|
*/
|
||||||
|
public interface IRecBillDao {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 获取OA工程付款单数据
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/6/20 0020 11:30
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
List<RecBillEntity> getOaRecBill(RecBillEntity rec);
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 修改推送状态
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/6/21 0021 11:15
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
int updateState(RecBillEntity rec);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.hzya.frame.seeyon.recbill.dao.impl;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
|
import com.hzya.frame.seeyon.recbill.dao.IRecBillDao;
|
||||||
|
import com.hzya.frame.seeyon.recbill.entity.RecBillEntity;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 👻👻👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @version 1.0
|
||||||
|
* @content
|
||||||
|
* @date 2023-08-30 10:27
|
||||||
|
*/
|
||||||
|
@Repository(value = "RecBillDaoImpl")
|
||||||
|
public class RecBillDaoImpl extends MybatisGenericDao implements IRecBillDao {
|
||||||
|
|
||||||
|
@DS("#rec.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public List<RecBillEntity> getOaRecBill(RecBillEntity rec) {
|
||||||
|
return super.selectList("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.PayBillEntity_list_base",rec);
|
||||||
|
}
|
||||||
|
@DS("#rec.dataSourceCode")
|
||||||
|
@Override
|
||||||
|
public int updateState(RecBillEntity rec) {
|
||||||
|
return super.update("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.PayBillEntity_update",rec);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.hzya.frame.seeyon.recbill.entity;
|
||||||
|
|
||||||
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 付款結算單
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/6/20 0020 11:07
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RecBillEntity extends BaseEntity {
|
||||||
|
private String billDate;//付款日期
|
||||||
|
private String primalMoney;//付款金额信息
|
||||||
|
private String pkOppaccount;//付款银行信息
|
||||||
|
private String pkSupplier;//供应商信息
|
||||||
|
private String tableName;//表名称
|
||||||
|
private String fieldName;//字段名称
|
||||||
|
private String state;//推送状态
|
||||||
|
private String pkCustomer;//客户
|
||||||
|
private String pkAccount;//收款账户
|
||||||
|
private String pkOrg;//组织
|
||||||
|
|
||||||
|
public String getPkCustomer() {
|
||||||
|
return pkCustomer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkCustomer(String pkCustomer) {
|
||||||
|
this.pkCustomer = pkCustomer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkAccount() {
|
||||||
|
return pkAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkAccount(String pkAccount) {
|
||||||
|
this.pkAccount = pkAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkOrg() {
|
||||||
|
return pkOrg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkOrg(String pkOrg) {
|
||||||
|
this.pkOrg = pkOrg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(String state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTableName() {
|
||||||
|
return tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTableName(String tableName) {
|
||||||
|
this.tableName = tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFieldName() {
|
||||||
|
return fieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFieldName(String fieldName) {
|
||||||
|
this.fieldName = fieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBillDate() {
|
||||||
|
return billDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBillDate(String billDate) {
|
||||||
|
this.billDate = billDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrimalMoney() {
|
||||||
|
return primalMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrimalMoney(String primalMoney) {
|
||||||
|
this.primalMoney = primalMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkOppaccount() {
|
||||||
|
return pkOppaccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkOppaccount(String pkOppaccount) {
|
||||||
|
this.pkOppaccount = pkOppaccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPkSupplier() {
|
||||||
|
return pkSupplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPkSupplier(String pkSupplier) {
|
||||||
|
this.pkSupplier = pkSupplier;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl">
|
||||||
|
<resultMap id="get-RecBillEntity-result" type="com.hzya.frame.seeyon.recbill.entity.RecBillEntity" >
|
||||||
|
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="pkOrg" column="pk_org" jdbcType="VARCHAR"/>
|
||||||
|
<result property="billDate" column="bill_date" jdbcType="VARCHAR"/>
|
||||||
|
<result property="primalMoney" column="primal_money" jdbcType="VARCHAR"/>
|
||||||
|
<result property="pkAccount" column="pk_account" jdbcType="VARCHAR"/>
|
||||||
|
<result property="pkCustomer" column="pk_customer" jdbcType="VARCHAR"/>
|
||||||
|
<result property="pkOppaccount" column="pk_oppaccount" jdbcType="VARCHAR"/>
|
||||||
|
<result property="pkSupplier" column="pk_supplier" jdbcType="VARCHAR"/>
|
||||||
|
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
||||||
|
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!--工程项目查询-->
|
||||||
|
<select id="RecBillEntity_list_base" resultMap="get-RecBillEntity-result" parameterType="com.hzya.frame.seeyon.recbill.entity.RecBillEntity">
|
||||||
|
SELECT
|
||||||
|
field0002 AS pk_org,
|
||||||
|
field0006 AS bill_date,
|
||||||
|
field0009 AS primal_money,
|
||||||
|
field0001 AS pk_account,
|
||||||
|
field0013 AS pk_customer,
|
||||||
|
field0012 AS pk_oppaccount,
|
||||||
|
'formmain_0233' as table_name,
|
||||||
|
'field0016' as field_name
|
||||||
|
FROM formmain_0233
|
||||||
|
WHERE field0016 IS null
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--通过主键修改方法-->
|
||||||
|
<update id="RecBillEntity_update" parameterType = "java.util.Map" >
|
||||||
|
update ${tableName} set ${fieldName} = #{state} where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.hzya.frame.seeyon.recbill.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.basedao.service.IBaseService;
|
||||||
|
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content huoqu
|
||||||
|
* @author laborer获取OA付款单数据并推送BIP生成付款结算单
|
||||||
|
* @date 2024/6/20 0020 11:19
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IRecBillService extends IBaseService<PaymentEntity,String> {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 工程付款单数据同步BIP
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/6/20 0020 11:24
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
JsonResultEntity sendRecBillToBip(JSONObject requestJson);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.hzya.frame.seeyon.recbill.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.bip.v3.v2207.util.BipUtil;
|
||||||
|
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
|
||||||
|
import com.hzya.frame.seeyon.recbill.dao.IRecBillDao;
|
||||||
|
import com.hzya.frame.seeyon.recbill.entity.RecBillEntity;
|
||||||
|
import com.hzya.frame.seeyon.recbill.service.IRecBillService;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 付款单同步BIP
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/6/20 0020 15:20
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service("RecBillServiceImpl")
|
||||||
|
public class RecBillServiceImpl extends BaseService<PaymentEntity,String> implements IRecBillService {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(RecBillServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IRecBillDao payBillDao;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @content 工程付款单数据同步BIP
|
||||||
|
* @author laborer
|
||||||
|
* @date 2024/6/20 0020 11:24
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JsonResultEntity sendRecBillToBip(JSONObject requestJson) {
|
||||||
|
RecBillEntity entity = new RecBillEntity();
|
||||||
|
requestJson.put("db_code","OA");
|
||||||
|
entity.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
List<RecBillEntity>payBillEntityList = payBillDao.getOaRecBill(entity);
|
||||||
|
if(CollectionUtils.isNotEmpty(payBillEntityList)){
|
||||||
|
for(RecBillEntity pay : payBillEntityList){
|
||||||
|
String token = BipUtil.getBipToken("yonyou","8000230000");
|
||||||
|
JSONObject main = bindingAdd(pay);
|
||||||
|
logger.info("银行流水收款信息数据{}",main.toString());
|
||||||
|
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230016",token);
|
||||||
|
logger.info("银行流水收款信息数据{}",result);
|
||||||
|
JSONObject resultObj = JSON.parseObject(result);
|
||||||
|
boolean flag = resultObj.getBoolean("success");
|
||||||
|
if(flag){
|
||||||
|
pay.setState("Y");
|
||||||
|
}else{
|
||||||
|
pay.setState("N");
|
||||||
|
}
|
||||||
|
pay.setDataSourceCode(requestJson.getString("db_code"));
|
||||||
|
payBillDao.updateState(pay);
|
||||||
|
// todo 后续在写吧(没字段等OA开了外网在创建),修改推送状态,避免再次查询
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JSONObject bindingAdd(RecBillEntity pay) {
|
||||||
|
JSONObject head = new JSONObject();
|
||||||
|
head.put("pk_org","");//所属组织
|
||||||
|
head.put("pk_group","");//集团
|
||||||
|
head.put("bill_type","F4");//单据类型 默认F5
|
||||||
|
head.put("trade_type","D4");//付款结算类型 默认D5
|
||||||
|
head.put("source_flag","2");//付款结算类型 默认2
|
||||||
|
head.put("bill_date",pay.getBillDate());//单据日期
|
||||||
|
head.put("primal_money",pay.getPrimalMoney());//付款原币金额
|
||||||
|
head.put("pk_currtype","CNY");//币种
|
||||||
|
head.put("billmaker","");//制单人
|
||||||
|
//处理明细数据,按照明细付款 多个明细生成多个付款结算单
|
||||||
|
JSONArray detailsArr = new JSONArray();
|
||||||
|
JSONObject body = new JSONObject();
|
||||||
|
body.put("pk_org","");//所属组织
|
||||||
|
body.put("pk_group","");//集团
|
||||||
|
body.put("bill_type","F4");//单据类型 默认F5
|
||||||
|
body.put("trade_type","D4");//付款结算类型 默认D5
|
||||||
|
body.put("pk_currtype","CNY");//币种
|
||||||
|
body.put("bill_date",pay.getBillDate());//单据日期
|
||||||
|
body.put("pay_primal",pay.getPrimalMoney());//付款原币金额
|
||||||
|
body.put("creationtime",pay.getBillDate());//创建时间
|
||||||
|
body.put("direction","-1");//方向 :1=收;-1=付;
|
||||||
|
body.put("objecttype","0");//交易对象
|
||||||
|
body.put("pk_customer",pay.getPkCustomer());//客户
|
||||||
|
body.put("pk_account",pay.getPkAccount());//收款银行账号
|
||||||
|
detailsArr.add(body);
|
||||||
|
JSONObject main = new JSONObject();
|
||||||
|
main.put("head",head);//表头
|
||||||
|
main.put("body",detailsArr);//明细数据
|
||||||
|
return main;
|
||||||
|
}
|
||||||
|
}
|
|
@ -147,7 +147,7 @@ public class DsDataSourceUtil {
|
||||||
driveClass = DataSourceUtilProperties.SQL2000DRIVER;
|
driveClass = DataSourceUtilProperties.SQL2000DRIVER;
|
||||||
} else if ("2".equalsIgnoreCase(dataSourceEntity.getSourceType())) {
|
} else if ("2".equalsIgnoreCase(dataSourceEntity.getSourceType())) {
|
||||||
driveClass = DataSourceUtilProperties.SQL2005DRIVER;
|
driveClass = DataSourceUtilProperties.SQL2005DRIVER;
|
||||||
} else if ("4".equalsIgnoreCase(dataSourceEntity.getSourceType())) {
|
}else if ("4".equalsIgnoreCase(dataSourceEntity.getSourceType())) {
|
||||||
driveClass = DataSourceUtilProperties.dm;
|
driveClass = DataSourceUtilProperties.dm;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -225,8 +225,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
//接口环境参数表 sys_application_api_para
|
//接口环境参数表 sys_application_api_para
|
||||||
saveApiPara(entity, olderAppId);
|
saveApiPara(entity, olderAppId);
|
||||||
|
|
||||||
//数据源表 sys_application_database
|
//数据源表不保存,可能出现数据源编号重复问题 sys_application_database
|
||||||
saveDatabase(entity, olderAppId);
|
//saveDatabase(entity, olderAppId);
|
||||||
|
|
||||||
//插件表 sys_application_plugin
|
//插件表 sys_application_plugin
|
||||||
savePlugin(entity, olderAppId);
|
savePlugin(entity, olderAppId);
|
||||||
|
@ -517,6 +517,27 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
if (entity.getUpdateType() == null || "".equals(entity.getUpdateType())) {
|
if (entity.getUpdateType() == null || "".equals(entity.getUpdateType())) {
|
||||||
return BaseResult.getFailureMessageEntity("系统错误");
|
return BaseResult.getFailureMessageEntity("系统错误");
|
||||||
}
|
}
|
||||||
|
//查看数据源编码是否存在
|
||||||
|
SysApplicationDatabaseEntity detailEntity = entity.getDatabaseEntity();
|
||||||
|
if(detailEntity != null && detailEntity.getSourceCode() != null && !"".equals(detailEntity.getSourceCode())){
|
||||||
|
SysApplicationDatabaseEntity checkData = new SysApplicationDatabaseEntity();
|
||||||
|
checkData.setSourceCode(detailEntity.getSourceCode());
|
||||||
|
checkData.setSts("Y");
|
||||||
|
List<SysApplicationDatabaseEntity> sysApplicationDatabaseEntities = sysApplicationDatabaseDao.queryBase(checkData);
|
||||||
|
if(detailEntity.getId() != null && !"".equals(detailEntity.getId())){
|
||||||
|
if(sysApplicationDatabaseEntities != null && sysApplicationDatabaseEntities.size() > 0){
|
||||||
|
for (int i = 0; i < sysApplicationDatabaseEntities.size(); i++) {
|
||||||
|
if(!detailEntity.getId().equals(sysApplicationDatabaseEntities.get(i).getId())){
|
||||||
|
return BaseResult.getFailureMessageEntity("数据源编码已经存在,请修改");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(sysApplicationDatabaseEntities != null && sysApplicationDatabaseEntities.size() > 0){
|
||||||
|
return BaseResult.getFailureMessageEntity("数据源编码已经存在,请修改");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//修改应用基本信息
|
//修改应用基本信息
|
||||||
SysApplicationEntity sysApplicationEntity = doUpdateApp(entity);
|
SysApplicationEntity sysApplicationEntity = doUpdateApp(entity);
|
||||||
if ("2".equals(entity.getUpdateType())) {//开发管理界面,需要保存 接口参数,和数据源
|
if ("2".equals(entity.getUpdateType())) {//开发管理界面,需要保存 接口参数,和数据源
|
||||||
|
@ -1691,7 +1712,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
|
|
||||||
SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode);
|
SysApplicationApiEntity receiveApi = getApiByAppIdApiCode(receiveApp.getId(), apiCode);
|
||||||
if (receiveApi == null) {
|
if (receiveApi == null) {
|
||||||
saveLog(sendApp, receiveApp, receiveApi, oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + ":" + apiCode + "未启用或者未创建" );
|
saveLog(sendApp, receiveApp, new SysApplicationApiEntity(), oldbodys, null, oldheaderMap, null, null, oldquerys, null, null, false,receiveApp.getName() + ":" + apiCode + "未启用或者未创建" );
|
||||||
return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建");
|
return BaseResult.getFailureMessageEntity(receiveApp.getName() + ":" + apiCode + "未启用或者未创建");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,16 @@ public class ComparisonDetailsEntity extends BaseEntity {
|
||||||
private String filedType;//字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME
|
private String filedType;//字段类型 1、BIGINT 2、DECIMAL 3、VARCHAR 4、DATETIME
|
||||||
private String formmainId;//上级id
|
private String formmainId;//上级id
|
||||||
|
|
||||||
|
private String dataId;//第三方主键id
|
||||||
|
|
||||||
|
public String getDataId() {
|
||||||
|
return dataId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataId(String dataId) {
|
||||||
|
this.dataId = dataId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFormmainId() {
|
public String getFormmainId() {
|
||||||
return formmainId;
|
return formmainId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<select id="queryComparisonDetailsPage" resultType="java.util.Map"
|
<select id="queryComparisonDetailsPage" resultType="java.util.Map"
|
||||||
parameterType="com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity">
|
parameterType="com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity">
|
||||||
select * from ${dbName}
|
select * from ${dbName}
|
||||||
where formmain_id=#{formmainId} and sts='Y'
|
where formmain_id=#{formmainId} and sts='Y' and (data_status='Y' or data_status='F')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,19 +48,19 @@
|
||||||
${key} =#{value}
|
${key} =#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</set>
|
</set>
|
||||||
where formmain_id=#{formmainId} and sts='Y'
|
where data_id=#{dataId} and formmain_id= #{formmainId} and sts='Y' and (data_status='Y' or data_status='F')
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- 多条件逻辑删除 -->
|
<!-- 多条件逻辑删除 -->
|
||||||
<update id="deleteComparisonDetails" parameterType = "java.util.Map" >
|
<update id="deleteComparisonDetails" parameterType = "java.util.Map" >
|
||||||
update
|
update
|
||||||
${dbName}
|
${dbName}
|
||||||
set sts= 'N' ,modify_time = now(),modify_user_id = #{modify_user_id}, data_status= 'N',delete_status='0'
|
set modify_time = now(),modify_user_id = #{modify_user_id}, data_status= 'N'
|
||||||
<trim prefix="where" prefixOverrides="and">
|
<trim prefix="where" prefixOverrides="and">
|
||||||
<!--<foreach collection="mapDetails.entrySet()" item="value" index="key">
|
<!--<foreach collection="mapDetails.entrySet()" item="value" index="key">
|
||||||
${key} =#{value}
|
${key} =#{value}
|
||||||
</foreach>-->
|
</foreach>-->
|
||||||
and formmain_id=#{formmainId} and sts='Y'
|
and formmain_id=#{formmainId} and sts='Y' and (data_status='Y' or data_status='F')
|
||||||
</trim>
|
</trim>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,16 @@ public class ComparisonEntity extends BaseEntity {
|
||||||
private String listType;//显示类型:列表
|
private String listType;//显示类型:列表
|
||||||
private String viewType;//显示类型:显示
|
private String viewType;//显示类型:显示
|
||||||
|
|
||||||
|
private String dataId;//第三方主键id
|
||||||
|
|
||||||
|
public String getDataId() {
|
||||||
|
return dataId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataId(String dataId) {
|
||||||
|
this.dataId = dataId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAddType() {
|
public String getAddType() {
|
||||||
return addType;
|
return addType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
${key} =#{value}
|
${key} =#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</set>
|
</set>
|
||||||
where id=#{id} and sts='Y'
|
where id=#{id} and sts='Y' and (data_status='Y' or data_status='F')
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
<foreach collection="map.entrySet()" item="value" index="key">
|
<foreach collection="map.entrySet()" item="value" index="key">
|
||||||
and ${key} =#{value}
|
and ${key} =#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
and id=#{id} and sts='Y'
|
and id=#{id} and sts='Y' and (data_status='Y' or data_status='F')
|
||||||
</trim>
|
</trim>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
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 IMasterDataCustoMermanageService extends IBaseService<ComparisonEntity, String> {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @content 查询客户档案同步中台主数据中心
|
|
||||||
* @author laborer
|
|
||||||
* @date 2024/6/20 0020 9:54
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
JsonResultEntity queryCustoMermanageArchives(JSONObject jsonObject);
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
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 IMasterDataMemberService extends IBaseService<ComparisonEntity, String> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @content 查询项目档案
|
|
||||||
* @Param
|
|
||||||
* @Return
|
|
||||||
* @Author hecan
|
|
||||||
* @Date 2024/6/6 16:10
|
|
||||||
* **/
|
|
||||||
JsonResultEntity queryMemberArchives(JSONObject jsonObject);
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
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<ComparisonEntity, String> {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @content 查询组织档案
|
|
||||||
* @Param
|
|
||||||
* @Return
|
|
||||||
* @Author hecan
|
|
||||||
* @Date 2024/6/4 16:57
|
|
||||||
* **/
|
|
||||||
JsonResultEntity queryOrgsArchives(JSONObject jsonObject);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
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<ComparisonEntity, String> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @content 查询项目档案
|
|
||||||
* @Param
|
|
||||||
* @Return
|
|
||||||
* @Author hecan
|
|
||||||
* @Date 2024/6/6 16:10
|
|
||||||
* **/
|
|
||||||
JsonResultEntity queryProjectArchives(JSONObject jsonObject);
|
|
||||||
}
|
|
|
@ -1,149 +0,0 @@
|
||||||
package com.hzya.frame.sysnew.comparison.masterData.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
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.IMasterDataCustoMermanageService;
|
|
||||||
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("MasterDataCustoMermanageServiceImpl")
|
|
||||||
public class MasterDataCustoMermanageServiceImpl extends BaseService<ComparisonEntity, String> implements IMasterDataCustoMermanageService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MasterDataDaoImpl masterDataDaoImpl;
|
|
||||||
@Autowired
|
|
||||||
private ComparisonServiceImpl comparisonServiceimpl;
|
|
||||||
@Autowired
|
|
||||||
private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl;
|
|
||||||
|
|
||||||
private String ts = "";
|
|
||||||
|
|
||||||
//同步客户档案到主数据
|
|
||||||
public JsonResultEntity queryCustoMermanageArchives(JSONObject json){
|
|
||||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
|
||||||
//查询主数据来源表,根据来源类型为插件得进行分类,获取来源名称和编码
|
|
||||||
List<MdmModuleSourceEntity> list = mdmModuleSourceDaoImpl.MdmModuleSourceentityGroupByType();
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
|
||||||
logger.info("数据来源表中没有类型为插件得数据,无法获取来源名称和来源编码");
|
|
||||||
return BaseResult.getFailureMessageEntity("数据来源表无插件类型");
|
|
||||||
}
|
|
||||||
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
|
|
||||||
//通过不同的应用类型用于拼接sql
|
|
||||||
String appTyp = mdmModuleSourceEntity.getAppType();
|
|
||||||
String dbCode = mdmModuleSourceEntity.getDbCode();
|
|
||||||
switch (appTyp) {
|
|
||||||
case "1":
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
|
||||||
String code = jsonObject.getString("code");
|
|
||||||
sb.append(" and a.code = '"+code+"'");
|
|
||||||
}else{
|
|
||||||
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
|
||||||
sb.append(" and a.update_time >= '"+ts+"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
|
||||||
stringBuffer.append("SELECT id as id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0226 WHERE 1=1 AND id = '1706533959075383844' " );
|
|
||||||
|
|
||||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
|
||||||
try {
|
|
||||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
|
||||||
logger.info("查询出来的值为:{}",hashMaps);
|
|
||||||
if (null != hashMaps && hashMaps.size() > 0) {
|
|
||||||
ParametricAssembly(mdmModuleSourceEntity,hashMaps,"10004");
|
|
||||||
} 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<HashMap<String, Object>> hashMaps,String mdmCode){
|
|
||||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
|
||||||
JSONObject jsonObjectUser = new JSONObject();
|
|
||||||
JSONObject jsonStr = new JSONObject();
|
|
||||||
jsonObjectUser.put("id", hashMap.get("id"));
|
|
||||||
jsonObjectUser.put("mdmCode", mdmCode);
|
|
||||||
jsonStr.put("jsonStr", jsonObjectUser);
|
|
||||||
//查询明细信息
|
|
||||||
Long formmainId = (Long) hashMap.get("id");
|
|
||||||
StringBuffer stringBufferDetails = new StringBuffer();
|
|
||||||
stringBufferDetails.append("SELECT field0023 AS pk_bankdoc,field0024 AS accnum,field0025 AS combinenum FROM formson_0229 WHERE formmain_id = '"+formmainId+"' " );
|
|
||||||
List<HashMap<String, Object>> hashMapsDetails = masterDataDaoImpl.queryArchivesByDataSource(stringBufferDetails.toString(),mdmModuleSourceEntity);
|
|
||||||
//先查询编码和名称查询是否存在
|
|
||||||
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("details", hashMapsDetails);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,144 +0,0 @@
|
||||||
package com.hzya.frame.sysnew.comparison.masterData.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
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.IMasterDataMemberService;
|
|
||||||
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("MasterDataMemberServiceImpl")
|
|
||||||
public class MasterDataMemberServiceImpl extends BaseService<ComparisonEntity, String> implements IMasterDataMemberService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MasterDataDaoImpl masterDataDaoImpl;
|
|
||||||
@Autowired
|
|
||||||
private ComparisonServiceImpl comparisonServiceimpl;
|
|
||||||
@Autowired
|
|
||||||
private MdmModuleSourceDaoImpl mdmModuleSourceDaoImpl;
|
|
||||||
|
|
||||||
private String ts = "";
|
|
||||||
|
|
||||||
//同步用户信息到主数据
|
|
||||||
public JsonResultEntity queryMemberArchives(JSONObject json){
|
|
||||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
|
||||||
//查询主数据来源表,根据来源类型为插件得进行分类,获取来源名称和编码
|
|
||||||
List<MdmModuleSourceEntity> list = mdmModuleSourceDaoImpl.MdmModuleSourceentityGroupByType();
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
|
||||||
logger.info("数据来源表中没有类型为插件得数据,无法获取来源名称和来源编码");
|
|
||||||
return BaseResult.getFailureMessageEntity("数据来源表无插件类型");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
|
|
||||||
//通过不同的应用类型用于拼接sql
|
|
||||||
String appTyp = mdmModuleSourceEntity.getAppType();
|
|
||||||
String dbCode = mdmModuleSourceEntity.getDbCode();
|
|
||||||
switch (appTyp) {
|
|
||||||
case "1":
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
|
||||||
String code = jsonObject.getString("code");
|
|
||||||
sb.append(" and a.code = '"+code+"'");
|
|
||||||
}else{
|
|
||||||
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
|
||||||
sb.append(" and a.update_time >= '"+ts+"'");
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
|
||||||
stringBuffer.append("select a.id as id, a.name as user_name, e.LOGIN_NAME as user_code FROM org_member a left join org_principal e on a.id = e.MEMBER_ID" +
|
|
||||||
" WHERE 1=1 " + sb.toString());
|
|
||||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
|
||||||
try {
|
|
||||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
|
||||||
logger.info("查询出来的值为:{}",hashMaps);
|
|
||||||
if (null != hashMaps && hashMaps.size() > 0) {
|
|
||||||
ParametricAssembly(mdmModuleSourceEntity,hashMaps,"10003");
|
|
||||||
} 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<HashMap<String, Object>> hashMaps,String mdmCode){
|
|
||||||
for (HashMap<String, Object> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,138 +0,0 @@
|
||||||
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<ComparisonEntity, String> 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<MdmModuleSourceEntity> 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<HashMap<String, Object>> 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<HashMap<String, Object>> hashMaps,String mdmCode){
|
|
||||||
for (HashMap<String, Object> 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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,132 +0,0 @@
|
||||||
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<ComparisonEntity, String> 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<MdmModuleSourceEntity> 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<HashMap<String, Object>> 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<HashMap<String, Object>> hashMaps,String mdmCode){
|
|
||||||
for (HashMap<String, Object> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -10,11 +10,11 @@ import com.hzya.frame.mdm.mdmModuleSource.dao.impl.MdmModuleSourceDaoImpl;
|
||||||
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
|
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
|
||||||
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
|
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.dao.impl.MasterDataDaoImpl;
|
||||||
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataProjectService;
|
|
||||||
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataService;
|
import com.hzya.frame.sysnew.comparison.masterData.service.IMasterDataService;
|
||||||
import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl;
|
import com.hzya.frame.sysnew.comparison.service.impl.ComparisonServiceImpl;
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -54,30 +54,31 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
return BaseResult.getFailureMessageEntity("数据来源表无插件类型");
|
return BaseResult.getFailureMessageEntity("数据来源表无插件类型");
|
||||||
}
|
}
|
||||||
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
|
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
|
||||||
|
String tableName = "";
|
||||||
try {
|
try {
|
||||||
//通过不同的应用类型用于拼接sql
|
//通过不同的应用类型用于拼接sql
|
||||||
String appTyp = mdmModuleSourceEntity.getAppType();
|
String appTyp = mdmModuleSourceEntity.getAppType();
|
||||||
String dbCode = mdmModuleSourceEntity.getDbCode();
|
String dbCode = mdmModuleSourceEntity.getDbCode();
|
||||||
String mdmCode = mdmModuleSourceEntity.getMdmCode();
|
String mdmCode = mdmModuleSourceEntity.getMdmCode();
|
||||||
List<HashMap<String, Object>>hashMaps = new ArrayList<>();
|
List<JSONObject> listAll = new ArrayList<>();
|
||||||
List<HashMap<String, Object>> hashMapsDetails = new ArrayList<>();
|
if(!"10004".equals(mdmCode)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (appTyp) {//1、致远OA 2、用友U8C 3、用友BIP
|
switch (appTyp) {//1、致远OA 2、用友U8C 3、用友BIP
|
||||||
case "1":
|
case "1":
|
||||||
//通过主数据编码判断,不同的接口走不通的查询逻辑
|
//通过主数据编码判断,不同的接口走不通的查询逻辑
|
||||||
switch (mdmCode){
|
switch (mdmCode){
|
||||||
case "10003"://致远用户信息
|
case "10003"://致远用户信息
|
||||||
bindingUser(jsonObject, mdmModuleSourceEntity, dbCode);
|
tableName = "mdm_user";
|
||||||
|
listAll = bindingUser(jsonObject, mdmModuleSourceEntity, dbCode);
|
||||||
break;
|
break;
|
||||||
case "10004"://致远客商信息
|
case "10004"://致远客商信息
|
||||||
hashMaps = binDingCust(jsonObject, mdmModuleSourceEntity, dbCode);
|
tableName = "mdm_customer";
|
||||||
//查询明细数据
|
listAll = binDingCust(jsonObject, mdmModuleSourceEntity, dbCode);
|
||||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
break;
|
||||||
//查询明细信息
|
case "10007"://致远客商信息
|
||||||
Long formmainId = (Long) hashMap.get("id");
|
tableName = "mdm_bank";
|
||||||
StringBuffer stringBufferDetails = new StringBuffer();
|
listAll = binDingBank(jsonObject, mdmModuleSourceEntity, dbCode);
|
||||||
stringBufferDetails.append("SELECT field0023 AS pk_bankdoc,field0024 AS accnum,field0025 AS combinenum FROM formson_0229 WHERE formmain_id = '"+formmainId+"' " );
|
|
||||||
hashMapsDetails = masterDataDaoImpl.queryArchivesByDataSource(stringBufferDetails.toString(),mdmModuleSourceEntity);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger.info("未匹配到主数据的编码,请检查");
|
logger.info("未匹配到主数据的编码,请检查");
|
||||||
|
@ -85,8 +86,8 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//调用主数据接口进行数据推送或更新
|
//调用主数据接口进行数据推送或更新
|
||||||
if (null != hashMaps && hashMaps.size() > 0) {
|
if (null != listAll && listAll.size() > 0) {
|
||||||
ParametricAssembly(mdmModuleSourceEntity,hashMaps,mdmCode,hashMapsDetails);
|
ParametricAssembly(mdmModuleSourceEntity, listAll, mdmCode, tableName);
|
||||||
} else {
|
} else {
|
||||||
logger.info("U8C主数据档案没有需要同步中台的数据");
|
logger.info("U8C主数据档案没有需要同步中台的数据");
|
||||||
}
|
}
|
||||||
|
@ -95,52 +96,123 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BaseResult.getSuccessMessageEntity("项目档案同步成功");
|
return BaseResult.getSuccessMessageEntity("主数据同步成功");
|
||||||
}
|
}
|
||||||
//绑定客户档案
|
//绑定银行
|
||||||
private List<HashMap<String, Object>> binDingCust(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode) {
|
private List<JSONObject> binDingBank(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode)throws Exception {
|
||||||
List<HashMap<String, Object>> hashMap;
|
List<JSONObject> list = new ArrayList<>();
|
||||||
StringBuffer sbCust = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
||||||
String code = jsonObject.getString("code");
|
String code = jsonObject.getString("code");
|
||||||
sbCust.append(" and a.code = '"+code+"'");
|
sb.append(" and a.code = '"+code+"'");
|
||||||
}else{
|
}else{
|
||||||
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||||
sbCust.append(" and a.update_time >= '"+ts+"'");
|
sb.append(" and a.update_time >= '"+ts+"'");
|
||||||
}
|
}
|
||||||
StringBuffer stringBufferCust = new StringBuffer();
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
stringBufferCust.append("SELECT id as id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0226 WHERE 1=1 "+ sbCust.toString());
|
stringBuffer.append("select id as data_id,a.* from bank a");
|
||||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||||
return masterDataDaoImpl.queryArchivesByDataSource(stringBufferCust.toString(),mdmModuleSourceEntity);
|
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||||
|
int i = 0;
|
||||||
|
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||||
|
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||||
|
JSONObject main = new JSONObject();
|
||||||
|
JSONObject mdm = new JSONObject();
|
||||||
|
for(String key:hashMap.keySet()) {
|
||||||
|
mdm.put(key, hashMap.get(key));
|
||||||
|
}
|
||||||
|
main.put("mdm_bank",mdm);
|
||||||
|
list.add(main);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//绑定客户档案
|
||||||
|
private List<JSONObject> binDingCust(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode)throws Exception {
|
||||||
|
List<JSONObject> list = new ArrayList<>();
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
||||||
|
String code = jsonObject.getString("code");
|
||||||
|
sb.append(" and a.code = '"+code+"'");
|
||||||
|
}else{
|
||||||
|
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
sb.append(" and a.update_time >= '"+ts+"'");
|
||||||
|
}
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append("SELECT id as data_id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0226 a WHERE 1=1 ");
|
||||||
|
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||||
|
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||||
|
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||||
|
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||||
|
JSONObject main = new JSONObject();
|
||||||
|
JSONObject mdm_cust = new JSONObject();
|
||||||
|
for(String key:hashMap.keySet()) {
|
||||||
|
mdm_cust.put(key, hashMap.get(key));
|
||||||
|
}
|
||||||
|
//获取明细信息
|
||||||
|
Long formmainId = (Long) hashMap.get("data_id");
|
||||||
|
StringBuffer stringBufferDetails = new StringBuffer();
|
||||||
|
stringBufferDetails.append("SELECT id as data_id ,field0023 AS pk_bankdoc,field0024 AS accnum,field0025 AS combinenum FROM formson_0229 WHERE formmain_id = '"+formmainId+"' " );
|
||||||
|
List<HashMap<String, Object>> hashMapsDetails = masterDataDaoImpl.queryArchivesByDataSource(stringBufferDetails.toString(),mdmModuleSourceEntity);
|
||||||
|
JSONArray mdm_customer_bank = new JSONArray();
|
||||||
|
if(CollectionUtils.isNotEmpty(hashMapsDetails)){
|
||||||
|
for (HashMap<String, Object> detailsMap : hashMapsDetails) {
|
||||||
|
JSONObject details = new JSONObject();
|
||||||
|
for (String key : detailsMap.keySet()) {
|
||||||
|
details.put(key, detailsMap.get(key));
|
||||||
|
}
|
||||||
|
mdm_customer_bank.add(details);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
main.put("mdm_customer_bank",mdm_customer_bank);
|
||||||
|
main.put("mdm_customer",mdm_cust);
|
||||||
|
list.add(main);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
//绑定OA用户参数
|
//绑定OA用户参数
|
||||||
private JSONArray bindingUser(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode) {
|
private List<JSONObject> bindingUser(JSONObject jsonObject, MdmModuleSourceEntity mdmModuleSourceEntity, String dbCode)throws Exception {
|
||||||
StringBuffer sbUser = new StringBuffer();
|
List<JSONObject> list = new ArrayList<>();
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
if(null != jsonObject && StrUtil.isNotEmpty(jsonObject.getString("code"))){
|
||||||
String code = jsonObject.getString("code");
|
String code = jsonObject.getString("code");
|
||||||
sbUser.append(" and a.code = '"+code+"'");
|
sb.append(" and a.code = '"+code+"'");
|
||||||
}else{
|
}else{
|
||||||
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||||
sbUser.append(" and a.update_time >= '"+ts+"'");
|
sb.append(" and a.update_time >= '"+ts+"'");
|
||||||
}
|
}
|
||||||
StringBuffer stringBufferUser = new StringBuffer();
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
stringBufferUser.append("SELECT id as id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0226 WHERE 1=1 "+ sbUser.toString());
|
stringBuffer.append("select a.id as data_id, a.name as user_name, e.LOGIN_NAME as user_code FROM org_member a left join org_principal e on a.id = e.MEMBER_ID" +
|
||||||
|
" WHERE 1=1 " + sb.toString());
|
||||||
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
mdmModuleSourceEntity.setDataSourceCode(dbCode);
|
||||||
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBufferUser.toString(),mdmModuleSourceEntity);
|
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
|
||||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
int i = 0;
|
||||||
|
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||||
|
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||||
|
JSONObject main = new JSONObject();
|
||||||
|
JSONObject mdm_user = new JSONObject();
|
||||||
|
for(String key:hashMap.keySet()) {
|
||||||
|
mdm_user.put(key, hashMap.get(key));
|
||||||
|
}
|
||||||
|
main.put("mdm_user",mdm_user);
|
||||||
|
list.add(main);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//查询档案参数组装
|
//查询档案参数组装
|
||||||
public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List<HashMap<String, Object>> hashMaps,String mdmCode,List<HashMap<String, Object>> hashMapsDetails){
|
public JsonResultEntity ParametricAssembly(MdmModuleSourceEntity mdmModuleSourceEntity,List<JSONObject> hashMaps,String mdmCode,String tableName)throws Exception{
|
||||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
for (JSONObject hashMap : hashMaps) {
|
||||||
|
JSONObject main = hashMap.getJSONObject(tableName);
|
||||||
|
|
||||||
JSONObject jsonObjectUser = new JSONObject();
|
JSONObject jsonObjectUser = new JSONObject();
|
||||||
JSONObject jsonStr = new JSONObject();
|
JSONObject jsonStr = new JSONObject();
|
||||||
jsonObjectUser.put("id", hashMap.get("id"));
|
jsonObjectUser.put("data_id", main.get("data_id"));
|
||||||
jsonObjectUser.put("mdmCode", mdmCode);
|
jsonObjectUser.put("mdmCode", mdmCode);
|
||||||
jsonStr.put("jsonStr", jsonObjectUser);
|
jsonStr.put("jsonStr", jsonObjectUser);
|
||||||
//先查询编码和名称查询是否存在
|
//先查询编码和名称查询是否存在
|
||||||
|
@ -151,40 +223,30 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list");
|
JSONArray jsonArrayList = jsonObjectAttribute.getJSONArray("list");
|
||||||
//如果jsonArrayList为null,说明没有值,在表中不存在
|
//如果jsonArrayList为null,说明没有值,在表中不存在
|
||||||
if (jsonArrayList == null || jsonArrayList.size() == 0) {
|
if (jsonArrayList == null || jsonArrayList.size() == 0) {
|
||||||
//将查询出来得数据调用通用接口新增,保存到表中
|
// //将查询出来得数据调用通用接口新增,保存到表中
|
||||||
JSONObject main = new JSONObject();
|
// JSONObject main = new JSONObject();
|
||||||
for(String key:hashMap.keySet()) {
|
// for(String key:hashMap.keySet()) {
|
||||||
main.put(key, hashMap.get(key));
|
// main.put(key, hashMap.get(key));
|
||||||
}
|
// }
|
||||||
jsonObjectUser.put("main", main);
|
// jsonObjectUser.put("main", main);
|
||||||
jsonObjectUser.put("appName","数智中台");
|
hashMap.put("appName","数智中台");
|
||||||
jsonObjectUser.put("appCode","800004");
|
hashMap.put("appCode","800004");
|
||||||
jsonObjectUser.put("optionName", "数智中台");
|
hashMap.put("mdmCode", mdmCode);
|
||||||
jsonStr.put("jsonStr", jsonObjectUser);
|
hashMap.put("optionName", "数智中台");
|
||||||
try {
|
jsonStr.put("jsonStr", hashMap);
|
||||||
comparisonServiceimpl.saveEntity(jsonStr);
|
JsonResultEntity result = comparisonServiceimpl.saveEntity(jsonStr);
|
||||||
} catch (Exception e) {
|
if(!result.isFlag()){
|
||||||
logger.info("U8C主数据档案新增用户档案失败,失败原因:{}",e.getMessage());
|
throw new BaseSystemException("主数据保存失败"+ result.getMsg());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Object o : jsonArrayList) {
|
hashMap.put("appName","数智中台");
|
||||||
JSONObject jsonObjectUpdate = JSON.parseObject(String.valueOf(o));
|
hashMap.put("appCode","800004");
|
||||||
String id = jsonObjectUpdate.getString("id");
|
hashMap.put("mdmCode", mdmCode);
|
||||||
JSONObject main = new JSONObject();
|
hashMap.put("optionName", "数智中台");
|
||||||
for(String key:hashMap.keySet()) {
|
jsonStr.put("jsonStr", hashMap);
|
||||||
main.put(key, hashMap.get(key));
|
JsonResultEntity result = comparisonServiceimpl.updateEntity(jsonStr);
|
||||||
main.put("id",id);
|
if(!result.isFlag()){
|
||||||
}
|
throw new BaseSystemException("主数据更新失败"+ result.getMsg());
|
||||||
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.hzya.frame.sysnew.comparison.dao.IComparisonDetailsDao;
|
||||||
import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity;
|
import com.hzya.frame.sysnew.comparison.entity.ComparisonDetailsEntity;
|
||||||
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
|
import com.hzya.frame.sysnew.comparison.entity.ComparisonEntity;
|
||||||
import com.hzya.frame.sysnew.comparison.service.IComparisonService;
|
import com.hzya.frame.sysnew.comparison.service.IComparisonService;
|
||||||
|
import com.hzya.frame.uuid.UUIDLong;
|
||||||
import com.hzya.frame.uuid.UUIDUtils;
|
import com.hzya.frame.uuid.UUIDUtils;
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
@ -28,6 +29,7 @@ import org.springframework.stereotype.Service;
|
||||||
import sun.java2d.pipe.AAShapePipe;
|
import sun.java2d.pipe.AAShapePipe;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service(value = "comparisonServiceImpl")
|
@Service(value = "comparisonServiceImpl")
|
||||||
public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String> implements IComparisonService {
|
public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String> implements IComparisonService {
|
||||||
|
@ -50,7 +52,6 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
//分页查询通用数据数据
|
//分页查询通用数据数据
|
||||||
@DS("master")
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity queryEntityPage(JSONObject json) {
|
public JsonResultEntity queryEntityPage(JSONObject json) {
|
||||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||||
|
@ -100,13 +101,15 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
for (Map<String, Object> comparisonEntitiePage : comparisonEntitiePages) {
|
for (Map<String, Object> comparisonEntitiePage : comparisonEntitiePages) {
|
||||||
JSONObject jsonObjects=new JSONObject();
|
JSONObject jsonObjects=new JSONObject();
|
||||||
jsonObjects.put(comparisonEntity.getDbName(),comparisonEntitiePage);
|
jsonObjects.put(comparisonEntity.getDbName(),comparisonEntitiePage);
|
||||||
comparisonDetailsEntity.setFormmainId(String.valueOf(comparisonEntitiePage.get("id")));
|
if(comparisonDetailsEntity.getDbName()!=null){
|
||||||
//查询明细表数据
|
comparisonDetailsEntity.setFormmainId(String.valueOf(comparisonEntitiePage.get("id")));
|
||||||
List<Map<String, Object>> maps = comparisonDetailsDao.queryComparisonDetailsPage(comparisonDetailsEntity);
|
//查询明细表数据
|
||||||
if(CollectionUtils.isNotEmpty(maps)){
|
List<Map<String, Object>> maps = comparisonDetailsDao.queryComparisonDetailsPage(comparisonDetailsEntity);
|
||||||
jsonObjects.put(comparisonDetailsEntity.getDbName(),maps);
|
if(CollectionUtils.isNotEmpty(maps)){
|
||||||
}else {
|
jsonObjects.put(comparisonDetailsEntity.getDbName(),maps);
|
||||||
jsonObjects.put(comparisonDetailsEntity.getDbName(),new JSONArray());
|
}else {
|
||||||
|
jsonObjects.put(comparisonDetailsEntity.getDbName(),new JSONArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
list.add(jsonObjects);
|
list.add(jsonObjects);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +125,6 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
//新增通用数据数据
|
//新增通用数据数据
|
||||||
@DS("master")
|
|
||||||
@Override
|
@Override
|
||||||
public JsonResultEntity saveEntity(JSONObject json) {
|
public JsonResultEntity saveEntity(JSONObject json) {
|
||||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||||
|
@ -135,9 +137,6 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
if (!checkStr(jsonObject.getString("optionName"))) {
|
if (!checkStr(jsonObject.getString("optionName"))) {
|
||||||
return BaseResult.getFailureMessageEntity("操作人为空");
|
return BaseResult.getFailureMessageEntity("操作人为空");
|
||||||
}
|
}
|
||||||
/*if (!checkStr(jsonObject.getString("rulePrefix"))) {
|
|
||||||
return BaseResult.getFailureMessageEntity("规则为空");
|
|
||||||
}*/
|
|
||||||
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
|
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
|
||||||
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
|
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
|
||||||
List<ComparisonEntity> comparisonEntities=new ArrayList<>();
|
List<ComparisonEntity> comparisonEntities=new ArrayList<>();
|
||||||
|
@ -151,99 +150,138 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
|
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
|
||||||
return BaseResult.getFailureMessageEntity("保存失败");
|
return BaseResult.getFailureMessageEntity("保存失败");
|
||||||
}
|
}
|
||||||
String main = jsonObject.getString("main");//获取主表数据
|
JSONObject jsonObjectMain=new JSONObject();
|
||||||
JSONArray jsonArray = jsonObject.getJSONArray("details");//获取子表数据
|
JSONArray jsonArray=new JSONArray();
|
||||||
JSONObject jsonObjectMain = JSONObject.parseObject(main);
|
List<JSONArray> arrayList=new ArrayList<>();
|
||||||
if(jsonObjectMain != null ) {
|
//根据dbtype和dbname分组,拿到表名称和表类型
|
||||||
Map<String, Object> map = new HashMap<>();//将主表数据存到map中
|
Map<String, Map<String, List<ComparisonEntity>>> collect = comparisonEntities.stream().collect(Collectors.groupingBy(ComparisonEntity::getDbName, Collectors.groupingBy(ComparisonEntity::getDbType)));
|
||||||
Map<String, Object> mapDetails = new HashMap<>();//将子表数据存到map中
|
List<Map.Entry<String, String>> keyPairs = collect.entrySet().stream()
|
||||||
if (comparisonEntities != null && comparisonEntities.size() > 0) {
|
.flatMap(e1 -> e1.getValue().keySet().stream()
|
||||||
map = spliceMainMap(comparisonEntities, jsonObjectMain, map, comparisonEntity);
|
.map(dbname -> new AbstractMap.SimpleEntry<>(e1.getKey(), dbname)))
|
||||||
mapDetails = spliceDetailMap(comparisonEntities, mapDetails, comparisonDetailsEntity, jsonArray);
|
.collect(Collectors.toList());
|
||||||
String uuid = null;
|
// keyPairs 得值为键值对,键是表名称,值是类型,避免多个子表得键一样,比如:mdm_customer:1,mdm_customer_bank:2,mdm_customer_option_log:2
|
||||||
if (jsonObjectMain.getString("id") == null) {
|
for (Map.Entry<String, String> keyPair : keyPairs) {
|
||||||
uuid = UUIDUtils.getUUID();
|
//如果是1,就是主表,根据查询出来得主表是否是传输传递得主表
|
||||||
map.put("id", uuid);
|
if(keyPair.getValue().equals("1")){
|
||||||
} else {
|
String main = jsonObject.getString(keyPair.getKey());
|
||||||
uuid = jsonObjectMain.getString("id");
|
if(main!=null){
|
||||||
map.put("id", jsonObjectMain.getString("id"));
|
jsonObjectMain = JSONObject.parseObject(main);
|
||||||
}
|
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||||
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
return BaseResult.getFailureMessageEntity("新增时候主表data_id不能为空");
|
||||||
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
}
|
||||||
map.put("org_id", "0");
|
}
|
||||||
map.put("create_time", new Date());
|
}
|
||||||
map.put("modify_time", new Date());
|
//如果是2,就是明细表,根据查询出来得子表是否是传输传递得子表
|
||||||
map.put("sts", "Y");
|
if(keyPair.getValue().equals("2")){
|
||||||
map.put("data_status", "Y");//新增状态
|
jsonArray= jsonObject.getJSONArray(keyPair.getKey());
|
||||||
map.put("add_status", "0");//新增状态
|
if(jsonArray!= null) {
|
||||||
map.put("update_status", "1");//修改状态
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
map.put("delete_status", "1");//删除状态
|
JSONObject jsonObjectDetails = jsonArray.getJSONObject(i);
|
||||||
ComparisonEntity comparisonEntityRule = comparisonEntities.get(0);
|
jsonObjectDetails.put("table_name", keyPair.getKey());
|
||||||
//查询单据规则 只查询主表得,明细表不用
|
if(!checkStr(jsonObjectDetails.getString("data_id"))){
|
||||||
try {
|
return BaseResult.getFailureMessageEntity("新增时候明细data_id不能为空");
|
||||||
ComparisonEntity comparisonEntityRules = comparisonDao.queryComparisonById(comparisonEntityRule);
|
}
|
||||||
String documentRule = comparisonEntityRules.getDocumentRule();
|
}
|
||||||
; //"KH-2024-05-30-1";
|
arrayList.add(jsonArray);
|
||||||
logger.info("通用数据保存接口中根据mId查询出来的单据规则为:{}", documentRule);
|
}
|
||||||
if (documentRule != null) {
|
}
|
||||||
//获取规则前缀 CK
|
}
|
||||||
String rulePrefix = documentRule.substring(0, documentRule.indexOf("-"));
|
if(jsonObjectMain!=null && jsonObjectMain.size()>0) {
|
||||||
//获取规则中间日期 yyyy-MM-dd
|
Map<String, Object> map = new HashMap<>();//将主表数据存到map中
|
||||||
String ruleDate = documentRule.substring(documentRule.indexOf("-") + 1, documentRule.lastIndexOf("-"));
|
List<List<Map<String, Object>>> mapDetails = new ArrayList<>();//将子表数据存到map中
|
||||||
String ruleMiddle = getRuleDate(ruleDate);
|
if (comparisonEntities != null && comparisonEntities.size() > 0) {
|
||||||
//获取规则后缀
|
map = spliceMainMap(comparisonEntities, jsonObjectMain, map, comparisonEntity, comparisonDetailsEntity);
|
||||||
String ruleSuffixLength = documentRule.substring(documentRule.lastIndexOf("-") + 1);
|
String uuid= String.valueOf(UUIDLong.longUUID());
|
||||||
int ruleSuffix = ruleSuffixLength.length();
|
map.put("id", uuid);
|
||||||
//生成单据规则
|
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
comparisonEntityRule.setRulePrefix(rulePrefix);
|
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
comparisonEntityRule.setRuleMiddle(ruleMiddle);
|
map.put("org_id", "0");
|
||||||
comparisonEntityRule.setRuleSuffix(ruleSuffix);
|
map.put("create_time", new Date());
|
||||||
try {
|
map.put("modify_time", new Date());
|
||||||
//新生成单据规则保存到数据库
|
map.put("sts", "Y");
|
||||||
ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule);
|
map.put("data_status", "Y");//新增状态
|
||||||
map.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则
|
map.put("add_status", "0");//新增状态
|
||||||
map.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号
|
map.put("update_status", "1");//修改状态
|
||||||
comparisonEntityRule.setMap(map);
|
map.put("delete_status", "1");//删除状态
|
||||||
} catch (Exception e) {
|
ComparisonEntity comparisonEntityRule = comparisonEntities.get(0);
|
||||||
logger.info("保存通用数据时候生成单据规则错误:{}", e.getMessage());
|
//查询单据规则 只查询主表得,明细表不用
|
||||||
return BaseResult.getFailureMessageEntity("保存失败");
|
try {
|
||||||
}
|
ComparisonEntity comparisonEntityRules = comparisonDao.queryComparisonById(comparisonEntityRule);
|
||||||
}
|
String documentRule = comparisonEntityRules.getDocumentRule();//"KH-2024-05-30-1";
|
||||||
} catch (Exception e) {
|
logger.info("通用数据保存接口中根据mId查询出来的单据规则为:{}", documentRule);
|
||||||
logger.info("通用数据保存接口中查询单据规则错误:{}", e.getMessage());
|
if (documentRule != null) {
|
||||||
return BaseResult.getFailureMessageEntity("保存失败");
|
//获取规则前缀 CK
|
||||||
}
|
String rulePrefix = documentRule.substring(0, documentRule.indexOf("-"));
|
||||||
try {
|
//获取规则中间日期 yyyy-MM-dd
|
||||||
//保存主表数据
|
String ruleDate = documentRule.substring(documentRule.indexOf("-") + 1, documentRule.lastIndexOf("-"));
|
||||||
ComparisonEntity comparisonEntityOne = comparisonDao.saveComparison(comparisonEntityRule);
|
String ruleMiddle = getRuleDate(ruleDate);
|
||||||
//保存子表数据
|
//获取规则后缀
|
||||||
if (mapDetails != null && mapDetails.size() > 0) {
|
String ruleSuffixLength = documentRule.substring(documentRule.lastIndexOf("-") + 1);
|
||||||
String uuidDetail = UUIDUtils.getUUID();
|
int ruleSuffix = ruleSuffixLength.length();
|
||||||
mapDetails.put("id", uuidDetail);
|
//生成单据规则
|
||||||
mapDetails.put("formmain_id", uuid);
|
comparisonEntityRule.setRulePrefix(rulePrefix);
|
||||||
mapDetails.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
comparisonEntityRule.setRuleMiddle(ruleMiddle);
|
||||||
mapDetails.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
comparisonEntityRule.setRuleSuffix(ruleSuffix);
|
||||||
mapDetails.put("org_id", "0");
|
try {
|
||||||
mapDetails.put("create_time", new Date());
|
//新生成单据规则保存到数据库
|
||||||
mapDetails.put("modify_time", new Date());
|
ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule);
|
||||||
mapDetails.put("sts", "Y");
|
map.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则
|
||||||
mapDetails.put("data_status","Y");//新增状态
|
map.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号
|
||||||
comparisonDetailsEntity.setMapDetails(mapDetails);
|
comparisonEntityRule.setMap(map);
|
||||||
ComparisonDetailsEntity comparisonDetailsEntityOne = comparisonDetailsDao.saveComparisonDetails(comparisonDetailsEntity);
|
} catch (Exception e) {
|
||||||
//comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne);
|
logger.info("保存通用数据时候生成单据规则错误:{}", e.getMessage());
|
||||||
map.put("details",mapDetails);
|
return BaseResult.getFailureMessageEntity("保存失败");
|
||||||
//保存操作日志
|
}
|
||||||
//controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
//保存操作日志
|
logger.info("通用数据保存接口中查询单据规则错误:{}", e.getMessage());
|
||||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonEntityRule.getDbName()+"_option_log");
|
return BaseResult.getFailureMessageEntity("保存失败");
|
||||||
return BaseResult.getSuccessMessageEntity("保存成功", map);
|
}
|
||||||
} catch (Exception e) {
|
try {
|
||||||
logger.info("保存通用数据时候错误:{}", e.getMessage());
|
List<JSONObject> list = new ArrayList<>();
|
||||||
return BaseResult.getFailureMessageEntity("保存失败");
|
JSONObject jsonObjectList = new JSONObject();
|
||||||
}
|
//保存主表数据
|
||||||
}
|
ComparisonEntity comparisonEntityOne = comparisonDao.saveComparison(comparisonEntityRule);
|
||||||
}
|
jsonObjectList.put(comparisonEntityOne.getDbName(),map);
|
||||||
|
//保存子表数据
|
||||||
|
if (arrayList != null && arrayList.size() > 0) {
|
||||||
|
mapDetails = spliceDetailMap(comparisonEntities, mapDetails, arrayList);
|
||||||
|
if(mapDetails.size()>0 && mapDetails!=null ){
|
||||||
|
for (List<Map<String, Object>> mapDetail : mapDetails) {
|
||||||
|
for (Map<String, Object> stringObjectMap : mapDetail) {
|
||||||
|
stringObjectMap.put("id", UUIDLong.longUUID());
|
||||||
|
stringObjectMap.put("formmain_id", uuid);
|
||||||
|
stringObjectMap.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
|
stringObjectMap.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
|
stringObjectMap.put("org_id", "0");
|
||||||
|
stringObjectMap.put("create_time", new Date());
|
||||||
|
stringObjectMap.put("modify_time", new Date());
|
||||||
|
stringObjectMap.put("sts", "Y");
|
||||||
|
stringObjectMap.put("data_status", "Y");//新增状态
|
||||||
|
comparisonDetailsEntity.setMapDetails(stringObjectMap);
|
||||||
|
comparisonDetailsEntity.setDbName(String.valueOf(stringObjectMap.get("table_name")));
|
||||||
|
stringObjectMap.remove("table_name");
|
||||||
|
ComparisonDetailsEntity comparisonDetailsEntityOne = comparisonDetailsDao.saveComparisonDetails(comparisonDetailsEntity);
|
||||||
|
comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne);
|
||||||
|
//保存操作日志
|
||||||
|
//controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonObjectList.put(comparisonDetailsEntity.getDbName(), mapDetails);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jsonObjectList.put(comparisonDetailsEntity.getDbName(), new ArrayList<>());
|
||||||
|
}
|
||||||
|
list.add(jsonObjectList);
|
||||||
|
//保存操作日志
|
||||||
|
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonEntityRule.getDbName()+"_option_log");
|
||||||
|
return BaseResult.getSuccessMessageEntity("保存成功", list);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("保存通用数据时候错误:{}", e.getMessage());
|
||||||
|
return BaseResult.getFailureMessageEntity("保存失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return BaseResult.getFailureMessageEntity("查询失败","请检查传递参数");
|
return BaseResult.getFailureMessageEntity("查询失败","请检查传递参数");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,11 +300,6 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
|
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
|
||||||
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
|
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
|
||||||
JSONObject jsonObjectMain=jsonObject.getJSONObject("main");//获取主表数据
|
|
||||||
JSONArray jsonArray = jsonObject.getJSONArray("details");//获取子表数据
|
|
||||||
if(!checkStr(jsonObjectMain.getString("id"))){
|
|
||||||
return BaseResult.getFailureMessageEntity("更新时候主表id不能为空");
|
|
||||||
}
|
|
||||||
List<ComparisonEntity> comparisonEntities=new ArrayList<>();
|
List<ComparisonEntity> comparisonEntities=new ArrayList<>();
|
||||||
//根据主数据编码查询表名称,字段名称等信息 10001
|
//根据主数据编码查询表名称,字段名称等信息 10001
|
||||||
try {
|
try {
|
||||||
|
@ -278,12 +311,57 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
|
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
|
||||||
return BaseResult.getFailureMessageEntity("更新失败");
|
return BaseResult.getFailureMessageEntity("更新失败");
|
||||||
}
|
}
|
||||||
|
JSONObject jsonObjectMain=new JSONObject();
|
||||||
|
JSONArray jsonArray=new JSONArray();
|
||||||
|
List<JSONArray> arrayList=new ArrayList<>();
|
||||||
|
//根据dbtype和dbname分组,拿到表名称和表类型
|
||||||
|
Map<String, Map<String, List<ComparisonEntity>>> collect = comparisonEntities.stream().collect(Collectors.groupingBy(ComparisonEntity::getDbName, Collectors.groupingBy(ComparisonEntity::getDbType)));
|
||||||
|
List<Map.Entry<String, String>> keyPairs = collect.entrySet().stream()
|
||||||
|
.flatMap(e1 -> e1.getValue().keySet().stream()
|
||||||
|
.map(dbname -> new AbstractMap.SimpleEntry<>(e1.getKey(), dbname)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for (Map.Entry<String, String> keyPair : keyPairs) {
|
||||||
|
if(keyPair.getValue().equals("1")){
|
||||||
|
String main = jsonObject.getString(keyPair.getKey());
|
||||||
|
if(main!=null){
|
||||||
|
jsonObjectMain = JSONObject.parseObject(main);
|
||||||
|
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||||
|
return BaseResult.getFailureMessageEntity("更新时候主表data_id不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(keyPair.getValue().equals("2")){
|
||||||
|
jsonArray= jsonObject.getJSONArray(keyPair.getKey());
|
||||||
|
if(jsonArray!= null) {
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
JSONObject jsonObjectDetails = jsonArray.getJSONObject(i);
|
||||||
|
if(!checkStr(jsonObjectDetails.getString("data_id"))){
|
||||||
|
return BaseResult.getFailureMessageEntity("更新明细表时候明细表data_id不能为空");
|
||||||
|
}
|
||||||
|
jsonObjectDetails.put("table_name", keyPair.getKey());
|
||||||
|
}
|
||||||
|
arrayList.add(jsonArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Map<String,Object> map=new HashMap<>();//将主表数据存到map中
|
Map<String,Object> map=new HashMap<>();//将主表数据存到map中
|
||||||
Map<String,Object> mapDetails=new HashMap<>();//将子表数据存到map中
|
List<List<Map<String,Object>>> mapDetails=new ArrayList<>();//将子表数据存到map中
|
||||||
if(comparisonEntities !=null && comparisonEntities.size()>0) {
|
if(comparisonEntities !=null && comparisonEntities.size()>0) {
|
||||||
map=spliceMainMap(comparisonEntities,jsonObjectMain,map,comparisonEntity);
|
map=spliceMainMap(comparisonEntities,jsonObjectMain,map,comparisonEntity,comparisonDetailsEntity);
|
||||||
mapDetails=spliceDetailMap(comparisonEntities,mapDetails,comparisonDetailsEntity,jsonArray);
|
|
||||||
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
//根据data_id查询id.根据id更新主表数据,然后再根据主表id和明细表的data_id,删除明细表数据
|
||||||
|
Map<String,Object> mapId=new HashMap<>();
|
||||||
|
mapId.put("data_id",jsonObjectMain.getString("data_id"));
|
||||||
|
ComparisonEntity comparison=new ComparisonEntity();
|
||||||
|
comparison.setDbName(comparisonEntity.getDbName());
|
||||||
|
comparison.setMap(mapId);
|
||||||
|
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||||
|
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||||
|
return BaseResult.getFailureMessageEntity("根据data_id查询id数据为空,请检查data_id");
|
||||||
|
}
|
||||||
|
String id = String.valueOf(comparisonEntitiePages.get(0).get("id"));
|
||||||
|
|
||||||
|
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
map.put("org_id", "0");
|
map.put("org_id", "0");
|
||||||
map.put("modify_time", new Date());
|
map.put("modify_time", new Date());
|
||||||
|
@ -291,7 +369,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
map.put("data_status","F");//数据状态
|
map.put("data_status","F");//数据状态
|
||||||
map.put("update_status","0");//修改状态
|
map.put("update_status","0");//修改状态
|
||||||
comparisonEntity.setMap(map);
|
comparisonEntity.setMap(map);
|
||||||
comparisonEntity.setId(jsonObjectMain.getString("id"));
|
comparisonEntity.setId(id);
|
||||||
/*//生成单据规则
|
/*//生成单据规则
|
||||||
comparisonEntity.setRulePrefix(jsonObject.getString("rulePrefix"));
|
comparisonEntity.setRulePrefix(jsonObject.getString("rulePrefix"));
|
||||||
try {
|
try {
|
||||||
|
@ -303,26 +381,41 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
return BaseResult.getFailureMessageEntity("更新失败",e.getMessage());
|
return BaseResult.getFailureMessageEntity("更新失败",e.getMessage());
|
||||||
}*/
|
}*/
|
||||||
try {
|
try {
|
||||||
//保存主表数据
|
List<JSONObject> jsonObjects=new ArrayList<>();
|
||||||
|
JSONObject jsonObjectList=new JSONObject();
|
||||||
|
//更新主表数据
|
||||||
Integer integer = comparisonDao.updateComparisonByType(comparisonEntity);
|
Integer integer = comparisonDao.updateComparisonByType(comparisonEntity);
|
||||||
if (integer > 0) {
|
jsonObjectList.put(comparisonEntity.getDbName(),map);
|
||||||
|
if (integer>0) {
|
||||||
//保存子表数据
|
//保存子表数据
|
||||||
if (mapDetails != null && mapDetails.size() > 0) {
|
if (arrayList != null && arrayList.size() > 0) {
|
||||||
mapDetails.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
mapDetails=spliceDetailMap(comparisonEntities,mapDetails,arrayList);
|
||||||
mapDetails.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
for (List<Map<String, Object>> mapDetail : mapDetails) {
|
||||||
mapDetails.put("org_id", "0");
|
for (Map<String, Object> stringObjectMap : mapDetail) {
|
||||||
mapDetails.put("modify_time", new Date());
|
stringObjectMap.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
mapDetails.put("sts", "Y");
|
stringObjectMap.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
mapDetails.put("data_status","F");//数据状态
|
stringObjectMap.put("org_id", "0");
|
||||||
comparisonDetailsEntity.setFormmainId(jsonObjectMain.getString("id"));
|
stringObjectMap.put("modify_time", new Date());
|
||||||
comparisonDetailsEntity.setMapDetails(mapDetails);
|
stringObjectMap.put("sts", "Y");
|
||||||
comparisonDetailsDao.updateComparisonDetailsByType(comparisonDetailsEntity);
|
stringObjectMap.put("data_status","F");//数据状态
|
||||||
//保存操作日志
|
comparisonDetailsEntity.setDataId(String.valueOf(stringObjectMap.get("data_id")));
|
||||||
// controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
|
comparisonDetailsEntity.setFormmainId(id);
|
||||||
|
comparisonDetailsEntity.setMapDetails(stringObjectMap);
|
||||||
|
comparisonDetailsEntity.setDbName(String.valueOf(stringObjectMap.get("table_name")));
|
||||||
|
stringObjectMap.remove("table_name");
|
||||||
|
comparisonDetailsDao.updateComparisonDetailsByType(comparisonDetailsEntity);
|
||||||
|
//保存操作日志
|
||||||
|
// controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonObjectList.put(comparisonDetailsEntity.getDbName(),mapDetails);
|
||||||
|
}else{
|
||||||
|
jsonObjectList.put(comparisonDetailsEntity.getDbName(),new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
jsonObjects.add(jsonObjectList);
|
||||||
//保存操作日志
|
//保存操作日志
|
||||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
||||||
return BaseResult.getSuccessMessageEntity("更新成功", integer);
|
return BaseResult.getSuccessMessageEntity("更新成功", jsonObjects);
|
||||||
}else{
|
}else{
|
||||||
return BaseResult.getFailureMessageEntity("更新失败");
|
return BaseResult.getFailureMessageEntity("更新失败");
|
||||||
}
|
}
|
||||||
|
@ -349,10 +442,6 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
|
ComparisonEntity comparisonEntity = jsonObject.toJavaObject(ComparisonEntity.class);
|
||||||
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
|
ComparisonDetailsEntity comparisonDetailsEntity=new ComparisonDetailsEntity();
|
||||||
JSONObject jsonObjectMain=jsonObject.getJSONObject("main");//获取主表数据
|
|
||||||
if(!checkStr(jsonObjectMain.getString("id"))){
|
|
||||||
return BaseResult.getFailureMessageEntity("删除时候主表id不能为空");
|
|
||||||
}
|
|
||||||
List<ComparisonEntity> comparisonEntities=new ArrayList<>();
|
List<ComparisonEntity> comparisonEntities=new ArrayList<>();
|
||||||
//根据主数据编码查询表名称,字段名称等信息 10001
|
//根据主数据编码查询表名称,字段名称等信息 10001
|
||||||
try {
|
try {
|
||||||
|
@ -364,6 +453,25 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
|
logger.info("根据主数据编码查询信息错误:{}",e.getMessage());
|
||||||
return BaseResult.getFailureMessageEntity("删除失败");
|
return BaseResult.getFailureMessageEntity("删除失败");
|
||||||
}
|
}
|
||||||
|
JSONObject jsonObjectMain=new JSONObject();
|
||||||
|
//根据dbtype和dbname分组,拿到表名称和表类型
|
||||||
|
Map<String, Map<String, List<ComparisonEntity>>> collect = comparisonEntities.stream().collect(Collectors.groupingBy(ComparisonEntity::getDbName, Collectors.groupingBy(ComparisonEntity::getDbType)));
|
||||||
|
List<Map.Entry<String, String>> keyPairs = collect.entrySet().stream()
|
||||||
|
.flatMap(e1 -> e1.getValue().keySet().stream()
|
||||||
|
.map(dbname -> new AbstractMap.SimpleEntry<>(e1.getKey(), dbname)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for (Map.Entry<String, String> keyPair : keyPairs) {
|
||||||
|
if(keyPair.getValue().equals("1")){
|
||||||
|
String main = jsonObject.getString(keyPair.getKey());
|
||||||
|
if(main!=null){
|
||||||
|
jsonObjectMain = JSONObject.parseObject(main);
|
||||||
|
if(!checkStr(jsonObjectMain.getString("data_id"))){
|
||||||
|
return BaseResult.getFailureMessageEntity("更新时候主表data_id不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String,Object> map=new HashMap<>();
|
||||||
if(comparisonEntities !=null && comparisonEntities.size()>0) {
|
if(comparisonEntities !=null && comparisonEntities.size()>0) {
|
||||||
for (ComparisonEntity entity : comparisonEntities) {
|
for (ComparisonEntity entity : comparisonEntities) {
|
||||||
|
@ -380,14 +488,27 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
comparisonEntity.setId(jsonObjectMain.getString("id"));
|
|
||||||
|
//根据data_id查询主表id.根据id删除主表数据,然后再根据主表id和明细表data_id删除明细表数据
|
||||||
|
Map<String,Object> mapId=new HashMap<>();
|
||||||
|
mapId.put("data_id",jsonObjectMain.getString("data_id"));
|
||||||
|
ComparisonEntity comparison=new ComparisonEntity();
|
||||||
|
comparison.setDbName(comparisonEntity.getDbName());
|
||||||
|
comparison.setMap(mapId);
|
||||||
|
List<Map<String,Object>> comparisonEntitiePages = comparisonDao.queryComparisonPage(comparison);
|
||||||
|
if(CollectionUtils.isEmpty(comparisonEntitiePages)){
|
||||||
|
return BaseResult.getFailureMessageEntity("根据data_id查询id数据为空,请检查data_id");
|
||||||
|
}
|
||||||
|
String id = String.valueOf(comparisonEntitiePages.get(0).get("id"));
|
||||||
|
|
||||||
|
comparisonEntity.setId(id);
|
||||||
comparisonEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
comparisonEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
comparisonEntity.setMap(map);
|
comparisonEntity.setMap(map);
|
||||||
try {
|
try {
|
||||||
Integer integer = comparisonDao.deleteComparison(comparisonEntity);
|
Integer integer = comparisonDao.deleteComparison(comparisonEntity);
|
||||||
if(integer>0){
|
if(integer>0){
|
||||||
if(comparisonDetailsEntity.getDbName()!=null){
|
if(comparisonDetailsEntity.getDbName()!=null){
|
||||||
comparisonDetailsEntity.setFormmainId(jsonObjectMain.getString("id"));
|
comparisonDetailsEntity.setFormmainId(id);
|
||||||
comparisonDetailsEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
comparisonDetailsEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||||
comparisonDetailsDao.deleteComparisonDetails(comparisonDetailsEntity);
|
comparisonDetailsDao.deleteComparisonDetails(comparisonDetailsEntity);
|
||||||
// controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
// controlsLogDaoimpl.saveControlsLog(comparisonDetailsEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
||||||
|
@ -395,7 +516,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口删除",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log");
|
||||||
return BaseResult.getSuccessMessageEntity("删除成功",integer);
|
return BaseResult.getSuccessMessageEntity("删除成功",integer);
|
||||||
}else{
|
}else{
|
||||||
return BaseResult.getFailureMessageEntity("删除失败","请查看id是否在表中存在");
|
return BaseResult.getFailureMessageEntity("删除失败","请查看data_id是否在表中存在");
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info("删除通用数据数据错误:{}",e.getMessage());
|
logger.info("删除通用数据数据错误:{}",e.getMessage());
|
||||||
|
@ -436,7 +557,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
|
|
||||||
//得到主表数据
|
//得到主表数据
|
||||||
private Map<String,Object> spliceMainMap(List<ComparisonEntity> comparisonEntities,JSONObject jsonObjectMain,Map<String, Object> map,ComparisonEntity comparisonEntity){
|
private Map<String,Object> spliceMainMap(List<ComparisonEntity> comparisonEntities,JSONObject jsonObjectMain,Map<String, Object> map,ComparisonEntity comparisonEntity,ComparisonDetailsEntity comparisonDetailsEntity){
|
||||||
for (ComparisonEntity entity : comparisonEntities) {
|
for (ComparisonEntity entity : comparisonEntities) {
|
||||||
//遍历主表下面的所有key,字段名
|
//遍历主表下面的所有key,字段名
|
||||||
for (String key : jsonObjectMain.keySet()) {
|
for (String key : jsonObjectMain.keySet()) {
|
||||||
|
@ -447,27 +568,36 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
map.put(key, jsonObjectMain.getString(key));
|
map.put(key, jsonObjectMain.getString(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(entity.getDbType().equals("2")){
|
||||||
|
comparisonDetailsEntity.setDbName(entity.getDbName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
//得到明细表数据
|
//得到明细表数据
|
||||||
private Map<String,Object> spliceDetailMap(List<ComparisonEntity> comparisonEntities,Map<String, Object> mapDetails,ComparisonDetailsEntity comparisonDetailsEntity,JSONArray jsonArray){
|
private List<List<Map<String, Object>>> spliceDetailMap(List<ComparisonEntity> comparisonEntities,List<List<Map<String, Object>>> mapDetails,List<JSONArray> arrayList){
|
||||||
if (jsonArray != null && jsonArray.size() > 0) {
|
if (arrayList != null && arrayList.size() > 0) {
|
||||||
for (Object object : jsonArray) {
|
for (JSONArray jsonArray : arrayList) {
|
||||||
JSONObject jsonObjectDetails = (JSONObject) JSON.toJSON(object);
|
List<Map<String,Object>> list=new ArrayList<>();
|
||||||
for (ComparisonEntity entity : comparisonEntities) {
|
for (Object object : jsonArray) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
JSONObject jsonObjectDetails = (JSONObject) JSON.toJSON(object);
|
||||||
//遍历主表下面的所有key,字段名
|
//遍历主表下面的所有key,字段名
|
||||||
for (String key : jsonObjectDetails.keySet()) {
|
for (String key : jsonObjectDetails.keySet()) {
|
||||||
if (entity.getDbType().equals("2")) {
|
for (ComparisonEntity entity : comparisonEntities) {
|
||||||
comparisonDetailsEntity.setDbName(entity.getDbName());
|
if (entity.getDbType().equals("2") && entity.getEnName().equals(key)) {
|
||||||
if(entity.getEnName().equals(key)){
|
jsonObject.put(key, jsonObjectDetails.getString(key));
|
||||||
mapDetails.put(key, jsonObjectDetails.getString(key));
|
}
|
||||||
|
if(key.equals("table_name")){
|
||||||
|
jsonObject.put(key,jsonObjectDetails.getString(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
list.add(jsonObject);
|
||||||
}
|
}
|
||||||
|
mapDetails.add(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapDetails;
|
return mapDetails;
|
||||||
|
@ -518,7 +648,6 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "option":
|
case "option":
|
||||||
//获取主表和明细表的字段信息
|
|
||||||
if(moduleDbEntity.getDbType().equals("3")){
|
if(moduleDbEntity.getDbType().equals("3")){
|
||||||
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity=new MdmModuleDbFiledsEntity();
|
MdmModuleDbFiledsEntity mdmModuleDbFiledsEntity=new MdmModuleDbFiledsEntity();
|
||||||
mdmModuleDbFiledsEntity.setDbId(moduleDbEntity.getId());
|
mdmModuleDbFiledsEntity.setDbId(moduleDbEntity.getId());
|
||||||
|
|
|
@ -31,74 +31,24 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
java.lang.String str = "{\"data\":{\"pk_group\":\"00\",\"enablestate\":\"2\",\"code\":\"20240621001\",\"modify_time\":1718935555000,\"document_rule_num\":2,\"mdm_customer_bank\":[],\"add_status\":\"0\",\"custprop\":\"0\",\"delete_status\":\"1\",\"custstate\":\"1\",\"id\":\"d3d20ea680dc4bffaa7e5bf84764d62a\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":24,\"document_rule\":\"KH-2024-06-21-00002\",\"create_user_id\":\"1\",\"create_time\":1718935555000,\"company_id\":\"Y\",\"pk_country\":\"CN\",\"update_status\":\"1\",\"sts\":\"Y\",\"pk_custclass\":\"K01\",\"org_id\":\"Y\",\"name\":\"测试下发客户\",\"taxpayerid\":\"087982419238904359\"},\"query\":\"[]\",\"header\":\"[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"500\\\",\\\"index\\\":0,\\\"concreteType\\\":\\\"String\\\",\\\"description\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNR\\\",\\\"id\\\":\\\"421b73f0-5562-4bfe-b770-c8aca8878bfd\\\",\\\"parameterName\\\":\\\"pubKey\\\",\\\"required\\\":true,\\\"example\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNREgMNeOEOwlvM2iqqEfshDadRHziDSB2PbRnoMqSv1nGr3XBlZuseNj5HmxDEkLhOdfyw0yjzoz3wK7XhFpeN4Iyf7NT7hps5jAQMEpnul9Qwmj5qUr/eK5SaO9H8n7sh9BvCdrX9oRUh+U2/ceA3O+y/MUHk5DRvSadc8FhpqbOaNBbAzPnyYAwpVUPvaJ90jcGN1ZG99HR1GEzC+Cn9s6vgt7dYL6ysMs36bSP47xraDSxpfr0CLwa6JV/9KjLIeqL1ZaMtK0CJ1zJGCBA6O6kgxeE9Ul7q2lSS6mPAEJ78izaTYsrjhLpKT+eTtFBOLFbiCrbLp8tVE5kwIDAQAB\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"100\\\",\\\"index\\\":1,\\\"concreteType\\\":\\\"String\\\",\\\"description\\\":\\\"OA\\\",\\\"id\\\":\\\"5659424d-261d-43ed-9fff-657bd15c7a64\\\",\\\"parameterName\\\":\\\"client_id\\\",\\\"required\\\":true,\\\"example\\\":\\\"OA\\\"},{\\\"parameterType\\\":\\\"authport\\\",\\\"length\\\":\\\"100\\\",\\\"index\\\":2,\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"d2c4477e-a0bb-4daa-97b4-3cf0b8445001\\\",\\\"parameterName\\\":\\\"access_token\\\",\\\"required\\\":true,\\\"example\\\":[\\\"attribute\\\",\\\"data\\\",\\\"access_token\\\"]}]\",\"body\":\"[{\\\"index\\\":0,\\\"id\\\":\\\"5ac44a3b-c0d5-4ae9-aec6-af6c4c8f59cc\\\",\\\"parameterName\\\":\\\"body\\\",\\\"first\\\":true}]\"}";
|
java.lang.String str = "{\"data\":{\"document_rule\":\"RY-2024-06-25-00001\",\"create_user_id\":\"1\",\"mdm_psnjobs\":[],\"create_time\":1719287779000,\"company_id\":\"Y\",\"modify_time\":1719287779000,\"sex\":\"男\",\"mobile\":\"13758050335\",\"document_rule_num\":1,\"add_status\":\"0\",\"update_status\":\"1\",\"sts\":\"Y\",\"delete_status\":\"1\",\"org_id\":\"Y\",\"name\":\"张三1\",\"id\":\"ba0ed50f82e94f8e8a0d000d09795961\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":5},\"query\":\"[]\",\"header\":\"[]\",\"body\":\"[{\\\"parameterType\\\":\\\"complex\\\",\\\"children\\\":[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":1,\\\"description\\\":\\\"用户名\\\",\\\"parameterName\\\":\\\"userName\\\",\\\"id\\\":\\\"3e5627fd-97a8-40ec-bb54-a973de695ad7\\\",\\\"example\\\":\\\"137000000\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":2,\\\"description\\\":\\\"性别 男 女\\\",\\\"parameterName\\\":\\\"gender\\\",\\\"id\\\":\\\"e7ec2721-8fa0-4301-9d71-64c93558efdf\\\",\\\"example\\\":\\\"男\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":3,\\\"description\\\":\\\"用户真实姓名\\\",\\\"parameterName\\\":\\\"userTrueName\\\",\\\"id\\\":\\\"fb760309-f24c-4638-ba19-f15a0fdba653\\\",\\\"example\\\":\\\"张三\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":4,\\\"description\\\":\\\"密码\\\",\\\"parameterName\\\":\\\"userPwd\\\",\\\"id\\\":\\\"a651ce81-f7ee-4aa2-ad48-4afa35fb584c\\\",\\\"example\\\":\\\"123456\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"concreteType\\\":\\\"String\\\",\\\"index\\\":5,\\\"description\\\":\\\"电话\\\",\\\"parameterName\\\":\\\"mobile\\\",\\\"id\\\":\\\"dad12b91-0c9f-45f2-9dc2-294bb50d5a29\\\",\\\"example\\\":\\\"137000000\\\"}],\\\"concreteType\\\":\\\"Object\\\",\\\"index\\\":0,\\\"id\\\":\\\"d643e859-fd5b-4b40-ab68-7092739dc2b9\\\",\\\"parameterName\\\":\\\"body\\\",\\\"first\\\":true}]\"}";
|
||||||
java.lang.String str1 = "com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();\n" +
|
|
||||||
" com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject();\n" +
|
|
||||||
"\n" +
|
|
||||||
" com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);\n" +
|
|
||||||
" com.alibaba.fastjson.JSONObject data = reqData.getJSONObject(\"data\");\n" +
|
|
||||||
" com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject();\n" +
|
|
||||||
" ufinterfaceObject.put(\"billtype\", \"customer\");\n" +
|
|
||||||
" ufinterfaceObject.put(\"isexchange\", \"Y\");\n" +
|
|
||||||
" ufinterfaceObject.put(\"replace\", \"Y\");\n" +
|
|
||||||
" ufinterfaceObject.put(\"sender\", \"OA\");\n" +
|
|
||||||
" ufinterfaceObject.put(\"account\", \"01\");\n" +
|
|
||||||
" ufinterfaceObject.put(\"groupcode\", \"00\");\n" +
|
|
||||||
" com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject();\n" +
|
|
||||||
" com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject();\n" +
|
|
||||||
" billheadObject.put(\"code\", data.get(\"code\"));\n" +
|
|
||||||
" billheadObject.put(\"custprop\", data.get(\"custprop\"));\n" +
|
|
||||||
" billheadObject.put(\"custstate\", data.get(\"custstate\"));\n" +
|
|
||||||
" billheadObject.put(\"pk_custclass\", data.get(\"pk_custclass\"));\n" +
|
|
||||||
" billheadObject.put(\"pk_country\", data.get(\"pk_country\"));\n" +
|
|
||||||
" billheadObject.put(\"pk_timezone\", \"P0800\");\n" +
|
|
||||||
" billheadObject.put(\"pk_format\", \"ZH-CN\");\n" +
|
|
||||||
" billheadObject.put(\"enablestate\", data.get(\"enablestate\"));\n" +
|
|
||||||
" billheadObject.put(\"name\", data.get(\"name\"));\n" +
|
|
||||||
" billheadObject.put(\"pk_group\", data.get(\"pk_group\"));\n" +
|
|
||||||
" billheadObject.put(\"pk_org\", data.get(\"pk_org\"));\n" +
|
|
||||||
" billheadObject.put(\"taxpayerid\", data.get(\"taxpayerid\"));\n" +
|
|
||||||
" billObject.put(\"billhead\", billheadObject);\n" +
|
|
||||||
" ufinterfaceObject.put(\"bill\", billObject);\n" +
|
|
||||||
" bodys.put(\"ufinterface\", ufinterfaceObject);\n" +
|
|
||||||
" returnObject.put(\"bodys\",bodys.toJSONString());\n" +
|
|
||||||
" return returnObject.toJSONString();".trim();
|
|
||||||
String newString =str1.replaceAll("\\s+", "");
|
|
||||||
A88772 s = new A88772();
|
A88772 s = new A88772();
|
||||||
s.execute(str);
|
s.execute(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class A88772 {
|
static class A88772 {
|
||||||
String execute(String jsonStr) {
|
String execute(String jsonStr) {
|
||||||
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
|
|
||||||
com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject();
|
|
||||||
|
|
||||||
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
|
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
|
||||||
com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data");
|
com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data");
|
||||||
com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
|
||||||
ufinterfaceObject.put("billtype", "customer");
|
com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject();
|
||||||
ufinterfaceObject.put("isexchange", "Y");
|
bodys.put("userName", data.get("login_name"));
|
||||||
ufinterfaceObject.put("replace", "Y");
|
if(data.get("gender") != null){
|
||||||
ufinterfaceObject.put("sender", "OA");
|
bodys.put("gender", data.get("gender"));
|
||||||
ufinterfaceObject.put("account", "01");
|
}
|
||||||
ufinterfaceObject.put("groupcode", "00");
|
bodys.put("userTrueName", data.get("user_name"));
|
||||||
com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject();
|
bodys.put("userPwd", "Hzya@1314");
|
||||||
com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject();
|
bodys.put("mobile", data.get("mobile"));
|
||||||
billheadObject.put("code", data.get("code"));
|
|
||||||
billheadObject.put("custprop", data.get("custprop"));
|
|
||||||
billheadObject.put("custstate", data.get("custstate"));
|
|
||||||
billheadObject.put("pk_custclass", data.get("pk_custclass"));
|
|
||||||
billheadObject.put("pk_country", data.get("pk_country"));
|
|
||||||
billheadObject.put("pk_timezone", "P0800");
|
|
||||||
billheadObject.put("pk_format", "ZH-CN");
|
|
||||||
billheadObject.put("enablestate", data.get("enablestate"));
|
|
||||||
billheadObject.put("name", data.get("name"));
|
|
||||||
billheadObject.put("pk_group", data.get("pk_group"));
|
|
||||||
billheadObject.put("pk_org", data.get("pk_org"));
|
|
||||||
billheadObject.put("taxpayerid", data.get("taxpayerid"));
|
|
||||||
billObject.put("billhead", billheadObject);
|
|
||||||
ufinterfaceObject.put("bill", billObject);
|
|
||||||
bodys.put("ufinterface", ufinterfaceObject);
|
|
||||||
returnObject.put("bodys",bodys.toJSONString());
|
returnObject.put("bodys",bodys.toJSONString());
|
||||||
return returnObject.toJSONString();
|
return returnObject.toJSONString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ package com.hzya.frame.web.quartz;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.base.PluginBaseEntity;
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
|
||||||
|
import com.hzya.frame.sysnew.application.database.dao.ISysApplicationDatabaseDao;
|
||||||
|
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
|
||||||
import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity;
|
import com.hzya.frame.sysnew.application.plugin.entity.SysApplicationPluginEntity;
|
||||||
import com.hzya.frame.sysnew.integtationTask.IIntegrationTaskCacheableService;
|
import com.hzya.frame.sysnew.integtationTask.IIntegrationTaskCacheableService;
|
||||||
import com.hzya.frame.sysnew.integtationTask.entity.IntegrationTaskEntity;
|
import com.hzya.frame.sysnew.integtationTask.entity.IntegrationTaskEntity;
|
||||||
|
@ -19,6 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,6 +34,8 @@ public class QuartzJobFactory implements Job {
|
||||||
private IIntegrationTaskCacheableService iIntegrationTaskCacheableService;
|
private IIntegrationTaskCacheableService iIntegrationTaskCacheableService;
|
||||||
@Resource
|
@Resource
|
||||||
private IIntegrationTaskLogDao integrationTaskLogDao;
|
private IIntegrationTaskLogDao integrationTaskLogDao;
|
||||||
|
@Resource
|
||||||
|
private ISysApplicationDatabaseDao sysApplicationDatabaseDao;
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
//当前开始时间
|
//当前开始时间
|
||||||
|
@ -103,6 +108,16 @@ public class QuartzJobFactory implements Job {
|
||||||
"2","3","插件未启用,不执行任务",startTime,startTime,new Date());
|
"2","3","插件未启用,不执行任务",startTime,startTime,new Date());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String sourceCode = null;
|
||||||
|
//查找应用的数据源编码
|
||||||
|
SysApplicationDatabaseEntity sysApplicationDatabaseEntity = new SysApplicationDatabaseEntity();
|
||||||
|
sysApplicationDatabaseEntity.setAppId(sysApplicationPluginEntity.getAppId());
|
||||||
|
sysApplicationDatabaseEntity.setSts("Y");
|
||||||
|
List<SysApplicationDatabaseEntity> sysApplicationDatabaseEntities = sysApplicationDatabaseDao.queryBase(sysApplicationDatabaseEntity);
|
||||||
|
if(sysApplicationDatabaseEntities != null && sysApplicationDatabaseEntities.size() == 1){
|
||||||
|
sourceCode = sysApplicationDatabaseEntities.get(0).getSourceCode();
|
||||||
|
}
|
||||||
|
|
||||||
//查找插件
|
//查找插件
|
||||||
PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode());
|
PluginBaseEntity pluginBaseEntity = PluginUtils.getPluginsById(sysApplicationPluginEntity.getPluginCode());
|
||||||
if(pluginBaseEntity == null ){
|
if(pluginBaseEntity == null ){
|
||||||
|
@ -114,6 +129,7 @@ public class QuartzJobFactory implements Job {
|
||||||
JSONObject req = new JSONObject();
|
JSONObject req = new JSONObject();
|
||||||
req.put("startTime",oldStartTime);
|
req.put("startTime",oldStartTime);
|
||||||
req.put("endTime",startTime);
|
req.put("endTime",startTime);
|
||||||
|
req.put("sourceCode",sourceCode);
|
||||||
try {
|
try {
|
||||||
JsonResultEntity jsonResultEntity = pluginBaseEntity.executeBusiness(req);
|
JsonResultEntity jsonResultEntity = pluginBaseEntity.executeBusiness(req);
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
|
|
Loading…
Reference in New Issue