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.manager.entity.Order; import com.zy.crm.manager.mapper.OrderMapper; import com.zy.crm.manager.service.OrderService; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @Service("orderService") public class OrderServiceImpl extends ServiceImpl implements OrderService { @Override public Order selectByUuid(Long hostId, String uuid) { return this.baseMapper.selectByUuid(hostId, uuid); } @Override public Page getPage(Page page, Long hostId, String deptId, Long userId, String condition, Integer status) { return page.setRecords(baseMapper.listByPage(page, hostId, deptId, userId, condition, status)); } @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; } private String getNextUuid(Long hostId) { Order order = this.baseMapper.selectOrderByNewestUuid(hostId); if (order == null) { return "00001"; } return zerofill(String.valueOf(Integer.parseInt(order.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 selectTopMoney() { return this.baseMapper.selectTopMoney(); } @Override public List selectCurrentYearMonthSuccess() { ArrayList list = new ArrayList(){{ add(0D);add(0D);add(0D);add(0D); add(0D);add(0D);add(0D);add(0D); add(0D);add(0D);add(0D);add(0D); }}; for (HashMap map : this.baseMapper.selectCurrentYearMonthSuccess()) { list.set(Integer.parseInt(map.get("mon").toString()) - 1, Double.parseDouble(map.get("money").toString())); } return list; } }