parent
a293de6688
commit
e6b10832b0
@ -1,34 +1,34 @@
|
|||||||
package cn.estsh.i3plus.core.apiservice.configuration;
|
//package cn.estsh.i3plus.core.apiservice.configuration;
|
||||||
|
//
|
||||||
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
//import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||||
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseMongoRepositoryFactoryBean;
|
//import cn.estsh.i3plus.pojo.base.jpa.factory.BaseMongoRepositoryFactoryBean;
|
||||||
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseRepositoryFactoryBean;
|
//import cn.estsh.i3plus.pojo.base.jpa.factory.BaseRepositoryFactoryBean;
|
||||||
import org.slf4j.Logger;
|
//import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
//import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
//import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
//import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
//import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
//import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @Description : 需要扫描其他包的配置文件
|
// * @Description : 需要扫描其他包的配置文件
|
||||||
* 此类专门添加需要单独加载的其他模块的包
|
// * 此类专门添加需要单独加载的其他模块的包
|
||||||
* @Reference :
|
// * @Reference :
|
||||||
* @Author : alwaysfrin
|
// * @Author : alwaysfrin
|
||||||
* @CreateDate : 2018-12-12 20:49
|
// * @CreateDate : 2018-12-12 20:49
|
||||||
* @Modify:
|
// * @Modify:
|
||||||
**/
|
// **/
|
||||||
@Configuration
|
//@Configuration
|
||||||
@ConditionalOnExpression("'${" + CommonConstWords.PROP_SWITCH_MONGO + ":false}' == 'true'")
|
//@ConditionalOnExpression("'${" + CommonConstWords.PROP_SWITCH_MONGO + ":false}' == 'true'")
|
||||||
//扫描需要单独处理的持久化包
|
////扫描需要单独处理的持久化包
|
||||||
@EnableMongoRepositories(basePackages = {
|
//@EnableMongoRepositories(basePackages = {
|
||||||
"cn.estsh.i3plus.**.platrepositorymongo"
|
// "cn.estsh.i3plus.**.platrepositorymongo"
|
||||||
},repositoryFactoryBeanClass = BaseMongoRepositoryFactoryBean.class)
|
//},repositoryFactoryBeanClass = BaseMongoRepositoryFactoryBean.class)
|
||||||
public class ScanMongoPackageConfiguration {
|
//public class ScanMongoPackageConfiguration {
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
|
// public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
|
||||||
|
//
|
||||||
public ScanMongoPackageConfiguration(){
|
// public ScanMongoPackageConfiguration(){
|
||||||
LOGGER.info("【扫描关联包...】");
|
// LOGGER.info("【扫描关联包...】");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
package cn.estsh.i3plus.core.apiservice.configuration;
|
//package cn.estsh.i3plus.core.apiservice.configuration;
|
||||||
|
//
|
||||||
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
//import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||||
import cn.estsh.i3plus.pojo.base.jpa.factory.BaseRepositoryFactoryBean;
|
//import cn.estsh.i3plus.pojo.base.jpa.factory.BaseRepositoryFactoryBean;
|
||||||
import org.slf4j.Logger;
|
//import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
//import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
//import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
//import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @Description : 需要扫描其他包的配置文件
|
// * @Description : 需要扫描其他包的配置文件
|
||||||
* 此类专门添加需要单独加载的其他模块的包
|
// * 此类专门添加需要单独加载的其他模块的包
|
||||||
* @Reference :
|
// * @Reference :
|
||||||
* @Author : alwaysfrin
|
// * @Author : alwaysfrin
|
||||||
* @CreateDate : 2018-12-12 20:49
|
// * @CreateDate : 2018-12-12 20:49
|
||||||
* @Modify:
|
// * @Modify:
|
||||||
**/
|
// **/
|
||||||
@Configuration
|
//@Configuration
|
||||||
//扫描需要单独处理的包
|
////扫描需要单独处理的包
|
||||||
@EntityScan(basePackages = {
|
//@EntityScan(basePackages = {
|
||||||
"cn.estsh.i3plus.**.platbean"
|
// "cn.estsh.i3plus.**.platbean"
|
||||||
})
|
//})
|
||||||
|
//
|
||||||
//需要单独处理的其他模块包
|
////需要单独处理的其他模块包
|
||||||
@EnableJpaRepositories(basePackages = {
|
//@EnableJpaRepositories(basePackages = {
|
||||||
"cn.estsh.i3plus.**.platrepository"
|
// "cn.estsh.i3plus.**.platrepository"
|
||||||
}, repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)
|
//}, repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)
|
||||||
public class ScanPackageConfiguration {
|
//public class ScanPackageConfiguration {
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
|
// public static final Logger LOGGER = LoggerFactory.getLogger(CommonConstWords.SYSTEM_LOG);
|
||||||
|
//
|
||||||
public ScanPackageConfiguration(){
|
// public ScanPackageConfiguration(){
|
||||||
LOGGER.info("【扫描关联包...】");
|
// LOGGER.info("【扫描关联包...】");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
//package cn.estsh.i3plus.core.apiservice.mq;
|
|
||||||
//
|
|
||||||
//import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
||||||
//import com.rabbitmq.client.Channel;
|
|
||||||
//import org.slf4j.Logger;
|
|
||||||
//import org.slf4j.LoggerFactory;
|
|
||||||
//import org.springframework.amqp.core.Message;
|
|
||||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
||||||
//import org.springframework.stereotype.Component;
|
|
||||||
//
|
|
||||||
//import java.util.Random;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * @Description : 邮件队列处理
|
|
||||||
// * @Reference :
|
|
||||||
// * @Author : yunhao
|
|
||||||
// * @CreateDate : 2018-11-15 22:15
|
|
||||||
// * @Modify:
|
|
||||||
// **/
|
|
||||||
//@Component
|
|
||||||
//public class MessageTestQueueReceiver {
|
|
||||||
// private static final Logger LOGGER = LoggerFactory.getLogger(MessageTestQueueReceiver.class);
|
|
||||||
// Random random = new Random();//默认构造方法
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 系统邮件处理队列
|
|
||||||
// *
|
|
||||||
// * @param data 系统消息信息
|
|
||||||
// * @param channel 通道
|
|
||||||
// * @param message 消息
|
|
||||||
// */
|
|
||||||
// @RabbitListener(queues = PlatformConstWords.QUEUE_IMPP_MESSAGE_LETTER_BAK,exclusive = true,concurrency = "1")
|
|
||||||
// public void processImppMail(String data, Channel channel, Message message) {
|
|
||||||
// try {
|
|
||||||
//
|
|
||||||
// LOGGER.info("====>> {}" ,data);
|
|
||||||
// Thread.sleep(random.nextInt(100));
|
|
||||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
||||||
// }catch (Exception e){
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
@ -1,139 +0,0 @@
|
|||||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.base;
|
|
||||||
|
|
||||||
import cn.estsh.i3plus.icloud.mdm.sdk.base.IBaseMdmBusiExtdCloud;
|
|
||||||
import cn.estsh.i3plus.icloud.mdm.sdk.base.IBaseMdmBusiModelCloud;
|
|
||||||
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
||||||
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
|
|
||||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
||||||
import cn.estsh.i3plus.pojo.mdm.bean.base.BaseMdmBusiModelBean;
|
|
||||||
import cn.estsh.i3plus.pojo.mdm.bean.base.MdmSyncData;
|
|
||||||
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description : 业务同步setvice
|
|
||||||
* @Reference :
|
|
||||||
* @Author : yunhao
|
|
||||||
* @CreateDate : 2020-05-15 17:58
|
|
||||||
* @Modify:
|
|
||||||
**/
|
|
||||||
public abstract class BaseBusiSyncMdmDataService<T, M extends BaseMdmBusiModelBean> {
|
|
||||||
|
|
||||||
private IBaseMdmBusiExtdCloud baseMdmBusiExtdCloud;
|
|
||||||
|
|
||||||
private IBaseMdmBusiModelCloud<M> baseMdmBusiModelCloud;
|
|
||||||
|
|
||||||
public BaseBusiSyncMdmDataService(IBaseMdmBusiExtdCloud baseMdmBusiExtdCloud, IBaseMdmBusiModelCloud<M> baseMdmBusiModelCloud) {
|
|
||||||
this.baseMdmBusiExtdCloud = baseMdmBusiExtdCloud;
|
|
||||||
this.baseMdmBusiModelCloud = baseMdmBusiModelCloud;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主数据新增同步
|
|
||||||
* @param syncData
|
|
||||||
*/
|
|
||||||
public void masterInsertSync(MdmSyncData syncData) {
|
|
||||||
baseMdmBusiExtdCloud.whiteDoProcessMissBusiExtdByMaster(syncData.getSyncDataId().toArray(new Long[syncData.getSyncDataId().size()]), syncData.getSyncDateUserName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主数据修改同步
|
|
||||||
* @param syncData
|
|
||||||
*/
|
|
||||||
public void masterUpdateSync(MdmSyncData syncData) {
|
|
||||||
BaseResultBean<M> baseResultBean =
|
|
||||||
baseMdmBusiModelCloud.whiteFindByMasterIds(syncData.getSyncDataId().toArray(new Long[syncData.getSyncDataId().size()]));
|
|
||||||
if (!baseResultBean.isSuccess()) {
|
|
||||||
throw ImppExceptionBuilder.newInstance()
|
|
||||||
.setSystemID(CommonEnumUtil.SOFT_TYPE.MDM.getCode())
|
|
||||||
.setErrorCode(ImppExceptionEnum.CLOUD_CALL_EXCEPTION.getCode())
|
|
||||||
.setErrorDetail(baseResultBean.getErrorMsg())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<M> modelBeanList = baseResultBean.getResultList();
|
|
||||||
updateBusiList(transform(modelBeanList));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主数据删除同步
|
|
||||||
* @param syncData
|
|
||||||
*/
|
|
||||||
public void masterDeleteSync(MdmSyncData syncData) {
|
|
||||||
baseMdmBusiExtdCloud.whiteDeleteWeaklyByMasterIds(syncData.getSyncDataId().toArray(new Long[syncData.getSyncDataId().size()]),syncData.getSyncDateUserName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务数据新增同步
|
|
||||||
* @param syncData
|
|
||||||
*/
|
|
||||||
public void busiInsertSync(MdmSyncData syncData){
|
|
||||||
BaseResultBean<M> baseResultBean =
|
|
||||||
baseMdmBusiModelCloud.whiteFindByIds(syncData.getSyncDataId().toArray(new Long[syncData.getSyncDataId().size()]));
|
|
||||||
if (!baseResultBean.isSuccess()) {
|
|
||||||
throw ImppExceptionBuilder.newInstance()
|
|
||||||
.setSystemID(CommonEnumUtil.SOFT_TYPE.MDM.getCode())
|
|
||||||
.setErrorCode(ImppExceptionEnum.CLOUD_CALL_EXCEPTION.getCode())
|
|
||||||
.setErrorDetail(baseResultBean.getErrorMsg())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<M> modelBeanList = baseResultBean.getResultList();
|
|
||||||
insertBusiList(transform(modelBeanList));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务数据修改同步
|
|
||||||
* @param syncData
|
|
||||||
*/
|
|
||||||
public void busiUpdateSync(MdmSyncData syncData){
|
|
||||||
BaseResultBean<M> baseResultBean =
|
|
||||||
baseMdmBusiModelCloud.findByIds(syncData.getSyncDataId().toArray(new Long[syncData.getSyncDataId().size()]));
|
|
||||||
if (!baseResultBean.isSuccess()) {
|
|
||||||
throw ImppExceptionBuilder.newInstance()
|
|
||||||
.setSystemID(CommonEnumUtil.SOFT_TYPE.MDM.getCode())
|
|
||||||
.setErrorCode(ImppExceptionEnum.CLOUD_CALL_EXCEPTION.getCode())
|
|
||||||
.setErrorDetail(baseResultBean.getErrorMsg())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<M> modelBeanList = baseResultBean.getResultList();
|
|
||||||
updateBusiList(transform(modelBeanList));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务数据删除同步
|
|
||||||
* @param syncData
|
|
||||||
*/
|
|
||||||
public void busiDeleteSync(MdmSyncData syncData){
|
|
||||||
deleteBusiList(syncData.getSyncDataId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类型转换
|
|
||||||
* @param syncDataList
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public abstract List<T> transform(List<M> syncDataList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增业务数据
|
|
||||||
* @param beanList
|
|
||||||
*/
|
|
||||||
public abstract void insertBusiList(List<T> beanList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改业务数据
|
|
||||||
* @param beanList
|
|
||||||
*/
|
|
||||||
public abstract void updateBusiList(List<T> beanList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除业务数据
|
|
||||||
* @param idList
|
|
||||||
*/
|
|
||||||
public abstract void deleteBusiList(List<Long> idList);
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue