|
|
|
@ -7,12 +7,19 @@ import java.util.List;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import com.glxp.api.dao.basic.ProductInfoDao;
|
|
|
|
|
import com.glxp.api.dao.basic.UdiCompanyDao;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.glxp.api.dao.basic.*;
|
|
|
|
|
import com.glxp.api.dao.inout.*;
|
|
|
|
|
import com.glxp.api.dao.purchase.*;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicProductsEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.CompanyProductRelevanceEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.ProductInfoEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiCompanyEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
import com.glxp.api.entity.purchase.SupManufacturerEntity;
|
|
|
|
|
import com.glxp.api.res.sync.*;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -34,12 +41,31 @@ import com.glxp.api.entity.sync.BasicExportStatusEntity;
|
|
|
|
|
import com.glxp.api.entity.sync.BasicExportStatusTimeEntity;
|
|
|
|
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
|
|
|
|
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
|
|
|
|
import com.glxp.api.res.sync.*;
|
|
|
|
|
import com.glxp.api.service.basic.BasicHospTypeService;
|
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.DateUtil;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.ibatis.session.SqlSessionFactory;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class HeartService {
|
|
|
|
|
@Resource
|
|
|
|
|
BasicExportService basicExportService;
|
|
|
|
@ -493,6 +519,81 @@ public class HeartService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private final BasicHospTypeDao basicHospTypeDao;
|
|
|
|
|
private final UdiRelevanceDao udiRelevanceDao;
|
|
|
|
|
private final BasicProductsDao basicProductsDao;
|
|
|
|
|
private final CompanyProductRelevanceDao relevanceDao;
|
|
|
|
|
private final BasicCorpDao corpDao;
|
|
|
|
|
private final SupCertDao supCertDao;
|
|
|
|
|
private final SupCertSetDao supCertSetDao;
|
|
|
|
|
private final SupCompanyDao supCompanyDao;
|
|
|
|
|
private final SupManufacturerDao supManufacturerDao;
|
|
|
|
|
private final SupProductDao supProductDao;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 从UDI自助平台拉取基础数据
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void pullBasicData() {
|
|
|
|
|
String data = spGetHttp.pullBasicData();
|
|
|
|
|
cn.hutool.json.JSONObject obj = JSONUtil.parseObj(data);
|
|
|
|
|
SpsSyncBasicDataResponse bean = obj.get("data", SpsSyncBasicDataResponse.class);
|
|
|
|
|
this.insertBasicData(bean);
|
|
|
|
|
String taskId = obj.getStr("taskId");
|
|
|
|
|
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
|
|
|
|
|
basicDownloadStatusEntity.setId(CustomUtil.getId());
|
|
|
|
|
basicDownloadStatusEntity.setTaskId(taskId);
|
|
|
|
|
basicDownloadStatusEntity.setStartTime(new Date());
|
|
|
|
|
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_BASIC_DATA);
|
|
|
|
|
basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_SUCCESS); //下载完成
|
|
|
|
|
basicDownloadStatusEntity.setType(BasicProcessStatus.BASIC_DATA);
|
|
|
|
|
basicDownloadStatusEntity.setScheduleType(1);
|
|
|
|
|
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
|
|
|
|
|
if (StrUtil.isNotBlank(taskId)) {
|
|
|
|
|
//通知自助平台任务已完成
|
|
|
|
|
spGetHttp.finishTask(taskId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置嵌套事物
|
|
|
|
|
*
|
|
|
|
|
* @param bean
|
|
|
|
|
*/
|
|
|
|
|
@Transactional(propagation = Propagation.NESTED)
|
|
|
|
|
public void insertBasicData(SpsSyncBasicDataResponse bean) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getHospTypeList())) {
|
|
|
|
|
basicHospTypeDao.insertOrUpdateBatch(bean.getHospTypeList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getUdiRelevanceList())) {
|
|
|
|
|
udiRelevanceDao.insertOrUpdateBatch(bean.getUdiRelevanceList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getProductsList())) {
|
|
|
|
|
basicProductsDao.insertOrUpdateBatch(bean.getProductsList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getRelevanceList())) {
|
|
|
|
|
relevanceDao.insertOrUpdateBatch(bean.getRelevanceList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getCorpList())) {
|
|
|
|
|
corpDao.insertOrUpdateBatch(bean.getCorpList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getSupCertList())) {
|
|
|
|
|
supCertDao.insertOrUpdateBatch(bean.getSupCertList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getSupCertSetList())) {
|
|
|
|
|
supCertSetDao.insertOrUpdateBatch(bean.getSupCertSetList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getSupCompanyList())) {
|
|
|
|
|
supCompanyDao.insertOrUpdateBatch(bean.getSupCompanyList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getSupManufacturerList())) {
|
|
|
|
|
supManufacturerDao.insertOrUpdateBatch(bean.getSupManufacturerList());
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(bean.getSupProductList())) {
|
|
|
|
|
supProductDao.insertOrUpdateBatch(bean.getSupProductList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void insetOrderDb(SpsSyncOrderResponse syncDataResponse, IoOrderEntity orderEntity) {
|
|
|
|
|
//更新码详情
|
|
|
|
|
if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailCodeEntities())) {
|
|
|
|
|