diff --git a/代码库/mall-admin/.classpath b/代码库/mall-admin/.classpath
new file mode 100644
index 0000000..6d7587a
--- /dev/null
+++ b/代码库/mall-admin/.classpath
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/代码库/mall-admin/.project b/代码库/mall-admin/.project
new file mode 100644
index 0000000..110f5e6
--- /dev/null
+++ b/代码库/mall-admin/.project
@@ -0,0 +1,40 @@
+
+
+ mall-admin
+
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+ org.springframework.ide.eclipse.boot.validation.springbootbuilder
+
+
+
+
+
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+
+
diff --git a/代码库/mall-admin/.settings/org.eclipse.jdt.core.prefs b/代码库/mall-admin/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..714351a
--- /dev/null
+++ b/代码库/mall-admin/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/代码库/mall-admin/.settings/org.eclipse.m2e.core.prefs b/代码库/mall-admin/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/代码库/mall-admin/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/代码库/mall-admin/.settings/org.eclipse.wst.common.project.facet.core.xml b/代码库/mall-admin/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..d858295
--- /dev/null
+++ b/代码库/mall-admin/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/代码库/mall-admin/pom.xml b/代码库/mall-admin/pom.xml
new file mode 100644
index 0000000..fbc0e4b
--- /dev/null
+++ b/代码库/mall-admin/pom.xml
@@ -0,0 +1,142 @@
+
+ 4.0.0
+
+ com.macro.mall
+ mall-admin
+ 0.0.1-SNAPSHOT
+ jar
+
+ mall-admin
+ mall-admin project for mall
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.14.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ true
+
+
+
+
+ com.macro.mall
+ mall-mbg
+ 1.0-SNAPSHOT
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 1.2.0
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+ 1.2.3
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.6.1
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.6.1
+
+
+
+ io.jsonwebtoken
+ jjwt
+ 0.9.0
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 2.5.0
+
+
+
+ net.logstash.logback
+ logstash-logback-encoder
+ 4.8
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ 1.1.10
+
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ com.spotify
+ docker-maven-plugin
+ 1.1.0
+
+
+ build-image
+ package
+
+ build
+
+
+
+
+ mall/${project.artifactId}:${project.version}
+ http://192.168.1.71:2375
+ java:8
+ ["java", "-jar", "-Dspring.profiles.active=prod","/${project.build.finalName}.jar"]
+
+
+ /
+ ${project.build.directory}
+ ${project.build.finalName}.jar
+
+
+
+
+
+
+
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/MallAdminApplication.java b/代码库/mall-admin/src/main/java/com/sock/mall/MallAdminApplication.java
new file mode 100644
index 0000000..74cd3ee
--- /dev/null
+++ b/代码库/mall-admin/src/main/java/com/sock/mall/MallAdminApplication.java
@@ -0,0 +1,18 @@
+package com.macro.mall;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * Ӧ
+ */
+@SpringBootApplication
+@MapperScan({"com.macro.mall.mapper","com.macro.mall.dao"})
+@EnableTransactionManagement
+public class MallAdminApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(MallAdminApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/bo/AdminUserDetails.java b/代码库/mall-admin/src/main/java/com/sock/mall/bo/AdminUserDetails.java
deleted file mode 100644
index 3e6a5ac..0000000
--- a/代码库/mall-admin/src/main/java/com/sock/mall/bo/AdminUserDetails.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.sock.mall.bo;
import com.sock.mall.model.UmsAdmin;
import com.sock.mall.model.UmsPermission;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
/**
* SpringSecurity需要的用户详情
*/
public class AdminUserDetails implements UserDetails {
private UmsAdmin umsAdmin;
private List permissionList;
public AdminUserDetails(UmsAdmin umsAdmin,List permissionList) {
this.umsAdmin = umsAdmin;
this.permissionList = permissionList;
}
@Override
public Collection extends GrantedAuthority> getAuthorities() {
//返回当前用户的权限
return permissionList.stream()
.filter(permission -> permission.getValue()!=null)
.map(permission ->new SimpleGrantedAuthority(permission.getValue()))
.collect(Collectors.toList());
}
@Override
/*登录密码*/
public String getPassword() {
return umsAdmin.getPassword();
}
@Override
/*登录名称*/
public String getUsername() {
return umsAdmin.getUsername();
}
@Override
/*有效性验证(是否过期)*/
public boolean isAccountNonExpired() {
return true;
}
@Override
/*有效性验证(是否被锁)*/
public boolean isAccountNonLocked() {
return true;
}
@Override
/*验证证书是否有效*/
public boolean isCredentialsNonExpired() {
return true;
}
@Override
/*状态判断890-*/
public boolean isEnabled() {
return umsAdmin.getStatus().equals(1);
}
}
\ No newline at end of file
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/bo/WebLog.java b/代码库/mall-admin/src/main/java/com/sock/mall/bo/WebLog.java
deleted file mode 100644
index f36df97..0000000
--- a/代码库/mall-admin/src/main/java/com/sock/mall/bo/WebLog.java
+++ /dev/null
@@ -1 +0,0 @@
-package com.sock.mall.bo;
/**
* Controller层的日志封装类
*/
public class WebLog {
/**
* 操作描述
*/
private String description;
/**
* 操作用户
*/
private String username;
/**
* 操作时间
*/
private Long startTime;
/**
* 消耗时间
*/
private Integer spendTime;
/**
* 根路径
*/
private String basePath;
/**
* URI
*/
private String uri;
/**
* URL
*/
private String url;
/**
* 请求类型
*/
private String method;
/**
* IP地址
*/
private String ip;
private Object parameter;
private Object result;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Integer getSpendTime() {
return spendTime;
}
public void setSpendTime(Integer spendTime) {
this.spendTime = spendTime;
}
public String getBasePath() {
return basePath;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Object getParameter() {
return parameter;
}
public void setParameter(Object parameter) {
this.parameter = parameter;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
}
\ No newline at end of file
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/component/BIndingResultAspect.java b/代码库/mall-admin/src/main/java/com/sock/mall/component/BIndingResultAspect.java
deleted file mode 100644
index 8ec4dc3..0000000
--- a/代码库/mall-admin/src/main/java/com/sock/mall/component/BIndingResultAspect.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.macro.mall.component;
-
-import com.macro.mall.dto.CommonResult;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Component;
-import org.springframework.validation.BindingResult;
-
-/**
- * HibernateValidator
- */
-@Aspect
-@Component
-@Order(2)
-public class BindingResultAspect {
- @Pointcut("execution(public * com.macro.mall.controller.*.*(..))")
- /*SpringMVCIJ֤*/
- /*Spring֤ĴBindingResult*/
- public void BindingResult() {
- }
-
- @Around("BindingResult()")
- public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
- /*Around(value="BindingResult()"*/
- Object[] args = joinPoint.getArgs();
- for (Object arg : args) {
- if (arg instanceof BindingResult) {
- /*֤ͨ*/
- BindingResult result = (BindingResult) arg;
- if (result.hasErrors()) {
- /*ݲ*/
- return new CommonResult().validateFailed(result);
- /* ֤ͨ쳣*/
- /*شļϢ*/
- }
- }
- }
- return joinPoint.proceed();//AOPл֪ͨproceed
- }
-}
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/component/JwtAuthenticationTokenFilter.java b/代码库/mall-admin/src/main/java/com/sock/mall/component/JwtAuthenticationTokenFilter.java
deleted file mode 100644
index 67c1408..0000000
--- a/代码库/mall-admin/src/main/java/com/sock/mall/component/JwtAuthenticationTokenFilter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.macro.mall.component;
-
-import com.macro.mall.util.JwtTokenUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
-import org.springframework.stereotype.Component;
-import org.springframework.web.filter.OncePerRequestFilter;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * JWT¼Ȩ
- */
-public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
- private static final Logger LOGGER = LoggerFactory.getLogger(JwtAuthenticationTokenFilter.class);
- /*Log4jUtils࣬LoggerIJ*/
- @Autowired
- private UserDetailsService userDetailsService;//ûϸϢ
- @Autowired
- private JwtTokenUtil jwtTokenUtil;//jwt¼Ȩ
- @Value("${jwt.tokenHeader}")
- private String tokenHeader;//¼ͷ
- @Value("${jwt.tokenHead}")
- private String tokenHead;
-
- @Override
- protected void doFilterInternal(HttpServletRequest request,
- HttpServletResponse response,
- FilterChain chain) throws ServletException, IOException {
- /*Filterʵֹ˹*/
- String authHeader = request.getHeader(this.tokenHeader);
- if (authHeader != null && authHeader.startsWith(this.tokenHead)) {
- String authToken = authHeader.substring(this.tokenHead.length());// The part after "Bearer "
- String username = jwtTokenUtil.getUserNameFromToken(authToken);
- LOGGER.info("checking username:{}", username);
- if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
- UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
- if (jwtTokenUtil.validateToken(authToken, userDetails)) {
- /*֤ϢSecurityContextHolderУUsernamePasswordAuthenticationTokenSecurity֤˺Ĺ*/
- UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
- authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
- LOGGER.info("authenticated user:{}", username);
- SecurityContextHolder.getContext().setAuthentication(authentication);
- }
- }
- }
- chain.doFilter(request, response);//תһ
- }
-}
\ No newline at end of file
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/component/RestAuthenticationEntryPoint.java b/代码库/mall-admin/src/main/java/com/sock/mall/component/RestAuthenticationEntryPoint.java
deleted file mode 100644
index 148d3ef..0000000
--- a/代码库/mall-admin/src/main/java/com/sock/mall/component/RestAuthenticationEntryPoint.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.macro.mall.component;
-
-import com.macro.mall.dto.CommonResult;
-import com.macro.mall.util.JsonUtil;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.AuthenticationEntryPoint;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * δ¼tokenʧЧʽӿʱԶķؽ
- */
-@Component
-public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {//
- @Override
- public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
- response.setCharacterEncoding("UTF-8");
- response.setContentType("application/json");
- response.getWriter().println(JsonUtil.objectToJson(new CommonResult().unauthorized(authException.getMessage())));
- response.getWriter().flush();
- }
-}
\ No newline at end of file
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/component/RestfulAccessDeniedHandler.java b/代码库/mall-admin/src/main/java/com/sock/mall/component/RestfulAccessDeniedHandler.java
deleted file mode 100644
index be45726..0000000
--- a/代码库/mall-admin/src/main/java/com/sock/mall/component/RestfulAccessDeniedHandler.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.macro.mall.component;
-
-import com.macro.mall.dto.CommonResult;
-import com.macro.mall.util.JsonUtil;
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.security.web.access.AccessDeniedHandler;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * ʽӿûȨʱԶķؽ
- */
-@Component
-public class RestfulAccessDeniedHandler implements AccessDeniedHandler{//ûзȨ
- @Override
- public void handle(HttpServletRequest request,
- HttpServletResponse response,
- AccessDeniedException e) throws IOException, ServletException {
- response.setCharacterEncoding("UTF-8");
- response.setContentType("application/json");
- response.getWriter().println(JsonUtil.objectToJson(new CommonResult().forbidden(e.getMessage())));
- response.getWriter().flush();
- }
-}
\ No newline at end of file
diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/component/WebLogAspect.java b/代码库/mall-admin/src/main/java/com/sock/mall/component/WebLogAspect.java
deleted file mode 100644
index 360d514..0000000
--- a/代码库/mall-admin/src/main/java/com/sock/mall/component/WebLogAspect.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package com.macro.mall.component;
-
-import com.macro.mall.bo.WebLog;
-import com.macro.mall.util.JsonUtil;
-import com.macro.mall.util.RequestUtil;
-import io.swagger.annotations.ApiOperation;
-import net.logstash.logback.marker.Markers;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.Signature;
-import org.aspectj.lang.annotation.*;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import java.lang.reflect.Method;
-import java.lang.reflect.Parameter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * ͳһ־
- */
-@Aspect//javaඨΪ
-@Component
-@Order(1)
-public class WebLogAspect {
- private static final Logger LOGGER = LoggerFactory.getLogger(WebLogAspect.class);
- private ThreadLocal startTime = new ThreadLocal<>();
- /**
- * һ
- * ~һ*ηֵⷵ
- * ~ڶ*controllerӰ
- * ~*ⷽ
- * ~..ƥIJ
- */
-
- @Pointcut("execution(public * com.macro.mall.controller.*.*(..))")
- public void webLog() {
- }
-
- @Before("webLog()")
- public void doBefore(JoinPoint joinPoint) throws Throwable {
- startTime.set(System.currentTimeMillis());
- }
-
- @AfterReturning(value = "webLog()", returning = "ret")
- public void doAfterReturning(Object ret) throws Throwable {
- }
-
- @Around("webLog()")
- public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
- //ȡǰ
- ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
- HttpServletRequest request = attributes.getRequest();
- //¼Ϣ(ͨlogstashelasticsearch)
- WebLog webLog = new WebLog();
- Object result = joinPoint.proceed();
- Signature signature = joinPoint.getSignature();
- MethodSignature methodSignature = (MethodSignature) signature;
- Method method = methodSignature.getMethod();
- if (method.isAnnotationPresent(ApiOperation.class)) {
- ApiOperation log = method.getAnnotation(ApiOperation.class);
- webLog.setDescription(log.value());
- }
- long endTime = System.currentTimeMillis();
- webLog.setBasePath(RequestUtil.getBasePath(request));
- webLog.setIp(request.getRemoteUser());
- webLog.setMethod(request.getMethod());
- webLog.setParameter(getParameter(method, joinPoint.getArgs()));
- webLog.setResult(result);
- webLog.setSpendTime((int) (endTime - startTime.get()));
- webLog.setStartTime(startTime.get());
- webLog.setUri(request.getRequestURI());
- webLog.setUrl(request.getRequestURL().toString());
- Map logMap = new HashMap<>();
- logMap.put("url",webLog.getUrl());
- logMap.put("method",webLog.getMethod());
- logMap.put("parameter",webLog.getParameter());
- logMap.put("spendTime",webLog.getSpendTime());
- logMap.put("description",webLog.getDescription());
- // LOGGER.info("{}", JsonUtil.objectToJson(webLog));
- LOGGER.info(Markers.appendEntries(logMap),JsonUtil.objectToJson(webLog));
- return result;//
- }
-
- /**
- * ݷʹIJȡ
- */
- private Object getParameter(Method method, Object[] args) {
- List