|
|
@@ -294,20 +294,20 @@ public class SubsidyModeAutoServiceImpl implements ISubsidyModeAutoService {
|
|
|
if(currentMode==null)
|
|
|
{
|
|
|
log.info("当前模式不存在,商户ID:{}", businessId);
|
|
|
- throw new ServiceException(SubsidyModeAutoExceptionEnum.CURRENT_MODE_IS_NOT_EXISTS);
|
|
|
+ return ;
|
|
|
}
|
|
|
//目标模式
|
|
|
SubsidyMode targetMode = this.subsidyModeService.loadById(subsidyModeAuto.getTargetModeId(), false);
|
|
|
if(targetMode==null)
|
|
|
{
|
|
|
log.info("目标模式不存在,商户ID:{}, 目标模式ID:{}", businessId, subsidyModeAuto.getTargetModeId());
|
|
|
- throw new ServiceException(SubsidyModeAutoExceptionEnum.TARGET_MODE_IS_NOT_EXISTS);
|
|
|
+ return ;
|
|
|
}
|
|
|
|
|
|
if(currentMode.getModeId().equals(targetMode.getModeId()))
|
|
|
{
|
|
|
log.info( "当前模式与目标模式一致,商户ID:{}", businessId);
|
|
|
- throw new ServiceException(SubsidyModeAutoExceptionEnum.CURRENT_MODE_IS_TARGET_MODE);
|
|
|
+ return ;
|
|
|
}
|
|
|
|
|
|
if(currentMode.getSharedMode() && !currentMode.getImmediateArrival())
|
|
|
@@ -316,12 +316,12 @@ public class SubsidyModeAutoServiceImpl implements ISubsidyModeAutoService {
|
|
|
if(subsidySharedPool==null)
|
|
|
{
|
|
|
log.info("均摊池不存在,商户ID:{}", businessId);
|
|
|
- throw new ServiceException(SubsidySharedPoolExceptionEnum.SubsidySharedPool_IS_NOT_EXISTS);
|
|
|
+ return ;
|
|
|
}
|
|
|
if(!currentMode.getModeId().equals(subsidySharedPool.getSubsidyModeId()))
|
|
|
{
|
|
|
log.info("当前模式与均摊池内的模式不一致,当前模式是:{},均摊池内的模式是:{}", currentMode.getModeId(), subsidySharedPool.getSubsidyModeId());
|
|
|
- throw new ServiceException(SubsidyModeAutoExceptionEnum.CURRENT_MODE_IS_NOT_SHARED_MODE);
|
|
|
+ return ;
|
|
|
}
|
|
|
|
|
|
if(subsidySharedPool.getSettlemented())
|
|
|
@@ -351,4 +351,19 @@ public class SubsidyModeAutoServiceImpl implements ISubsidyModeAutoService {
|
|
|
.build());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void switchMode(Long businessId, Long newValidQueueCount) {
|
|
|
+ SubsidyModeAuto subsidyModeAuto = this.loadByBusinessId(businessId);
|
|
|
+ if(subsidyModeAuto==null)
|
|
|
+ {
|
|
|
+ log.info("当前模式不存在,商户ID:{}", businessId);
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotNull(subsidyModeAuto.getMaxQueueCount())&& newValidQueueCount >= subsidyModeAuto.getMaxQueueCount())
|
|
|
+ {
|
|
|
+ log.info("当前模式已满足条件,商户ID:{}", businessId);
|
|
|
+ this.switchMode(subsidyModeAuto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|