dashan
1 year ago
commit
35bfc13eb2
34 changed files with 1247 additions and 0 deletions
@ -0,0 +1,98 @@
@@ -0,0 +1,98 @@
|
||||
# ---> Java |
||||
# Compiled class file |
||||
*.class |
||||
# Log file |
||||
*.log |
||||
# BlueJ files |
||||
*.ctxt |
||||
# Mobile Tools for Java (J2ME) |
||||
.mtj.tmp/ |
||||
# Package Files # |
||||
*.jar |
||||
*.war |
||||
*.nar |
||||
*.ear |
||||
*.zip |
||||
*.tar.gz |
||||
*.rar |
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml |
||||
hs_err_pid* |
||||
replay_pid* |
||||
# ---> Maven |
||||
target/ |
||||
pom.xml.tag |
||||
pom.xml.releaseBackup |
||||
pom.xml.versionsBackup |
||||
pom.xml.next |
||||
release.properties |
||||
dependency-reduced-pom.xml |
||||
buildNumber.properties |
||||
.mvn/timing.properties |
||||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar |
||||
.mvn/wrapper/maven-wrapper.jar |
||||
# Eclipse m2e generated files |
||||
# Eclipse Core |
||||
.project |
||||
# JDT-specific (Eclipse Java Development Tools) |
||||
.classpath |
||||
# ---> JetBrains |
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider |
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 |
||||
# User-specific stuff |
||||
.idea/**/workspace.xml |
||||
.idea/**/tasks.xml |
||||
.idea/**/usage.statistics.xml |
||||
.idea/**/dictionaries |
||||
.idea/**/shelf |
||||
# AWS User-specific |
||||
.idea/**/aws.xml |
||||
# Generated files |
||||
.idea/**/contentModel.xml |
||||
# Sensitive or high-churn files |
||||
.idea/**/dataSources/ |
||||
.idea/**/dataSources.ids |
||||
.idea/**/dataSources.local.xml |
||||
.idea/**/sqlDataSources.xml |
||||
.idea/**/dynamic.xml |
||||
.idea/**/uiDesigner.xml |
||||
.idea/**/dbnavigator.xml |
||||
# Gradle |
||||
.idea/**/gradle.xml |
||||
.idea/**/libraries |
||||
# Gradle and Maven with auto-import |
||||
# When using Gradle or Maven with auto-import, you should exclude module files, |
||||
# since they will be recreated, and may cause churn. Uncomment if using |
||||
# auto-import. |
||||
# .idea/artifacts |
||||
# .idea/compiler.xml |
||||
# .idea/jarRepositories.xml |
||||
# .idea/modules.xml |
||||
# .idea/*.iml |
||||
# .idea/modules |
||||
# *.iml |
||||
# *.ipr |
||||
# CMake |
||||
cmake-build-*/ |
||||
# Mongo Explorer plugin |
||||
.idea/**/mongoSettings.xml |
||||
# File-based project format |
||||
*.iws |
||||
# IntelliJ |
||||
out/ |
||||
# mpeltonen/sbt-idea plugin |
||||
.idea_modules/ |
||||
# JIRA plugin |
||||
atlassian-ide-plugin.xml |
||||
# Cursive Clojure plugin |
||||
.idea/replstate.xml |
||||
# SonarLint plugin |
||||
.idea/sonarlint/ |
||||
# Crashlytics plugin (for Android Studio and IntelliJ) |
||||
com_crashlytics_export_strings.xml |
||||
crashlytics.properties |
||||
crashlytics-build.properties |
||||
fabric.properties |
||||
# Editor-based Rest Client |
||||
.idea/httpRequests |
||||
# Android studio 3.1+ serialized cache file |
||||
.idea/caches/build_file_checksums.ser |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="CompilerConfiguration"> |
||||
<annotationProcessing> |
||||
<profile default="true" name="Default" enabled="true" /> |
||||
<profile name="Maven default annotation processors profile" enabled="true"> |
||||
<sourceOutputDir name="target/generated-sources/annotations" /> |
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> |
||||
<outputRelativeToContentRoot value="true" /> |
||||
<module name="ds-utils" /> |
||||
<module name="ds-miniapps-api" /> |
||||
<module name="ds-basemodel" /> |
||||
<module name="ds-miniapps-model" /> |
||||
<module name="ds-miniapps-biz" /> |
||||
<module name="ds-gateway" /> |
||||
<module name="ds-timer-task" /> |
||||
</profile> |
||||
</annotationProcessing> |
||||
</component> |
||||
<component name="JavacSettings"> |
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE"> |
||||
<module name="dashan-cloud" options="" /> |
||||
<module name="ds-basemodel" options="-parameters" /> |
||||
<module name="ds-biz" options="" /> |
||||
<module name="ds-commons" options="" /> |
||||
<module name="ds-gateway" options="-parameters" /> |
||||
<module name="ds-miniapps" options="" /> |
||||
<module name="ds-miniapps-api" options="-parameters" /> |
||||
<module name="ds-miniapps-biz" options="-parameters" /> |
||||
<module name="ds-miniapps-model" options="-parameters" /> |
||||
<module name="ds-timer-task" options="-parameters" /> |
||||
<module name="ds-utils" options="-parameters" /> |
||||
</option> |
||||
</component> |
||||
</project> |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="Encoding"> |
||||
<file url="file://$PROJECT_DIR$/ds-biz/ds-miniapps/ds-miniapps-api/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-biz/ds-miniapps/ds-miniapps-biz/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-biz/ds-miniapps/ds-miniapps-model/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-biz/ds-miniapps/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-biz/ds-miniapps/src/main/resources" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-biz/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-biz/src/main/resources" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-commons/ds-basemodel/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-commons/ds-utils/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-commons/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-commons/src/main/resources" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-gateway/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-gateway/src/main/resources" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/ds-timer-task/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> |
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> |
||||
</component> |
||||
</project> |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="RemoteRepositoriesConfiguration"> |
||||
<remote-repository> |
||||
<option name="id" value="central" /> |
||||
<option name="name" value="Central Repository" /> |
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="central" /> |
||||
<option name="name" value="Central Repository" /> |
||||
<option name="url" value="https://repo.maven.apache.org/maven2" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="spring-milestones" /> |
||||
<option name="name" value="Spring Milestones" /> |
||||
<option name="url" value="https://repo.spring.io/milestone" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="sonatype-repos-s" /> |
||||
<option name="name" value="Sonatype Repository" /> |
||||
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="central" /> |
||||
<option name="name" value="Maven Central repository" /> |
||||
<option name="url" value="https://repo1.maven.org/maven2" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="spring-snapshots" /> |
||||
<option name="name" value="Spring Snapshots" /> |
||||
<option name="url" value="https://repo.spring.io/snapshot" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="central" /> |
||||
<option name="name" value="Central Repository" /> |
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="jboss.community" /> |
||||
<option name="name" value="JBoss Community repository" /> |
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="central" /> |
||||
<option name="name" value="Central Repository" /> |
||||
<option name="url" value="https://maven.aliyun.com/repository/public" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="aliyun-repos" /> |
||||
<option name="name" value="Aliyun Repository" /> |
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="central" /> |
||||
<option name="name" value="Central Repository" /> |
||||
<option name="url" value="https://maven.aliyun.com/repository/central" /> |
||||
</remote-repository> |
||||
<remote-repository> |
||||
<option name="id" value="sonatype-repos" /> |
||||
<option name="name" value="Sonatype Repository" /> |
||||
<option name="url" value="https://oss.sonatype.org/content/groups/public" /> |
||||
</remote-repository> |
||||
</component> |
||||
</project> |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="ExternalStorageConfigurationManager" enabled="true" /> |
||||
<component name="MavenProjectsManager"> |
||||
<option name="originalFiles"> |
||||
<list> |
||||
<option value="$PROJECT_DIR$/pom.xml" /> |
||||
</list> |
||||
</option> |
||||
</component> |
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK" /> |
||||
</project> |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="VcsDirectoryMappings"> |
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" /> |
||||
</component> |
||||
</project> |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-miniapps</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-miniapps-api</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
</project> |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-miniapps</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-miniapps-biz</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-miniapps-model</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-utils</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<scope>test</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-miniapps-model</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-utils</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<scope>compile</scope> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
</project> |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.ds.miniapps.biz; |
||||
|
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
@SpringBootApplication |
||||
public class MiniAppsApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
SpringApplication.run(MiniAppsApplication.class, args); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
package com.ds.miniapps.biz.service.dummyinfo; |
||||
|
||||
import com.ds.miniapps.model.entity.dummyinfo.DummyInfo; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
public interface DummyInfoService { |
||||
/** |
||||
* 随机创建假人信息 |
||||
* @param num 数量 |
||||
* @return 假人集合 |
||||
*/ |
||||
List<DummyInfo> randCreateDummyInfo(@NotNull(message = "数量不能为空")Integer num); |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
package com.ds.miniapps.biz.service.impl.dummyinfo; |
||||
|
||||
import com.ds.commons.utils.stringutil.RandInitNameUtils; |
||||
import com.ds.commons.utils.stringutil.RandInitPhoneNumbersUtils; |
||||
import com.ds.miniapps.biz.service.dummyinfo.DummyInfoService; |
||||
import com.ds.miniapps.model.entity.dummyinfo.DummyInfo; |
||||
import com.ds.miniapps.model.enums.dummyinfo.TelecomOperatorsEnum; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.Random; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
@Service |
||||
public class DummyInfoServiceImpl implements DummyInfoService { |
||||
@Override |
||||
public List<DummyInfo> randCreateDummyInfo(@NotNull(message = "数量不能为空") Integer num) { |
||||
if (num>1000){ |
||||
num=1000; |
||||
} |
||||
Random random = new Random(); |
||||
List<DummyInfo> dummyInfos = new ArrayList<>(num*2); |
||||
for (Integer i = 0; i < num; i++) { |
||||
DummyInfo dummyInfo = new DummyInfo(); |
||||
|
||||
// 随机运营商识别码
|
||||
int code = random.nextInt(3); |
||||
boolean bool = random.nextInt(100)<=90; |
||||
|
||||
dummyInfo.setSex(bool?"男":"女"); |
||||
dummyInfo.setName(RandInitNameUtils.getFamilyName()+RandInitNameUtils.getName(bool)); |
||||
dummyInfo.setPhone(RandInitPhoneNumbersUtils.createPhoneNumber(code)); |
||||
dummyInfo.setTelecomOperator(TelecomOperatorsEnum.getTelecomOperatorByCode(code)); |
||||
dummyInfos.add(dummyInfo); |
||||
} |
||||
return dummyInfos; |
||||
} |
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
package com.ds.miniapps.biz.dummyinfo; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
|
||||
import com.alibaba.excel.EasyExcel; |
||||
import com.ds.miniapps.biz.service.dummyinfo.DummyInfoService; |
||||
import com.ds.miniapps.model.entity.dummyinfo.DummyInfo; |
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
||||
import java.util.List; |
||||
|
||||
@SpringBootTest |
||||
class DummyInfoServiceTest { |
||||
|
||||
@Autowired |
||||
private DummyInfoService dummyInfoService; |
||||
|
||||
@Test |
||||
void randDummyInfo(){ |
||||
List<DummyInfo> dummyInfos = dummyInfoService.randCreateDummyInfo(1000); |
||||
|
||||
// 写法2
|
||||
String fileName = "C:\\Users\\21113\\Desktop\\doc\\simpleWrite" + System.currentTimeMillis() + ".xlsx"; |
||||
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
|
||||
// 如果这里想使用03 则 传入excelType参数即可
|
||||
EasyExcel.write(fileName, DummyInfo.class).sheet("模板").doWrite(dummyInfos); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
package com.ds.miniapps.biz.dummyinfo; |
||||
|
||||
import com.ds.commons.utils.stringutil.RandInitPhoneNumbersUtils; |
||||
import com.ds.miniapps.model.enums.dummyinfo.TelecomOperatorsEnum; |
||||
import org.junit.jupiter.api.Test; |
||||
|
||||
import java.util.Random; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
public class DummyInfoTest { |
||||
|
||||
@Test |
||||
void initDummyInfoTest(){ |
||||
Random random = new Random(); |
||||
for (int i = 1; i <= 10; i++) { |
||||
// 随机运营商识别码
|
||||
int code = random.nextInt(3); |
||||
System.out.println(TelecomOperatorsEnum.getTelecomOperatorNameByCode(code) + ": " + RandInitPhoneNumbersUtils.createPhoneNumber(code)); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-miniapps</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-miniapps-model</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
|
||||
|
||||
</dependencies> |
||||
</project> |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
package com.ds.miniapps.model.entity.dummyinfo; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.ds.miniapps.model.enums.dummyinfo.TelecomOperatorsConvert; |
||||
import com.ds.miniapps.model.enums.dummyinfo.TelecomOperatorsEnum; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
@Data |
||||
@ApiModel("假人信息类") |
||||
public class DummyInfo { |
||||
|
||||
|
||||
@ApiModelProperty("姓名") |
||||
private String name; |
||||
|
||||
@ApiModelProperty("手机号") |
||||
private String phone; |
||||
|
||||
@ApiModelProperty("运营商信息") |
||||
@ExcelProperty(converter = TelecomOperatorsConvert.class) |
||||
private TelecomOperatorsEnum telecomOperator; |
||||
|
||||
@ApiModelProperty("性别") |
||||
private String sex; |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
package com.ds.miniapps.model.enums.dummyinfo; |
||||
|
||||
import com.alibaba.excel.converters.Converter; |
||||
import com.alibaba.excel.converters.WriteConverterContext; |
||||
import com.alibaba.excel.metadata.data.WriteCellData; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
public class TelecomOperatorsConvert implements Converter<TelecomOperatorsEnum> { |
||||
|
||||
|
||||
@Override |
||||
public WriteCellData<?> convertToExcelData(WriteConverterContext<TelecomOperatorsEnum> context) { |
||||
return new WriteCellData<>(context.getValue().getName()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
|
||||
package com.ds.miniapps.model.enums.dummyinfo; |
||||
|
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Getter; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
@Getter |
||||
@AllArgsConstructor |
||||
public enum TelecomOperatorsEnum { |
||||
/** |
||||
* 中国移动 |
||||
*/ |
||||
CHINA_MOBILE(0, "中国移动"), |
||||
/** |
||||
* 中国联通 |
||||
*/ |
||||
CHINA_UNICOM(1, "中国联通"), |
||||
/** |
||||
* 中国电信 |
||||
*/ |
||||
CHINA_TELECOM(2, "中国电信"); |
||||
|
||||
/** |
||||
* 运营商识别码 |
||||
*/ |
||||
private final Integer code; |
||||
|
||||
/** |
||||
* 运营商名称 |
||||
*/ |
||||
private final String name; |
||||
|
||||
/** |
||||
* 通过运营商识别码获取运营商名称 |
||||
* |
||||
* @param code 运营商识别码 |
||||
* @return 运营商名称 |
||||
*/ |
||||
public static String getTelecomOperatorNameByCode(Integer code) { |
||||
// 循环遍历所有枚举
|
||||
for (TelecomOperatorsEnum value : TelecomOperatorsEnum.values()) { |
||||
// 返回当前运营商名称
|
||||
if (value.code.equals(code)) { |
||||
return value.name; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* 通过运营商识别码获取运营商名称 |
||||
* |
||||
* @param code 运营商识别码 |
||||
* @return 运营商名称 |
||||
*/ |
||||
public static TelecomOperatorsEnum getTelecomOperatorByCode(Integer code) { |
||||
// 循环遍历所有枚举
|
||||
for (TelecomOperatorsEnum value : TelecomOperatorsEnum.values()) { |
||||
// 返回当前运营商名称
|
||||
if (value.code.equals(code)) { |
||||
return value; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-biz</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-miniapps</artifactId> |
||||
<packaging>pom</packaging> |
||||
<modules> |
||||
<module>ds-miniapps-api</module> |
||||
<module>ds-miniapps-model</module> |
||||
<module>ds-miniapps-biz</module> |
||||
</modules> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
</project> |
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>dashan-cloud</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-biz</artifactId> |
||||
<packaging>pom</packaging> |
||||
<modules> |
||||
<module>ds-miniapps</module> |
||||
</modules> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.projectlombok</groupId> |
||||
<artifactId>lombok</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-test</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>io.springfox</groupId> |
||||
<artifactId>springfox-boot-starter</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.xiaoymin</groupId> |
||||
<artifactId>knife4j-spring-boot-starter</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.xiaoymin</groupId> |
||||
<artifactId>swagger-bootstrap-ui</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.alibaba</groupId> |
||||
<artifactId>easyexcel</artifactId> |
||||
<version>3.3.2</version> |
||||
</dependency> |
||||
</dependencies> |
||||
</project> |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-commons</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-basemodel</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>com.alibaba</groupId> |
||||
<artifactId>easyexcel</artifactId> |
||||
<version>3.3.2</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
</project> |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>ds-commons</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-utils</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
</project> |
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
package com.ds.commons.utils.stringutil; |
||||
|
||||
import java.util.Random; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
public class RandInitNameUtils { |
||||
static String familyName1 = "赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻水云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁黄吴龚叶戴"; |
||||
static String girlName = "秀娟英华慧巧美娜静淑惠珠翠雅芝玉萍红娥玲芬芳燕彩春菊兰凤洁梅琳素云莲真环雪荣爱妹霞香月莺媛艳瑞凡佳嘉琼勤珍贞莉桂娣叶璧璐娅琦晶妍茜秋珊莎锦黛青倩婷姣婉娴瑾颖露瑶怡婵雁蓓纨仪荷丹蓉眉君琴蕊薇菁梦岚苑婕馨瑗琰韵融园艺咏卿聪澜纯毓悦昭冰爽琬茗羽希宁欣飘育滢馥筠柔竹霭凝晓欢霄枫芸菲寒伊亚宜可姬舒影荔枝思丽"; |
||||
static String boyName = "伟刚勇毅俊峰强军平保东文辉力明永健世广志义兴良海山仁波宁贵福生龙元全国胜学祥才发武新利清飞彬富顺信子杰涛昌成康星光天达安岩中茂进林有坚和彪博诚先敬震振壮会思群豪心邦承乐绍功松善厚庆磊民友裕河哲江超浩亮政谦亨奇固之轮翰朗伯宏言若鸣朋斌梁栋维启克伦翔旭鹏泽晨辰士以建家致树炎德行时泰盛雄琛钧冠策腾楠榕风航弘"; |
||||
|
||||
/** |
||||
* 功能:随机产生姓氏 |
||||
* |
||||
* @return |
||||
*/ |
||||
public static String getFamilyName() { |
||||
int strLen = familyName1.length(); |
||||
int index = new Random().nextInt(strLen); |
||||
|
||||
return String.valueOf(familyName1.charAt(index)); |
||||
} |
||||
|
||||
/** |
||||
* 功能:随机产生性别 |
||||
* |
||||
* @return |
||||
*/ |
||||
public String getSex() { |
||||
int randNum = new Random().nextInt(2) + 1; |
||||
return randNum == 1 ? "男" : "女"; |
||||
} |
||||
|
||||
/** |
||||
* 功能:传入性别参数,依据性别产生名字 |
||||
* |
||||
* @param sex true 男 false女 |
||||
* @return |
||||
*/ |
||||
public static String getName(boolean sex) { |
||||
StringBuilder stringBuilder = new StringBuilder(); |
||||
|
||||
stringBuilder.append(sex?boyName.charAt(new Random().nextInt(boyName.length()-1)):girlName.charAt(new Random().nextInt(girlName.length()-1))); |
||||
|
||||
Random random = new Random(); |
||||
int randNumber = random.nextInt(100); |
||||
if (randNumber<=75){ |
||||
stringBuilder.append(sex?boyName.charAt(new Random().nextInt(boyName.length()-1)):girlName.charAt(new Random().nextInt(girlName.length()-1))); |
||||
} |
||||
|
||||
return stringBuilder.toString(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
package com.ds.commons.utils.stringutil; |
||||
|
||||
import java.util.Random; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/27 |
||||
*/ |
||||
public class RandInitPhoneNumbersUtils { |
||||
/** |
||||
* 中国移动 |
||||
*/ |
||||
private static final String[] CHINA_MOBILE = { |
||||
"134", "135", "136", "137", "138", "139", "150", "151", "152", "157", "158", "159", |
||||
"182", "183", "184", "187", "188", "178", "147", "172", "198" |
||||
}; |
||||
|
||||
/** |
||||
* 中国联通 |
||||
*/ |
||||
private static final String[] CHINA_UNICOM = {"130", "131", "132", "145", "155", "156", "166", "171", "175", "176", "185", "186", "166"}; |
||||
|
||||
/** |
||||
* 中国电信 |
||||
*/ |
||||
private static final String[] CHINA_TELECOM = {"133", "149", "153", "173", "177", "180", "181", "189", "199"}; |
||||
|
||||
/** |
||||
* 生成手机号方法 |
||||
* |
||||
* @param operator 运营商识别码 |
||||
*/ |
||||
public static String createPhoneNumber(int operator) { |
||||
// 定义随机数对象
|
||||
Random random = new Random(); |
||||
// 定义StringBuilder对象用于存储生成的手机号
|
||||
StringBuilder builder = new StringBuilder(); |
||||
// 手机号前三位
|
||||
String mobilePrefix = null; |
||||
// 随机生成指定运营商中的手机前三位
|
||||
mobilePrefix = switch (operator) { |
||||
// 中国移动
|
||||
case 0 -> CHINA_MOBILE[random.nextInt(CHINA_MOBILE.length)]; |
||||
// 中国联通
|
||||
case 1 -> CHINA_UNICOM[random.nextInt(CHINA_UNICOM.length)]; |
||||
// 中国电信
|
||||
case 2 -> CHINA_TELECOM[random.nextInt(CHINA_TELECOM.length)]; |
||||
default -> "运营商错误"; |
||||
}; |
||||
// 拼接手机号前三位
|
||||
builder.append(mobilePrefix); |
||||
// 定义辅助变量用于手机号后八位的生成
|
||||
int temp; |
||||
// 生成手机号后8位
|
||||
for (int i = 0; i < 8; i++) { |
||||
// 随机生成一个 [0, 9] 以内的整数
|
||||
temp = random.nextInt(10); |
||||
// 拼接当前随机数
|
||||
builder.append(temp); |
||||
} |
||||
// 将生成的电话号码返回
|
||||
return builder.toString(); |
||||
} |
||||
} |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>dashan-cloud</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-commons</artifactId> |
||||
<packaging>pom</packaging> |
||||
<modules> |
||||
<module>ds-utils</module> |
||||
<module>ds-basemodel</module> |
||||
</modules> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
</project> |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>dashan-cloud</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-gateway</artifactId> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<!-- <dependency>--> |
||||
<!-- <groupId>org.springframework.cloud</groupId>--> |
||||
<!-- <artifactId>spring-cloud-starter-gateway</artifactId>--> |
||||
<!-- </dependency>--> |
||||
<!--注册中心客户端--> |
||||
<dependency> |
||||
<groupId>com.alibaba.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||
</dependency> |
||||
<!--配置中心客户端--> |
||||
<dependency> |
||||
<groupId>com.alibaba.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
||||
</dependency> |
||||
</dependencies> |
||||
</project> |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
package com.ds.gateway; |
||||
|
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/7 |
||||
*/ |
||||
@SpringBootApplication |
||||
@EnableDiscoveryClient |
||||
public class GateWayApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
SpringApplication.run(GateWayApplication.class, args); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
package com.ds.gateway; |
||||
|
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/8 |
||||
*/ |
||||
@RestController |
||||
public class TestController { |
||||
|
||||
@Value("${testconfig}") |
||||
private String test; |
||||
|
||||
@GetMapping("/test") |
||||
public String test(){ |
||||
return test; |
||||
} |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
server: |
||||
port: 8080 |
||||
spring: |
||||
application: |
||||
name: ds-gateway |
||||
cloud: |
||||
nacos: |
||||
server-addr: @nacosAddress@ |
||||
username: nacos |
||||
password: nacos |
||||
discovery: |
||||
namespace: @nacosNamespace@ |
||||
config: |
||||
file-extension: yml |
||||
namespace: @nacosNamespace@ |
||||
config: |
||||
import: |
||||
- optional:nacos:${spring.application.name}.${spring.cloud.nacos.config.file-extension} |
||||
|
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>dashan-cloud</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
</parent> |
||||
|
||||
<artifactId>ds-timer-task</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.projectlombok</groupId> |
||||
<artifactId>lombok</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.xuxueli</groupId> |
||||
<artifactId>xxl-job-core</artifactId> |
||||
<version>2.4.0</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-web</artifactId> |
||||
</dependency> |
||||
<!--注册中心客户端--> |
||||
<dependency> |
||||
<groupId>com.alibaba.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
||||
</dependency> |
||||
<!--配置中心客户端--> |
||||
<dependency> |
||||
<groupId>com.alibaba.cloud</groupId> |
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
</project> |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
package com.ds.timertask; |
||||
|
||||
import org.springframework.boot.SpringApplication; |
||||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/7 |
||||
*/ |
||||
@SpringBootApplication |
||||
@EnableDiscoveryClient |
||||
public class TimerTaskApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
SpringApplication.run(TimerTaskApplication.class, args); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
package com.ds.timertask.config; |
||||
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; |
||||
import lombok.Data; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.cloud.context.config.annotation.RefreshScope; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/22 |
||||
*/ |
||||
@Configuration |
||||
@Slf4j |
||||
@RefreshScope |
||||
@Data |
||||
public class XxlJobConfig { |
||||
|
||||
@Value("${xxl.job.admin.addresses}") |
||||
private String adminAddresses; |
||||
|
||||
@Value("${xxl.job.accessToken:}") |
||||
private String accessToken; |
||||
|
||||
@Value("${xxl.job.executor.appname:}") |
||||
private String appname; |
||||
|
||||
@Value("${xxl.job.executor.address:}") |
||||
private String address; |
||||
|
||||
@Value("${xxl.job.executor.ip:}") |
||||
private String ip; |
||||
|
||||
@Value("${xxl.job.executor.port:9999}") |
||||
private int port; |
||||
|
||||
@Value("${xxl.job.executor.logpath:}") |
||||
private String logPath; |
||||
|
||||
@Value("${xxl.job.executor.logretentiondays:30}") |
||||
private int logRetentionDays; |
||||
|
||||
|
||||
|
||||
@Bean |
||||
public XxlJobSpringExecutor xxlJobExecutor() { |
||||
log.info(">>>>>>>>>>> xxl-job config init."); |
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); |
||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses); |
||||
xxlJobSpringExecutor.setAppname(appname); |
||||
xxlJobSpringExecutor.setAddress(address); |
||||
xxlJobSpringExecutor.setIp(ip); |
||||
xxlJobSpringExecutor.setPort(port); |
||||
xxlJobSpringExecutor.setAccessToken(accessToken); |
||||
xxlJobSpringExecutor.setLogPath(logPath); |
||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays); |
||||
return xxlJobSpringExecutor; |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
package com.ds.timertask.jobhandler; |
||||
|
||||
import com.xxl.job.core.context.XxlJobHelper; |
||||
import com.xxl.job.core.handler.annotation.XxlJob; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
/** |
||||
* @author ds |
||||
* @since 2023/8/23 |
||||
*/ |
||||
@Component |
||||
@Slf4j |
||||
public class DemoJobHandler { |
||||
@XxlJob("demoJobHandler") |
||||
public void demoJobHandler() { |
||||
log.info("XXL-JOB DEMO RUNNING"); |
||||
XxlJobHelper.log("XXL-JOB, Hello World."); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
server: |
||||
port: 15001 |
||||
spring: |
||||
application: |
||||
name: ds-timer-task |
||||
cloud: |
||||
nacos: |
||||
server-addr: @nacosAddress@ |
||||
username: nacos |
||||
password: nacos |
||||
discovery: |
||||
namespace: @nacosNamespace@ |
||||
config: |
||||
file-extension: yml |
||||
namespace: @nacosNamespace@ |
||||
config: |
||||
import: |
||||
- optional:nacos:${spring.application.name}.${spring.cloud.nacos.config.file-extension} |
||||
|
@ -0,0 +1,129 @@
@@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-starter-parent</artifactId> |
||||
<version>3.1.0</version> |
||||
</parent> |
||||
<groupId>com.ds</groupId> |
||||
<artifactId>dashan-cloud</artifactId> |
||||
<version>0.0.1-SNAPSHOT</version> |
||||
<packaging>pom</packaging> |
||||
<name>dashan-cloud</name> |
||||
<description>dashan-cloud</description> |
||||
<modules> |
||||
<module>ds-gateway</module> |
||||
<module>ds-timer-task</module> |
||||
<module>ds-commons</module> |
||||
<module>ds-biz</module> |
||||
</modules> |
||||
<properties> |
||||
<java.version>17</java.version> |
||||
<maven.compiler.source>17</maven.compiler.source> |
||||
<maven.compiler.target>17</maven.compiler.target> |
||||
<spring.boot.version>3.1.0</spring.boot.version> |
||||
<spring.cloud.version>2022.0.2</spring.cloud.version> |
||||
<spring.cloud.alibaba.version>2022.0.0.0-RC2</spring.cloud.alibaba.version> |
||||
<knife4j.version>3.0.3</knife4j.version> |
||||
<swagger-bootstrap-ui.version>1.8.5</swagger-bootstrap-ui.version> |
||||
<springfox.version>3.0.0</springfox.version> |
||||
</properties> |
||||
|
||||
<dependencyManagement> |
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-dependencies</artifactId> |
||||
<version>${spring.boot.version}</version> |
||||
<type>pom</type> |
||||
<scope>import</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springframework.cloud</groupId> |
||||
<artifactId>spring-cloud-dependencies</artifactId> |
||||
<version>${spring.cloud.version}</version> |
||||
<type>pom</type> |
||||
<scope>import</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.alibaba.cloud</groupId> |
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId> |
||||
<version>${spring.cloud.alibaba.version}</version> |
||||
<type>pom</type> |
||||
<scope>import</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>io.springfox</groupId> |
||||
<artifactId>springfox-boot-starter</artifactId> |
||||
<version>${springfox.version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.xiaoymin</groupId> |
||||
<artifactId>knife4j-spring-boot-starter</artifactId> |
||||
<version>${knife4j.version}</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.github.xiaoymin</groupId> |
||||
<artifactId>swagger-bootstrap-ui</artifactId> |
||||
<version>${swagger-bootstrap-ui.version}</version> |
||||
</dependency> |
||||
</dependencies> |
||||
</dependencyManagement> |
||||
|
||||
<build> |
||||
<resources> |
||||
<resource> |
||||
<directory>src/main/resources</directory> |
||||
<filtering>true</filtering> |
||||
</resource> |
||||
</resources> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>org.springframework.boot</groupId> |
||||
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
|
||||
<!--配置测试开发生产环境--> |
||||
<profiles> |
||||
<profile> |
||||
<!--开发环境--> |
||||
<id>dev</id> |
||||
<!-- 加了这个,默认选中 --> |
||||
<activation> |
||||
<activeByDefault>true</activeByDefault> |
||||
</activation> |
||||
<properties> |
||||
<activatedProperties>dev</activatedProperties> |
||||
<!-- dev对应的命名空间id 默认public 为空 --> |
||||
<nacosNamespace></nacosNamespace> |
||||
<nacosAddress>http://server:8848</nacosAddress> |
||||
</properties> |
||||
</profile> |
||||
<profile> |
||||
<!--测试环境--> |
||||
<id>test</id> |
||||
<properties> |
||||
<activatedProperties>test</activatedProperties> |
||||
<!-- test对应的命名空间id --> |
||||
<nacosNamespace>ca82f95e-8b1b-4c59-b12e-035444e8c454</nacosNamespace> |
||||
<!-- test环境对应的nacos地址 --> |
||||
<nacosAddress>http://server:8848</nacosAddress> |
||||
</properties> |
||||
</profile> |
||||
<!--生产环境--> |
||||
<profile> |
||||
<id>prod</id> |
||||
<properties> |
||||
<activatedProperties>prod</activatedProperties> |
||||
<!-- prod对应的命名空间id --> |
||||
<nacosNamespace>7c2f9c5d-88e9-449d-a78e-bcea0e7ada59</nacosNamespace> |
||||
<nacosAddress>http://server:8848</nacosAddress> |
||||
</properties> |
||||
</profile> |
||||
</profiles> |
||||
</project> |
Loading…
Reference in new issue