| | |
| | | package com.zy.crm.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.Cools; |
| | | import com.zy.crm.manager.mapper.CstmrMapper; |
| | | import com.zy.crm.manager.entity.Cstmr; |
| | | import com.zy.crm.manager.service.CstmrService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getNextUuid(Long hostId) { |
| | | public synchronized String getUuid(Long hostId) { |
| | | String uuid = null; |
| | | int times = 0; |
| | | while (Cools.isEmpty(uuid)) { |
| | | if (times > 100) { break; } |
| | | String nextUuid = getNextUuid(hostId); |
| | | if (selectByUuid(hostId, nextUuid) == null) { |
| | | uuid = nextUuid; |
| | | } |
| | | times ++; |
| | | } |
| | | return uuid; |
| | | } |
| | | |
| | | private String getNextUuid(Long hostId) { |
| | | Cstmr cstmr = this.baseMapper.selectCstmrByNewestUuid(hostId); |
| | | if (cstmr == null) { |
| | | return "0001"; |