| | |
| | | package com.fzzy.igds.utils; |
| | | |
| | | import com.fzzy.igds.camera.data.ydqly.YdQlyNode; |
| | | import com.ruoyi.common.config.FrameworkConfig; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.ShiroUtils; |
| | |
| | | */ |
| | | public static Map<String, String> contextSnCompanyIdMap = new HashMap<>(); |
| | | |
| | | /** |
| | | * 流媒体节点使用 |
| | | */ |
| | | public static List<YdQlyNode> nodeList = null; |
| | | |
| | | /** |
| | | * 生成顺序ID:年月日时分秒毫秒(17位) + 序列号(4位) = 21位 |
| | |
| | | } |
| | | } |
| | | |
| | | if (null == prefix) return String.format("%s%04d", currentTimestamp, seq); |
| | | return prefix + "_" + String.format("%s%04d", currentTimestamp, seq); |
| | | if (null == prefix) return String.format("%s%02d", currentTimestamp, seq); |
| | | return prefix + "_" + String.format("%s%02d", currentTimestamp, seq); |
| | | } |
| | | |
| | | |
| | |
| | | public static String getCompanyIdBySn(String sn) { |
| | | return contextSnCompanyIdMap.get(sn); |
| | | } |
| | | |
| | | public static String getTimeId() { |
| | | return DateFormatUtils.format(new Date(), "yyyyMMddHHmmss"); |
| | | } |
| | | |
| | | public static String getTimeId(int start, int end) { |
| | | return DateFormatUtils.format(new Date(), "yyyyMMddHHmmss") + RandomUtils.nextInt(start, end); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 如果用户是库区用户,判断是否数据公司级别 |
| | | * |
| | | * @param userDeptId 当前用户部门ID |
| | | * @return 如果部门ID大于长度7说明是库区,否则就是公司级别 |
| | | */ |
| | | public static boolean isDepotUser(String userDeptId) { |
| | | if(StringUtils.isBlank(userDeptId)) return false; |
| | | return userDeptId.length() > 7; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | for (int i = 0; i < 10; i++){ |
| | | String id = generateId(); |
| | | System.out.println(id); |
| | | } |
| | | } |
| | | } |