Esse commit está contido em:
lgh 2022-11-10 10:30:15 +08:00
commit 605cdb5aa0
2 arquivos alterados com 9 adições e 5 exclusões

Ver arquivo

@ -11,10 +11,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* id生成器使用redis自增接口实现
@ -153,6 +151,12 @@ public class IDGenerator {
}
if (!isEmpty(sequenceName)) {
long sequence = gen(sequenceName);
//设置key有效期为当天,次日凌晨失效
Calendar curDate = Calendar.getInstance();
Calendar tomorrowDate = new GregorianCalendar(curDate.get(Calendar.YEAR), curDate.get(Calendar.MONTH), curDate.get(Calendar.DATE) + 1, 0, 0, 0);
int second = (int)(tomorrowDate.getTimeInMillis() - curDate.getTimeInMillis()) / 1000;
idGenerator.redisTemplate.opsForValue().set(KEY_PREFIX_SEQUENCE + sequenceName, sequence, second, TimeUnit.SECONDS);
idGenerator.redisTemplate.opsForValue().getOperations();
if (sequenceLength > 0) {
if (sequenceLength > MAX_SEQUENCE_LENGTH) {
sequenceLength = MAX_SEQUENCE_LENGTH;

Ver arquivo

@ -1222,7 +1222,7 @@ public class AsynRunTaskService extends BaseService {
currTask.setStoveCode(stoveCode);
currTaskServiceBiz.updateById(currTask);
}else {
logger.info(currTask.getId()+"任务为多步骤任务且第一步为清洗,不生产清洗炉炉号.");
logger.info(currTask.getId()+"任务为多步骤任务且第一步为清洗,不生洗炉炉号.");
}
}
/**