* 最大序號
* @return next seq
*/
private int getDBNextSeq(String seqNode, int interval, int startSeq,
int maxSeq) {
Sequence thisSeq = getSequence(seqNode);
int returnSeq = -1;
try {
if (thisSeq == null || thisSeq.getSeqNode().length() == 0) {
thisSeq = new Sequence();
thisSeq.setSeqNode(seqNode);
thisSeq.setNextSeq(startSeq + 1);
thisSeq.setUpdateTime(CapDate.getCurrentTimestamp());
thisSeq.setRounds(1);
saveSeq(thisSeq, -1);
return startSeq;
} else {
Sequence nextSeq = thisSeq;
returnSeq = thisSeq.getNextSeq();
int next = returnSeq + 1;
if (maxSeq > 0 && (next * interval) >= maxSeq) {
next = startSeq;
nextSeq.setRounds(thisSeq.getRounds() + 1);
}
nextSeq.setNextSeq(next);
nextSeq.setUpdateTime(CapDate.getCurrentTimestamp());
int row = saveSeq(nextSeq, returnSeq);
if (row != 1) {
return getDBNextSeq(seqNode, interval, startSeq, maxSeq);
}
}