|
|
@@ -2,12 +2,10 @@ package jp.yamoto.farm.common.core.service.impl;
|
|
|
|
|
|
import jp.yamoto.farm.common.core.domain.entity.RangedSeq;
|
|
|
import jp.yamoto.farm.common.core.service.IRangedSeqService;
|
|
|
-import jp.yamoto.farm.common.exception.ServiceException;
|
|
|
import jp.yamoto.farm.common.mapper.RangedSeqMapper;
|
|
|
import jp.yamoto.farm.common.utils.StringUtils;
|
|
|
import jp.yamoto.farm.common.utils.ValueUtils;
|
|
|
import jp.yamoto.farm.common.utils.uuid.IdUtils;
|
|
|
-import org.apache.logging.log4j.LogManager;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -19,6 +17,15 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class RangedSeqServiceImpl implements IRangedSeqService {
|
|
|
|
|
|
+ /**
|
|
|
+ * 顧客シリアルキー1
|
|
|
+ */
|
|
|
+ private static final String SERIAL_PREFIX_CUSTOMER = "C";
|
|
|
+ /**
|
|
|
+ * 顧客シリアルキー1
|
|
|
+ */
|
|
|
+ private static final String SERIAL_PREFIX_FARMER = "F";
|
|
|
+
|
|
|
@Autowired
|
|
|
private RangedSeqMapper rangedSeqMapper;
|
|
|
|
|
|
@@ -31,10 +38,14 @@ public class RangedSeqServiceImpl implements IRangedSeqService {
|
|
|
public String generateSerialNo(String serialType) {
|
|
|
Integer seq = 0;
|
|
|
String result = "";
|
|
|
- if(ValueUtils.isEqual(SERIAL_TYPE_CUSTOMER, serialType)) {
|
|
|
+ if( ValueUtils.isEqual(SERIAL_TYPE_CUSTOMER, serialType)) {
|
|
|
seq = this.increaseSequence(SERIAL_PREFIX_CUSTOMER,SERIAL_PREFIX_CUSTOMER,SERIAL_TYPE_CUSTOMER,SERIAL_TYPE_CUSTOMER,null,null);
|
|
|
String serialNo = StringUtils.leftPad(String.valueOf(seq), 5, '0');
|
|
|
result = SERIAL_PREFIX_CUSTOMER + serialNo;
|
|
|
+ } else if( ValueUtils.isEqual(SERIAL_TYPE_FARMER, serialType)) {
|
|
|
+ seq = this.increaseSequence(SERIAL_PREFIX_FARMER,SERIAL_PREFIX_FARMER,SERIAL_TYPE_FARMER,SERIAL_TYPE_FARMER,null,null);
|
|
|
+ String serialNo = StringUtils.leftPad(String.valueOf(seq), 5, '0');
|
|
|
+ result = SERIAL_PREFIX_FARMER + serialNo;
|
|
|
}
|
|
|
|
|
|
return result;
|