package com.zy.crm.manager.service.impl; import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.core.common.Cools; import com.zy.crm.common.entity.UserYear; import com.zy.crm.manager.entity.CompanyMoney; import com.zy.crm.manager.entity.Plan; import com.zy.crm.manager.mapper.PlanMapper; import com.zy.crm.manager.service.PlanService; import io.swagger.models.License; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; @Service("planService") public class PlanServiceImpl extends ServiceImpl implements PlanService { @Override public Plan selectByUuid(Long hostId, String uuid) { return this.baseMapper.selectByUuid(hostId, uuid); } @Override public Integer selectPendingTaskCount(Long director) { return this.baseMapper.selectPendingTaskCount(director); } @Override public 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; } @Override public Page getPage(Page page, Long hostId, String deptId, Long userId, Long director,String condition) { return page.setRecords(baseMapper.listByPage(page, hostId, deptId, userId,director, condition)); } private String getNextUuid(Long hostId) { Plan plan = this.baseMapper.selectPlanByNewestUuid(hostId); if (plan == null) { return "00001"; } return zerofill(String.valueOf(Integer.parseInt(plan.getUuid()) + 1), 5); } public static String zerofill(String msg, Integer count){ if (msg.length() == count){ return msg; } else if (msg.length() > count){ return msg.substring(0, 16); } else { StringBuilder msgBuilder = new StringBuilder(msg); for (int i = 0; i selctPlanListByDirector(Long userId){ return this.baseMapper.selctPlanListByDirector(userId); } @Override public List getApproval(Integer settle, Integer assistantHostSign){ return this.baseMapper.getApproval(settle,assistantHostSign); } @Override public List selectMonth(){ return this.baseMapper.selectMonth(); } @Override public List selectUserYear(Long user){ return this.baseMapper.selectUserYear(user); } }