diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml
index 0f3f510..c8bafe3 100644
--- a/.idea/dataSources.local.xml
+++ b/.idea/dataSources.local.xml
@@ -5,7 +5,6 @@
#@
`
- true
master_key
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 16906c8..77fb2f5 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,26 +4,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
@@ -46,6 +39,9 @@
+
+
+
@@ -58,6 +54,9 @@
+
+
+
{
"customColor": "",
"associatedIndex": 3
@@ -93,7 +92,7 @@
"project.structure.side.proportion": "0.0",
"run.code.analysis.last.selected.profile": "pProject Default",
"run.configurations.included.in.services": "true",
- "settings.editor.selected.configurable": "preferences.pluginManager",
+ "settings.editor.selected.configurable": "preferences.lookFeel",
"spring.configuration.checksum": "a925cb78a857f19db6d9680ed9c97ee6",
"vue.rearranger.settings.migration": "true"
},
@@ -103,6 +102,11 @@
]
}
}]]>
+
+
+
+
+
@@ -224,6 +237,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -263,7 +291,8 @@
-
+
+
diff --git a/etl-cleaning/pom.xml b/etl-cleaning/pom.xml
index 4b4e991..2e5c8f5 100644
--- a/etl-cleaning/pom.xml
+++ b/etl-cleaning/pom.xml
@@ -19,6 +19,16 @@
2.6.13
+
+ com.anji-plus
+ spring-boot-starter-captcha
+ 1.3.0
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
org.springframework
spring-jdbc
diff --git a/etl-cleaning/src/main/java/com/etl/cleaning/config/DatabaseConfig.java b/etl-cleaning/src/main/java/com/etl/cleaning/config/DatabaseConfig.java
index 5424368..741e462 100644
--- a/etl-cleaning/src/main/java/com/etl/cleaning/config/DatabaseConfig.java
+++ b/etl-cleaning/src/main/java/com/etl/cleaning/config/DatabaseConfig.java
@@ -1,6 +1,5 @@
package com.etl.cleaning.config;
-import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
diff --git a/etl-cleaning/src/main/java/com/etl/cleaning/controller/CaptchaController.java b/etl-cleaning/src/main/java/com/etl/cleaning/controller/CaptchaController.java
new file mode 100644
index 0000000..ce6aa32
--- /dev/null
+++ b/etl-cleaning/src/main/java/com/etl/cleaning/controller/CaptchaController.java
@@ -0,0 +1,58 @@
+package com.etl.cleaning.controller;
+
+import com.anji.captcha.model.common.ResponseModel;
+import com.anji.captcha.model.vo.CaptchaVO;
+import com.anji.captcha.service.CaptchaService;
+import com.etl.common.util.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * 获取滑块验证码
+ */
+@RestController
+@RequestMapping("/captcha")
+public class CaptchaController {
+ @Autowired
+ private CaptchaService captchaService;
+
+
+ @PostMapping({"/get"})
+ public ResponseModel get(@RequestBody CaptchaVO data, HttpServletRequest request) {
+ assert request.getRemoteHost() != null;
+
+ data.setBrowserInfo(getRemoteId(request));
+ return this.captchaService.get(data);
+ }
+
+ @PostMapping({"/check"})
+ public ResponseModel check(@RequestBody CaptchaVO data, HttpServletRequest request) {
+ data.setBrowserInfo(getRemoteId(request));
+ return this.captchaService.check(data);
+ }
+
+ public ResponseModel verify(@RequestBody CaptchaVO data, HttpServletRequest request) {
+ return this.captchaService.verification(data);
+ }
+
+ public static final String getRemoteId(HttpServletRequest request) {
+ String xfwd = request.getHeader("X-Forwarded-For");
+ String ip = getRemoteIpFromXfwd(xfwd);
+ String ua = request.getHeader("user-agent");
+ return StringUtils.isNotBlank(ip) ? ip + ua : request.getRemoteAddr() + ua;
+ }
+
+ private static String getRemoteIpFromXfwd(String xfwd) {
+ if (StringUtils.isNotBlank(xfwd)) {
+ String[] ipList = xfwd.split(",");
+ return StringUtils.trim(ipList[0]);
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/etl-cleaning/src/main/java/com/etl/cleaning/controller/UserController.java b/etl-cleaning/src/main/java/com/etl/cleaning/controller/UserController.java
new file mode 100644
index 0000000..99cc6d2
--- /dev/null
+++ b/etl-cleaning/src/main/java/com/etl/cleaning/controller/UserController.java
@@ -0,0 +1,31 @@
+package com.etl.cleaning.controller;
+
+import com.etl.cleaning.domian.request.UserRequest;
+import com.etl.common.result.Result;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 登录测试(滑块验证码)
+ */
+@RestController
+@RequestMapping("/user")
+public class UserController {
+ /**
+ * 登录测试
+ * @param userRequest
+ * @return
+ */
+ @PostMapping("/login")
+ public Result loginUser(@RequestBody UserRequest userRequest){
+ if(!userRequest.getName().equals("admin")){
+ throw new RuntimeException("用户名错误");
+ }
+ if(!userRequest.getPassword().equals("admin")){
+ throw new RuntimeException("密码错误");
+ }
+ return Result.success();
+ }
+}
diff --git a/etl-cleaning/src/main/java/com/etl/cleaning/domian/request/UserRequest.java b/etl-cleaning/src/main/java/com/etl/cleaning/domian/request/UserRequest.java
new file mode 100644
index 0000000..945b389
--- /dev/null
+++ b/etl-cleaning/src/main/java/com/etl/cleaning/domian/request/UserRequest.java
@@ -0,0 +1,13 @@
+package com.etl.cleaning.domian.request;
+
+import lombok.Data;
+
+/**
+ * 登录参数
+ */
+@Data
+public class UserRequest {
+ private String name;
+ private String password;
+}
+
diff --git a/etl-cleaning/src/main/java/com/etl/cleaning/service/PlaceService.java b/etl-cleaning/src/main/java/com/etl/cleaning/service/PlaceService.java
index 561a282..87beb0c 100644
--- a/etl-cleaning/src/main/java/com/etl/cleaning/service/PlaceService.java
+++ b/etl-cleaning/src/main/java/com/etl/cleaning/service/PlaceService.java
@@ -2,8 +2,13 @@ package com.etl.cleaning.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.cleaning.domian.pojo.DataPlace;
+import com.etl.cleaning.domian.request.PlaceRequest;
+
+import java.util.List;
+
/**
* 数据源管理
*/
public interface PlaceService extends IService {
+ List showPlacePage(PlaceRequest placeRequest);
}
diff --git a/etl-cleaning/src/main/java/com/etl/cleaning/serviceimpl/DefaultCaptchaServiceImpl.java b/etl-cleaning/src/main/java/com/etl/cleaning/serviceimpl/DefaultCaptchaServiceImpl.java
new file mode 100644
index 0000000..1271f9f
--- /dev/null
+++ b/etl-cleaning/src/main/java/com/etl/cleaning/serviceimpl/DefaultCaptchaServiceImpl.java
@@ -0,0 +1,87 @@
+package com.etl.cleaning.serviceimpl;
+
+import com.anji.captcha.model.common.RepCodeEnum;
+import com.anji.captcha.model.common.ResponseModel;
+import com.anji.captcha.model.vo.CaptchaVO;
+import com.anji.captcha.service.CaptchaService;
+import com.anji.captcha.service.impl.CaptchaServiceFactory;
+import com.anji.captcha.util.StringUtils;
+import java.util.Iterator;
+import java.util.Properties;
+import com.anji.captcha.service.impl.AbstractCaptchaService;
+
+public class DefaultCaptchaServiceImpl extends AbstractCaptchaService {
+ public DefaultCaptchaServiceImpl() {
+ }
+
+ public String captchaType() {
+ return "default";
+ }
+
+ public void init(Properties config) {
+ Iterator var2 = CaptchaServiceFactory.instances.keySet().iterator();
+
+ while(var2.hasNext()) {
+ String s = (String)var2.next();
+ if (!this.captchaType().equals(s)) {
+ this.getService(s).init(config);
+ }
+ }
+
+ }
+
+ public void destroy(Properties config) {
+ Iterator var2 = CaptchaServiceFactory.instances.keySet().iterator();
+
+ while(var2.hasNext()) {
+ String s = (String)var2.next();
+ if (!this.captchaType().equals(s)) {
+ this.getService(s).destroy(config);
+ }
+ }
+
+ }
+
+ private CaptchaService getService(String captchaType) {
+ return (CaptchaService)CaptchaServiceFactory.instances.get(captchaType);
+ }
+
+ public ResponseModel get(CaptchaVO captchaVO) {
+ if (captchaVO == null) {
+ return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"captchaVO"});
+ } else {
+ return StringUtils.isEmpty(captchaVO.getCaptchaType()) ? RepCodeEnum.NULL_ERROR.parseError(new Object[]{"类型"}) : this.getService(captchaVO.getCaptchaType()).get(captchaVO);
+ }
+ }
+
+ public ResponseModel check(CaptchaVO captchaVO) {
+ if (captchaVO == null) {
+ return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"captchaVO"});
+ } else if (StringUtils.isEmpty(captchaVO.getCaptchaType())) {
+ return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"类型"});
+ } else {
+ return StringUtils.isEmpty(captchaVO.getToken()) ? RepCodeEnum.NULL_ERROR.parseError(new Object[]{"token"}) : this.getService(captchaVO.getCaptchaType()).check(captchaVO);
+ }
+ }
+
+ public ResponseModel verification(CaptchaVO captchaVO) {
+ if (captchaVO == null) {
+ return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"captchaVO"});
+ } else if (StringUtils.isEmpty(captchaVO.getCaptchaVerification())) {
+ return RepCodeEnum.NULL_ERROR.parseError(new Object[]{"二次校验参数"});
+ } else {
+ try {
+ String codeKey = String.format(REDIS_SECOND_CAPTCHA_KEY, captchaVO.getCaptchaVerification());
+ if (!CaptchaServiceFactory.getCache(cacheType).exists(codeKey)) {
+ return ResponseModel.errorMsg(RepCodeEnum.API_CAPTCHA_INVALID);
+ }
+ CaptchaServiceFactory.getCache(cacheType).delete(codeKey);
+ } catch (Exception var3) {
+ this.logger.error("验证码坐标解析失败", var3);
+ return ResponseModel.errorMsg(var3.getMessage());
+ }
+ return ResponseModel.success();
+ }
+ }
+
+}
diff --git a/etl-cleaning/src/main/resources/application.properties b/etl-cleaning/src/main/resources/application.properties
index b372ec4..da24829 100644
--- a/etl-cleaning/src/main/resources/application.properties
+++ b/etl-cleaning/src/main/resources/application.properties
@@ -1,2 +1,71 @@
server.port=8080
+# redis
+spring.redis.host=47.101.130.221
+spring.redis.port=6379
+spring.redis.password=123456
+# ????????????????????
+# ?????
+# ??????,?classpath:??,?resource?????,??classpath:images/jigsaw
+aj.captcha.jigsaw=classpath:images/jigsaw/bbb.jpg
+# ????????????????????
+# ?????
+# ??????,?classpath:??,?resource?????,??classpath:images/pic-click
+aj.captcha.pic-click=classpath:images/jigsaw/aaa.jpg
+# ?????????????????????CaptchaCacheService????Redis??memcache?
+# ??CaptchaCacheServiceRedisImpl.java
+# ??????????????redis?????????
+# ??????????????????????????????????????????
+# ??????????????spring-boot-starter-data-redis?
+# ???CaptchaCacheServiceRedisImpl.java???
+# redis -----> SPI??resources????META-INF.services???(??)???????resources?
+# ??local/redis...
+aj.captcha.cache-type=local
+# local?????,??????????
+#aj.captcha.cache-number=1000
+# local????????(???),???0?????
+#aj.captcha.timing-clear=180
+#spring.redis.host=10.108.11.46
+#spring.redis.port=6379
+#spring.redis.password=
+#spring.redis.database=2
+#spring.redis.timeout=6000
+
+# ?????default???????
+aj.captcha.type=default
+# ??????Unicode,??????@value????????????????
+# https://tool.chinaz.com/tools/unicode.aspx ???Unicode
+# ???????(????)
+aj.captcha.water-mark=????????
+# ???????(??????????????)
+# ?????????????jar???????????????
+# ????????OS???????????????
+# ????????????????????resources?fonts??????ttf\ttc\otf??
+# aj.captcha.water-font=WenQuanZhengHei.ttf
+# ????????????(?????)
+# aj.captcha.font-type=WenQuanZhengHei.ttf
+# ?????????????(??5??)
+aj.captcha.slip-offset=5
+# aes??????????(true|false)
+aj.captcha.aes-status=true
+# ?????(0/1/2)
+aj.captcha.interference-options=2
+#?????? ??Font.BOLD
+aj.captcha.font-style=1
+#????????
+aj.captcha.font-size=25
+#??????,???????????
+#aj.captcha.click-word-count=4
+aj.captcha.history-data-clear-enable=false
+# ??????????????? true|false
+aj.captcha.req-frequency-limit-enable=false
+# ????5??get????
+aj.captcha.req-get-lock-limit=5
+# ????????????,s
+aj.captcha.req-get-lock-seconds=360
+# get???????????
+aj.captcha.req-get-minute-limit=30
+# check???????????
+aj.captcha.req-check-minute-limit=30
+# verify???????????(????????????captchaService)
+#aj.captcha.req-verify-minute-limit=30
diff --git a/etl-cleaning/src/main/resources/images/jigsaw/aaa.jpg b/etl-cleaning/src/main/resources/images/jigsaw/aaa.jpg
new file mode 100644
index 0000000..090bc7b
Binary files /dev/null and b/etl-cleaning/src/main/resources/images/jigsaw/aaa.jpg differ
diff --git a/etl-cleaning/src/main/resources/images/jigsaw/bbb.jpg b/etl-cleaning/src/main/resources/images/jigsaw/bbb.jpg
new file mode 100644
index 0000000..26bb900
Binary files /dev/null and b/etl-cleaning/src/main/resources/images/jigsaw/bbb.jpg differ