|
|
@@ -14,6 +14,7 @@ import com.energy.manage.service.mappers.windfield.WindFieldMapper;
|
|
|
import com.energy.manage.service.mappers.windfieldbatch.WindFieldBatchMapper;
|
|
|
import com.energy.manage.service.service.cache.CacheService;
|
|
|
import com.energy.manage.service.service.windfieldbatch.WindFieldBatchService;
|
|
|
+import com.energy.manage.service.util.PinYinUtils;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -48,6 +49,10 @@ public class WindFieldBatchServiceImpl implements WindFieldBatchService {
|
|
|
*/
|
|
|
@Override
|
|
|
public int addWindFieldBatch(WindFieldBatchDto windEgineBatchDto) {
|
|
|
+ WindFieldBatchVo exsitBatchVo = windFieldBatchMapper.selectByBatchName(windEgineBatchDto.getBatchName());
|
|
|
+ if(exsitBatchVo != null){
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
windEgineBatchDto.setBatchCode(createWindFieldBatchCode(windEgineBatchDto.getFieldCode()));
|
|
|
WindFieldVo windFieldVo = windFieldMapper.selectByCodeNumber(windEgineBatchDto.getFieldCode());
|
|
|
windEgineBatchDto.setFieldName(windFieldVo.getFieldName());
|
|
|
@@ -97,12 +102,23 @@ public class WindFieldBatchServiceImpl implements WindFieldBatchService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 生成批次名称
|
|
|
+ * @param fieldName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String createBatchName(String fieldName){
|
|
|
+ String fieldPYHeader = PinYinUtils.getPinYinHeadChar(fieldName);
|
|
|
+ return fieldPYHeader.concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, fieldPYHeader)),6));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 生成风场批次号
|
|
|
* @param fieldCode
|
|
|
* @return
|
|
|
*/
|
|
|
public String createWindFieldBatchCode(String fieldCode){
|
|
|
- String sequece = IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode()))));
|
|
|
+ String sequece = IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode().concat(IdGeneratorUtil.zeroFillUtil(cacheService.incr(ManagerRedisKeyConstant.build(ManagerRedisKeyConstant.IDGENERATOR_CONSTANTS_KEY, IdPrefixEnum.WIND_FIELD_NUMBER.getCode(),IdPrefixEnum.WIND_ENGINE_BATCH_NUMBER.getCode())),6));
|
|
|
return fieldCode + SEPARATOR + sequece;
|
|
|
}
|
|
|
}
|