• 积累


    好玩儿的枚举:


    public interface RabbitMQTypeEnums {
    
        String SYSTEM_PREFIX = "tx";
        String SEPARATOR = "_";
        String ROUTING_KEY = "routingKey";
        String QUEUE_NAME = "queueName";
        /**
         * 子系统
         *
         * @return
         */
        String getSubSystem();
    
        /**
         * 业务key
         * @return
         */
        String getBusinessKey();
    
        /**
         * 获取routingkey
         * @return
         */
        default String getRoutingKey() {
            return SYSTEM_PREFIX + SEPARATOR + this.getSubSystem() + SEPARATOR + this.getBusinessKey()+ROUTING_KEY;
        }
        /**
         * 获取队列名字
         * @return
         */
        default String getQueueName() {
            return SYSTEM_PREFIX + SEPARATOR + this.getSubSystem() + SEPARATOR + this.getBusinessKey()+QUEUE_NAME;
        }
        @Getter
        @AllArgsConstructor
        enum COMMON implements RabbitMQTypeEnums {
            /**
             * 短链接 redis key
             */
            FILE_EXPORT_ROUTING_KEY("fileExport", "文件导出");
    
            private String businessKey;
            private String desc;
    
            @Override
            public String getSubSystem() {
                return SubSystemEnum.COMMON.getValue();
            }
        }
    
        @Getter
        enum SubSystemEnum {
    
            USER("user"),
            COURSE("course"),
            COMMON("common"),
            MARKET("market"),
            TASK("task"),
            ;
            private String value;
            SubSystemEnum(String value) {
                this.value = value;
            }
        }
    }

    interface+常量+default方法+enums

     好玩的 假饿汉模式


    @Data
    @Slf4j
    public class OrgPushCallInfoDto {
    
        private String statusStr;
        private String startTime;
        private String connectedTime;
        private String hangUpTime;
        private String duringTime;
        private String customerNumber;
        private String extention;
        private String connectedNumber;
        private String uniqueId;
        private String recordFile;
    
        public static OrgPushCallInfoDto of(HttpServletRequest request) {
            String statusStr = request.getParameter("status");
            String startTime = request.getParameter("call_start");
            String connectedTime = request.getParameter("connected_time");
            String hangUpTime = request.getParameter("hang_up_time");
            String duringTime = request.getParameter("during_time");
            String customerNumber = request.getParameter("customer_number");
            String extention = request.getParameter("extention");
            String connectedNumber = request.getParameter("connected_number");
            String uniqueId = request.getParameter("unique_id");
            String recordFile = request.getParameter("record_file");
    
            OrgPushCallInfoDto dto = new OrgPushCallInfoDto();
            dto.statusStr = statusStr;
            dto.startTime = startTime;
            dto.connectedTime = connectedTime;
            dto.hangUpTime = hangUpTime;
            dto.duringTime = duringTime;
            dto.customerNumber = customerNumber;
            dto.extention = extention;
            dto.connectedNumber = connectedNumber;
            dto.uniqueId = uniqueId;
            dto.recordFile = recordFile;
    
            log.info("receive record info:{}", dto);
            return dto;
        }
    
    }
  • 相关阅读:
    Python之Pyautogui模块20180125《PYTHON快速上手让繁琐的工作自动化》18章
    〈Android 群英传-神兵利器〉第7章一个的寂寞与一群人的狂欢
    一,Android Studio笔记
    一、探索 Android Studio
    微服务之网关:Ocelot+Consul实现动态集群扩展
    MacOS任意降级
    微服务之注册服务与发现:Consul在Windows下安装使用
    .Net Core中使用 AutoMapper
    .Net Core中使用Swagger
    .NetCore中使用EF Core
  • 原文地址:https://www.cnblogs.com/toov5/p/10608869.html
Copyright © 2020-2023  润新知