数据同步问题相关修改

dev
anthonywj 2 years ago
parent f31a16bccf
commit ade2dd215d

@ -49,7 +49,7 @@ public class HdSchemaExecutor implements ApplicationRunner {
String sql = IoUtil.readUtf8(inputStream);
try {
//判断版本表是否存在
int count = hdCommonDao.selectTableExist("hd_version");
int count = hdCommonDao.selectTableExist("sys_db_version");
if (count == 0) {
hdCommonDao.updateSql(sql);
}
@ -85,4 +85,4 @@ public class HdSchemaExecutor implements ApplicationRunner {
// schema.add(new SchemaData("v2.2", "schema_v2.2.sql"));
// schema.add(new SchemaData("v2.3", "schema_v2.3.sql"));
}
}
}

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.*;
import com.glxp.api.constant.Constant;
import com.glxp.api.dao.basic.BasicProductsDao;
import com.glxp.api.entity.basic.*;
import com.glxp.api.entity.inout.*;
@ -29,12 +30,10 @@ import com.glxp.api.service.inout.*;
import com.glxp.api.service.inout.impl.IoOrderInvoiceService;
import com.glxp.api.service.purchase.*;
import com.glxp.api.service.thrsys.IThrBusTypeOriginService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.JsonUtils;
import com.glxp.api.util.RedisUtil;
import com.glxp.api.util.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -93,22 +92,25 @@ public class SpsSyncDownloadService {
log.info("创建单据同步任务");
//自动创建要求被下载已完成单据任务.
// 1.判断是否同步任务已存在
Date curTime = new Date();
BasicExportStatusEntity basicExportStatusEntity1 = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class)
.eq(BasicExportStatusEntity::getType, NEW_ALL_ORDER)
.orderByDesc(BasicExportStatusEntity::getStartTime)
.last("limit 1")
);
log.info("no1:" + basicExportStatusEntity1.getStatus() + "---" + BasicExportStatusEnum.COMPLETED.getCode());
//首次任务or上次任务结束
if (basicExportStatusEntity1 == null || BasicExportStatusEnum.COMPLETED.getCode().equals(basicExportStatusEntity1.getStatus())) {
if (basicExportStatusEntity1 == null || IntUtil.value(BasicExportStatusEnum.COMPLETED.getCode()) == IntUtil.value(basicExportStatusEntity1.getStatus())) {
log.info("no2:" + basicExportStatusEntity1.getStatus() + "---" + BasicExportStatusEnum.COMPLETED.getCode());
SpsSyncDataRequest spsSyncDataRequest = getRequest(ConstantStatus.SYNC_DOWNLOAD_SCAN_ORDER);
if (lastUpdateTime != null)
spsSyncDataRequest.setLastUpdateTime(DateUtil.formatDateTime(lastUpdateTime));
BaseResponse<SpsSyncOrderResponse> baseResponse = findOrder(spsSyncDataRequest);
SpsSyncOrderResponse syncOrderResponse = baseResponse.getData();
log.info("no4:" + syncOrderResponse);
// 2.查看是否有需要更新的数据
if (CollUtil.isNotEmpty(syncOrderResponse.getOrderEntities())) {
log.info("no5:" + syncOrderResponse.getOrderEntities().size());
// 3.插入到任务表,等待获取
BasicExportStatusEntity orderStatusEntity = new BasicExportStatusEntity();
orderStatusEntity.setId(CustomUtil.getId());
@ -116,7 +118,7 @@ public class SpsSyncDownloadService {
orderStatusEntity.setType(NEW_ALL_ORDER);
orderStatusEntity.setUpdateTime(new Date());
orderStatusEntity.setStatus(BasicExportStatusEnum.WAIT_SYNC.getCode());
orderStatusEntity.setStartTime(new Date());
orderStatusEntity.setStartTime(curTime);
orderStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
if (lastUpdateTime != null) {
@ -127,6 +129,7 @@ public class SpsSyncDownloadService {
orderStatusEntity.setRemark(baseResponse.getData().getSyncRemark());
} catch (IOException e) {
e.printStackTrace();
log.error("no6:" + ExceptionUtils.getStackTrace(e));
}
}
basicExportService.insertExportStatus(orderStatusEntity);
@ -931,6 +934,7 @@ public class SpsSyncDownloadService {
syncOrderResponse.setOrderDetailCodeEntities(orderDetailCodeEntities);
syncOrderResponse.setOrderDetailResultEntities(orderDetailResultEntities);
syncOrderResponse.setOrderInvoiceEntities(orderInvoiceEntities);
log.info("no3:" + logs);
return ResultVOUtils.success(syncOrderResponse);
}

@ -16,7 +16,7 @@ import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class BasicExportServiceImpl extends ServiceImpl<BasicExportDao,BasicExportStatusEntity> implements BasicExportService {
public class BasicExportServiceImpl extends ServiceImpl<BasicExportDao, BasicExportStatusEntity> implements BasicExportService {
@Resource
BasicExportDao basicExportDao;
@ -67,6 +67,6 @@ public class BasicExportServiceImpl extends ServiceImpl<BasicExportDao,BasicExpo
@Override
public BasicExportStatusEntity findLast(String idDatas) {
return null;
return basicExportDao.findLast(idDatas);
}
}

Loading…
Cancel
Save