定时补救阿里单据上传和关联关系
parent
a3d9fd6b4f
commit
ad61d32e30
@ -0,0 +1,13 @@
|
|||||||
|
package com.glxp.api.req.alihealth.local;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AliBillsDisposeReqeust {
|
||||||
|
private List<IoOrderEntity> ioOrderEntityList;
|
||||||
|
private String erpName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.glxp.api.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.glxp.api.dao.collect.IoCollectCodeBackMapper;
|
||||||
|
import com.glxp.api.dao.schedule.ScheduledDao;
|
||||||
|
import com.glxp.api.entity.collect.IoCollectCodeBackup;
|
||||||
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
||||||
|
import com.glxp.api.entity.system.ScheduledEntity;
|
||||||
|
import com.glxp.api.http.sync.SpGetHttpClient;
|
||||||
|
import com.glxp.api.req.alihealth.local.AliBillsDisposeReqeust;
|
||||||
|
import com.glxp.api.req.collect.IoCollectCodeRequest;
|
||||||
|
import com.glxp.api.req.system.ScheduledRequest;
|
||||||
|
|
||||||
|
import com.glxp.api.service.system.SystemParamConfigService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||||
|
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||||
|
import org.springframework.scheduling.support.CronTrigger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import redis.clients.jedis.resps.Tuple;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@EnableScheduling
|
||||||
|
@Slf4j
|
||||||
|
public class AliRelCodeDetailTask implements SchedulingConfigurer {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScheduledDao scheduledDao;
|
||||||
|
@Resource
|
||||||
|
private IoCollectCodeBackMapper ioCollectCodeBackMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SpGetHttpClient spGetHttpClient;
|
||||||
|
@Resource
|
||||||
|
private SystemParamConfigService systemParamConfigService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
||||||
|
scheduledTaskRegistrar.addTriggerTask(() -> process(),
|
||||||
|
triggerContext -> {
|
||||||
|
ScheduledRequest scheduledRequest = new ScheduledRequest();
|
||||||
|
scheduledRequest.setCronName("aliRelCodeDetailTask");
|
||||||
|
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
|
||||||
|
if (scheduledEntity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String cron = scheduledEntity.getCron();
|
||||||
|
if (cron.isEmpty()) {
|
||||||
|
log.error("cron is null");
|
||||||
|
}
|
||||||
|
return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void process() {
|
||||||
|
String paramValue = systemParamConfigService.selectValueByParamKey("aliRelCodeDetail");
|
||||||
|
if (StrUtil.isNotEmpty(paramValue) && paramValue.equals("1")) {
|
||||||
|
List<IoCollectCodeBackup> list = ioCollectCodeBackMapper.filterNotRelCode(new IoCollectCodeRequest());
|
||||||
|
List<IoOrderEntity> ioOrderEntityList = new ArrayList<>();
|
||||||
|
log.error("开始补救上传和拉取关联关系列表==="+list);
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
for (IoCollectCodeBackup ioCollectCodeBackup : list) {
|
||||||
|
IoOrderEntity ioOrderEntity = new IoOrderEntity();
|
||||||
|
ioOrderEntity.setBillNo(ioCollectCodeBackup.getBillNo());
|
||||||
|
ioOrderEntity.setFromCorp(ioCollectCodeBackup.getFromCorp());
|
||||||
|
ioOrderEntity.setAuditTime(ioCollectCodeBackup.getOperTime());
|
||||||
|
ioOrderEntityList.add(ioOrderEntity);
|
||||||
|
}
|
||||||
|
AliBillsDisposeReqeust aliBillsDisposeReqeust = new AliBillsDisposeReqeust();
|
||||||
|
aliBillsDisposeReqeust.setIoOrderEntityList(ioOrderEntityList);
|
||||||
|
spGetHttpClient.aliBillsDispose(aliBillsDisposeReqeust);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue