|
@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.ruoyi.agent.domain.Agent;
|
|
import com.ruoyi.agent.domain.Agent;
|
|
|
|
|
+import com.ruoyi.agent.domain.vo.AgentConfigVo;
|
|
|
import com.ruoyi.agent.enums.AgentAuditType;
|
|
import com.ruoyi.agent.enums.AgentAuditType;
|
|
|
import com.ruoyi.agent.enums.AgentLevel;
|
|
import com.ruoyi.agent.enums.AgentLevel;
|
|
|
import com.ruoyi.agent.exception.AgentApplyExceptionEnum;
|
|
import com.ruoyi.agent.exception.AgentApplyExceptionEnum;
|
|
|
import com.ruoyi.agent.service.IAgentAccountCodeService;
|
|
import com.ruoyi.agent.service.IAgentAccountCodeService;
|
|
|
|
|
+import com.ruoyi.agent.service.IAgentConfigService;
|
|
|
import com.ruoyi.agent.service.IAgentService;
|
|
import com.ruoyi.agent.service.IAgentService;
|
|
|
import com.ruoyi.common.enums.AuditStatus;
|
|
import com.ruoyi.common.enums.AuditStatus;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
@@ -48,6 +50,7 @@ public class AgentAccountCodeApplyServiceImpl implements IAgentAccountCodeApplyS
|
|
|
|
|
|
|
|
private final AgentAccountCodeApplyMapper baseMapper;
|
|
private final AgentAccountCodeApplyMapper baseMapper;
|
|
|
private final IAgentAccountCodeService agentAccountCodeService;
|
|
private final IAgentAccountCodeService agentAccountCodeService;
|
|
|
|
|
+ private final IAgentConfigService agentConfigService;
|
|
|
@Lazy
|
|
@Lazy
|
|
|
@Resource
|
|
@Resource
|
|
|
private IAgentService agentService;
|
|
private IAgentService agentService;
|
|
@@ -130,6 +133,19 @@ public class AgentAccountCodeApplyServiceImpl implements IAgentAccountCodeApplyS
|
|
|
if(AgentLevel.COUNTY_AGENT.equals(agent.getAgentLevel())){
|
|
if(AgentLevel.COUNTY_AGENT.equals(agent.getAgentLevel())){
|
|
|
bo.setParentAgentId(agent.getParentAgentId());
|
|
bo.setParentAgentId(agent.getParentAgentId());
|
|
|
}
|
|
}
|
|
|
|
|
+ //判断码数量
|
|
|
|
|
+ AgentConfigVo info = agentConfigService.getInfo();
|
|
|
|
|
+ if (ObjectUtil.isNotNull(info)) {
|
|
|
|
|
+ if(AgentLevel.COUNTY_AGENT.equals(agent.getAgentLevel())) {
|
|
|
|
|
+ if (bo.getApplyQuantity() < info.getRegionMinAccountNum()) {
|
|
|
|
|
+ throw new ServiceException(AgentAccountCodeApplyExceptionEnum.AGENT_ACCOUNT_CODE_APPLY_QUANTITY_NOT_ENOUGH);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (bo.getApplyQuantity() < info.getProvinceMinAccountNum()) {
|
|
|
|
|
+ throw new ServiceException(AgentAccountCodeApplyExceptionEnum.AGENT_ACCOUNT_CODE_APPLY_QUANTITY_NOT_ENOUGH);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
AgentAccountCodeApply add = BeanUtil.toBean(bo, AgentAccountCodeApply.class);
|
|
AgentAccountCodeApply add = BeanUtil.toBean(bo, AgentAccountCodeApply.class);
|
|
|
validEntityBeforeSave(add);
|
|
validEntityBeforeSave(add);
|
|
|
add.setAuditStatus(AuditStatus.WAIT_AUDIT);
|
|
add.setAuditStatus(AuditStatus.WAIT_AUDIT);
|