diff --git a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/controller/AuthController.java b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/controller/AuthController.java index 88258126d..806c6d7cd 100644 --- a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/controller/AuthController.java +++ b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/controller/AuthController.java @@ -10,6 +10,7 @@ package com.elink.esua.epdc.controller; import com.elink.esua.epdc.commons.tools.constant.Constant; import com.elink.esua.epdc.commons.tools.exception.ErrorCode; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; import com.elink.esua.epdc.commons.tools.security.user.UserDetail; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.commons.tools.validator.AssertUtils; @@ -108,4 +109,14 @@ public class AuthController { return new Result().ok(data); } + + @GetMapping(value = "getLoginUserInfo") + public Result getLoginUserInfo(String token) { + + CpUserDetail cpUserDetail = authService.getLoginUserInfo(token); + if (cpUserDetail != null) { + return new Result().ok(cpUserDetail); + } + return new Result().error(); + } } diff --git a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java index e40236835..88e16e9b8 100644 --- a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java +++ b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java @@ -10,8 +10,6 @@ package com.elink.esua.epdc.feign.fallback; import com.elink.esua.epdc.feign.ResourceFeignClient; import com.elink.esua.epdc.commons.tools.security.bo.ResourceBO; -import com.elink.esua.epdc.feign.ResourceFeignClient; -import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @@ -22,7 +20,6 @@ import java.util.List; * @author Mark sunlightcs@gmail.com * @since 1.0.0 */ -@Component public class ResourceFeignClientFallback implements ResourceFeignClient { @Override diff --git a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java index 76a676fcd..fa1b1bd5b 100644 --- a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java +++ b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/feign/fallback/UserFeignClientFallback.java @@ -11,7 +11,6 @@ package com.elink.esua.epdc.feign.fallback; import com.elink.esua.epdc.commons.tools.security.user.UserDetail; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.feign.UserFeignClient; -import org.springframework.stereotype.Component; /** * 用户接口 Fallback @@ -19,7 +18,6 @@ import org.springframework.stereotype.Component; * @author Mark sunlightcs@gmail.com * @since 1.0.0 */ -@Component public class UserFeignClientFallback implements UserFeignClient { @Override diff --git a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/AuthService.java b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/AuthService.java index d4de33d0a..1f500829c 100644 --- a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/AuthService.java +++ b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/AuthService.java @@ -8,6 +8,7 @@ package com.elink.esua.epdc.service; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; import com.elink.esua.epdc.dto.AuthorizationDTO; import com.elink.esua.epdc.dto.LoginDTO; @@ -28,4 +29,6 @@ public interface AuthService { * 退出 */ void logout(Long userId); + + CpUserDetail getLoginUserInfo(String token); } diff --git a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/AuthServiceImpl.java b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/AuthServiceImpl.java index 8dcf3e4d1..cd792001d 100644 --- a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/AuthServiceImpl.java +++ b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/AuthServiceImpl.java @@ -8,6 +8,8 @@ package com.elink.esua.epdc.service.impl; +import com.elink.esua.epdc.commons.tools.redis.CpUserDetailRedis; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; import com.elink.esua.epdc.enums.UserStatusEnum; import com.elink.esua.epdc.commons.tools.exception.ErrorCode; import com.elink.esua.epdc.commons.tools.exception.RenException; @@ -25,11 +27,11 @@ import com.elink.esua.epdc.commons.tools.utils.IpUtils; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dto.AuthorizationDTO; import com.elink.esua.epdc.dto.LoginDTO; -import com.elink.esua.epdc.enums.UserStatusEnum; import com.elink.esua.epdc.feign.UserFeignClient; import com.elink.esua.epdc.jwt.JwtProperties; import com.elink.esua.epdc.jwt.JwtUtils; import com.elink.esua.epdc.service.AuthService; +import io.jsonwebtoken.Claims; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; @@ -50,6 +52,8 @@ public class AuthServiceImpl implements AuthService { @Autowired private UserDetailRedis userDetailRedis; @Autowired + private CpUserDetailRedis cpUserDetailRedis; + @Autowired private LogProducer logProducer; @Autowired private JwtUtils jwtUtils; @@ -144,4 +148,25 @@ public class AuthServiceImpl implements AuthService { userDetailRedis.logout(userId); } + @Override + public CpUserDetail getLoginUserInfo(String token) { + //是否过期 + Claims claims = jwtUtils.getClaimByToken(token); + if (claims == null || jwtUtils.isTokenExpired(claims.getExpiration())) { + throw new RenException(ErrorCode.UNAUTHORIZED); + } + + //获取用户ID + String userId = claims.getSubject(); + + //查询Redis,如果没数据,则保持用户信息到Redis + CpUserDetail cpUserDetail = cpUserDetailRedis.get(userId); + if (cpUserDetail != null) { + //过期时间 + long expire = (claims.getExpiration().getTime() - System.currentTimeMillis()) / 1000; + cpUserDetailRedis.set(cpUserDetail, expire); + return cpUserDetail; + } + return null; + } } diff --git a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/ResourceServiceImpl.java b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/ResourceServiceImpl.java index 1245b18ce..ff60d36b2 100644 --- a/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/ResourceServiceImpl.java +++ b/esua-epdc/epdc-auth/src/main/java/com/elink/esua/epdc/service/impl/ResourceServiceImpl.java @@ -20,7 +20,6 @@ import com.elink.esua.epdc.commons.tools.security.enums.ResourceAuthEnum; import com.elink.esua.epdc.commons.tools.security.enums.UserKillEnum; import com.elink.esua.epdc.commons.tools.security.user.UserDetail; import com.elink.esua.epdc.commons.tools.utils.Result; -import com.elink.esua.epdc.feign.ResourceFeignClient; import com.elink.esua.epdc.feign.UserFeignClient; import com.elink.esua.epdc.jwt.JwtUtils; import com.elink.esua.epdc.service.ResourceService; diff --git a/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/enums/ELinkDelFlagEnum.java b/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/enums/EpdcDelFlagEnum.java similarity index 87% rename from esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/enums/ELinkDelFlagEnum.java rename to esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/enums/EpdcDelFlagEnum.java index 7d45663c4..e88c27245 100644 --- a/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/enums/ELinkDelFlagEnum.java +++ b/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/enums/EpdcDelFlagEnum.java @@ -14,7 +14,7 @@ package com.elink.esua.epdc.commons.mybatis.enums; * @author yujintao * @date 2019/8/19 10:37 */ -public enum ELinkDelFlagEnum { +public enum EpdcDelFlagEnum { /** * 未删 */ @@ -26,7 +26,7 @@ public enum ELinkDelFlagEnum { private String value; - ELinkDelFlagEnum(String value) { + EpdcDelFlagEnum(String value) { this.value = value; } diff --git a/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/handler/FieldMetaObjectHandler.java b/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/handler/FieldMetaObjectHandler.java index cdeebf750..2e83a40b5 100644 --- a/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/handler/FieldMetaObjectHandler.java +++ b/esua-epdc/epdc-commons/epdc-commons-mybatis/src/main/java/com/elink/esua/epdc/commons/mybatis/handler/FieldMetaObjectHandler.java @@ -1,15 +1,22 @@ /** * Copyright (c) 2018 人人开源 All rights reserved. - * + *

* https://www.renren.io - * + *

* 版权所有,侵权必究! */ package com.elink.esua.epdc.commons.mybatis.handler; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.elink.esua.epdc.commons.mybatis.entity.BaseEntity; +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; import com.elink.esua.epdc.commons.mybatis.enums.DelFlagEnum; +import com.elink.esua.epdc.commons.mybatis.enums.EpdcDelFlagEnum; +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.constant.FieldConstant; +import com.elink.esua.epdc.commons.tools.constant.NumConstant; import com.elink.esua.epdc.commons.tools.security.user.SecurityUser; import com.elink.esua.epdc.commons.tools.security.user.UserDetail; import org.apache.ibatis.reflection.MetaObject; @@ -29,39 +36,80 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { private final static String CREATOR = "creator"; private final static String UPDATE_DATE = "updateDate"; private final static String UPDATER = "updater"; - private final static String DEL_FLAG = "delFlag"; private final static String DEPT_ID = "deptId"; @Override public void insertFill(MetaObject metaObject) { UserDetail user = SecurityUser.getUser(); - if(user == null){ - return; - } Date date = new Date(); + if (metaObject.getOriginalObject() instanceof BaseEpdcEntity) { + String userId = user == null ? Constant.APP_USER_FLAG : String.valueOf(user.getId()); + Long deptId = user == null ? null : user.getDeptId(); + setFieldValByName(FieldConstant.CREATED_TIME_HUMP, date, metaObject); + setFieldValByName(FieldConstant.CREATED_BY_HUMP, userId, metaObject); + setFieldValByName(FieldConstant.UPDATED_TIME_HUMP, date, metaObject); + setFieldValByName(FieldConstant.UPDATED_BY_HUMP, userId, metaObject); + setFieldValByName(FieldConstant.REVISION_HUMP, NumConstant.ZERO, metaObject); + //删除标识 + setFieldValByName(FieldConstant.DEL_FLAG_HUMP, EpdcDelFlagEnum.NORMAL.value(), metaObject); + // 数据权限标志 + setFieldValByName(DEPT_ID, deptId, metaObject); - //创建者 - setFieldValByName(CREATOR, user.getId(), metaObject); - //创建时间 - setFieldValByName(CREATE_DATE, date, metaObject); - - //创建者所属部门 - setFieldValByName(DEPT_ID, user.getDeptId(), metaObject); - - //更新者 - setFieldValByName(UPDATER, user.getId(), metaObject); - //更新时间 - setFieldValByName(UPDATE_DATE, date, metaObject); - - //删除标识 - setFieldValByName(DEL_FLAG, DelFlagEnum.NORMAL.value(), metaObject); + } else { + if (user == null) { + return; + } + //创建者 + setFieldValByName(CREATOR, user.getId(), metaObject); + //创建时间 + setFieldValByName(CREATE_DATE, date, metaObject); + //创建者所属部门 + if (metaObject.hasGetter(DEPT_ID)) { + if (null == metaObject.getValue(DEPT_ID)) { + setFieldValByName(DEPT_ID, user.getDeptId(), metaObject); + } + } + //更新者 + setFieldValByName(UPDATER, user.getId(), metaObject); + //更新时间 + setFieldValByName(UPDATE_DATE, date, metaObject); + //删除标识 + setFieldValByName(FieldConstant.DEL_FLAG_HUMP, DelFlagEnum.NORMAL.value(), metaObject); + } } @Override public void updateFill(MetaObject metaObject) { - //更新者 - setFieldValByName(UPDATER, SecurityUser.getUserId(), metaObject); - //更新时间 - setFieldValByName(UPDATE_DATE, new Date(), metaObject); + + Object originalObject = metaObject.getOriginalObject(); + Long id = SecurityUser.getUserId(); + + boolean fillEntity = false; + boolean fillEsuaEntity = false; + if (originalObject instanceof BaseEntity) { + fillEntity = true; + } else if (originalObject instanceof BaseEpdcEntity) { + fillEsuaEntity = true; + } else { + if (metaObject.hasGetter(Constants.ENTITY)) { + Object et = metaObject.getValue(Constants.ENTITY); + if (et instanceof BaseEpdcEntity) { + fillEsuaEntity = true; + } else if (et instanceof BaseEntity) { + fillEntity = true; + } + } + } + if (fillEntity) { + id = null == id ? 0L : id; + //更新者 + setFieldValByName(UPDATER, id, metaObject); + //更新时间 + setFieldValByName(UPDATE_DATE, new Date(), metaObject); + } else if (fillEsuaEntity) { + String userId = null == id ? Constant.APP_USER_FLAG : String.valueOf(id); + setFieldValByName(FieldConstant.UPDATED_BY_HUMP, userId, metaObject); + setFieldValByName(FieldConstant.UPDATED_TIME_HUMP, new Date(), metaObject); + } } } diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/annotation/LoginUser.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/annotation/LoginUser.java new file mode 100644 index 000000000..ef06ef68d --- /dev/null +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/annotation/LoginUser.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.commons.tools.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 登录用户信息 + * + * @author Mark sunlightcs@gmail.com + */ +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +public @interface LoginUser { + +} diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/Constant.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/Constant.java index 547016804..c45b047a8 100644 --- a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/Constant.java +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/Constant.java @@ -1,8 +1,8 @@ /** * Copyright (c) 2018 人人开源 All rights reserved. - * + *

* https://www.renren.io - * + *

* 版权所有,侵权必究! */ @@ -84,4 +84,16 @@ public interface Constant { * token header */ String TOKEN_HEADER = "token"; + /** + * authorization header + */ + String AUTHORIZATION_HEADER = "authorization"; + /** + * APP用户标识 + */ + String APP_USER_KEY = "appUserId"; + /** + * 移动端用户标识 + */ + String APP_USER_FLAG = "APP_USER"; } diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/FieldConstant.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/FieldConstant.java new file mode 100644 index 000000000..fa72296c2 --- /dev/null +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/FieldConstant.java @@ -0,0 +1,33 @@ +package com.elink.esua.epdc.commons.tools.constant; + + +/** + * 常用字段常量 + * + * @author yujintao + * @email yujintao@elink-cn.com + * @date 2019/8/20 10:11 + */ +public interface FieldConstant { + + String ID = "ID"; + String ID_HUMP = "id"; + + String REVISION = "REVISION"; + String REVISION_HUMP = "revision"; + + String CREATED_BY = "CREATED_BY"; + String CREATED_BY_HUMP = "createdBy"; + + String CREATED_TIME = "CREATED_TIME"; + String CREATED_TIME_HUMP = "createdTime"; + + String UPDATED_BY = "UPDATED_BY"; + String UPDATED_BY_HUMP = "updatedBy"; + + String UPDATED_TIME = "UPDATED_TIME"; + String UPDATED_TIME_HUMP = "updatedTime"; + + String DEL_FLAG = "DEL_FLAG"; + String DEL_FLAG_HUMP = "delFlag"; +} diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java index f96e57fd5..dce6e8978 100644 --- a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/ServiceConstant.java @@ -59,4 +59,8 @@ public interface ServiceConstant { * 生活服务模块 */ String EPDC_SERVICES_SERVER = "epdc-services-server"; + /** + * 移动端接口模块 + */ + String EPDC_APP_SERVER = "epdc-app-server"; } diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/CpUserDetailRedis.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/CpUserDetailRedis.java new file mode 100644 index 000000000..6ba73d60b --- /dev/null +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/CpUserDetailRedis.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.commons.tools.redis; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.map.MapUtil; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * CP用户Redis + * + * @author rongchao + * @since 1.0.0 + */ +@Component +public class CpUserDetailRedis { + + @Autowired + private RedisUtils redisUtils; + + public void set(CpUserDetail user, long expire) { + if (user == null) { + return; + } + String key = RedisKeys.getCpUserKey(user.getId()); + //bean to map + Map map = BeanUtil.beanToMap(user, false, true); + redisUtils.hMSet(key, map, expire); + } + + public CpUserDetail get(String id) { + String key = RedisKeys.getCpUserKey(id); + + Map map = redisUtils.hGetAll(key); + if (MapUtil.isEmpty(map)) { + return null; + } + + //map to bean + CpUserDetail user = BeanUtil.mapToBean(map, CpUserDetail.class, true); + + return user; + } + + /** + * 用户退出 + * + * @param id + */ + public void logout(String id) { + redisUtils.delete(RedisKeys.getCpUserKey(id)); + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisKeys.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisKeys.java index 0568fe833..64682ac20 100644 --- a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisKeys.java +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/redis/RedisKeys.java @@ -71,4 +71,8 @@ public class RedisKeys { public static String getUserPermissionsKey(Long userId) { return MODULE_FLAG + "sys:user:permissions:" + userId; } + + public static String getCpUserKey(String id) { + return MODULE_FLAG + "sys:security:cpuser:" + id; + } } diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/resolver/LoginUserHandlerMethodArgumentResolver.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/resolver/LoginUserHandlerMethodArgumentResolver.java new file mode 100644 index 000000000..4d12e9e46 --- /dev/null +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/resolver/LoginUserHandlerMethodArgumentResolver.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.commons.tools.resolver; + +import com.elink.esua.epdc.commons.tools.annotation.LoginUser; +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.redis.CpUserDetailRedis; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.MethodParameter; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.method.support.ModelAndViewContainer; + +/** + * 有@LoginUser注解的方法参数,注入当前登录用户 + * + * @author Mark sunlightcs@gmail.com + */ +@Component +public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { + + @Autowired + private CpUserDetailRedis cpUserDetailRedis; + + + @Override + public boolean supportsParameter(MethodParameter parameter) { + return parameter.getParameterType().isAssignableFrom(CpUserDetail.class) && parameter.hasParameterAnnotation(LoginUser.class); + } + + @Override + public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container, + NativeWebRequest request, WebDataBinderFactory factory) throws Exception { + //获取用户ID + String userId = request.getHeader(Constant.APP_USER_KEY); + if (StringUtils.isEmpty(userId)) { + return null; + } + CpUserDetail user = cpUserDetailRedis.get(userId); + return user; + } +} diff --git a/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/security/user/CpUserDetail.java b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/security/user/CpUserDetail.java new file mode 100644 index 000000000..0ef01eb33 --- /dev/null +++ b/esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/security/user/CpUserDetail.java @@ -0,0 +1,42 @@ +package com.elink.esua.epdc.commons.tools.security.user; + +import lombok.Data; + +import java.io.Serializable; + +/** + * APP用户详情 + * + * @author rongchao + * @Date 19-5-13 + */ +@Data +public class CpUserDetail implements Serializable { + + private static final long serialVersionUID = 6172109654041516399L; + + /** + * 用户ID + */ + private String id; + + /** + * 昵称 + */ + private String nickname; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 手机号 + */ + private String mobile; + + /** + * 令牌 + */ + private String token; +} diff --git a/esua-epdc/epdc-gateway/pom.xml b/esua-epdc/epdc-gateway/pom.xml index c093f5302..c10e0c8bf 100644 --- a/esua-epdc/epdc-gateway/pom.xml +++ b/esua-epdc/epdc-gateway/pom.xml @@ -78,6 +78,8 @@ lb://epdc-activiti-server lb://epdc-api-server + lb://epdc-app-server + lb://epdc-heart-server lb://epdc-job-server @@ -113,6 +115,7 @@ lb://epdc-admin-server lb://epdc-activiti-server lb://epdc-api-server + lb://epdc-app-server lb://epdc-heart-server lb://epdc-job-server lb://epdc-message-server @@ -142,6 +145,7 @@ lb://epdc-admin-server lb://epdc-activiti-server lb://epdc-api-server + lb://epdc-app-server lb://epdc-heart-server lb://epdc-job-server lb://epdc-message-server diff --git a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/ResourceFeignClient.java b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/ResourceFeignClient.java index 6b71aa939..68f229806 100644 --- a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/ResourceFeignClient.java +++ b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/ResourceFeignClient.java @@ -1,19 +1,21 @@ /** * Copyright (c) 2018 人人开源 All rights reserved. - * + *

* https://www.renren.io - * + *

* 版权所有,侵权必究! */ package com.elink.esua.epdc.feign; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; import com.elink.esua.epdc.feign.fallback.ResourceFeignClientFallback; import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; import com.elink.esua.epdc.commons.tools.security.user.UserDetail; import com.elink.esua.epdc.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; @@ -29,13 +31,24 @@ public interface ResourceFeignClient { /** * 是否有资源访问权限 - * @param token token - * @param url 资源URL - * @param method 请求方式 * + * @param token token + * @param url 资源URL + * @param method 请求方式 * @return 有访问权限,则返回用户信息 */ @PostMapping("auth/resource") Result resource(@RequestHeader(HttpHeaders.ACCEPT_LANGUAGE) String language, @RequestParam("token") String token, @RequestParam("url") String url, @RequestParam("method") String method); + + /** + * 获取登录用户信息 + * + * @param token + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author + * @date 2019/8/19 17:19 + */ + @GetMapping("auth/getLoginUserInfo") + Result getLoginUserInfo(@RequestParam("token") String token); } diff --git a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java index bbd19e192..2f21a1005 100644 --- a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java +++ b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/feign/fallback/ResourceFeignClientFallback.java @@ -8,10 +8,10 @@ package com.elink.esua.epdc.feign.fallback; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; import com.elink.esua.epdc.commons.tools.security.user.UserDetail; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.feign.ResourceFeignClient; -import org.springframework.stereotype.Component; /** * 资源接口 Fallback @@ -19,11 +19,15 @@ import org.springframework.stereotype.Component; * @author Mark sunlightcs@gmail.com * @since 1.0.0 */ -@Component public class ResourceFeignClientFallback implements ResourceFeignClient { @Override public Result resource(String language, String token, String url, String method) { return new Result().error(); } + + @Override + public Result getLoginUserInfo(String token) { + return new Result().error(); + } } diff --git a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/AuthFilter.java b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/AuthFilter.java index 25b44ac78..ddc5a2aa4 100644 --- a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/AuthFilter.java +++ b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/AuthFilter.java @@ -41,7 +41,9 @@ import java.util.List; @Configuration @ConfigurationProperties(prefix = "renren") public class AuthFilter implements GlobalFilter { + private final AntPathMatcher antPathMatcher = new AntPathMatcher(); + @Autowired private ResourceFeignClient resourceFeignClient; /** diff --git a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/CpAuthGatewayFilterFactory.java b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/CpAuthGatewayFilterFactory.java new file mode 100644 index 000000000..babf5a4ce --- /dev/null +++ b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/CpAuthGatewayFilterFactory.java @@ -0,0 +1,122 @@ + +package com.elink.esua.epdc.filter; + +import com.alibaba.fastjson.JSON; +import com.elink.esua.epdc.commons.tools.constant.Constant; +import com.elink.esua.epdc.commons.tools.security.user.CpUserDetail; +import com.elink.esua.epdc.commons.tools.utils.Result; +import com.elink.esua.epdc.feign.ResourceFeignClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.stereotype.Component; +import org.springframework.util.AntPathMatcher; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.List; + +/** + * app接口权限过滤器 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component("CpAuth") +public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory { + + @Autowired + private ResourceFeignClient resourceFeignClient; + + @Autowired + private CpProperty cpProperty; + + private final AntPathMatcher antPathMatcher = new AntPathMatcher(); + + @Override + public List shortcutFieldOrder() { + return Arrays.asList("enabled"); + } + + public CpAuthGatewayFilterFactory() { + super(CpAuthGatewayFilterFactory.CpAuthConfig.class); + } + + @Override + public GatewayFilter apply(CpAuthConfig config) { + return (exchange, chain) -> { + if (!config.isEnabled()) { + return chain.filter(exchange); + } + + ServerHttpRequest request = exchange.getRequest(); + String requestUri = request.getPath().pathWithinApplication().value(); + + //请求放行,无需验证权限 + if (!pathMatcher(requestUri)) { + return chain.filter(exchange); + } + + HttpHeaders headers = request.getHeaders(); + String token = headers.getFirst(Constant.AUTHORIZATION_HEADER); + if (token == null) { + token = request.getQueryParams().getFirst(Constant.AUTHORIZATION_HEADER); + } + Result result = resourceFeignClient.getLoginUserInfo(token); + if (!result.success()) { + return response(exchange, result); + } + CpUserDetail user = result.getData(); + //当前登录用户userId,添加到header中 + if (user != null) { + ServerHttpRequest build = exchange.getRequest().mutate().header(Constant.APP_USER_KEY, user.getId()).build(); + return chain.filter(exchange.mutate().request(build).build()); + } + return chain.filter(exchange); + }; + } + + private Mono response(ServerWebExchange exchange, Object object) { + String json = JSON.toJSONString(object); + DataBuffer buffer = exchange.getResponse().bufferFactory().wrap(json.getBytes(StandardCharsets.UTF_8)); + exchange.getResponse().getHeaders().setContentType(MediaType.APPLICATION_JSON_UTF8); + exchange.getResponse().setStatusCode(HttpStatus.OK); + return exchange.getResponse().writeWith(Flux.just(buffer)); + } + + private boolean pathMatcher(String requestUri) { + for (String url : cpProperty.getUrls()) { + if (antPathMatcher.match(url, requestUri)) { + return true; + } + } + return false; + } + + public static class CpAuthConfig { + + /** + * 控制是否开启认证 + */ + private boolean enabled; + + public CpAuthConfig() { + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/CpProperty.java b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/CpProperty.java new file mode 100644 index 000000000..33f7af4ca --- /dev/null +++ b/esua-epdc/epdc-gateway/src/main/java/com/elink/esua/epdc/filter/CpProperty.java @@ -0,0 +1,22 @@ +package com.elink.esua.epdc.filter; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author rongchao + * @Date 19-5-17 + */ +@Data +@Component +@EnableConfigurationProperties +@ConfigurationProperties(prefix = "epdc") +public class CpProperty { + + private List urls; + +} diff --git a/esua-epdc/epdc-gateway/src/main/resources/application.yml b/esua-epdc/epdc-gateway/src/main/resources/application.yml index 496945468..14d6a0e32 100644 --- a/esua-epdc/epdc-gateway/src/main/resources/application.yml +++ b/esua-epdc/epdc-gateway/src/main/resources/application.yml @@ -76,7 +76,7 @@ spring: uri: @gateway.routes.epdc-heart-server.uri@ order: 8 predicates: - - Path=/api/** + - Path=/heart/** filters: - StripPrefix=0 #友邻社群模块 @@ -84,7 +84,7 @@ spring: uri: @gateway.routes.epdc-neighbor-server.uri@ order: 9 predicates: - - Path=/api/** + - Path=/neighbor/** filters: - StripPrefix=0 #新闻公告模块 @@ -92,7 +92,7 @@ spring: uri: @gateway.routes.epdc-news-server.uri@ order: 10 predicates: - - Path=/api/** + - Path=/news/** filters: - StripPrefix=0 #党群议事模块 @@ -100,7 +100,7 @@ spring: uri: @gateway.routes.epdc-party-server.uri@ order: 11 predicates: - - Path=/api/** + - Path=/party/** filters: - StripPrefix=0 #生活服务模块 @@ -108,9 +108,18 @@ spring: uri: @gateway.routes.epdc-services-server.uri@ order: 12 predicates: - - Path=/api/** + - Path=/services/** + filters: + - StripPrefix=0 + #生活服务模块 + - id: epdc-app-server + uri: @gateway.routes.epdc-app-server.uri@ + order: 13 + predicates: + - Path=/epdc-app/** filters: - StripPrefix=0 + - CpAuth=true nacos: discovery: server-addr: @nacos.server-addr@ @@ -155,3 +164,11 @@ renren: - /activiti/modeler.html - /activiti/service/** - /activiti/editor-app/** + + + + +epdc: + # 便捷通行接口 + urls: + - /*/epdc-app/** \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-client/pom.xml b/esua-epdc/epdc-module/epdc-app/epdc-app-client/pom.xml new file mode 100644 index 000000000..5b6fa3045 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-client/pom.xml @@ -0,0 +1,48 @@ + + + + epdc-app + com.esua.epdc + 1.0.0 + + 4.0.0 + + epdc-app-client + jar + + + + com.esua.epdc + epdc-commons-tools + 1.0.0 + + + com.esua.epdc + epdc-heart-client + 1.0.0 + + + com.esua.epdc + epdc-neighbor-client + 1.0.0 + + + com.esua.epdc + epdc-news-client + 1.0.0 + + + com.esua.epdc + epdc-party-client + 1.0.0 + + + com.esua.epdc + epdc-services-client + 1.0.0 + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-client/src/main/java/com/elink/esua/epdc/epdc.gitkeep b/esua-epdc/epdc-module/epdc-app/epdc-app-client/src/main/java/com/elink/esua/epdc/epdc.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/pom.xml b/esua-epdc/epdc-module/epdc-app/epdc-app-server/pom.xml new file mode 100644 index 000000000..864ee1c86 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/pom.xml @@ -0,0 +1,143 @@ + + + + epdc-app + com.esua.epdc + 1.0.0 + + 4.0.0 + + epdc-app-server + jar + + + + com.esua.epdc + epdc-app-client + 1.0.0 + + + com.esua.epdc + epdc-commons-tools + 1.0.0 + + + com.esua.epdc + epdc-commons-mybatis + 1.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + de.codecentric + spring-boot-admin-starter-client + ${spring.boot.admin.version} + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + com.spotify + docker-maven-plugin + + + + + + + + dev + + true + + + dev + + 9058 + + 47.104.224.45 + 6379 + elink@888 + + + + + epdc + elink888 + + false + 47.104.224.45:8848 + + + + + test + + test + + 9058 + + 47.104.224.45 + 6379 + elink@888 + + + + + epdc + elink888 + + false + 47.104.224.45:8848 + + + + + prod + + prod + + 9058 + + 47.104.224.45 + 6379 + elink@888 + + + + + epdc + elink888 + + false + 47.104.224.45:8848 + + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/AppApplication.java b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/AppApplication.java new file mode 100644 index 000000000..5fa453d6b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/AppApplication.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * 移动端接口模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.1.0 + */ +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class AppApplication { + + public static void main(String[] args) { + SpringApplication.run(AppApplication.class, args); + } + +} diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java new file mode 100644 index 000000000..0a6891524 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.config; + +import com.elink.esua.epdc.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息-移动端接口模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "app"; + } +} diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/config/WebConfig.java b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/config/WebConfig.java new file mode 100644 index 000000000..1ca742ce7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/java/com/elink/esua/epdc/config/WebConfig.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.elink.esua.epdc.config; + +import com.elink.esua.epdc.commons.tools.resolver.LoginUserHandlerMethodArgumentResolver; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.List; + +/** + * MVC配置 + * + * @author Mark sunlightcs@gmail.com + */ +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Autowired + private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver; + + @Override + public void addArgumentResolvers(List argumentResolvers) { + argumentResolvers.add(loginUserHandlerMethodArgumentResolver); + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/application.yml b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/application.yml new file mode 100644 index 000000000..bdb3aa82a --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/application.yml @@ -0,0 +1,65 @@ +server: + port: @server.port@ + servlet: + context-path: /epdc-app + +spring: + application: + name: epdc-app-server + # 环境 dev|test|prod + profiles: + active: @spring.profiles.active@ + messages: + encoding: UTF-8 + basename: i18n/messages,i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: 0 + host: @spring.redis.host@ + timeout: 30s + port: @spring.redis.port@ + password: @spring.redis.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + register-enabled: @nacos.register-enabled@ + datasource: + druid: + driver-class-name: com.mysql.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + + +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: io.renren.entity;com.elink.esua.epdc.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ID_WORKER + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages_en_US.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages_en_US.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages_zh_CN.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages_zh_CN.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages_zh_TW.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/messages_zh_TW.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation_en_US.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation_en_US.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation_zh_CN.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation_zh_CN.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation_zh_TW.properties b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/i18n/validation_zh_TW.properties new file mode 100644 index 000000000..e69de29bb diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/logback-spring.xml b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..dd5aa1d15 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/mapper/ScheduleJobDao.xml b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/mapper/ScheduleJobDao.xml new file mode 100644 index 000000000..57cb6edb5 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/mapper/ScheduleJobDao.xml @@ -0,0 +1,14 @@ + + + + + + + + update schedule_job set status = #{status} where id in + + #{id} + + + + diff --git a/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/mapper/ScheduleJobLogDao.xml b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/mapper/ScheduleJobLogDao.xml new file mode 100644 index 000000000..3683f2ca4 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/epdc-app-server/src/main/resources/mapper/ScheduleJobLogDao.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/esua-epdc/epdc-module/epdc-app/pom.xml b/esua-epdc/epdc-module/epdc-app/pom.xml new file mode 100644 index 000000000..cc01eb83b --- /dev/null +++ b/esua-epdc/epdc-module/epdc-app/pom.xml @@ -0,0 +1,20 @@ + + + + epdc-module + com.esua.epdc + 1.0.0 + + 4.0.0 + + epdc-app + pom + + epdc-app-client + epdc-app-server + + + + \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-services/epdc-services-server/pom.xml b/esua-epdc/epdc-module/epdc-services/epdc-services-server/pom.xml index 74dbcd9ce..18d36ca66 100644 --- a/esua-epdc/epdc-module/epdc-services/epdc-services-server/pom.xml +++ b/esua-epdc/epdc-module/epdc-services/epdc-services-server/pom.xml @@ -15,7 +15,7 @@ com.esua.epdc - epdc-news-client + epdc-services-client 1.0.0 diff --git a/esua-epdc/epdc-module/pom.xml b/esua-epdc/epdc-module/pom.xml index a3d1775b4..d68ea69ef 100644 --- a/esua-epdc/epdc-module/pom.xml +++ b/esua-epdc/epdc-module/pom.xml @@ -24,6 +24,7 @@ epdc-party epdc-neighbor epdc-services + epdc-app