4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.api;
18 |
19 | import java.io.Serializable;
20 |
21 | /**
22 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.api;
18 |
19 | import com.xkcoding.magic.core.tool.enums.SortType;
20 | import io.swagger.annotations.ApiModel;
21 | import io.swagger.annotations.ApiModelProperty;
22 | import lombok.AllArgsConstructor;
23 | import lombok.Data;
24 | import lombok.NoArgsConstructor;
25 |
26 | /**
27 | *
28 | * 通用分页参数封装
29 | *
30 | *
31 | * @author yangkai.shen
32 | * @date Created in 2019/9/19 22:05
33 | */
34 | @Data
35 | @NoArgsConstructor
36 | @AllArgsConstructor
37 | @ApiModel(description = "分页参数")
38 | public class PageQuery {
39 | /**
40 | * 当前页码
41 | */
42 | @ApiModelProperty(value = "当前页码", required = true)
43 | private Integer currentPage;
44 | /**
45 | * 每页条数
46 | */
47 | @ApiModelProperty(value = "每页条数", required = true)
48 | private Integer pageSize;
49 | /**
50 | * 排序字段
51 | */
52 | @ApiModelProperty(value = "排序字段")
53 | private String sortBy;
54 | /**
55 | * 排序方式
56 | *
57 | * @see SortType
58 | */
59 | @ApiModelProperty(value = "排序方式")
60 | private SortType sortType;
61 | }
62 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/java/com/xkcoding/magic/core/tool/autoconfigure/MagicPropertyConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-2028, DreamLu All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * Neither the name of the dreamlu.net developer nor the names of its
13 | * contributors may be used to endorse or promote products derived from
14 | * this software without specific prior written permission.
15 | * Author: DreamLu 卢春梦 (596392912@qq.com)
16 | */
17 |
18 | package com.xkcoding.magic.core.tool.autoconfigure;
19 |
20 | import com.xkcoding.magic.core.tool.props.MagicPropertySourcePostProcessor;
21 | import org.springframework.context.annotation.Bean;
22 | import org.springframework.context.annotation.Configuration;
23 | import org.springframework.core.Ordered;
24 | import org.springframework.core.annotation.Order;
25 |
26 | /**
27 | * blade property config
28 | *
29 | * @author L.cm
30 | */
31 | @Configuration
32 | @Order(Ordered.HIGHEST_PRECEDENCE)
33 | public class MagicPropertyConfiguration {
34 |
35 | @Bean
36 | public MagicPropertySourcePostProcessor magicPropertySourcePostProcessor() {
37 | return new MagicPropertySourcePostProcessor();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/java/com/xkcoding/magic/core/tool/autoconfigure/ToolAutoConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2029, xkcoding & Yangkai.Shen & 沈扬凯 (237497819@qq.com & xkcoding.com).
3 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.autoconfigure;
18 |
19 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
20 | import org.springframework.context.annotation.Configuration;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.autoconfigure;
18 |
19 | import lombok.Data;
20 | import org.springframework.boot.context.properties.ConfigurationProperties;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.constants;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.enums;
18 |
19 | import com.xkcoding.magic.core.tool.api.IResultCode;
20 | import lombok.AllArgsConstructor;
21 | import lombok.Getter;
22 |
23 | import javax.servlet.http.HttpServletResponse;
24 |
25 | /**
26 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.enums;
18 |
19 | import cn.hutool.core.util.StrUtil;
20 | import lombok.AllArgsConstructor;
21 | import lombok.Getter;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.exception;
18 |
19 | import com.xkcoding.magic.core.tool.api.IResultCode;
20 | import com.xkcoding.magic.core.tool.enums.CommonResultCode;
21 | import lombok.Getter;
22 |
23 | /**
24 | *
25 | * 通用业务异常
26 | *
27 | *
28 | * @author yangkai.shen
29 | * @date Created in 2019/9/19 22:21
30 | */
31 | public class ServiceException extends RuntimeException {
32 | private static final long serialVersionUID = 2359767895161832954L;
33 |
34 | @Getter
35 | private final IResultCode resultCode;
36 | @Getter
37 | private final Object data;
38 |
39 | public ServiceException(String message) {
40 | super(message);
41 | this.resultCode = CommonResultCode.INTERNAL_SERVER_ERROR;
42 | data = null;
43 | }
44 |
45 | public ServiceException(IResultCode resultCode) {
46 | super(resultCode.getMessage());
47 | this.resultCode = resultCode;
48 | data = null;
49 | }
50 |
51 | public ServiceException(IResultCode resultCode, Object data) {
52 | super(resultCode.getMessage());
53 | this.resultCode = resultCode;
54 | this.data = data;
55 | }
56 |
57 | public ServiceException(IResultCode resultCode, Throwable cause) {
58 | super(cause);
59 | this.resultCode = resultCode;
60 | data = null;
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/java/com/xkcoding/magic/core/tool/props/MagicPropertySource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-2028, DreamLu All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * Neither the name of the dreamlu.net developer nor the names of its
13 | * contributors may be used to endorse or promote products derived from
14 | * this software without specific prior written permission.
15 | * Author: DreamLu 卢春梦 (596392912@qq.com)
16 | */
17 |
18 | package com.xkcoding.magic.core.tool.props;
19 |
20 | import org.springframework.core.Ordered;
21 |
22 | import java.lang.annotation.*;
23 |
24 | /**
25 | * 自定义资源文件读取,优先级最低
26 | *
27 | * @author L.cm
28 | */
29 | @Target(ElementType.TYPE)
30 | @Retention(RetentionPolicy.RUNTIME)
31 | @Documented
32 | public @interface MagicPropertySource {
33 |
34 | /**
35 | * Indicate the resource location(s) of the properties file to be loaded.
36 | * for example, {@code "classpath:/com/example/app.yml"}
37 | *
38 | * @return location(s)
39 | */
40 | String value();
41 |
42 | /**
43 | * load app-{activeProfile}.yml
44 | *
45 | * @return {boolean}
46 | */
47 | boolean loadActiveProfile() default true;
48 |
49 | /**
50 | * Get the order value of this resource.
51 | *
52 | * @return order
53 | */
54 | int order() default Ordered.LOWEST_PRECEDENCE;
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/java/com/xkcoding/magic/core/tool/spel/ExpressionRootObject.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-2028, DreamLu All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * Neither the name of the dreamlu.net developer nor the names of its
13 | * contributors may be used to endorse or promote products derived from
14 | * this software without specific prior written permission.
15 | * Author: DreamLu 卢春梦 (596392912@qq.com)
16 | */
17 |
18 | package com.xkcoding.magic.core.tool.spel;
19 |
20 | import lombok.AllArgsConstructor;
21 | import lombok.Getter;
22 |
23 | import java.lang.reflect.Method;
24 |
25 | /**
26 | * ExpressionRootObject
27 | *
28 | * @author L.cm
29 | */
30 | @Getter
31 | @AllArgsConstructor
32 | public class ExpressionRootObject {
33 | private final Method method;
34 |
35 | private final Object[] args;
36 |
37 | private final Object target;
38 |
39 | private final Class> targetClass;
40 |
41 | private final Method targetMethod;
42 | }
43 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/java/com/xkcoding/magic/core/tool/support/wrapper/page/mybatisplus/PageResultWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2029, xkcoding & Yangkai.Shen & 沈扬凯 (237497819@qq.com & xkcoding.com).
3 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.support.wrapper.page.mybatisplus;
18 |
19 | import com.baomidou.mybatisplus.core.metadata.IPage;
20 | import com.xkcoding.magic.core.tool.api.PageResult;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.support.wrapper.page.pagehelper;
18 |
19 | import com.github.pagehelper.Page;
20 | import com.xkcoding.magic.core.tool.api.PageResult;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.support.wrapper.vo;
18 |
19 | import com.xkcoding.magic.core.tool.api.PageResult;
20 |
21 | import java.util.List;
22 | import java.util.stream.Collectors;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.util;
18 |
19 | import cn.hutool.core.util.ArrayUtil;
20 | import org.springframework.lang.Nullable;
21 |
22 | /**
23 | *
24 | * 对 hutool CollUtil 的扩展
25 | *
26 | *
27 | * @author yangkai.shen
28 | * @date Created in 2020/1/2 10:49
29 | */
30 | public class CollUtil extends cn.hutool.core.collection.CollUtil {
31 | /**
32 | * 数组中是否包含元素
33 | *
34 | * @param 数组元素类型
35 | * @param array 数组
36 | * @param value 被检查的元素
37 | * @return 是否包含
38 | */
39 | public static boolean contains(@Nullable T[] array, T value) {
40 | return ArrayUtil.isNotEmpty(array) && ArrayUtil.contains(array, value);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/java/com/xkcoding/magic/core/tool/util/UrlUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018-2028, DreamLu All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * Redistributions of source code must retain the above copyright notice,
8 | * this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * Neither the name of the dreamlu.net developer nor the names of its
13 | * contributors may be used to endorse or promote products derived from
14 | * this software without specific prior written permission.
15 | * Author: DreamLu 卢春梦 (596392912@qq.com)
16 | */
17 | package com.xkcoding.magic.core.tool.util;
18 |
19 | import java.net.URI;
20 | import java.net.URISyntaxException;
21 | import java.nio.charset.Charset;
22 |
23 | /**
24 | * url处理工具类
25 | *
26 | * @author L.cm
27 | */
28 | public class UrlUtil extends org.springframework.web.util.UriUtils {
29 |
30 | /**
31 | * url 编码,同js decodeURIComponent
32 | *
33 | * @param source url
34 | * @param charset 字符集
35 | * @return 编码后的url
36 | */
37 | public static String encodeURL(String source, Charset charset) {
38 | return UrlUtil.encode(source, charset.name());
39 | }
40 |
41 | /**
42 | * url 解码
43 | *
44 | * @param source url
45 | * @param charset 字符集
46 | * @return 解码url
47 | */
48 | public static String decodeURL(String source, Charset charset) {
49 | return UrlUtil.decode(source, charset.name());
50 | }
51 |
52 | /**
53 | * 获取url路径
54 | *
55 | * @param uriStr 路径
56 | * @return url路径
57 | */
58 | public static String getPath(String uriStr) {
59 | URI uri;
60 |
61 | try {
62 | uri = new URI(uriStr);
63 | } catch (URISyntaxException var3) {
64 | throw new RuntimeException(var3);
65 | }
66 |
67 | return uri.getPath();
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/java/com/xkcoding/magic/core/tool/yaml/YamlPropertyLoaderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net).
3 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.core.tool.yaml;
18 |
19 | import com.xkcoding.magic.core.tool.util.StrUtil;
20 | import org.springframework.boot.env.OriginTrackedMapPropertySource;
21 | import org.springframework.boot.env.YamlPropertySourceLoader;
22 | import org.springframework.core.env.MapPropertySource;
23 | import org.springframework.core.env.PropertySource;
24 | import org.springframework.core.io.Resource;
25 | import org.springframework.core.io.support.DefaultPropertySourceFactory;
26 | import org.springframework.core.io.support.EncodedResource;
27 | import org.springframework.lang.Nullable;
28 |
29 | import java.io.IOException;
30 | import java.util.Collections;
31 | import java.util.HashMap;
32 | import java.util.List;
33 | import java.util.Map;
34 | import java.util.stream.Stream;
35 |
36 | /**
37 | * Yaml配置文件加载
38 | *
39 | * @author lcm
40 | */
41 | public class YamlPropertyLoaderFactory extends DefaultPropertySourceFactory {
42 |
43 | @Override
44 | public PropertySource> createPropertySource(@Nullable String name, EncodedResource encodedResource) throws IOException {
45 | if (encodedResource == null) {
46 | return emptyPropertySource(name);
47 | }
48 | Resource resource = encodedResource.getResource();
49 | String fileName = resource.getFilename();
50 | List> sources = new YamlPropertySourceLoader().load(fileName, resource);
51 | if (sources.isEmpty()) {
52 | return emptyPropertySource(fileName);
53 | }
54 | // yaml 数据存储,合成一个 PropertySource
55 | Map ymlDataMap = new HashMap<>(32);
56 | for (PropertySource> source : sources) {
57 | ymlDataMap.putAll(((MapPropertySource) source).getSource());
58 | }
59 | return new OriginTrackedMapPropertySource(getSourceName(fileName, name), ymlDataMap);
60 | }
61 |
62 | private static PropertySource> emptyPropertySource(@Nullable String name) {
63 | return new MapPropertySource(getSourceName(name), Collections.emptyMap());
64 | }
65 |
66 | private static String getSourceName(String... names) {
67 | return Stream.of(names).filter(StrUtil::isNotBlank).findFirst().orElse("MagicYamlPropertySource");
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/magic-core-tool/src/main/resources/ip/ip2region.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xkcoding/magic-starter/d7c4529464cec03e876aeef9c14d5f2d9af8c0d2/magic-core-tool/src/main/resources/ip/ip2region.db
--------------------------------------------------------------------------------
/magic-starter-bom/README.md:
--------------------------------------------------------------------------------
1 |
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.autoconfigure;
18 |
19 | import com.xkcoding.magic.id.support.factory.impl.SnowflakeIdFactory;
20 | import com.xkcoding.magic.id.support.id.Id;
21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
22 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
23 | import org.springframework.context.annotation.Bean;
24 | import org.springframework.context.annotation.Configuration;
25 |
26 | /**
27 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.autoconfigure;
18 |
19 | import com.xkcoding.magic.id.autoconfigure.base.BaseIdProperties;
20 | import lombok.Data;
21 | import lombok.EqualsAndHashCode;
22 | import org.springframework.boot.context.properties.ConfigurationProperties;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.autoconfigure;
18 |
19 | import com.xkcoding.magic.id.autoconfigure.base.BaseIdProperties;
20 | import lombok.Data;
21 | import lombok.EqualsAndHashCode;
22 | import org.springframework.boot.context.properties.ConfigurationProperties;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.autoconfigure;
18 |
19 | import com.xkcoding.magic.id.autoconfigure.base.BaseIdProperties;
20 | import lombok.Data;
21 | import lombok.EqualsAndHashCode;
22 | import org.springframework.boot.context.properties.ConfigurationProperties;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.autoconfigure.base;
18 |
19 | import lombok.Data;
20 |
21 | /**
22 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.exception;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.business;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.business.impl;
18 |
19 | import cn.hutool.core.date.DateUtil;
20 | import com.xkcoding.magic.core.tool.util.StrUtil;
21 | import com.xkcoding.magic.id.support.business.BusinessName;
22 | import lombok.AllArgsConstructor;
23 | import lombok.NoArgsConstructor;
24 |
25 | /**
26 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.business.impl;
18 |
19 | import com.xkcoding.magic.id.support.business.BusinessName;
20 | import lombok.AllArgsConstructor;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.factory;
18 |
19 | import com.xkcoding.magic.id.support.id.Id;
20 |
21 | /**
22 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.factory.impl;
18 |
19 | import com.xkcoding.magic.id.support.factory.IdFactory;
20 | import com.xkcoding.magic.id.support.id.Id;
21 | import com.xkcoding.magic.id.support.id.impl.SnowFlakeId;
22 | import com.xkcoding.magic.id.support.prefix.Prefix;
23 | import com.xkcoding.magic.id.support.prefix.impl.DefaultPrefix;
24 |
25 | /**
26 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.id;
18 |
19 | import com.xkcoding.magic.id.exception.IdException;
20 | import com.xkcoding.magic.id.support.business.BusinessName;
21 | import com.xkcoding.magic.id.support.prefix.Prefix;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.id;
18 |
19 | import com.xkcoding.magic.id.support.business.BusinessName;
20 | import com.xkcoding.magic.id.support.prefix.Prefix;
21 | import com.xkcoding.magic.id.support.range.RangeManager;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.prefix;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.prefix.impl;
18 |
19 | import com.xkcoding.magic.core.tool.util.StrUtil;
20 | import com.xkcoding.magic.id.support.prefix.Prefix;
21 | import lombok.AllArgsConstructor;
22 | import lombok.NoArgsConstructor;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.range;
18 |
19 | import com.xkcoding.magic.id.exception.IdException;
20 | import com.xkcoding.magic.id.support.range.model.IdRange;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.id.support.range.model;
18 |
19 | import java.util.concurrent.atomic.AtomicLong;
20 |
21 | /**
22 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.annotation;
18 |
19 | import java.lang.annotation.*;
20 |
21 | /**
22 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.aspect;
18 |
19 | import com.xkcoding.magic.core.tool.constants.MagicConsts;
20 | import com.xkcoding.magic.log.annotation.OperateLog;
21 | import com.xkcoding.magic.log.support.publisher.LogEventPublisher;
22 | import lombok.RequiredArgsConstructor;
23 | import lombok.extern.slf4j.Slf4j;
24 | import org.aspectj.lang.ProceedingJoinPoint;
25 | import org.aspectj.lang.annotation.Around;
26 | import org.aspectj.lang.annotation.Aspect;
27 | import org.springframework.beans.factory.annotation.Autowired;
28 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
29 | import org.springframework.core.annotation.Order;
30 | import org.springframework.stereotype.Component;
31 |
32 | /**
33 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.autoconfigure;
18 |
19 | import com.xkcoding.magic.log.support.LogHandler;
20 | import com.xkcoding.magic.log.support.OperatorService;
21 | import com.xkcoding.magic.log.support.listener.LogEventListener;
22 | import com.xkcoding.magic.log.support.logger.MagicLogger;
23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
25 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
26 | import org.springframework.context.annotation.Bean;
27 | import org.springframework.context.annotation.Configuration;
28 |
29 | /**
30 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.autoconfigure;
18 |
19 | import lombok.Data;
20 | import org.springframework.boot.context.properties.ConfigurationProperties;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.constants;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.enums;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.model;
18 |
19 | import com.xkcoding.magic.log.enums.LogType;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.Setter;
23 | import lombok.ToString;
24 | import org.springframework.boot.logging.LogLevel;
25 |
26 | /**
27 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.model;
18 |
19 | import com.xkcoding.magic.log.enums.LogType;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.Setter;
23 | import lombok.ToString;
24 | import org.springframework.boot.logging.LogLevel;
25 |
26 | /**
27 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.model;
18 |
19 | import com.xkcoding.magic.log.enums.LogType;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.Setter;
23 | import lombok.ToString;
24 | import org.springframework.boot.logging.LogLevel;
25 |
26 | /**
27 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.support;
18 |
19 | import com.xkcoding.magic.log.model.CustomLogModel;
20 | import com.xkcoding.magic.log.model.ErrorLogModel;
21 | import com.xkcoding.magic.log.model.OperateLogModel;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.support;
18 |
19 | import com.xkcoding.magic.log.constants.LogConstants;
20 |
21 | import javax.servlet.http.HttpServletRequest;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.support.event;
18 |
19 | import org.springframework.context.ApplicationEvent;
20 |
21 | import java.util.Map;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.support.event;
18 |
19 | import org.springframework.context.ApplicationEvent;
20 |
21 | import java.util.Map;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.support.event;
18 |
19 | import org.springframework.context.ApplicationEvent;
20 |
21 | import java.util.Map;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.log.support.logger;
18 |
19 | import com.xkcoding.magic.log.support.publisher.LogEventPublisher;
20 | import lombok.extern.slf4j.Slf4j;
21 | import org.springframework.beans.factory.InitializingBean;
22 | import org.springframework.boot.logging.LogLevel;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.autoconfigure;
18 |
19 | import com.xkcoding.magic.core.tool.util.StrUtil;
20 | import com.xkcoding.magic.message.constants.MessageConstants;
21 | import lombok.RequiredArgsConstructor;
22 | import org.springframework.beans.factory.annotation.Qualifier;
23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
24 | import org.springframework.context.ApplicationContext;
25 | import org.springframework.context.annotation.Bean;
26 | import org.springframework.context.annotation.Configuration;
27 | import org.thymeleaf.TemplateEngine;
28 | import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
29 | import org.thymeleaf.spring5.SpringTemplateEngine;
30 | import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
31 | import org.thymeleaf.templatemode.TemplateMode;
32 |
33 | /**
34 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.autoconfigure;
18 |
19 | import com.xkcoding.magic.message.constants.MessageConstants;
20 | import com.xkcoding.magic.message.support.dingtalk.DingTalkMessageSender;
21 | import com.xkcoding.magic.message.support.email.EmailMessageSender;
22 | import com.xkcoding.magic.message.support.sms.SmsMessageSender;
23 | import org.springframework.beans.factory.annotation.Qualifier;
24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
25 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
26 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
27 | import org.springframework.context.annotation.Bean;
28 | import org.springframework.context.annotation.Configuration;
29 | import org.springframework.mail.javamail.JavaMailSender;
30 | import org.thymeleaf.TemplateEngine;
31 |
32 | /**
33 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.autoconfigure;
18 |
19 | import lombok.Data;
20 | import org.springframework.boot.context.properties.ConfigurationProperties;
21 |
22 | import java.util.Map;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.constants;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.enums;
18 |
19 | import lombok.AllArgsConstructor;
20 | import lombok.Getter;
21 |
22 | /**
23 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.enums;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model;
18 |
19 | /**
20 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk;
18 |
19 | import com.xkcoding.magic.message.enums.DingTalkType;
20 | import com.xkcoding.magic.message.model.Message;
21 | import lombok.Data;
22 |
23 | /**
24 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk;
18 |
19 | import com.xkcoding.magic.message.enums.DingTalkType;
20 | import com.xkcoding.magic.message.model.dingtalk.support.actioncard.ActionCardSingle;
21 | import lombok.Data;
22 | import lombok.EqualsAndHashCode;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk;
18 |
19 | import com.xkcoding.magic.message.enums.DingTalkType;
20 | import com.xkcoding.magic.message.model.dingtalk.support.actioncard.ActionCardWhole;
21 | import lombok.Data;
22 | import lombok.EqualsAndHashCode;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk;
18 |
19 | import com.xkcoding.magic.message.enums.DingTalkType;
20 | import com.xkcoding.magic.message.model.dingtalk.support.feedcard.FeedCard;
21 | import lombok.Data;
22 | import lombok.EqualsAndHashCode;
23 |
24 | /**
25 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk;
18 |
19 | import com.xkcoding.magic.message.enums.DingTalkType;
20 | import com.xkcoding.magic.message.model.dingtalk.support.link.Link;
21 | import lombok.Data;
22 | import lombok.EqualsAndHashCode;
23 |
24 | /**
25 | *
26 | * 钉钉 link 类型,参考文档:https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq#a-namebfrzrdalink%E7%B1%BB%E5%9E%8B
27 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk;
18 |
19 | import com.xkcoding.magic.message.enums.DingTalkType;
20 | import com.xkcoding.magic.message.model.dingtalk.support.Attention;
21 | import com.xkcoding.magic.message.model.dingtalk.support.markdown.Markdown;
22 | import lombok.Data;
23 | import lombok.EqualsAndHashCode;
24 |
25 | /**
26 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk;
18 |
19 | import com.xkcoding.magic.message.enums.DingTalkType;
20 | import com.xkcoding.magic.message.model.dingtalk.support.Attention;
21 | import com.xkcoding.magic.message.model.dingtalk.support.text.Text;
22 | import lombok.Data;
23 | import lombok.EqualsAndHashCode;
24 |
25 | /**
26 | *
27 | * 钉钉 text 类型,参考文档:https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq#a-nameg0hcpdatext%E7%B1%BB%E5%9E%8B
28 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk.support;
18 |
19 | import com.google.common.collect.Lists;
20 | import lombok.AllArgsConstructor;
21 | import lombok.Data;
22 | import lombok.NoArgsConstructor;
23 |
24 | import java.util.List;
25 |
26 | @Data
27 | @NoArgsConstructor
28 | @AllArgsConstructor
29 | public class Attention {
30 | /**
31 | * 被@人的手机号(在content里添加@人的手机号)
32 | */
33 | private List atMobiles = Lists.newArrayList();
34 | /**
35 | * 当@所有人时:true,否则为:false
36 | */
37 | private boolean isAtAll;
38 | }
39 |
--------------------------------------------------------------------------------
/magic-starter-message/src/main/java/com/xkcoding/magic/message/model/dingtalk/support/actioncard/ActionCardSingle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2029, xkcoding & Yangkai.Shen & 沈扬凯 (237497819@qq.com & xkcoding.com).
3 | *
4 | * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.gnu.org/licenses/lgpl.html
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.xkcoding.magic.message.model.dingtalk.support.actioncard;
18 |
19 | import com.google.common.collect.Lists;
20 | import lombok.AllArgsConstructor;
21 | import lombok.Data;
22 | import lombok.NoArgsConstructor;
23 |
24 | import java.util.List;
25 |
26 | /**
27 | *