Merge remote-tracking branch 'origin/dev_drug' into dev_drug
commit
e59d9fd50e
@ -0,0 +1,12 @@
|
|||||||
|
package com.glxp.api.req.alihealth.local;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.collect.IoCollectCodeBackup;
|
||||||
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@Data
|
||||||
|
public class AliBillsDisposeReqeust {
|
||||||
|
private List<IoOrderEntity> ioOrderEntityList;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.glxp.api.req.alihealth.local;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.collect.IoCollectCodeBackup;
|
||||||
|
import com.glxp.api.req.alihealth.AlihealthYljgUploadinoutbillReqeust;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AlihealthGetRelCodeReqeust {
|
||||||
|
|
||||||
|
private List<IoCollectCodeBackup> ioCollectCodeBackupList;
|
||||||
|
}
|
@ -1,99 +1,99 @@
|
|||||||
package com.glxp.api.task;
|
//package com.glxp.api.task;
|
||||||
|
//
|
||||||
import cn.hutool.core.collection.CollUtil;
|
//import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.glxp.api.common.res.BaseResponse;
|
//import com.glxp.api.common.res.BaseResponse;
|
||||||
import com.glxp.api.dao.schedule.ScheduledDao;
|
//import com.glxp.api.dao.schedule.ScheduledDao;
|
||||||
import com.glxp.api.entity.collect.RelCodeBatch;
|
//import com.glxp.api.entity.collect.RelCodeBatch;
|
||||||
import com.glxp.api.entity.collect.RelCodeDetail;
|
//import com.glxp.api.entity.collect.RelCodeDetail;
|
||||||
import com.glxp.api.entity.system.ScheduledEntity;
|
//import com.glxp.api.entity.system.ScheduledEntity;
|
||||||
import com.glxp.api.req.alihealth.AlihealthYljgSinglerelationReqeust;
|
//import com.glxp.api.req.alihealth.AlihealthYljgSinglerelationReqeust;
|
||||||
import com.glxp.api.req.system.ScheduledRequest;
|
//import com.glxp.api.req.system.ScheduledRequest;
|
||||||
import com.glxp.api.res.alihealth.AlihealthYljgSinglerelationResponse;
|
//import com.glxp.api.res.alihealth.AlihealthYljgSinglerelationResponse;
|
||||||
import com.glxp.api.service.collect.RelCodeBatchService;
|
//import com.glxp.api.service.collect.RelCodeBatchService;
|
||||||
import com.glxp.api.service.collect.RelCodeDetailService;
|
//import com.glxp.api.service.collect.RelCodeDetailService;
|
||||||
import com.glxp.api.util.CacheUtils;
|
//import com.glxp.api.util.CacheUtils;
|
||||||
import com.glxp.api.util.DateUtil;
|
//import com.glxp.api.util.DateUtil;
|
||||||
import com.glxp.api.util.RedisUtil;
|
//import com.glxp.api.util.RedisUtil;
|
||||||
import com.glxp.api.util.alihealth.AlihealthYljgUtils;
|
//import com.glxp.api.util.alihealth.AlihealthYljgUtils;
|
||||||
import com.glxp.api.util.redis.RedisDelayedQueue;
|
//import com.glxp.api.util.redis.RedisDelayedQueue;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
//import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
//import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
//import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
//import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
//import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||||
import org.springframework.scheduling.support.CronTrigger;
|
//import org.springframework.scheduling.support.CronTrigger;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
import redis.clients.jedis.resps.Tuple;
|
//import redis.clients.jedis.resps.Tuple;
|
||||||
|
//
|
||||||
import javax.annotation.Resource;
|
//import javax.annotation.Resource;
|
||||||
import java.util.*;
|
//import java.util.*;
|
||||||
|
//
|
||||||
@Component
|
//@Component
|
||||||
@EnableScheduling
|
//@EnableScheduling
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class AliRelCodeDetailTask implements SchedulingConfigurer {
|
//public class AliRelCodeDetailTask implements SchedulingConfigurer {
|
||||||
|
//
|
||||||
final Logger logger = LoggerFactory.getLogger(AsyncDiDlTask.class);
|
// final Logger logger = LoggerFactory.getLogger(AsyncDiDlTask.class);
|
||||||
@Resource
|
// @Resource
|
||||||
AsyncCompanyDlHelper udiCompanyTask;
|
// AsyncCompanyDlHelper udiCompanyTask;
|
||||||
@Resource
|
// @Resource
|
||||||
RedisUtil redisUtil;
|
// RedisUtil redisUtil;
|
||||||
|
//
|
||||||
@Resource
|
// @Resource
|
||||||
private ScheduledDao scheduledDao;
|
// private ScheduledDao scheduledDao;
|
||||||
@Resource
|
// @Resource
|
||||||
private RedisDelayedQueue redisDelayedQueue;
|
// private RedisDelayedQueue redisDelayedQueue;
|
||||||
@Resource
|
// @Resource
|
||||||
private AlihealthYljgUtils alihealthYljgUtils;
|
// private AlihealthYljgUtils alihealthYljgUtils;
|
||||||
@Resource
|
// @Resource
|
||||||
private RelCodeBatchService relCodeBatchService;
|
// private RelCodeBatchService relCodeBatchService;
|
||||||
@Resource
|
// @Resource
|
||||||
private RelCodeDetailService relCodeDetailService;
|
// private RelCodeDetailService relCodeDetailService;
|
||||||
|
//
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
// public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
|
||||||
scheduledTaskRegistrar.addTriggerTask(() -> process(),
|
// scheduledTaskRegistrar.addTriggerTask(() -> process(),
|
||||||
triggerContext -> {
|
// triggerContext -> {
|
||||||
ScheduledRequest scheduledRequest = new ScheduledRequest();
|
// ScheduledRequest scheduledRequest = new ScheduledRequest();
|
||||||
scheduledRequest.setCronName("aliRelCodeDetailTask");
|
// scheduledRequest.setCronName("aliRelCodeDetailTask");
|
||||||
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
|
// ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
|
||||||
if (scheduledEntity == null) {
|
// if (scheduledEntity == null) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
String cron = scheduledEntity.getCron();
|
// String cron = scheduledEntity.getCron();
|
||||||
if (cron.isEmpty()) {
|
// if (cron.isEmpty()) {
|
||||||
logger.error("cron is null");
|
// logger.error("cron is null");
|
||||||
}
|
// }
|
||||||
return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
// return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void process() {
|
// private void process() {
|
||||||
|
//
|
||||||
long currentTimestamp = System.currentTimeMillis() / 1000; // 当前时间戳(秒)
|
// long currentTimestamp = System.currentTimeMillis() / 1000; // 当前时间戳(秒)
|
||||||
|
//
|
||||||
// 获取所有超时的任务 (score <= 当前时间戳)
|
// // 获取所有超时的任务 (score <= 当前时间戳)
|
||||||
List<Tuple> tasksToProcess = redisDelayedQueue.getJedis().zrangeByScoreWithScores("rel_code_queue", "-inf", String.valueOf(currentTimestamp));
|
// List<Tuple> tasksToProcess = redisDelayedQueue.getJedis().zrangeByScoreWithScores("rel_code_queue", "-inf", String.valueOf(currentTimestamp));
|
||||||
|
//
|
||||||
Iterator<Tuple> iterator = tasksToProcess.iterator();
|
// Iterator<Tuple> iterator = tasksToProcess.iterator();
|
||||||
while (iterator.hasNext()) {
|
// while (iterator.hasNext()) {
|
||||||
Tuple task = iterator.next();
|
// Tuple task = iterator.next();
|
||||||
String taskId = task.getElement();
|
// String taskId = task.getElement();
|
||||||
String[] codes = taskId.split("&&&");
|
// String[] codes = taskId.split("&&&");
|
||||||
if (codes!=null && codes.length>0) {
|
// if (codes!=null && codes.length>0) {
|
||||||
String code = codes[0];
|
// String code = codes[0];
|
||||||
String erpId = codes[1];
|
// String erpId = codes[1];
|
||||||
log.error("关联关系下载任务ID===" + code);
|
// log.error("关联关系下载任务ID===" + code);
|
||||||
// 处理阿里关联关系
|
// // 处理阿里关联关系
|
||||||
relCodeBatchService.addRelCodeAli(code,erpId);
|
// relCodeBatchService.addRelCodeAli(code,erpId);
|
||||||
}
|
// }
|
||||||
// 从队列中删除已执行的任务
|
// // 从队列中删除已执行的任务
|
||||||
redisDelayedQueue.getJedis().zrem("rel_code_queue", taskId);
|
// redisDelayedQueue.getJedis().zrem("rel_code_queue", taskId);
|
||||||
log.error("关联关系下载删除任务ID " + taskId + " removed from queue.");
|
// log.error("关联关系下载删除任务ID " + taskId + " removed from queue.");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
Loading…
Reference in New Issue