selectLoginUserInfoByPassword(PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectLoginUserInfoByPassword", passwordLoginUserInfoFormDTO);
+ }
+
+}
diff --git a/epmet-auth/src/main/java/com/epmet/jwt/JwtTokenProperties.java b/epmet-auth/src/main/java/com/epmet/jwt/JwtTokenProperties.java
new file mode 100644
index 0000000000..ddff4febcc
--- /dev/null
+++ b/epmet-auth/src/main/java/com/epmet/jwt/JwtTokenProperties.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.jwt;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Jwt
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Configuration
+@ConfigurationProperties(prefix = "jwt.token")
+public class JwtTokenProperties {
+ private String secret;
+ private int expire;
+
+ public String getSecret() {
+ return secret;
+ }
+
+ public void setSecret(String secret) {
+ this.secret = secret;
+ }
+
+ public int getExpire() {
+ return expire;
+ }
+
+ public void setExpire(int expire) {
+ this.expire = expire;
+ }
+}
diff --git a/epmet-auth/src/main/java/com/epmet/jwt/JwtTokenUtils.java b/epmet-auth/src/main/java/com/epmet/jwt/JwtTokenUtils.java
new file mode 100644
index 0000000000..33baf31c52
--- /dev/null
+++ b/epmet-auth/src/main/java/com/epmet/jwt/JwtTokenUtils.java
@@ -0,0 +1,132 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.jwt;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import org.apache.commons.codec.binary.Base64;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Jwt工具类
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Component
+public class JwtTokenUtils {
+ private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class);
+
+ @Autowired
+ private JwtTokenProperties jwtProperties;
+
+ /**
+ * 生成jwt token 弃用
+ */
+ @Deprecated
+ public String generateToken(String userId) {
+ return Jwts.builder()
+ .setHeaderParam("typ", "JWT")
+ .setSubject(userId)
+ .setIssuedAt(new Date())
+ .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
+ .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret())
+ .compact();
+ }
+
+ public Claims getClaimByToken(String token) {
+ try {
+ return Jwts.parser()
+ .setSigningKey(jwtProperties.getSecret())
+ .parseClaimsJws(token)
+ .getBody();
+ } catch (Exception e) {
+ logger.debug("validate is token error, token = " + token, e);
+ return null;
+ }
+ }
+
+ /**
+ * @return java.util.Date
+ * @param token
+ * @Author yinzuomei
+ * @Description 获取token的有效期截止时间
+ * @Date 2020/3/18 22:17
+ **/
+ public Date getExpiration(String token){
+ try {
+ return Jwts.parser()
+ .setSigningKey(jwtProperties.getSecret())
+ .parseClaimsJws(token)
+ .getBody().getExpiration();
+ } catch (Exception e) {
+ logger.debug("validate is token error, token = " + token, e);
+ return null;
+ }
+ }
+
+ /**
+ * @param map
+ * @return java.lang.String
+ * @Author yinzuomei
+ * @Description 根据app+client+userId生成token
+ * @Date 2020/3/18 22:29
+ **/
+ public String createToken(Map map) {
+ return Jwts.builder()
+ .setHeaderParam("typ", "JWT")
+ .setClaims(map)
+ .setIssuedAt(new Date())
+ .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
+ .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret())
+ .compact();
+ }
+
+ /**
+ * token是否过期
+ *
+ * @return true:过期
+ */
+ public boolean isTokenExpired(Date expiration) {
+ return expiration.before(new Date());
+ }
+
+ public static void main(String[] args) {
+ Map map=new HashMap<>();
+ map.put("app","gov");
+ map.put("client","wxmp");
+ map.put("userId","100526ABC");
+ String tokenStr=Jwts.builder()
+ .setHeaderParam("typ", "JWT")
+ .setClaims(map)
+ .setIssuedAt(new Date())
+ .setExpiration(DateTime.now().plusSeconds(604800).toDate())
+ .signWith(SignatureAlgorithm.HS512, "7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]")
+ .compact();
+ System.out.println(tokenStr);
+ Claims claims= Jwts.parser()
+ .setSigningKey("7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]")
+ .parseClaimsJws(tokenStr)
+ .getBody();
+ System.out.println("app="+ claims.get("app"));
+ System.out.println("client="+ claims.get("client"));
+ System.out.println("userId="+ claims.get("userId"));
+ }
+
+}
diff --git a/epmet-auth/src/main/java/com/epmet/jwt/JwtUtils.java b/epmet-auth/src/main/java/com/epmet/jwt/JwtUtils.java
index 9ffdef84f4..dbd8743793 100644
--- a/epmet-auth/src/main/java/com/epmet/jwt/JwtUtils.java
+++ b/epmet-auth/src/main/java/com/epmet/jwt/JwtUtils.java
@@ -29,9 +29,10 @@ import java.util.Date;
public class JwtUtils {
private static final Logger logger = LoggerFactory.getLogger(JwtUtils.class);
+ /* @Autowired
+ private JwtProperties jwtProperties;*/
@Autowired
- private JwtProperties jwtProperties;
-
+ private JwtTokenProperties jwtProperties;
/**
* 生成jwt token
*/
diff --git a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
index abd3da1d06..a37f43b604 100644
--- a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
+++ b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java
@@ -10,6 +10,8 @@ package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -21,6 +23,7 @@ import org.springframework.stereotype.Component;
*/
@Component
public class CaptchaRedis {
+ private Logger logger = LogManager.getLogger(CaptchaRedis.class);
/**
* 验证码5分钟过期
*/
@@ -30,13 +33,14 @@ public class CaptchaRedis {
public void set(String uuid, String captcha){
String key = RedisKeys.getLoginCaptchaKey(uuid);
+ logger.info("保存验证码key=["+key+"]");
redisUtils.set(key, captcha, EXPIRE);
}
public String get(String uuid){
String key = RedisKeys.getLoginCaptchaKey(uuid);
String captcha = (String)redisUtils.get(key);
-
+ //logger.info("获取验证码key=["+key+"]captcha=["+captcha+"]");
//删除验证码
if(captcha != null){
redisUtils.delete(key);
diff --git a/epmet-auth/src/main/java/com/epmet/service/LoginService.java b/epmet-auth/src/main/java/com/epmet/service/LoginService.java
new file mode 100644
index 0000000000..444b2c5bbe
--- /dev/null
+++ b/epmet-auth/src/main/java/com/epmet/service/LoginService.java
@@ -0,0 +1,40 @@
+package com.epmet.service;
+
+import com.epmet.common.token.dto.form.LoginByPassWordFormDTO;
+import com.epmet.common.token.dto.form.LoginByWxCodeFormDTO;
+import com.epmet.common.token.dto.result.UserTokenResultDTO;
+import com.epmet.commons.tools.utils.Result;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2020/3/14 20:21
+ */
+public interface LoginService {
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 微信小程序登录
+ * @Date 2020/3/14 19:34
+ **/
+ Result loginByWxCode(LoginByWxCodeFormDTO formDTO);
+
+ /**
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 手机号+密码登录接口
+ * @Date 2020/3/14 19:54
+ **/
+ Result loginByPassword(LoginByPassWordFormDTO formDTO);
+
+ /**
+ * @param token
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 退出登录
+ * @Date 2020/3/18 22:44
+ **/
+ Result logoutByToken(String token);
+}
diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java
index d9a0c39d18..835c9aab3a 100644
--- a/epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/CaptchaServiceImpl.java
@@ -11,6 +11,8 @@ package com.epmet.service.impl;
import com.google.code.kaptcha.Producer;
import com.epmet.redis.CaptchaRedis;
import com.epmet.service.CaptchaService;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -24,6 +26,7 @@ import java.awt.image.BufferedImage;
*/
@Service
public class CaptchaServiceImpl implements CaptchaService {
+ private Logger logger = LogManager.getLogger(CaptchaServiceImpl.class);
@Autowired
private Producer producer;
@Autowired
@@ -33,7 +36,7 @@ public class CaptchaServiceImpl implements CaptchaService {
public BufferedImage create(String uuid) {
//生成验证码
String captcha = producer.createText();
-
+ //logger.info("uuid:"+uuid+",生成的验证码:"+captcha);
//保存验证码
captchaRedis.set(uuid, captcha);
diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
new file mode 100644
index 0000000000..23e04e4f9a
--- /dev/null
+++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
@@ -0,0 +1,289 @@
+package com.epmet.service.impl;
+
+import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
+import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
+import com.epmet.common.token.constant.LoginConstant;
+import com.epmet.common.token.dto.form.LoginByPassWordFormDTO;
+import com.epmet.common.token.dto.form.LoginByWxCodeFormDTO;
+import com.epmet.common.token.dto.result.UserTokenResultDTO;
+import com.epmet.commons.tools.exception.ErrorCode;
+import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.security.password.PasswordUtils;
+import com.epmet.commons.tools.utils.CpUserDetailRedis;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerUserDTO;
+import com.epmet.dto.form.PasswordLoginUserInfoFormDTO;
+import com.epmet.dto.form.WxLoginUserInfoFormDTO;
+import com.epmet.dto.result.PasswordLoginUserInfoResultDTO;
+import com.epmet.feign.EpmetUserFeignClient;
+import com.epmet.jwt.JwtTokenProperties;
+import com.epmet.jwt.JwtTokenUtils;
+import com.epmet.service.CaptchaService;
+import com.epmet.service.LoginService;
+import com.epmet.utils.WxMaServiceUtils;
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2020/3/14 20:31
+ */
+@Slf4j
+@Service
+public class LoginServiceImpl implements LoginService {
+ private static final Logger logger = LoggerFactory.getLogger(AuthServiceImpl.class);
+
+ @Autowired
+ private EpmetUserFeignClient epmetUserFeignClient;
+
+ @Autowired
+ private WxMaServiceUtils wxMaServiceUtils;
+
+ @Autowired
+ private JwtTokenUtils jwtTokenUtils;
+
+ @Autowired
+ private JwtTokenProperties jwtTokenProperties;
+
+ @Autowired
+ private CpUserDetailRedis cpUserDetailRedis;
+
+ @Autowired
+ private CaptchaService captchaService;
+
+ /**
+ * 微信小程序登录
+ *
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @since 2020/3/14 19:34
+ */
+ @Override
+ public Result loginByWxCode(LoginByWxCodeFormDTO formDTO) {
+ //1、根据wxCode获取微信信息
+ WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO);
+ logger.info("openId=[" + wxMaJscode2SessionResult.getOpenid() + "]unionId=[" + wxMaJscode2SessionResult.getUnionid() + "]");
+ //2、根据openId查询数据库,没有则直接插入一条记录
+ String userId = this.getUserId(formDTO, wxMaJscode2SessionResult);
+ if (StringUtils.isNotBlank(userId)) {
+ //3、封装token且存到redis
+ UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
+ userTokenResultDTO.setToken(this.packagingUserToken(formDTO, userId, wxMaJscode2SessionResult));
+ return new Result().ok(userTokenResultDTO);
+ }
+ return new Result().error("登录失败");
+ }
+
+ /**
+ * 解析微信code获取小程序用户信息
+ *
+ * @param formDTO
+ * @return cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult
+ * @author yinzuomei
+ * @date 2020/3/14 20:16
+ */
+ private WxMaJscode2SessionResult getWxMaUser(LoginByWxCodeFormDTO formDTO) {
+ WxMaJscode2SessionResult wxMaJscode2SessionResult = null;
+ try {
+ if (LoginConstant.APP_GOV.equals(formDTO.getApp())) {
+ wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(formDTO.getWxCode());
+ } else if (LoginConstant.APP_OPER.equals(formDTO.getApp())) {
+ wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(formDTO.getWxCode());
+ } else if (LoginConstant.APP_RESI.equals(formDTO.getApp())) {
+ wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(formDTO.getWxCode());
+ }
+ } catch (WxErrorException e) {
+ log.error("->[getMaOpenId]::error[{}]", "解析微信code失败");
+ }
+ if (null == wxMaJscode2SessionResult) {
+ throw new RenException("解析微信用户信息失败");
+ } else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) {
+ throw new RenException("获取微信openid失败");
+ }
+ return wxMaJscode2SessionResult;
+ }
+
+ /**
+ * 根据openId查询用户id
+ *
+ * @param formDTO
+ * @param wxMaJscode2SessionResult
+ * @return java.lang.String
+ * @author yinzuomei
+ * @since 2020/3/14 19:34
+ */
+ private String getUserId(LoginByWxCodeFormDTO formDTO, WxMaJscode2SessionResult wxMaJscode2SessionResult) {
+ WxLoginUserInfoFormDTO wxLoginUserInfoFormDTO=new WxLoginUserInfoFormDTO();
+ wxLoginUserInfoFormDTO.setApp(formDTO.getApp());
+ wxLoginUserInfoFormDTO.setOpenId(wxMaJscode2SessionResult.getOpenid());
+ Result userResult=epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO);
+ String userId="";
+ if(!userResult.success()){
+ throw new RenException("获取用户信息失败"+userResult.getMsg());
+ }
+ userId= (String) userResult.getData();
+ if (StringUtils.isBlank(userId)&&LoginConstant.APP_GOV.equals(formDTO.getApp())) {
+ //查询customer_staff待完善
+ } else if (StringUtils.isBlank(userId)&&LoginConstant.APP_OPER.equals(formDTO.getApp())) {
+ //查询oper_user待完善
+ } else if (StringUtils.isBlank(userId)&&LoginConstant.APP_RESI.equals(formDTO.getApp())) {
+ //查询customer_user
+ WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService()
+ .getUserInfo(wxMaJscode2SessionResult.getSessionKey(),
+ formDTO.getEncryptedData(),
+ formDTO.getIv());
+ CustomerUserDTO customerUserDTO=this.packageCustomerUserDTO(wxMaUserInfo);
+ Result saveCustomerUserResult=epmetUserFeignClient.saveCustomerUser(customerUserDTO);
+ if(!saveCustomerUserResult.success()){
+ throw new RenException("创建用户失败"+userResult.getMsg());
+ }
+ userId = saveCustomerUserResult.getData();
+ }
+ return userId;
+ }
+
+ /**
+ * @param wxMaUserInfo
+ * @return com.epmet.dto.CustomerUserDTO
+ * @Author yinzuomei
+ * @Description 微信信息封装为customer_user记录
+ * @Date 2020/3/17 18:22
+ **/
+ private CustomerUserDTO packageCustomerUserDTO(WxMaUserInfo wxMaUserInfo) {
+ CustomerUserDTO customerUserDTO = new CustomerUserDTO();
+ customerUserDTO.setCity(wxMaUserInfo.getCity());
+ customerUserDTO.setWxOpenId(wxMaUserInfo.getOpenId());
+ customerUserDTO.setNickname(wxMaUserInfo.getNickName());
+ customerUserDTO.setCountry(wxMaUserInfo.getCountry());
+ customerUserDTO.setHeadImgUrl(wxMaUserInfo.getAvatarUrl());
+ customerUserDTO.setCountry(wxMaUserInfo.getCountry());
+ customerUserDTO.setProvince(wxMaUserInfo.getProvince());
+ customerUserDTO.setSex(Integer.valueOf(wxMaUserInfo.getGender()));
+ return customerUserDTO;
+ }
+
+ /**
+ * 封装用户token值
+ *
+ * @param formDTO
+ * @param userId
+ * @param wxMaJscode2SessionResult
+ * @return java.lang.String
+ * @author yinzuomei
+ * @since 2020/3/14 19:34
+ */
+ private String packagingUserToken(LoginByWxCodeFormDTO formDTO,
+ String userId,
+ WxMaJscode2SessionResult wxMaJscode2SessionResult) {
+ // 生成token
+ Map map = new HashMap<>();
+ map.put("app", formDTO.getApp());
+ map.put("client", formDTO.getClient());
+ map.put("userId", userId);
+ String token = jwtTokenUtils.createToken(map);
+// logger.info("app:"+formDTO.getApp()+";client:"+formDTO.getClient()+";userId:"+userId+";生成token["+token+"]");
+ int expire = jwtTokenProperties.getExpire();
+ TokenDto tokenDto = new TokenDto();
+ tokenDto.setApp(formDTO.getApp());
+ tokenDto.setClient(formDTO.getClient());
+ tokenDto.setUserId(userId);
+ tokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid());
+ tokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey());
+ tokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid());
+ tokenDto.setToken(token);
+ tokenDto.setUpdateTime(System.currentTimeMillis());
+ tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
+ cpUserDetailRedis.set(tokenDto, expire);
+// logger.info("token过期时间:"+tokenUtil.getExpire(tokenDto.getApp(),tokenDto.getClient(),tokenDto.getUserId()));
+// logger.info("截止时间:"+ DateUtils.format(jwtTokenUtils.getExpiration(token),"yyyy-MM-dd HH:mm:ss"));
+ return token;
+ }
+
+ /**
+ * 手机号+密码登录接口
+ *
+ * @param formDTO
+ * @return com.epmet.commons.tools.utils.Result
+ * @author yinzuomei
+ * @since 2020/3/14 19:34
+ */
+ @Override
+ public Result loginByPassword(LoginByPassWordFormDTO formDTO) {
+ //1、验证码是否正确
+ boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha());
+ if(!flag){
+ return new Result().error(ErrorCode.CAPTCHA_ERROR);
+ }
+ //2、账号是否存在
+ //获取用户信息
+ PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO=new PasswordLoginUserInfoFormDTO();
+ passwordLoginUserInfoFormDTO.setApp(formDTO.getApp());
+ passwordLoginUserInfoFormDTO.setPhone(formDTO.getPhone());
+ Result userInfoResult=epmetUserFeignClient.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO);
+ logger.info(userInfoResult.getCode()+userInfoResult.getMsg());
+ if(!userInfoResult.success()||null==userInfoResult.getData()){
+ return new Result().error("账号不存在");
+ }
+ //3、密码是否正确
+ //密码错误
+ if(!PasswordUtils.matches(formDTO.getPassword(),userInfoResult.getData().getPassWord())){
+ throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR);
+ }
+ //4、生成token返回,且将TokenDto存到redis
+ UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
+ userTokenResultDTO.setToken(this.packagingUserToken(formDTO, userInfoResult.getData().getUserId()));
+ return new Result().ok(userTokenResultDTO);
+ }
+
+ /**
+ * 封装用户token值
+ *
+ * @param formDTO
+ * @param userId
+ * @return java.lang.String
+ * @author yinzuomei
+ * @since 2020/3/14 19:34
+ */
+ private String packagingUserToken(LoginByPassWordFormDTO formDTO,
+ String userId) {
+ // 生成token
+ Map map = new HashMap<>();
+ map.put("app", formDTO.getApp());
+ map.put("client", formDTO.getClient());
+ map.put("userId", userId);
+ String token = jwtTokenUtils.createToken(map);
+// logger.info("app:"+formDTO.getApp()+";client:"+formDTO.getClient()+";userId:"+userId+";生成token["+token+"]");
+ int expire = jwtTokenProperties.getExpire();
+ TokenDto tokenDto = new TokenDto();
+ tokenDto.setApp(formDTO.getApp());
+ tokenDto.setClient(formDTO.getClient());
+ tokenDto.setUserId(userId);
+ tokenDto.setToken(token);
+ tokenDto.setUpdateTime(System.currentTimeMillis());
+ tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
+ cpUserDetailRedis.set(tokenDto, expire);
+// logger.info("token过期时间:"+tokenUtil.getExpire(tokenDto.getApp(),tokenDto.getClient(),tokenDto.getUserId()));
+// logger.info("截止时间:"+ DateUtils.format(jwtTokenUtils.getExpiration(token),"yyyy-MM-dd HH:mm:ss"));
+ return token;
+ }
+
+
+ @Override
+ public Result logoutByToken(String token) {
+ //记录登出日志
+ //删除redis
+ //web端清空菜单栏和权限,小程序目前又
+ return null;
+ }
+}
diff --git a/epmet-auth/src/main/resources/bootstrap.yml b/epmet-auth/src/main/resources/bootstrap.yml
index c467033451..7b50c86084 100644
--- a/epmet-auth/src/main/resources/bootstrap.yml
+++ b/epmet-auth/src/main/resources/bootstrap.yml
@@ -85,8 +85,39 @@ ribbon:
ReadTimeout: 300000
ConnectTimeout: 300000
jwt:
- #秘钥
- # secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]
- secret: f4e2e52034348f86b67cde5[www.renren.io]
- #token有效时长,默认7天,单位秒
- expire: 604800
+ token:
+ #秘钥
+ secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]
+ #token有效时长,默认7天,单位秒
+ expire: 604800
+wx:
+ mp:
+ configs:
+ - appId: @wx.mp.configs.appId@
+ secret: @wx.mp.configs.secret@
+ token: @wx.mp.configs.token@
+ aesKey: @wx.mp.configs.aesKey@
+ ma:
+ configs:
+ - appid: @resi.wx.ma.appId@
+ secret: @resi.wx.ma.secret@
+ token: #微信小程序消息服务器配置的token
+ aesKey: #微信小程序消息服务器配置的EncodingAESKey
+ msgDataFormat: JSON
+# - appid: @gov.wx.ma.appId@
+# secret: @gov.wx.ma.secret@
+# token: #微信小程序消息服务器配置的token
+# aesKey: #微信小程序消息服务器配置的EncodingAESKey
+# msgDataFormat: JSON
+# - appid: @oper.wx.ma.appId@
+# secret: @oper.wx.ma.secret@
+# token: #微信小程序消息服务器配置的token
+# aesKey: #微信小程序消息服务器配置的EncodingAESKey
+# msgDataFormat: JSON
+ appId:
+ # 党群e事通-居民端小程序配置appId
+ resi: @resi.wx.ma.appId@
+ # 党群e事通-政府端小程序配置的appId
+ #gov: @gov.wx.ma.appId@
+ # 党群e事通-运营端小程序配置的appId
+ #oper: @oper.wx.ma.appId@
diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml
index c605d010dc..7eabb4ea78 100644
--- a/epmet-cloud-generator/src/main/resources/application.yml
+++ b/epmet-cloud-generator/src/main/resources/application.yml
@@ -9,7 +9,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
#MySQL配置
driverClassName: com.mysql.jdbc.Driver
- url: jdbc:mysql://47.104.224.45:3308/epmet_oper_crm?useUnicode=true&characterEncoding=UTF-8&useSSL=false
+ url: jdbc:mysql://47.104.224.45:3308/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: epmet
password: elink@833066
#oracle配置
diff --git a/epmet-commons/epmet-common-clienttoken/pom.xml b/epmet-commons/epmet-common-clienttoken/pom.xml
new file mode 100644
index 0000000000..66221b888c
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/pom.xml
@@ -0,0 +1,125 @@
+
+
+
+ epmet-commons
+ com.epmet
+ 2.0.0
+
+ 4.0.0
+
+ epmet-common-clienttoken
+ jar
+
+ epmet-common-clienttoken
+ http://www.example.com
+ 客户端token
+
+
+
+ com.epmet
+ epmet-commons-tools
+ ${project.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+ com.vaadin.external.google
+ android-json
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ compile
+
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure-processor
+ compile
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-starter-log4j2
+ provided
+
+
+
+ io.jsonwebtoken
+ jjwt
+ 0.7.0
+
+
+
+
+ ${project.artifactId}
+
+
+
+ maven-clean-plugin
+
+
+
+ maven-resources-plugin
+
+
+ maven-compiler-plugin
+
+ true
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+ ${project.build.sourceEncoding}
+
+
+
+ maven-surefire-plugin
+
+
+ maven-war-plugin
+
+
+ maven-install-plugin
+
+
+ maven-deploy-plugin
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.4
+
+
+
+ true
+
+
+
+
+
+
+ ${project.basedir}/src/main/java
+
+
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/annotation/Login.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/annotation/Login.java
new file mode 100644
index 0000000000..e5a19a10c5
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/annotation/Login.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.epmet.common.token.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 登录效验
+ * @author chenshun
+ * @email sunlightcs@gmail.com
+ * @date 2017/9/23 14:30
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Login {
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/annotation/NeedClientToken.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/annotation/NeedClientToken.java
new file mode 100644
index 0000000000..4c2cd0b553
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/annotation/NeedClientToken.java
@@ -0,0 +1,13 @@
+package com.epmet.common.token.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.CLASS)//生命注释保留时长,这里无需反射使用,使用CLASS级别
+@Target(ElementType.METHOD)//生命可以使用此注解的元素级别类型(如类、方法变量等)
+public @interface NeedClientToken {
+
+ boolean value() default true;
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java
new file mode 100644
index 0000000000..b546108bc8
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/constant/LoginConstant.java
@@ -0,0 +1,33 @@
+package com.epmet.common.token.constant;
+
+/**
+ * @Description app、client
+ * @Author yinzuomei
+ * @Date 2020/3/14 20:12
+ */
+public interface LoginConstant {
+ /**
+ * 政府端
+ */
+ String APP_GOV = "gov";
+
+ /**
+ * 居民端
+ */
+ String APP_RESI = "resi";
+
+ /**
+ * 运营端
+ */
+ String APP_OPER = "oper";
+
+ /**
+ * web
+ */
+ String CLIENT_WEB = "web";
+
+ /**
+ * 微信小程序
+ */
+ String CLIENT_WXMP = "wxmp";
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByPassWordFormDTO.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByPassWordFormDTO.java
new file mode 100644
index 0000000000..742a38844e
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByPassWordFormDTO.java
@@ -0,0 +1,40 @@
+package com.epmet.common.token.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Description 手机号+密码登录接口入参
+ * @Author yinzuomei
+ * @Date 2020/3/14 19:46
+ */
+@Data
+public class LoginByPassWordFormDTO extends LoginCommonFormDTO implements Serializable {
+ private static final long serialVersionUID = -7507437651048051183L;
+
+ /**
+ * 手机号
+ */
+ @NotBlank(message = "手机号不能为空")
+ private String phone;
+
+ /**
+ * 密码
+ */
+ @NotBlank(message = "密码不能为空")
+ private String password;
+
+ /**
+ * 验证码
+ */
+ @NotBlank(message="验证码不能为空")
+ private String captcha;
+
+ /**
+ * 唯一标识
+ */
+ @NotBlank(message="唯一标识不能为空")
+ private String uuid;
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByWxCodeFormDTO.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByWxCodeFormDTO.java
new file mode 100644
index 0000000000..149514a0a3
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginByWxCodeFormDTO.java
@@ -0,0 +1,34 @@
+package com.epmet.common.token.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Description 微信小程序登录接口入参
+ * @Author yinzuomei
+ * @Date 2020/3/14 14:39
+ */
+@Data
+public class LoginByWxCodeFormDTO extends LoginCommonFormDTO implements Serializable {
+ private static final long serialVersionUID = 7950477424010655108L;
+
+ /**
+ * 微信code
+ */
+ @NotBlank(message = "wxCode不能为空")
+ private String wxCode;
+
+ /**
+ * 用户信息
+ */
+ @NotBlank(message = "用户信息不能为空")
+ private String encryptedData;
+
+ /**
+ * 加密算法的初始向量
+ */
+ @NotBlank(message = "初始向量不能为空")
+ private String iv;
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginCommonFormDTO.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginCommonFormDTO.java
new file mode 100644
index 0000000000..9b2390388e
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/form/LoginCommonFormDTO.java
@@ -0,0 +1,28 @@
+package com.epmet.common.token.dto.form;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * @Description 登录接口通用入参
+ * @Author yinzuomei
+ * @Date 2020/3/14 19:47
+ */
+@Data
+public class LoginCommonFormDTO implements Serializable {
+ private static final long serialVersionUID = -5582224784914714820L;
+
+ /**
+ * 政府端:gov、居民端:resi、运营端:oper
+ */
+ @NotBlank(message = "app不能为空(政府端:gov、居民端:resi、运营端:oper)")
+ private String app;
+
+ /**
+ * PC端:web、微信小程序:wxmp
+ */
+ @NotBlank(message = "client不能为空(PC端:web、微信小程序:wxmp)")
+ private String client;
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/result/UserTokenResultDTO.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/result/UserTokenResultDTO.java
new file mode 100644
index 0000000000..e5296bf42b
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/dto/result/UserTokenResultDTO.java
@@ -0,0 +1,20 @@
+package com.epmet.common.token.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description 登录接口返参DTO
+ * @Author yinzuomei
+ * @Date 2020/3/14 15:10
+ */
+@Data
+public class UserTokenResultDTO implements Serializable {
+ private static final long serialVersionUID = 5214475907074876716L;
+
+ /**
+ * 令牌
+ */
+ private String token;
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/enums/ErrorCode.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/enums/ErrorCode.java
new file mode 100644
index 0000000000..2f9cdd1376
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/enums/ErrorCode.java
@@ -0,0 +1,47 @@
+package com.epmet.common.token.enums;
+
+
+import com.epmet.common.token.error.IErrorCode;
+
+/**
+ * client token错误码
+ *
+ * @author rongchao
+ * @Date 18-11-24
+ */
+public enum ErrorCode implements IErrorCode {
+
+ SUCCESS(0, "请求成功"),
+
+ ERR10001(10001, "token解析失败"),
+ ERR10002(10002, "token失效"),
+ ERR10003(10003, "token生成失败,请重试。"),
+ ERR10004(10004, "返回的Object类型不是EsuaResponse,无法添加token!"),
+ ERR10005(10005, "token不能为空"),
+
+ ERR500(500, "Internal Server Error"),
+ ERR501(501, "参数绑定异常"),
+
+ ERR(ErrorCode.COMMON_ERR_CODE, "其他异常");
+
+ private int code;
+
+ private String msg;
+
+ ErrorCode(final int code, final String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ public static final int COMMON_ERR_CODE = -1;
+
+ @Override
+ public int getCode() {
+ return code;
+ }
+
+ @Override
+ public String getMsg() {
+ return msg;
+ }
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/error/IErrorCode.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/error/IErrorCode.java
new file mode 100644
index 0000000000..9b58ccc96e
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/error/IErrorCode.java
@@ -0,0 +1,11 @@
+package com.epmet.common.token.error;
+
+/**
+ * @author rongchao
+ * @Date 18-11-20
+ */
+public interface IErrorCode {
+ int getCode();
+
+ String getMsg();
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/property/TokenPropertise.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/property/TokenPropertise.java
new file mode 100644
index 0000000000..1552871f39
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/property/TokenPropertise.java
@@ -0,0 +1,23 @@
+package com.epmet.common.token.property;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author rongchao
+ * @Date 18-12-3
+ */
+@Component
+@ConfigurationProperties(prefix = "token")
+public class TokenPropertise {
+
+ private long expire = 7200L;
+
+ public long getExpire() {
+ return expire;
+ }
+
+ public void setExpire(long expire) {
+ this.expire = expire;
+ }
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/TokenUtil.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/TokenUtil.java
new file mode 100644
index 0000000000..efefc5e16a
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/TokenUtil.java
@@ -0,0 +1,54 @@
+package com.epmet.common.token.util;
+
+import com.epmet.common.token.property.TokenPropertise;
+import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.utils.CpUserDetailRedis;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * token服务类
+ *
+ * @author rongchao
+ * @Date 18-10-31
+ */
+@Component
+public class TokenUtil {
+
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ @Autowired
+ private TokenPropertise tokenPropertise;
+
+ @Autowired
+ private CpUserDetailRedis redisUtils;
+
+ public TokenDto getTokenInfo(String app, String client, String userId) {
+ TokenDto tokenDto = redisUtils.get(app,client,userId);
+ return tokenDto;
+ }
+
+ public void expireToken(String app,String client,String userId) {
+ redisUtils.logout(app,client,userId);
+ }
+
+ public boolean delayToken(String app,String client,String userId) {
+ return redisUtils.expire(app, client,userId,tokenPropertise.getExpire());
+ }
+
+ /**
+ * 获取token过期时间
+ *
+ * @param app
+ * @param client
+ * @param userId
+ * @return long
+ * @author yujintao
+ * @date 2019/9/9 14:19
+ */
+ public long getExpire(String app,String client,String userId) {
+ return redisUtils.getExpire(app,client,userId);
+ }
+}
diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/UserUtil.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/UserUtil.java
new file mode 100644
index 0000000000..03f2a2bb26
--- /dev/null
+++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/UserUtil.java
@@ -0,0 +1,55 @@
+package com.epmet.common.token.util;
+
+import com.epmet.commons.tools.constant.Constant;
+import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.utils.WebUtil;
+
+/**
+ * 用户工具类
+ *
+ * @author rongchao
+ * @Date 18-11-20
+ */
+public class UserUtil {
+
+ /**
+ * 获取当前用户信息
+ *
+ * @return
+ */
+ public static TokenDto getCurrentUser() {
+ return (TokenDto) WebUtil.getAttributesFromRequest(Constant.APP_USER_KEY);
+ }
+
+ /**
+ * 获取当前用户信息
+ *
+ * @return com.elink.esua.common.token.dto.UserTokenDto
+ * @author yujintao
+ * @date 2018/12/5 9:24
+ */
+ public static TokenDto getCurrentUserInfo() {
+ TokenDto tokenDto = getCurrentUser();
+ if (tokenDto == null) {
+ return null;
+ }
+ return tokenDto;
+ }
+
+ /**
+ * 获取当前用户ID
+ *
+ * @return
+ */
+ public static String getCurrentUserId() {
+ TokenDto tokenDto = getCurrentUser();
+ if (tokenDto == null) {
+ return null;
+ }
+ return tokenDto.getUserId();
+ }
+
+ public static void setCurrentUser(TokenDto user) {
+ WebUtil.setAttributesFromRequest(Constant.APP_USER_KEY, user);
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools-phone/pom.xml b/epmet-commons/epmet-commons-tools-phone/pom.xml
new file mode 100644
index 0000000000..7e8d052ee8
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-phone/pom.xml
@@ -0,0 +1,41 @@
+
+
+
+ epmet-commons
+ com.epmet
+ 2.0.0
+
+ 4.0.0
+
+ epmet-commons-tools-phone
+ jar
+
+
+
+ com.googlecode.libphonenumber
+ libphonenumber
+ 8.8.8
+
+
+ com.googlecode.libphonenumber
+ carrier
+ 1.75
+
+
+ com.googlecode.libphonenumber
+ geocoder
+ 2.85
+
+
+ com.googlecode.libphonenumber
+ prefixmapper
+ 2.85
+
+
+
+
+ ${project.artifactId}
+
+
diff --git a/epmet-commons/epmet-commons-tools-phone/src/main/java/com/epmet/commons/tools/utils/PhoneDto.java b/epmet-commons/epmet-commons-tools-phone/src/main/java/com/epmet/commons/tools/utils/PhoneDto.java
new file mode 100644
index 0000000000..8bc240a16e
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-phone/src/main/java/com/epmet/commons/tools/utils/PhoneDto.java
@@ -0,0 +1,79 @@
+package com.epmet.commons.tools.utils;
+
+/**
+ * 电话DTO
+ *
+ * @author rongchao
+ * @Date 18-12-11
+ */
+public class PhoneDto {
+
+ /**
+ * 省份名称
+ */
+ private String provinceName;
+
+ /**
+ * 城市名称
+ */
+ private String cityName;
+
+ /**
+ * 运营商:移动/电信/联通
+ */
+ private String carrier;
+
+ /**
+ * 省份名称
+ *
+ * @return 获取provinceName属性值
+ */
+ public String getProvinceName() {
+ return provinceName;
+ }
+
+ /**
+ * 省份名称
+ *
+ * @param provinceName 设置 provinceName 属性值为参数值 provinceName
+ */
+ public void setProvinceName(String provinceName) {
+ this.provinceName = provinceName;
+ }
+
+ /**
+ * 城市名称
+ *
+ * @return 获取cityName属性值
+ */
+ public String getCityName() {
+ return cityName;
+ }
+
+ /**
+ * 城市名称
+ *
+ * @param cityName 设置 cityName 属性值为参数值 cityName
+ */
+ public void setCityName(String cityName) {
+ this.cityName = cityName;
+ }
+
+ /**
+ * 运营商:移动/电信/联通
+ *
+ * @return 获取carrier属性值
+ */
+ public String getCarrier() {
+ return carrier;
+ }
+
+ /**
+ * 运营商:移动/电信/联通
+ *
+ * @param carrier 设置 carrier 属性值为参数值 carrier
+ */
+ public void setCarrier(String carrier) {
+ this.carrier = carrier;
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools-phone/src/main/java/com/epmet/commons/tools/utils/PhoneUtil.java b/epmet-commons/epmet-commons-tools-phone/src/main/java/com/epmet/commons/tools/utils/PhoneUtil.java
new file mode 100644
index 0000000000..022525592c
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-phone/src/main/java/com/epmet/commons/tools/utils/PhoneUtil.java
@@ -0,0 +1,178 @@
+package com.epmet.commons.tools.utils;
+
+/**
+ * @author rongchao
+ * @Date 18-12-11
+ */
+
+
+
+import com.google.i18n.phonenumbers.PhoneNumberToCarrierMapper;
+import com.google.i18n.phonenumbers.PhoneNumberUtil;
+import com.google.i18n.phonenumbers.Phonenumber;
+import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
+import com.google.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder;
+
+import java.util.Locale;
+
+/**
+ * 手机号归属地查询
+ * jar依赖:com.googlecode.libphonenumber(Libphonenumber、Geocoder、Prefixmapper
+ * 、Carrier) pom依赖:http://mvnrepository.com/search?q=libphonenumber
+ * 项目地址:https://github.com/googlei18n/libphonenumber
+ *
+ * @author rongchao
+ * @Date 18-12-11
+ */
+public class PhoneUtil {
+
+ /**
+ * 直辖市
+ */
+ private final static String[] MUNICIPALITY = {"北京市", "天津市", "上海市", "重庆市"};
+
+ /**
+ * 自治区
+ */
+ private final static String[] AUTONOMOUS_REGION = {"新疆", "内蒙古", "西藏", "宁夏", "广西"};
+
+ private static PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil
+ .getInstance();
+
+ /**
+ * 提供与电话号码相关的运营商信息
+ */
+ private static PhoneNumberToCarrierMapper carrierMapper = PhoneNumberToCarrierMapper
+ .getInstance();
+
+ /**
+ * 提供与电话号码有关的地理信息
+ */
+ private static PhoneNumberOfflineGeocoder geocoder = PhoneNumberOfflineGeocoder
+ .getInstance();
+
+ /**
+ * 中国大陆区区号
+ */
+ private final static int COUNTRY_CODE = 86;
+
+ /**
+ * 根据手机号 判断手机号是否有效
+ *
+ * @param phoneNumber 手机号码
+ * @return true-有效 false-无效
+ */
+ public static boolean checkPhoneNumber(String phoneNumber) {
+ long phone = Long.parseLong(phoneNumber);
+
+ PhoneNumber pn = new PhoneNumber();
+ pn.setCountryCode(COUNTRY_CODE);
+ pn.setNationalNumber(phone);
+
+ return phoneNumberUtil.isValidNumber(pn);
+
+ }
+
+ /**
+ * 根据手机号 判断手机运营商
+ *
+ * @param phoneNumber 手机号码
+ * @return 如:广东省广州市移动
+ */
+ public static String getCarrier(String phoneNumber) {
+
+ long phone = Long.parseLong(phoneNumber);
+
+ PhoneNumber pn = new PhoneNumber();
+ pn.setCountryCode(COUNTRY_CODE);
+ pn.setNationalNumber(phone);
+ // 返回结果只有英文,自己转成成中文
+ String carrierEn = carrierMapper.getNameForNumber(pn, Locale.ENGLISH);
+ String carrierZh = "";
+ switch (carrierEn) {
+ case "China Mobile":
+ carrierZh += "移动";
+ break;
+ case "China Unicom":
+ carrierZh += "联通";
+ break;
+ case "China Telecom":
+ carrierZh += "电信";
+ break;
+ default:
+ break;
+ }
+ return carrierZh;
+ }
+
+ /**
+ * 根据手机号 获取手机归属地
+ *
+ * @param phoneNumber 手机号码
+ * @return 如:广东省广州市
+ */
+ public static String getGeo(String phoneNumber) {
+ long phone = Long.parseLong(phoneNumber);
+
+ Phonenumber.PhoneNumber pn = new Phonenumber.PhoneNumber();
+ pn.setCountryCode(COUNTRY_CODE);
+ pn.setNationalNumber(phone);
+ return geocoder.getDescriptionForNumber(pn, Locale.CHINESE);
+ }
+
+ /**
+ * 根据手机号 获取手机信息模型
+ *
+ *
+ * 若返回值为null,则说明该号码无效
+ *
+ *
+ * @param phoneNumber 手机号码
+ * @return 手机信息模型PhoneModel
+ */
+ public static PhoneDto getPhoneDto(String phoneNumber) {
+ if (checkPhoneNumber(phoneNumber)) {
+ String geo = getGeo(phoneNumber);
+ PhoneDto phoneDto = new PhoneDto();
+ String carrier = getCarrier(phoneNumber);
+ phoneDto.setCarrier(carrier);
+ // 直辖市
+ for (String val : MUNICIPALITY) {
+ if (geo.equals(val)) {
+ phoneDto.setProvinceName(val.replace("市", ""));
+ phoneDto.setCityName(val);
+ return phoneDto;
+ }
+ }
+ // 自治区
+ for (String val : AUTONOMOUS_REGION) {
+ if (geo.startsWith(val)) {
+ phoneDto.setProvinceName(val);
+ phoneDto.setCityName(geo.replace(val, ""));
+ return phoneDto;
+ }
+ }
+
+ // 其它
+ String[] splitArr = geo.split("省");
+ if (splitArr != null && splitArr.length == 2) {
+ phoneDto.setProvinceName(splitArr[0]);
+ phoneDto.setCityName(splitArr[1]);
+ return phoneDto;
+ }
+ }
+ return null;
+ }
+
+ public static void main(String[] args) {
+ PhoneDto phoneDto = PhoneUtil.getPhoneDto("13701001254");
+ if (phoneDto != null) {
+ System.out.println(phoneDto.getProvinceName());
+ System.out.println(phoneDto.getCityName());
+ System.out.println(phoneDto.getCarrier());
+ } else {
+ System.err.println("该号码无效");
+ }
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-ma/pom.xml b/epmet-commons/epmet-commons-tools-wx-ma/pom.xml
new file mode 100644
index 0000000000..7380ada9e3
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-ma/pom.xml
@@ -0,0 +1,34 @@
+
+
+
+ epmet-commons
+ com.epmet
+ 2.0.0
+
+ 4.0.0
+
+ 1.0.0
+ epmet-commons-tools-wx-ma
+ jar
+
+
+
+ org.projectlombok
+ lombok
+ provided
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ compile
+
+
+ com.github.binarywang
+ weixin-java-miniapp
+ 3.6.0
+
+
+
+
diff --git a/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java
new file mode 100644
index 0000000000..8d7aaa463d
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java
@@ -0,0 +1,65 @@
+package com.epmet.utils;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import com.epmet.wx.ma.WxMaConfig;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * 获取小程序业务工具
+ *
+ * @author work@yujt.net.cn
+ * @date 2019/11/25 13:29
+ */
+@Component
+public class WxMaServiceUtils {
+
+ @Value("${wx.ma.appId.resi}")
+ private String APPID_RESI;
+
+ /*@Value("${wx.ma.appId.gov}")
+ private String APPID_GOV;
+
+ @Value("${wx.ma.appId.oper}")
+ private String APPID_OPER;*/
+
+ /**
+ * 获取党群e事通-居民端小程序配置
+ *
+ * @return cn.binarywang.wx.miniapp.api.WxMaService
+ * @author yinzuomei
+ * @date 2020/03/13 10:44
+ */
+ public final WxMaService resiWxMaService() {
+ final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI);
+ return wxMaService;
+ }
+
+ /**
+ * 获取党群e事通-政府端小程序配置
+ *
+ * @return cn.binarywang.wx.miniapp.api.WxMaService
+ * @author yinzuomei
+ * @date 2020/03/13 10:44
+ */
+ public final WxMaService govWxMaService() {
+// final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV);
+ final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI);
+ return wxMaService;
+ }
+
+ /**
+ *
+ * 获取党群e事通-运营端小程序配置
+ *
+ * @params []
+ * @return cn.binarywang.wx.miniapp.api.WxMaService
+ * @author yinzuomei
+ * @since 2020/03/13 10:44
+ */
+ public final WxMaService operWxMaService() {
+// final WxMaService wxMaService = WxMaConfig.getMaService(APPID_OPER);
+ final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI);
+ return wxMaService;
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/wx/ma/WxMaConfig.java b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/wx/ma/WxMaConfig.java
new file mode 100644
index 0000000000..073b701bd2
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/wx/ma/WxMaConfig.java
@@ -0,0 +1,148 @@
+package com.epmet.wx.ma;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
+import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage;
+import cn.binarywang.wx.miniapp.bean.WxMaTemplateData;
+import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage;
+import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
+import cn.binarywang.wx.miniapp.message.WxMaMessageHandler;
+import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author Binary Wang
+ */
+@Configuration
+@EnableConfigurationProperties(WxMaProperties.class)
+public class WxMaConfig {
+
+ private WxMaProperties properties;
+
+ private static Map routers = Maps.newHashMap();
+ private static Map maServices = Maps.newHashMap();
+
+ @Autowired
+ public WxMaConfig(WxMaProperties properties) {
+ this.properties = properties;
+ }
+
+ public static WxMaService getMaService(String appid) {
+ WxMaService wxService = maServices.get(appid);
+ if (wxService == null) {
+ throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
+ }
+
+ return wxService;
+ }
+
+ public static WxMaMessageRouter getRouter(String appid) {
+ return routers.get(appid);
+ }
+
+ @PostConstruct
+ public void init() {
+ List configs = this.properties.getConfigs();
+ if (configs == null) {
+ throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!");
+ }
+
+ maServices = configs.stream()
+ .map(a -> {
+ WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
+ config.setAppid(a.getAppid());
+ config.setSecret(a.getSecret());
+ config.setToken(a.getToken());
+ config.setAesKey(a.getAesKey());
+ config.setMsgDataFormat(a.getMsgDataFormat());
+
+ WxMaService service = new WxMaServiceImpl();
+ service.setWxMaConfig(config);
+ routers.put(a.getAppid(), this.newRouter(service));
+ return service;
+ }).collect(Collectors.toMap(s -> s.getWxMaConfig().getAppid(), a -> a));
+ }
+
+ private WxMaMessageRouter newRouter(WxMaService service) {
+ final WxMaMessageRouter router = new WxMaMessageRouter(service);
+ router
+ .rule().handler(logHandler).next()
+ .rule().async(false).content("模板").handler(templateMsgHandler).end()
+ .rule().async(false).content("文本").handler(textHandler).end()
+ .rule().async(false).content("图片").handler(picHandler).end()
+ .rule().async(false).content("二维码").handler(qrcodeHandler).end();
+ return router;
+ }
+
+ private final WxMaMessageHandler templateMsgHandler = (wxMessage, context, service, sessionManager) -> {
+ service.getMsgService().sendTemplateMsg(WxMaTemplateMessage.builder()
+ .templateId("此处更换为自己的模板id")
+ .formId("自己替换可用的formid")
+ .data(Lists.newArrayList(
+ new WxMaTemplateData("keyword1", "339208499", "#173177")))
+ .toUser(wxMessage.getFromUser())
+ .build());
+ return null;
+ };
+
+ private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> {
+ System.out.println("收到消息:" + wxMessage.toString());
+ service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson())
+ .toUser(wxMessage.getFromUser()).build());
+ return null;
+ };
+
+ private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> {
+ service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息")
+ .toUser(wxMessage.getFromUser()).build());
+ return null;
+ };
+
+ private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> {
+ try {
+ WxMediaUploadResult uploadResult = service.getMediaService()
+ .uploadMedia("image", "png",
+ ClassLoader.getSystemResourceAsStream("tmp.png"));
+ service.getMsgService().sendKefuMsg(
+ WxMaKefuMessage
+ .newImageBuilder()
+ .mediaId(uploadResult.getMediaId())
+ .toUser(wxMessage.getFromUser())
+ .build());
+ } catch (WxErrorException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ };
+
+ private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> {
+ try {
+ final File file = service.getQrcodeService().createQrcode("123", 430);
+ WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file);
+ service.getMsgService().sendKefuMsg(
+ WxMaKefuMessage
+ .newImageBuilder()
+ .mediaId(uploadResult.getMediaId())
+ .toUser(wxMessage.getFromUser())
+ .build());
+ } catch (WxErrorException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ };
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/wx/ma/WxMaProperties.java b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/wx/ma/WxMaProperties.java
new file mode 100644
index 0000000000..3d5dc33b4c
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/wx/ma/WxMaProperties.java
@@ -0,0 +1,48 @@
+package com.epmet.wx.ma;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import java.util.List;
+
+/**
+ * 微信小程序框架配置类
+ *
+ * @author rongchao
+ * @Date 19-5-13
+ */
+@Data
+@ConfigurationProperties(prefix = "wx.ma")
+public class WxMaProperties {
+
+ private List configs;
+
+ @Data
+ public static class Config {
+ /**
+ * 设置微信小程序的appid
+ */
+ private String appid;
+
+ /**
+ * 设置微信小程序的Secret
+ */
+ private String secret;
+
+ /**
+ * 设置微信小程序消息服务器配置的token
+ */
+ private String token;
+
+ /**
+ * 设置微信小程序消息服务器配置的EncodingAESKey
+ */
+ private String aesKey;
+
+ /**
+ * 消息格式,XML或者JSON
+ */
+ private String msgDataFormat;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/.editorconfig b/epmet-commons/epmet-commons-tools-wx-mp/.editorconfig
new file mode 100644
index 0000000000..775be5ba05
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/.editorconfig
@@ -0,0 +1,14 @@
+# EditorConfig: http://editorconfig.org/
+
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/.travis.yml b/epmet-commons/epmet-commons-tools-wx-mp/.travis.yml
new file mode 100644
index 0000000000..5d2a7698b9
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/.travis.yml
@@ -0,0 +1,13 @@
+language: java
+jdk:
+ - openjdk8
+
+script: "mvn clean package -Dmaven.test.skip=true"
+
+branches:
+ only:
+ - master
+
+notifications:
+ email:
+ - binarywang@vip.qq.com
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/README.md b/epmet-commons/epmet-commons-tools-wx-mp/README.md
new file mode 100644
index 0000000000..790d56ba1b
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/README.md
@@ -0,0 +1,58 @@
+[](https://gitee.com/binary/weixin-java-mp-demo-springboot)
+[](https://github.com/binarywang/weixin-java-mp-demo-springboot)
+[](https://travis-ci.org/binarywang/weixin-java-mp-demo-springboot)
+-----------------------
+
+### 本Demo基于Spring Boot构建,实现微信公众号后端开发功能。
+### 本项目为WxJava的Demo演示程序,更多Demo请[查阅此处](https://github.com/Wechat-Group/WxJava/blob/master/demo.md)。
+#### 如有问题请[【在此提问】](https://github.com/binarywang/weixin-java-mp-demo-springboot/issues),谢谢配合。
+
+
+
+## 使用步骤:
+1. 请注意,本demo为简化代码编译时加入了lombok支持,如果不了解lombok的话,请先学习下相关知识,比如可以阅读[此文章](https://mp.weixin.qq.com/s/cUc-bUcprycADfNepnSwZQ);
+1. 另外,新手遇到问题,请务必先阅读[【开发文档首页】](https://github.com/Wechat-Group/WxJava/wiki)的常见问题部分,可以少走很多弯路,节省不少时间。
+1. 配置:复制 `/src/main/resources/application.yml.template` 或修改其扩展名生成 `application.yml` 文件,根据自己需要填写相关配置(需要注意的是:yml文件内的属性冒号后面的文字之前需要加空格,可参考已有配置,否则属性会设置不成功);
+2. 主要配置说明如下:
+```
+wx:
+ mp:
+ configs:
+ - appId: 1111 (一个公众号的appid)
+ secret: 1111(公众号的appsecret)
+ token: 111 (接口配置里的Token值)
+ aesKey: 111 (接口配置里的EncodingAESKey值)
+ - appId: 2222 (另一个公众号的appid,以下同上)
+ secret: 1111
+ token: 111
+ aesKey: 111
+```
+3. 运行Java程序:`WxMpDemoApplication`;
+4. 配置微信公众号中的接口地址:http://公网可访问域名/wx/portal/xxxxx (注意,xxxxx为对应公众号的appid值);
+5. 根据自己需要修改各个handler的实现,加入自己的业务逻辑。
+
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/pom.xml b/epmet-commons/epmet-commons-tools-wx-mp/pom.xml
new file mode 100644
index 0000000000..5f69e61f1e
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/pom.xml
@@ -0,0 +1,60 @@
+
+
+ 4.0.0
+
+
+ com.epmet
+ epmet-commons
+ 2.0.0
+
+
+ 1.0.0
+ epmet-commons-tools-wx-mp
+ jar
+
+
+
+
+
+ 3.6.0
+ 1.8
+ 1.8
+ UTF-8
+ UTF-8
+ zh_CN
+ wechat-mp-demo
+
+
+
+
+ com.github.binarywang
+ weixin-java-mp
+ ${weixin-java-mp.version}
+
+
+
+ org.projectlombok
+ lombok
+ provided
+
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ compile
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ compile
+ true
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure-processor
+ compile
+ true
+
+
+
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/AbstractBuilder.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/AbstractBuilder.java
new file mode 100644
index 0000000000..8dad467ffd
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/AbstractBuilder.java
@@ -0,0 +1,17 @@
+package com.epmet.wx.mp.builder;
+
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+public abstract class AbstractBuilder {
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+ public abstract WxMpXmlOutMessage build(String content,
+ WxMpXmlMessage wxMessage, WxMpService service);
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/ImageBuilder.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/ImageBuilder.java
new file mode 100644
index 0000000000..8afe9679d9
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/ImageBuilder.java
@@ -0,0 +1,24 @@
+package com.epmet.wx.mp.builder;
+
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutImageMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+public class ImageBuilder extends AbstractBuilder {
+
+ @Override
+ public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage,
+ WxMpService service) {
+
+ WxMpXmlOutImageMessage m = WxMpXmlOutMessage.IMAGE().mediaId(content)
+ .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
+ .build();
+
+ return m;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/TextBuilder.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/TextBuilder.java
new file mode 100644
index 0000000000..9486aef270
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/builder/TextBuilder.java
@@ -0,0 +1,22 @@
+package com.epmet.wx.mp.builder;
+
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+public class TextBuilder extends AbstractBuilder {
+
+ @Override
+ public WxMpXmlOutMessage build(String content, WxMpXmlMessage wxMessage,
+ WxMpService service) {
+ WxMpXmlOutTextMessage m = WxMpXmlOutMessage.TEXT().content(content)
+ .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
+ .build();
+ return m;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/config/WxMpConfiguration.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/config/WxMpConfiguration.java
new file mode 100644
index 0000000000..f2df571c42
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/config/WxMpConfiguration.java
@@ -0,0 +1,113 @@
+package com.epmet.wx.mp.config;
+
+import com.epmet.wx.mp.handler.*;
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.mp.api.WxMpMessageRouter;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
+import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static me.chanjar.weixin.common.api.WxConsts.EventType;
+import static me.chanjar.weixin.common.api.WxConsts.EventType.SUBSCRIBE;
+import static me.chanjar.weixin.common.api.WxConsts.EventType.UNSUBSCRIBE;
+import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType.CLICK;
+import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType.VIEW;
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType.EVENT;
+import static me.chanjar.weixin.mp.constant.WxMpEventConstants.CustomerService.*;
+import static me.chanjar.weixin.mp.constant.WxMpEventConstants.POI_CHECK_NOTIFY;
+
+/**
+ * wechat mp configuration
+ *
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@AllArgsConstructor
+@Configuration
+@EnableConfigurationProperties(WxMpProperties.class)
+public class WxMpConfiguration {
+ private final LogHandler logHandler;
+ private final NullHandler nullHandler;
+ private final KfSessionHandler kfSessionHandler;
+ private final StoreCheckNotifyHandler storeCheckNotifyHandler;
+ private final LocationHandler locationHandler;
+ private final MenuHandler menuHandler;
+ private final MsgHandler msgHandler;
+ private final UnsubscribeHandler unsubscribeHandler;
+ private final SubscribeHandler subscribeHandler;
+ private final ScanHandler scanHandler;
+ private final WxMpProperties properties;
+
+ @Bean
+ public WxMpService wxMpService() {
+ // 代码里 getConfigs()处报错的同学,请注意仔细阅读项目说明,你的IDE需要引入lombok插件!!!!
+ final List configs = this.properties.getConfigs();
+ if (configs == null) {
+ throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!");
+ }
+
+ WxMpService service = new WxMpServiceImpl();
+ service.setMultiConfigStorages(configs
+ .stream().map(a -> {
+ WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl();
+ configStorage.setAppId(a.getAppId());
+ configStorage.setSecret(a.getSecret());
+ configStorage.setToken(a.getToken());
+ configStorage.setAesKey(a.getAesKey());
+ return configStorage;
+ }).collect(Collectors.toMap(WxMpDefaultConfigImpl::getAppId, a -> a, (o, n) -> o)));
+ return service;
+ }
+
+ @Bean
+ public WxMpMessageRouter messageRouter(WxMpService wxMpService) {
+ final WxMpMessageRouter newRouter = new WxMpMessageRouter(wxMpService);
+
+ // 记录所有事件的日志 (异步执行)
+ newRouter.rule().handler(this.logHandler).next();
+
+ // 接收客服会话管理事件
+ newRouter.rule().async(false).msgType(EVENT).event(KF_CREATE_SESSION)
+ .handler(this.kfSessionHandler).end();
+ newRouter.rule().async(false).msgType(EVENT).event(KF_CLOSE_SESSION)
+ .handler(this.kfSessionHandler).end();
+ newRouter.rule().async(false).msgType(EVENT).event(KF_SWITCH_SESSION)
+ .handler(this.kfSessionHandler).end();
+
+ // 门店审核事件
+ newRouter.rule().async(false).msgType(EVENT).event(POI_CHECK_NOTIFY).handler(this.storeCheckNotifyHandler).end();
+
+ // 自定义菜单事件
+ newRouter.rule().async(false).msgType(EVENT).event(CLICK).handler(this.menuHandler).end();
+
+ // 点击菜单连接事件
+ newRouter.rule().async(false).msgType(EVENT).event(VIEW).handler(this.nullHandler).end();
+
+ // 关注事件
+ newRouter.rule().async(false).msgType(EVENT).event(SUBSCRIBE).handler(this.subscribeHandler).end();
+
+ // 取消关注事件
+ newRouter.rule().async(false).msgType(EVENT).event(UNSUBSCRIBE).handler(this.unsubscribeHandler).end();
+
+ // 上报地理位置事件
+ newRouter.rule().async(false).msgType(EVENT).event(EventType.LOCATION).handler(this.locationHandler).end();
+
+ // 接收地理位置消息
+ newRouter.rule().async(false).msgType(XmlMsgType.LOCATION).handler(this.locationHandler).end();
+
+ // 扫码事件
+ newRouter.rule().async(false).msgType(EVENT).event(EventType.SCAN).handler(this.scanHandler).end();
+
+ // 默认
+ newRouter.rule().async(false).handler(this.msgHandler).end();
+
+ return newRouter;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/config/WxMpProperties.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/config/WxMpProperties.java
new file mode 100644
index 0000000000..3e5c181948
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/config/WxMpProperties.java
@@ -0,0 +1,46 @@
+package com.epmet.wx.mp.config;
+
+import com.epmet.wx.mp.utils.JsonUtils;
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import java.util.List;
+
+/**
+ * wechat mp properties
+ *
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Data
+@ConfigurationProperties(prefix = "wx.mp")
+public class WxMpProperties {
+ private List configs;
+
+ @Data
+ public static class MpConfig {
+ /**
+ * 设置微信公众号的appid
+ */
+ private String appId;
+
+ /**
+ * 设置微信公众号的app secret
+ */
+ private String secret;
+
+ /**
+ * 设置微信公众号的token
+ */
+ private String token;
+
+ /**
+ * 设置微信公众号的EncodingAESKey
+ */
+ private String aesKey;
+ }
+
+ @Override
+ public String toString() {
+ return JsonUtils.toJson(this);
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/AbstractHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/AbstractHandler.java
new file mode 100644
index 0000000000..3831d6427a
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/AbstractHandler.java
@@ -0,0 +1,12 @@
+package com.epmet.wx.mp.handler;
+
+import me.chanjar.weixin.mp.api.WxMpMessageHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+public abstract class AbstractHandler implements WxMpMessageHandler {
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/KfSessionHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/KfSessionHandler.java
new file mode 100644
index 0000000000..cfdcb95eec
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/KfSessionHandler.java
@@ -0,0 +1,25 @@
+package com.epmet.wx.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class KfSessionHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService wxMpService,
+ WxSessionManager sessionManager) {
+ //TODO 对会话做处理
+ return null;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/LocationHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/LocationHandler.java
new file mode 100644
index 0000000000..78f8296350
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/LocationHandler.java
@@ -0,0 +1,44 @@
+package com.epmet.wx.mp.handler;
+
+import com.epmet.wx.mp.builder.TextBuilder;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class LocationHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService wxMpService,
+ WxSessionManager sessionManager) {
+ if (wxMessage.getMsgType().equals(XmlMsgType.LOCATION)) {
+ //TODO 接收处理用户发送的地理位置消息
+ try {
+ String content = "感谢反馈,您的的地理位置已收到!";
+ return new TextBuilder().build(content, wxMessage, null);
+ } catch (Exception e) {
+ this.logger.error("位置消息接收处理失败", e);
+ return null;
+ }
+ }
+
+ //上报地理位置事件
+ this.logger.info("上报地理位置,纬度 : {},经度 : {},精度 : {}",
+ wxMessage.getLatitude(), wxMessage.getLongitude(), String.valueOf(wxMessage.getPrecision()));
+
+ //TODO 可以将用户地理位置信息保存到本地数据库,以便以后使用
+
+ return null;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/LogHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/LogHandler.java
new file mode 100644
index 0000000000..7efe62c03e
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/LogHandler.java
@@ -0,0 +1,25 @@
+package com.epmet.wx.mp.handler;
+
+import com.epmet.wx.mp.utils.JsonUtils;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class LogHandler extends AbstractHandler {
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService wxMpService,
+ WxSessionManager sessionManager) {
+ this.logger.info("\n接收到请求消息,内容:{}", JsonUtils.toJson(wxMessage));
+ return null;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/MenuHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/MenuHandler.java
new file mode 100644
index 0000000000..edb0fa8af8
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/MenuHandler.java
@@ -0,0 +1,36 @@
+package com.epmet.wx.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class MenuHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService weixinService,
+ WxSessionManager sessionManager) {
+
+ String msg = String.format("type:%s, event:%s, key:%s",
+ wxMessage.getMsgType(), wxMessage.getEvent(),
+ wxMessage.getEventKey());
+ if (MenuButtonType.VIEW.equals(wxMessage.getEvent())) {
+ return null;
+ }
+
+ return WxMpXmlOutMessage.TEXT().content(msg)
+ .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
+ .build();
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/MsgHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/MsgHandler.java
new file mode 100644
index 0000000000..492ba61613
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/MsgHandler.java
@@ -0,0 +1,52 @@
+package com.epmet.wx.mp.handler;
+
+import com.epmet.wx.mp.builder.TextBuilder;
+import com.epmet.wx.mp.utils.JsonUtils;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+import static me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class MsgHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService weixinService,
+ WxSessionManager sessionManager) {
+
+ if (!wxMessage.getMsgType().equals(XmlMsgType.EVENT)) {
+ //TODO 可以选择将消息保存到本地
+ }
+
+ //当用户输入关键词如“你好”,“客服”等,并且有客服在线时,把消息转发给在线客服
+ try {
+ if (StringUtils.startsWithAny(wxMessage.getContent(), "你好", "客服")
+ && weixinService.getKefuService().kfOnlineList()
+ .getKfOnlineList().size() > 0) {
+ return WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE()
+ .fromUser(wxMessage.getToUser())
+ .toUser(wxMessage.getFromUser()).build();
+ }
+ } catch (WxErrorException e) {
+ e.printStackTrace();
+ }
+
+ //TODO 组装回复消息
+ String content = "收到信息内容:" + JsonUtils.toJson(wxMessage);
+
+ return new TextBuilder().build(content, wxMessage, weixinService);
+
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/NullHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/NullHandler.java
new file mode 100644
index 0000000000..39716acf93
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/NullHandler.java
@@ -0,0 +1,24 @@
+package com.epmet.wx.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class NullHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService wxMpService,
+ WxSessionManager sessionManager) {
+ return null;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/ScanHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/ScanHandler.java
new file mode 100644
index 0000000000..0f22dd27ff
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/ScanHandler.java
@@ -0,0 +1,25 @@
+package com.epmet.wx.mp.handler;
+
+import java.util.Map;
+
+import org.springframework.stereotype.Component;
+
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class ScanHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map map,
+ WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
+ // 扫码事件处理
+ return null;
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/StoreCheckNotifyHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/StoreCheckNotifyHandler.java
new file mode 100644
index 0000000000..79ed57f75c
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/StoreCheckNotifyHandler.java
@@ -0,0 +1,27 @@
+package com.epmet.wx.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * 门店审核事件处理
+ *
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class StoreCheckNotifyHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService wxMpService,
+ WxSessionManager sessionManager) {
+ // TODO 处理门店审核事件
+ return null;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/SubscribeHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/SubscribeHandler.java
new file mode 100644
index 0000000000..4acfb20c81
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/SubscribeHandler.java
@@ -0,0 +1,71 @@
+package com.epmet.wx.mp.handler;
+
+import java.util.Map;
+
+import com.epmet.wx.mp.builder.TextBuilder;
+import org.springframework.stereotype.Component;
+
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import me.chanjar.weixin.mp.bean.result.WxMpUser;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class SubscribeHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService weixinService,
+ WxSessionManager sessionManager) throws WxErrorException {
+
+ this.logger.info("新关注用户 OPENID: " + wxMessage.getFromUser());
+
+ // 获取微信用户基本信息
+ try {
+ WxMpUser userWxInfo = weixinService.getUserService()
+ .userInfo(wxMessage.getFromUser(), null);
+ if (userWxInfo != null) {
+ // TODO 可以添加关注用户到本地数据库
+ }
+ } catch (WxErrorException e) {
+ if (e.getError().getErrorCode() == 48001) {
+ this.logger.info("该公众号没有获取用户信息权限!");
+ }
+ }
+
+
+ WxMpXmlOutMessage responseResult = null;
+ try {
+ responseResult = this.handleSpecial(wxMessage);
+ } catch (Exception e) {
+ this.logger.error(e.getMessage(), e);
+ }
+
+ if (responseResult != null) {
+ return responseResult;
+ }
+
+ try {
+ return new TextBuilder().build("感谢关注", wxMessage, weixinService);
+ } catch (Exception e) {
+ this.logger.error(e.getMessage(), e);
+ }
+
+ return null;
+ }
+
+ /**
+ * 处理特殊请求,比如如果是扫码进来的,可以做相应处理
+ */
+ private WxMpXmlOutMessage handleSpecial(WxMpXmlMessage wxMessage)
+ throws Exception {
+ //TODO
+ return null;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/UnsubscribeHandler.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/UnsubscribeHandler.java
new file mode 100644
index 0000000000..3f86977706
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/handler/UnsubscribeHandler.java
@@ -0,0 +1,27 @@
+package com.epmet.wx.mp.handler;
+
+import me.chanjar.weixin.common.session.WxSessionManager;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
+import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+@Component
+public class UnsubscribeHandler extends AbstractHandler {
+
+ @Override
+ public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
+ Map context, WxMpService wxMpService,
+ WxSessionManager sessionManager) {
+ String openId = wxMessage.getFromUser();
+ this.logger.info("取消关注用户 OPENID: " + openId);
+ // TODO 可以更新本地数据库为取消关注状态
+ return null;
+ }
+
+}
diff --git a/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/utils/JsonUtils.java b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/utils/JsonUtils.java
new file mode 100644
index 0000000000..8534fce802
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools-wx-mp/src/main/java/com/epmet/wx/mp/utils/JsonUtils.java
@@ -0,0 +1,16 @@
+package com.epmet.wx.mp.utils;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+/**
+ * @author Binary Wang(https://github.com/binarywang)
+ */
+public class JsonUtils {
+ public static String toJson(Object obj) {
+ Gson gson = new GsonBuilder()
+ .setPrettyPrinting()
+ .create();
+ return gson.toJson(obj);
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LoginUser.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LoginUser.java
new file mode 100644
index 0000000000..0a7f7b625a
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LoginUser.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.epmet.commons.tools.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 登录用户信息
+ *
+ * @author chenshun
+ * @email sunlightcs@gmail.com
+ * @date 2017-03-23 20:39
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface LoginUser {
+
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java
index 15b2e92cbf..38a6c0d33a 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java
@@ -104,8 +104,4 @@ public interface Constant {
* 版本控制用
*/
String VERSION_CONTROL = "/{version}";
- /**
- * 移动端接口标识
- */
- String EPDC_APP = "epdc-app/";
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java
index c358b530b3..5b129bbf42 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java
@@ -49,6 +49,11 @@ public interface ServiceConstant {
*/
String RESI_GUIDE_SERVER = "resi-guide-server";
+ /**
+ * 政府机构组织管理
+ */
+ String GOV_ORG_SERVER = "gov-org-server";
+
/**
* 政府端组织架构
*/
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ModuleErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ModuleErrorCode.java
new file mode 100644
index 0000000000..c2b194e25f
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ModuleErrorCode.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.commons.tools.exception;
+
+
+/**
+ * 模块错误编码,由9位数字组成,前6位为模块编码,后3位为业务编码
+ *
+ * 如:100001001(100001代表模块,001代表业务代码)
+ *
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+public interface ModuleErrorCode extends ErrorCode {
+ int TOKEN_NOT_EMPTY = 100005001;
+ int TOKEN_INVALID = 100005002;
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
index 419ab5a51e..c6c09162dd 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
@@ -1,8 +1,8 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
- *
+ *
* https://www.renren.io
- *
+ *
* 版权所有,侵权必究!
*/
@@ -13,59 +13,114 @@ package com.epmet.commons.tools.redis;
* @since 1.0.0
*/
public class RedisKeys {
- /**
- * 系统参数Key
- */
- public static String getSysParamsKey(){
- return "sys:params";
- }
-
- /**
- * 登录验证码Key
- */
- public static String getLoginCaptchaKey(String uuid){
- return "sys:captcha:" + uuid;
- }
-
- /**
- * 登录用户Key
- */
- public static String getSecurityUserKey(Long id){
- return "sys:security:user:" + id;
- }
-
- /**
- * 系统日志Key
- */
- public static String getSysLogKey(){
- return "sys:log";
- }
-
- /**
- * 系统资源Key
- */
- public static String getSysResourceKey(){
- return "sys:resource";
- }
-
- /**
- * 用户菜单导航Key
- */
- public static String getUserMenuNavKey(Long userId, String language){
- return "sys:user:nav:" + userId + "_" + language;
- }
-
- /**
- * 用户菜单导航Key
- */
- public static String getUserMenuNavKey(Long userId){
- return "sys:user:nav:" + userId + "_*";
- }
-
- /**
- * 用户权限标识Key
- */
- public static String getUserPermissionsKey(Long userId){
- return "sys:user:permissions:" + userId;
- }
+
+ /**
+ * 党群e事通redis前缀
+ */
+ private static String rootPrefix = "epmet:";
+
+ /**
+ * 系统参数Key
+ */
+ public static String getSysParamsKey() {
+ return rootPrefix.concat("sys:params");
+ }
+
+ /**
+ * 登录验证码Key
+ */
+ public static String getLoginCaptchaKey(String uuid) {
+ return rootPrefix.concat("sys:captcha:").concat(uuid);
+ }
+
+ /**
+ * 登录用户Key
+ */
+ public static String getSecurityUserKey(Long id) {
+ return rootPrefix.concat("sys:security:user:").concat(String.valueOf(id));
+ }
+
+ /**
+ * 系统日志Key
+ */
+ public static String getSysLogKey() {
+ return rootPrefix.concat("sys:log");
+ }
+
+ /**
+ * 系统资源Key
+ */
+ public static String getSysResourceKey() {
+ return rootPrefix.concat("sys:resource");
+ }
+
+ /**
+ * 用户菜单导航Key
+ */
+ public static String getUserMenuNavKey(Long userId, String language) {
+ return rootPrefix.concat("sys:user:nav:").concat(String.valueOf(userId)).concat("_").concat(language);
+ }
+
+ /**
+ * 用户菜单导航Key
+ */
+ public static String getUserMenuNavKey(String userId, String app, String client, String language) {
+ return rootPrefix.concat("oper:access:nav:").concat(userId).concat("_").concat(app).concat("_").concat(client).concat("_").concat(language);
+ }
+
+ /**
+ * 用户菜单导航Key
+ */
+ public static String getUserMenuNavKey(Long userId) {
+ return rootPrefix.concat("sys:user:nav:").concat(String.valueOf(userId)).concat("_*");
+ }
+
+ /**
+ * 用户权限标识Key
+ */
+ public static String getUserPermissionsKey(Long userId) {
+ return rootPrefix.concat("sys:user:permissions:").concat(String.valueOf(userId));
+ }
+
+ /**
+ * 用户权限标识Key
+ */
+ public static String getUserPermissionsKey(String userId, String app, String client) {
+ return rootPrefix.concat("oper:access:permissions:").concat(userId).concat("_").concat(app).concat("_").concat(client);
+ }
+
+ /**
+ * epmet用户token对应redis中的Key
+ * epmet:sys:security:user:token字符串
+ */
+ public static String getCpUserKey(String app, String client, String userId) {
+ return rootPrefix.concat("sys:security:user:").concat(app).concat(":").concat(client).concat(":").concat(userId);
+ }
+
+ /**
+ * 拼接手机验证码key---后面需要改!!!
+ *
+ * @param phone
+ * @return java.lang.String
+ * @author yujintao
+ * @date 2019/9/6 17:03
+ */
+ public static String getPhoneSmsCodeKey(String phone) {
+ return rootPrefix.concat("phone:sms:code:").concat(phone);
+ }
+
+ /**
+ * 用户请求发送短信接口,记录本次请求时间,保存一分钟
+ * ---后面需要改!!!
+ *
+ * @param phone
+ * @return java.lang.String
+ * @author work@yujt.net.cn
+ * @date 2019/12/6 19:05
+ */
+ public static String getPhoneSmsHistoryKey(String phone) {
+ return rootPrefix.concat("phone:sms:history:").concat(phone);
+ }
+
+
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
index 9211a3a319..fd02d32f73 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
@@ -29,29 +29,53 @@ public class RedisUtils {
@Autowired
private RedisTemplate redisTemplate;
- /** 默认过期时长为24小时,单位:秒 */
+ /**
+ * 默认过期时长为24小时,单位:秒
+ */
public final static long DEFAULT_EXPIRE = 60 * 60 * 24L;
- /** 过期时长为1小时,单位:秒 */
+ /**
+ * 过期时长为1小时,单位:秒
+ */
public final static long HOUR_ONE_EXPIRE = 60 * 60 * 1L;
- /** 过期时长为6小时,单位:秒 */
+ /**
+ * 过期时长为6小时,单位:秒
+ */
public final static long HOUR_SIX_EXPIRE = 60 * 60 * 6L;
- /** 不设置过期时长 */
+ /**
+ * 过期时长为5分钟,单位:秒
+ */
+ public final static long MINUTE_FIVE_EXPIRE = 60 * 5 * 1L;
+ /**
+ * 过期时长为1分钟,单位:秒
+ */
+ public final static long MINUTE_ONE_EXPIRE = 60 * 1 * 1L;
+ /**
+ * 过期时长为10分钟,单位:秒
+ */
+ public final static long MINUTE_TEN_EXPIRE = 60 * 10 * 1L;
+ /**
+ * 过期时长为30分钟,单位:秒
+ */
+ public final static long MINUTE_THIRTY_EXPIRE = 60 * 30 * 1L;
+ /**
+ * 不设置过期时长
+ */
public final static long NOT_EXPIRE = -1L;
- public void set(String key, Object value, long expire){
+ public void set(String key, Object value, long expire) {
redisTemplate.opsForValue().set(key, value);
- if(expire != NOT_EXPIRE){
+ if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
- public void set(String key, Object value){
+ public void set(String key, Object value) {
set(key, value, DEFAULT_EXPIRE);
}
public Object get(String key, long expire) {
Object value = redisTemplate.opsForValue().get(key);
- if(expire != NOT_EXPIRE){
+ if (expire != NOT_EXPIRE) {
expire(key, expire);
}
return value;
@@ -61,7 +85,7 @@ public class RedisUtils {
return get(key, NOT_EXPIRE);
}
- public Set keys(String pattern){
+ public Set keys(String pattern) {
return redisTemplate.keys(pattern);
}
@@ -81,19 +105,19 @@ public class RedisUtils {
return redisTemplate.opsForHash().get(key, field);
}
- public Map hGetAll(String key){
+ public Map hGetAll(String key) {
HashOperations hashOperations = redisTemplate.opsForHash();
return hashOperations.entries(key);
}
- public void hMSet(String key, Map map){
+ public void hMSet(String key, Map map) {
hMSet(key, map, DEFAULT_EXPIRE);
}
- public void hMSet(String key, Map map, long expire){
+ public void hMSet(String key, Map map, long expire) {
redisTemplate.opsForHash().putAll(key, map);
- if(expire != NOT_EXPIRE){
+ if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
@@ -105,32 +129,37 @@ public class RedisUtils {
public void hSet(String key, String field, Object value, long expire) {
redisTemplate.opsForHash().put(key, field, value);
- if(expire != NOT_EXPIRE){
+ if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
- public void expire(String key, long expire){
- redisTemplate.expire(key, expire, TimeUnit.SECONDS);
+ public boolean expire(String key, long expire) {
+ return redisTemplate.expire(key, expire, TimeUnit.SECONDS);
}
- public void hDel(String key, Object... fields){
+ public long getExpire(String key) {
+ return redisTemplate.getExpire(key, TimeUnit.SECONDS);
+ }
+
+ public void hDel(String key, Object... fields) {
redisTemplate.opsForHash().delete(key, fields);
}
- public void leftPush(String key, Object value){
+ public void leftPush(String key, Object value) {
leftPush(key, value, DEFAULT_EXPIRE);
}
- public void leftPush(String key, Object value, long expire){
+ public void leftPush(String key, Object value, long expire) {
redisTemplate.opsForList().leftPush(key, value);
- if(expire != NOT_EXPIRE){
+ if (expire != NOT_EXPIRE) {
expire(key, expire);
}
}
- public Object rightPop(String key){
+ public Object rightPop(String key) {
return redisTemplate.opsForList().rightPop(key);
}
+
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/config/WebMvcConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/config/WebMvcConfig.java
index b6b81f0611..d1af449333 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/config/WebMvcConfig.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/config/WebMvcConfig.java
@@ -8,6 +8,7 @@
package com.epmet.commons.tools.security.config;
+import com.epmet.commons.tools.security.resolver.LoginUserHandlerMethodArgumentResolver;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
@@ -40,9 +41,11 @@ import java.util.TimeZone;
public class WebMvcConfig implements WebMvcConfigurer {
@Autowired
private UserDetailHandlerMethodArgumentResolver userDetailHandlerMethodArgumentResolver;
-
+ @Autowired
+ private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver;
@Override
public void addArgumentResolvers(List argumentResolvers) {
+ argumentResolvers.add(loginUserHandlerMethodArgumentResolver);
argumentResolvers.add(userDetailHandlerMethodArgumentResolver);
}
@@ -75,4 +78,5 @@ public class WebMvcConfig implements WebMvcConfigurer {
converter.setObjectMapper(mapper);
return converter;
}
+
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java
new file mode 100644
index 0000000000..fb8a5dd7ec
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java
@@ -0,0 +1,60 @@
+package com.epmet.commons.tools.security.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 用户token
+ *
+ * @author yinzuomei
+ * @Date 2020-03-14
+ */
+@Data
+public class TokenDto implements Serializable {
+ private static final long serialVersionUID = 8883581762088390769L;
+ /**
+ * 政府端:gov、居民端:resi、运营端:oper
+ */
+ private String app;
+
+ /**
+ * PC端:web、微信小程序:wxmp
+ */
+ private String client;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * sessionKey
+ */
+ private String sessionKey;
+
+ /**
+ * openId
+ */
+ private String openId;
+
+ /**
+ * unionId
+ */
+ private String unionId;
+
+ /**
+ * token字符串
+ */
+ private String token;
+
+ /**
+ * 过期时间戳
+ */
+ private Long expireTime;
+
+ /**
+ * 最后一次更新时间
+ */
+ private long updateTime;
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java
new file mode 100644
index 0000000000..4285f17cb8
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.commons.tools.security.resolver;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.annotation.LoginUser;
+import com.epmet.commons.tools.constant.Constant;
+import com.epmet.commons.tools.exception.ErrorCode;
+import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.utils.CpUserDetailRedis;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.MethodParameter;
+import org.springframework.stereotype.Service;
+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
+ */
+@Service
+public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ @Autowired
+ private CpUserDetailRedis cpUserDetailRedis;
+
+ public LoginUserHandlerMethodArgumentResolver(){
+
+ }
+
+ @Override
+ public boolean supportsParameter(MethodParameter parameter) {
+ if(parameter.getParameterType().isAssignableFrom(TokenDto.class)){
+ logger.info("入参是TokenDto.class");
+ }else{
+ logger.info("parameter.getParameterType().isAssignableFrom(TokenDto.class)");
+ }
+ if(parameter.hasParameterAnnotation(LoginUser.class)){
+ logger.info("入参@LoginUser");
+ }else {
+ logger.info("parameter.hasParameterAnnotation(LoginUser.class) is false");
+ }
+ return parameter.getParameterType().isAssignableFrom(TokenDto.class) && parameter.hasParameterAnnotation(LoginUser.class);
+ }
+
+ @Override
+ public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container,
+ NativeWebRequest request, WebDataBinderFactory factory) throws Exception {
+ //app-client-userId
+ String redisKey = request.getHeader(Constant.APP_USER_KEY);
+ if (StringUtils.isEmpty(redisKey)) {
+ throw new RenException(ErrorCode.UNAUTHORIZED);
+ }
+ String[] keyArray=redisKey.split("-");
+ String app=keyArray[0];
+ String client=keyArray[1];
+ String userId=keyArray[2];
+ TokenDto tokenDto = cpUserDetailRedis.get(app,client,userId);
+ logger.info("resolveArgument TokenDto:"+ JSON.toJSONString(tokenDto));
+ return tokenDto;
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java
new file mode 100644
index 0000000000..f49c9ddcb5
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.commons.tools.utils;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.map.MapUtil;
+import com.epmet.commons.tools.redis.RedisKeys;
+import com.epmet.commons.tools.redis.RedisUtils;
+import com.epmet.commons.tools.security.dto.TokenDto;
+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(TokenDto user, long expire) {
+ if (user == null) {
+ return;
+ }
+ String key = RedisKeys.getCpUserKey(user.getApp(), user.getClient(), user.getUserId());
+ //bean to map
+ Map map = BeanUtil.beanToMap(user, false, true);
+ redisUtils.hMSet(key, map, expire);
+ }
+
+ /**
+ * 获取token信息
+ *
+ * @param app 居民端resi;政府端gov;运营端oper
+ * @param client PC端:web;微信小程序端:wxmp
+ * @param userId oper_user、customer_user、customer_staff表主键
+ * @return
+ */
+ public TokenDto get(String app, String client, String userId) {
+ String key = RedisKeys.getCpUserKey(app,client,userId);
+
+ Map map = redisUtils.hGetAll(key);
+ if (MapUtil.isEmpty(map)) {
+ return null;
+ }
+
+ //map to bean
+ TokenDto user = BeanUtil.mapToBean(map, TokenDto.class, true);
+
+ return user;
+ }
+
+ /**
+ * 删除用户信息
+ *
+ * @param app 居民端resi;政府端gov;运营端oper
+ * @param client PC端:web;微信小程序端:wxmp
+ * @param userId oper_user、customer_user、customer_staff表主键
+ */
+ public void logout(String app, String client, String userId) {
+ redisUtils.delete(RedisKeys.getCpUserKey(app,client,userId));
+ }
+
+ /**
+ * 设置redis时间
+ *
+ * @param app 居民端resi;政府端gov;运营端oper
+ * @param client PC端:web;微信小程序端:wxmp
+ * @param userId oper_user、customer_user、customer_staff表主键
+ * @param expire 有效时间
+ * @author rongchao
+ */
+ public boolean expire(String app, String client, String userId, long expire) {
+ return redisUtils.expire(RedisKeys.getCpUserKey(app,client,userId), expire);
+ }
+
+ /**
+ * 查询token剩余时间
+ *
+ * @param app 居民端resi;政府端gov;运营端oper
+ * @param client PC端:web;微信小程序端:wxmp
+ * @param userId oper_user、customer_user、customer_staff表主键
+ * @return 获取有效期
+ * @author yujintao
+ * @date 2019/9/9 14:18
+ */
+ public long getExpire(String app, String client, String userId) {
+ return redisUtils.getExpire(RedisKeys.getCpUserKey(app, client, userId));
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
index 022d28b9c8..097da00d3e 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
@@ -29,6 +29,8 @@ public class DateUtils {
public final static String DATE_PATTERN = "yyyy-MM-dd";
/** 时间格式(yyyy-MM-dd HH:mm:ss) */
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
+ /** 时间格式(yyyyMMddHHmmss) */
+ public final static String DATE_TIME_NO_SPLIT = "yyyyMMddHHmmss";
/**
* 日期格式化 日期格式为:yyyy-MM-dd
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java
new file mode 100644
index 0000000000..53713e032c
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.commons.tools.utils;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 树节点,所有需要实现树节点的,都需要继承该类
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Data
+public class TreeStringNode implements Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * 主键
+ */
+ private String id;
+ /**
+ * 上级ID
+ */
+ private String pid;
+ /**
+ * 子节点列表
+ */
+ private List children = new ArrayList<>();
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java
index 3c365c5dbe..b78c8317ef 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java
@@ -77,4 +77,29 @@ public class TreeUtils {
return result;
}
+ /**
+ * 构建树节点
+ */
+ public static List buildTree(List treeNodes) {
+ List result = new ArrayList<>();
+
+ //list转map
+ Map nodeMap = new LinkedHashMap<>(treeNodes.size());
+ for(T treeNode : treeNodes){
+ nodeMap.put(treeNode.getId(), treeNode);
+ }
+
+ for(T node : nodeMap.values()) {
+ T parent = nodeMap.get(node.getPid());
+ if(parent != null && !(node.getId().equals(parent.getId()))){
+ parent.getChildren().add(node);
+ continue;
+ }
+
+ result.add(node);
+ }
+
+ return result;
+ }
+
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/WebUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/WebUtil.java
new file mode 100644
index 0000000000..f1e2c53382
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/WebUtil.java
@@ -0,0 +1,66 @@
+package com.epmet.commons.tools.utils;
+
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Web工具类
+ *
+ * @author rongchao
+ * @Date 18-11-20
+ */
+public class WebUtil {
+
+ public static HttpServletRequest getHttpServletRequest() {
+ ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ HttpServletRequest request = requestAttributes.getRequest();
+ return request;
+ }
+
+ public static Object getAttributesFromRequest(String paramName) {
+ ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ return requestAttributes.getAttribute(paramName, RequestAttributes.SCOPE_REQUEST);
+ }
+
+ public static void setAttributesFromRequest(String paramName, Object obj) {
+ ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ requestAttributes.setAttribute(paramName, obj, RequestAttributes.SCOPE_REQUEST);
+ }
+
+ /**
+ * 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址,
+ *
+ * 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢?
+ * 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。
+ *
+ * 如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130,
+ * 192.168.1.100
+ *
+ * 用户真实IP为: 192.168.1.110
+ *
+ * @return
+ */
+ public static String getIpAddress() {
+ HttpServletRequest request = getHttpServletRequest();
+ String ip = request.getHeader("x-forwarded-for");
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("WL-Proxy-Client-IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_CLIENT_IP");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+ }
+ if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+ ip = request.getRemoteAddr();
+ }
+ return ip;
+ }
+}
diff --git a/epmet-commons/pom.xml b/epmet-commons/pom.xml
index c4f8cd0f99..350503fdae 100644
--- a/epmet-commons/pom.xml
+++ b/epmet-commons/pom.xml
@@ -17,6 +17,10 @@
epmet-commons-tools
epmet-commons-mybatis
epmet-commons-dynamic-datasource
+ epmet-commons-tools-phone
+ epmet-common-clienttoken
+ epmet-commons-tools-wx-ma
+ epmet-commons-tools-wx-mp
diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml
index 3827af2249..cf70dc34c2 100644
--- a/epmet-gateway/pom.xml
+++ b/epmet-gateway/pom.xml
@@ -47,6 +47,17 @@
io.springfox
springfox-swagger-ui
+
+ io.jsonwebtoken
+ jjwt
+ 0.7.0
+
+
+ com.epmet
+ epmet-common-clienttoken
+ 2.0.0
+ compile
+
@@ -97,44 +108,49 @@
- lb://epmet-auth-server
-
+
+ http://127.0.0.1:8081
lb://epmet-admin-server
-
+
lb://epmet-monitor-server
-
+
lb://epmet-oss-server
-
+
- http://localhost:8085
+ http://127.0.0.1:8085
- http://localhost:8086
+ http://127.0.0.1:8086
- http://localhost:8084
+ http://127.0.0.1:8084
- http://localhost:8087
+ http://127.0.0.1:8087
lb://epmet-demo-server
-
+
- http://localhost:8089
+ http://127.0.0.1:8089
- http://localhost:8090
+ http://127.0.0.1:8090
+
+ http://127.0.0.1:8091
+
http://localhost:8091
- http://localhost:8092
+ http://127.0.0.1:8092
+
+ http://127.0.0.1:8093
@@ -186,6 +202,8 @@
lb://resi-guide-server
lb://gov-org-server
+
+ lb://oper-access-server
diff --git a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
index d9c3402533..352ae0df92 100644
--- a/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
+++ b/epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
@@ -1,8 +1,8 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
- *
+ *
* https://www.renren.io
- *
+ *
* 版权所有,侵权必究!
*/
@@ -12,6 +12,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.annotation.ComponentScan;
/**
* 网关服务
@@ -24,8 +25,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableFeignClients
public class GatewayApplication {
- public static void main(String[] args) {
- SpringApplication.run(GatewayApplication.class, args);
- }
-
+ public static void main(String[] args) {
+ SpringApplication.run(GatewayApplication.class, args);
+ }
}
diff --git a/epmet-gateway/src/main/java/com/epmet/filter/AuthFilter.java b/epmet-gateway/src/main/java/com/epmet/filter/AuthFilter.java
index 3c2dd5a28c..4c83d810da 100644
--- a/epmet-gateway/src/main/java/com/epmet/filter/AuthFilter.java
+++ b/epmet-gateway/src/main/java/com/epmet/filter/AuthFilter.java
@@ -14,6 +14,8 @@ import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.Result;
import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
@@ -41,9 +43,10 @@ import java.util.List;
@Configuration
@ConfigurationProperties(prefix = "renren")
public class AuthFilter implements GlobalFilter {
+ private Logger logger = LoggerFactory.getLogger(getClass());
private final AntPathMatcher antPathMatcher = new AntPathMatcher();
@Autowired
- private ResourceFeignClient resourceFeignClient;
+ public ResourceFeignClient resourceFeignClient;
/**
* 不拦截的urls
*/
@@ -56,6 +59,7 @@ public class AuthFilter implements GlobalFilter {
//请求放行,无需验证权限
if(pathMatcher(requestUri)){
+ logger.info("AuthFilter当前requestUri=["+requestUri+"]AuthFilter已放行");
return chain.filter(exchange);
}
diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java
new file mode 100644
index 0000000000..dd74348b92
--- /dev/null
+++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java
@@ -0,0 +1,158 @@
+
+package com.epmet.filter;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.constant.Constant;
+import com.epmet.commons.tools.exception.ErrorCode;
+import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.security.dto.TokenDto;
+import com.epmet.commons.tools.utils.CpUserDetailRedis;
+import com.epmet.jwt.JwtTokenUtils;
+import io.jsonwebtoken.Claims;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 {
+ private Logger logger = LoggerFactory.getLogger(getClass());
+ @Autowired
+ private CpProperty cpProperty;
+ private final AntPathMatcher antPathMatcher = new AntPathMatcher();
+ @Autowired
+ private JwtTokenUtils jwtTokenUtils;
+ @Autowired
+ private CpUserDetailRedis cpUserDetailRedis;
+
+
+ @Override
+ public List shortcutFieldOrder() {
+ return Arrays.asList("enabled");
+ }
+
+ public CpAuthGatewayFilterFactory() {
+ super(CpAuthConfig.class);
+ }
+
+ @Override
+ public GatewayFilter apply(CpAuthConfig config) {
+ return (exchange, chain) -> {
+ if (!config.isEnabled()) {
+ logger.info("===========");
+ 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);
+ logger.info("CpAuthGatewayFilterFactory当前requestUri=[" + requestUri + "]CpAuthGatewayFilterFactory拦截成功token:"+token);
+ if (StringUtils.isBlank(token)) {
+ token = request.getQueryParams().getFirst(Constant.AUTHORIZATION_HEADER);
+ logger.info("params token:"+token);
+ if (StringUtils.isBlank(token)) {
+ return chain.filter(exchange);
+ }
+ }
+ TokenDto user = this.getLoginUserInfo(token);
+ //当前登录用户userId,添加到header中
+ if (user != null) {
+ String redisKey = user.getApp() + "-" + user.getClient() + "-" + user.getUserId();
+ logger.info("redisKey=" + redisKey);
+ ServerHttpRequest build = exchange.getRequest().mutate().header(Constant.APP_USER_KEY, redisKey).build();
+ return chain.filter(exchange.mutate().request(build).build());
+ }
+ return chain.filter(exchange);
+ };
+ }
+
+ public TokenDto getLoginUserInfo(String token) {
+ //是否过期
+ Claims claims = jwtTokenUtils.getClaimByToken(token);
+ if (claims == null || jwtTokenUtils.isTokenExpired(claims.getExpiration())) {
+ throw new RenException(ErrorCode.UNAUTHORIZED);
+ }
+ //获取用户ID
+ String app = (String) claims.get("app");
+ String client = (String) claims.get("client");
+ String userId = (String) claims.get("userId");
+ //查询Redis,如果没数据,则保持用户信息到Redis
+ TokenDto tokenDto = cpUserDetailRedis.get(app, client, userId);
+ if (null == tokenDto) {
+ throw new RenException(ErrorCode.REGION_SUB_DELETE_ERROR, Constant.TOKEN_HEADER);
+ }
+ //过期时间
+ long expire = (claims.getExpiration().getTime() - System.currentTimeMillis()) / 1000;
+ cpUserDetailRedis.set(tokenDto, expire);
+ return tokenDto;
+ }
+
+ 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.getSwaggerUrls()) {
+ if (antPathMatcher.match(url, requestUri)) {
+ return false;
+ }
+ }
+ 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;
+ }
+ }
+}
diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java
new file mode 100644
index 0000000000..9d6b103f20
--- /dev/null
+++ b/epmet-gateway/src/main/java/com/epmet/filter/CpProperty.java
@@ -0,0 +1,27 @@
+package com.epmet.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 = "epmet")
+public class CpProperty {
+
+ private List urls;
+
+ /**
+ * 不处理token,直接通过
+ */
+ private List swaggerUrls;
+
+}
diff --git a/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenProperties.java b/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenProperties.java
new file mode 100644
index 0000000000..ddff4febcc
--- /dev/null
+++ b/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenProperties.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.jwt;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Jwt
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Configuration
+@ConfigurationProperties(prefix = "jwt.token")
+public class JwtTokenProperties {
+ private String secret;
+ private int expire;
+
+ public String getSecret() {
+ return secret;
+ }
+
+ public void setSecret(String secret) {
+ this.secret = secret;
+ }
+
+ public int getExpire() {
+ return expire;
+ }
+
+ public void setExpire(int expire) {
+ this.expire = expire;
+ }
+}
diff --git a/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java b/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java
new file mode 100644
index 0000000000..33baf31c52
--- /dev/null
+++ b/epmet-gateway/src/main/java/com/epmet/jwt/JwtTokenUtils.java
@@ -0,0 +1,132 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.jwt;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import org.apache.commons.codec.binary.Base64;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Jwt工具类
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Component
+public class JwtTokenUtils {
+ private static final Logger logger = LoggerFactory.getLogger(JwtTokenUtils.class);
+
+ @Autowired
+ private JwtTokenProperties jwtProperties;
+
+ /**
+ * 生成jwt token 弃用
+ */
+ @Deprecated
+ public String generateToken(String userId) {
+ return Jwts.builder()
+ .setHeaderParam("typ", "JWT")
+ .setSubject(userId)
+ .setIssuedAt(new Date())
+ .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
+ .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret())
+ .compact();
+ }
+
+ public Claims getClaimByToken(String token) {
+ try {
+ return Jwts.parser()
+ .setSigningKey(jwtProperties.getSecret())
+ .parseClaimsJws(token)
+ .getBody();
+ } catch (Exception e) {
+ logger.debug("validate is token error, token = " + token, e);
+ return null;
+ }
+ }
+
+ /**
+ * @return java.util.Date
+ * @param token
+ * @Author yinzuomei
+ * @Description 获取token的有效期截止时间
+ * @Date 2020/3/18 22:17
+ **/
+ public Date getExpiration(String token){
+ try {
+ return Jwts.parser()
+ .setSigningKey(jwtProperties.getSecret())
+ .parseClaimsJws(token)
+ .getBody().getExpiration();
+ } catch (Exception e) {
+ logger.debug("validate is token error, token = " + token, e);
+ return null;
+ }
+ }
+
+ /**
+ * @param map
+ * @return java.lang.String
+ * @Author yinzuomei
+ * @Description 根据app+client+userId生成token
+ * @Date 2020/3/18 22:29
+ **/
+ public String createToken(Map map) {
+ return Jwts.builder()
+ .setHeaderParam("typ", "JWT")
+ .setClaims(map)
+ .setIssuedAt(new Date())
+ .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
+ .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret())
+ .compact();
+ }
+
+ /**
+ * token是否过期
+ *
+ * @return true:过期
+ */
+ public boolean isTokenExpired(Date expiration) {
+ return expiration.before(new Date());
+ }
+
+ public static void main(String[] args) {
+ Map map=new HashMap<>();
+ map.put("app","gov");
+ map.put("client","wxmp");
+ map.put("userId","100526ABC");
+ String tokenStr=Jwts.builder()
+ .setHeaderParam("typ", "JWT")
+ .setClaims(map)
+ .setIssuedAt(new Date())
+ .setExpiration(DateTime.now().plusSeconds(604800).toDate())
+ .signWith(SignatureAlgorithm.HS512, "7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]")
+ .compact();
+ System.out.println(tokenStr);
+ Claims claims= Jwts.parser()
+ .setSigningKey("7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]")
+ .parseClaimsJws(tokenStr)
+ .getBody();
+ System.out.println("app="+ claims.get("app"));
+ System.out.println("client="+ claims.get("client"));
+ System.out.println("userId="+ claims.get("userId"));
+ }
+
+}
diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml
index da86f7dfe7..36fabb7b50 100644
--- a/epmet-gateway/src/main/resources/bootstrap.yml
+++ b/epmet-gateway/src/main/resources/bootstrap.yml
@@ -42,6 +42,7 @@ spring:
- Path=${server.servlet.context-path}/sys/**
filters:
- StripPrefix=1
+ - CpAuth=true
#监控服务
- id: epmet-monitor-server
uri: @gateway.routes.epmet-monitor-server.uri@
@@ -90,6 +91,7 @@ spring:
- Path=${server.servlet.context-path}/epmetuser/**
filters:
- StripPrefix=1
+ - CpAuth=true
#demo流服务
- id: epmet-demo-server
uri: @gateway.routes.epmet-demo-server.uri@
@@ -98,6 +100,7 @@ spring:
- Path=${server.servlet.context-path}/demo/**
filters:
- StripPrefix=1
+ - CpAuth=true
#运营端客户定制化服务
- id: oper-customize-server
uri: @gateway.routes.oper-customize-server.uri@
@@ -106,6 +109,7 @@ spring:
- Path=${server.servlet.context-path}/oper/customize/**
filters:
- StripPrefix=1
+ - CpAuth=true
#运营端客户管理
- id: oper-crm-server
uri: @gateway.routes.oper-crm-server.uri@
@@ -114,6 +118,7 @@ spring:
- Path=${server.servlet.context-path}/oper/crm/**
filters:
- StripPrefix=1
+ - CpAuth=true
#居民端陌生人导览
- id: resi-guide-server
uri: @gateway.routes.resi-guide-server.uri@
@@ -130,6 +135,16 @@ spring:
- Path=${server.servlet.context-path}/gov/org/**
filters:
- StripPrefix=1
+ - CpAuth=true
+ #运营端访问权限控制
+ - id: oper-access-server
+ uri: @gateway.routes.oper-access-server.uri@
+ order: 14
+ predicates:
+ - Path=${server.servlet.context-path}/oper/access/**
+ filters:
+ - StripPrefix=1
+ - CpAuth=true
nacos:
discovery:
server-addr: @nacos.server-addr@
@@ -148,6 +163,7 @@ renren:
urls:
- /auth/captcha
- /auth/login
+ - /auth/login/*
- /*/swagger-resources/**
- /*/swagger-ui.html
- /*/webjars/**
@@ -160,7 +176,9 @@ renren:
- /activiti/editor-app/**
- /oper/customize/**
- /oper/crm/**
- - /resi/guide/**
+ - /epmetuser/**
+ - /gov/org/**
+ - /oper/access/**
management:
endpoints:
web:
@@ -179,6 +197,10 @@ mybatis-plus:
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:
@@ -208,3 +230,20 @@ hystrix:
ribbon:
ReadTimeout: 300000
ConnectTimeout: 300000
+
+epmet:
+ # 党群e事通
+ urls:
+ - /oper/customize/**
+ - /oper/crm/**
+ - /epmetuser/**
+ - /gov/org/**
+ - /oper/access/**
+ swaggerUrls:
+
+jwt:
+ token:
+ #秘钥
+ secret: 7016867071f0ebf1c46f123eaaf4b9d6[elink.epmet]
+ #token有效时长,默认7天,单位秒
+ expire: 604800
diff --git a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml
index 06496153f4..1a8c58dbdf 100644
--- a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml
@@ -63,6 +63,10 @@ mybatis-plus:
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:
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java
index 17810c525b..0e6ecfe1bc 100644
--- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java
@@ -18,6 +18,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@@ -26,6 +27,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerDTO;
+import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.DemoDTO;
import com.epmet.dto.form.SaveCustomerFormDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
@@ -155,4 +157,28 @@ public class DemoController {
return demoService.saveCustomerInfo(dto);
}
+ /**
+ * @param id
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 测试demo-gov get入参@PathVariable
+ * @Date 2020/3/20 9:37
+ **/
+ @GetMapping("/getcustomergrid/{id}")
+ public Result getcustomergrid(@PathVariable("id") String id) {
+ return demoService.getcustomergrid(id);
+ }
+
+ /**
+ * @param id
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 测试demo-admin get入参@RequestParam
+ * @Date 2020/3/20 9:37
+ **/
+ @GetMapping("getSysUserInfoById")
+ public Result getSysUserInfoById(@RequestParam("id") Long id) {
+ return demoService.getSysUserInfoById(id);
+ }
+
}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/AdminFeignClient.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/AdminFeignClient.java
new file mode 100644
index 0000000000..b8c41f35e8
--- /dev/null
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/AdminFeignClient.java
@@ -0,0 +1,41 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.feign;
+
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.security.user.UserDetail;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.feign.fallback.AdminFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * 用户接口
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@FeignClient(name = ServiceConstant.EPMET_ADMIN_SERVER, fallback = AdminFeignClientFallback.class)
+public interface AdminFeignClient {
+
+ /**
+ * 根据用户ID,获取用户信息
+ */
+ @GetMapping("sys/user/getById")
+ Result getById(@RequestParam("id") Long id);
+
+ /**
+ * 根据用户名,获取用户信息
+ * @param username 用户名
+ */
+ @GetMapping("sys/user/getByUsername")
+ Result getByUsername(@RequestParam("username") String username);
+
+}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
new file mode 100644
index 0000000000..52562d655b
--- /dev/null
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
@@ -0,0 +1,14 @@
+package com.epmet.feign;
+
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.feign.fallback.EpmetUserFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2020/3/16 14:48
+ */
+@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class)
+public interface EpmetUserFeignClient {
+}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
index c955830654..eb48542008 100644
--- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
@@ -1,5 +1,22 @@
package com.epmet.feign;
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerGridDTO;
+import com.epmet.feign.fallback.GovOrgFeignClientFallBack;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2020/3/18 11:11
+ */
+@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class)
+public interface GovOrgFeignClient {
+ @GetMapping("gov/org/customergrid/getcustomergrid/{id}")
+ Result getcustomergrid(@PathVariable("id") String id);
import com.epmet.commons.tools.constant.ServiceConstant;
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java
index a66d034f8e..77bcac25aa 100644
--- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java
@@ -4,7 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
-import com.epmet.feign.impl.OperCrmFeignClientFallBack;
+import com.epmet.feign.fallback.OperCrmFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/AdminFeignClientFallback.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/AdminFeignClientFallback.java
new file mode 100644
index 0000000000..1339aa4265
--- /dev/null
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/AdminFeignClientFallback.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.feign.fallback;
+
+import com.epmet.commons.tools.security.user.UserDetail;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.feign.AdminFeignClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * 用户接口 Fallback
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Component
+public class AdminFeignClientFallback implements AdminFeignClient {
+
+ @Override
+ public Result getById(Long id) {
+ return new Result<>();
+ }
+
+ @Override
+ public Result getByUsername(String username) {
+ return new Result<>();
+ }
+}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
new file mode 100644
index 0000000000..68ae3f7db1
--- /dev/null
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
@@ -0,0 +1,15 @@
+package com.epmet.feign.fallback;
+
+import com.epmet.feign.EpmetUserFeignClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2020/3/16 14:53
+ */
+@Component
+public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
+
+
+}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
new file mode 100644
index 0000000000..f1540af47a
--- /dev/null
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java
@@ -0,0 +1,21 @@
+package com.epmet.feign.fallback;
+
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.utils.ModuleUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.CustomerGridDTO;
+import com.epmet.feign.GovOrgFeignClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description
+ * @Author yinzuomei
+ * @Date 2020/3/18 11:13
+ */
+@Component
+public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
+ @Override
+ public Result getcustomergrid(String id) {
+ return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getcustomergrid",id);
+ }
+}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/impl/OperCrmFeignClientFallBack.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java
similarity index 97%
rename from epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/impl/OperCrmFeignClientFallBack.java
rename to epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java
index dd82f90351..3c79473590 100644
--- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/impl/OperCrmFeignClientFallBack.java
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java
@@ -1,4 +1,4 @@
-package com.epmet.feign.impl;
+package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java
index b503541ded..612f736267 100644
--- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/DemoService.java
@@ -19,8 +19,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDTO;
+import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.DemoDTO;
import com.epmet.dto.form.SaveCustomerFormDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
@@ -135,4 +137,22 @@ public interface DemoService extends BaseService {
**/
Result saveCustomerInfo(SaveCustomerFormDTO dto);
+ /**
+ * @param id
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 测试demo-gov get入参@PathVariable
+ * @Date 2020/3/20 9:37
+ **/
+ Result getcustomergrid(String id);
+
+ /**
+ * @param id
+ * @return com.epmet.commons.tools.utils.Result
+ * @Author yinzuomei
+ * @Description 测试demo-admin get入参@RequestParam
+ * @Date 2020/3/20 9:37
+ **/
+ Result getSysUserInfoById(Long id);
+
}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/impl/DemoServiceImpl.java b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/impl/DemoServiceImpl.java
index fd03d19782..666bfb533b 100644
--- a/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/impl/DemoServiceImpl.java
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/impl/DemoServiceImpl.java
@@ -22,14 +22,18 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.DemoDao;
import com.epmet.dto.CustomerDTO;
+import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.DemoDTO;
import com.epmet.dto.form.SaveCustomerFormDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.entity.DemoEntity;
+import com.epmet.feign.AdminFeignClient;
+import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.DemoRedis;
import com.epmet.service.DemoService;
@@ -41,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -58,6 +61,10 @@ public class DemoServiceImpl extends BaseServiceImpl implem
private DemoRedis demoRedis;
@Autowired
private OperCrmFeignClient operCrmFeignClient;
+ @Autowired
+ private GovOrgFeignClient govOrgFeignClient;
+ @Autowired
+ private AdminFeignClient adminFeignClient;
@Override
public PageData page(Map params) {
IPage page = baseDao.selectPage(
@@ -152,4 +159,13 @@ public class DemoServiceImpl extends BaseServiceImpl implem
return operCrmFeignClient.queryCustomInfoByCustomerId(customerId);
}
+ @Override
+ public Result getcustomergrid(String id) {
+ return govOrgFeignClient.getcustomergrid(id);
+ }
+
+ @Override
+ public Result getSysUserInfoById(Long id) {
+ return adminFeignClient.getById(id);
+ }
}
diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml
index 6774795607..5134667e20 100644
--- a/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml
@@ -61,6 +61,10 @@ mybatis-plus:
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:
diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml
index 56c78c7015..f402978001 100644
--- a/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml
@@ -69,6 +69,10 @@ mybatis-plus:
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:
diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml
index 00794fff65..f34d2325d4 100644
--- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml
@@ -69,6 +69,10 @@ mybatis-plus:
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:
diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml
index e30cc30a50..ff736a728f 100644
--- a/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml
@@ -80,6 +80,10 @@ mybatis-plus:
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:
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
index a08ccf397f..fec741f5e4 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
@@ -40,7 +40,7 @@ import java.util.Map;
/**
- * 客户网格表
+ * 客户网格表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
@@ -48,7 +48,7 @@ import java.util.Map;
@RestController
@RequestMapping("customergrid")
public class CustomerGridController {
-
+
@Autowired
private CustomerGridService customerGridService;
@@ -119,4 +119,9 @@ public class CustomerGridController {
return customerGridService.listGridForStrangerByOrder(listCustomerGridFormDTO);
}
-}
\ No newline at end of file
+ @GetMapping("getcustomergrid/{id}")
+ public Result getcustomergrid(@PathVariable("id") String id){
+ CustomerGridDTO data = customerGridService.get(id);
+ return new Result().ok(data);
+ }
+}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml
index b33d976571..3d1fddbaef 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml
@@ -84,6 +84,10 @@ mybatis-plus:
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:
diff --git a/epmet-module/oper-access/oper-access-client/pom.xml b/epmet-module/oper-access/oper-access-client/pom.xml
new file mode 100644
index 0000000000..f0572d0e8d
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/pom.xml
@@ -0,0 +1,35 @@
+
+
+
+ oper-access
+ com.epmet
+ 2.0.0
+
+ 4.0.0
+
+ oper-access-client
+ jar
+
+
+
+ com.epmet
+ epmet-commons-tools
+ 2.0.0
+
+
+ io.springfox
+ springfox-swagger2
+
+
+ io.springfox
+ springfox-swagger-ui
+
+
+
+
+ ${project.artifactId}
+
+
+
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java
new file mode 100644
index 0000000000..506e1885b6
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 国际化
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperLanguageDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 表名
+ */
+ private String tableName;
+
+ /**
+ * 表主键
+ */
+ private String tableId;
+
+ /**
+ * 字段名
+ */
+ private String fieldName;
+
+ /**
+ * 字段值
+ */
+ private String fieldValue;
+
+ /**
+ * 语言
+ */
+ private String language;
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java
new file mode 100644
index 0000000000..59089f00ff
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java
@@ -0,0 +1,115 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.epmet.commons.tools.utils.TreeStringNode;
+import com.epmet.dto.result.MenuResourceDTO;
+import lombok.Data;
+
+
+/**
+ * 菜单管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperMenuDTO extends TreeStringNode implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ */
+ private String id;
+
+ /**
+ * 上级ID,一级菜单为0
+ */
+ private String pid;
+
+ /**
+ * 菜单URL
+ */
+ private String url;
+
+ /**
+ * 类型 0:菜单 1:按钮
+ */
+ private Integer type;
+
+ /**
+ * 菜单图标
+ */
+ private String icon;
+
+ /**
+ * 权限标识,如:sys:menu:save
+ */
+ private String permissions;
+
+ /**
+ * 排序
+ */
+ private Integer sort;
+
+ /**
+ * 删除标识:0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+ /**
+ * 菜单资源
+ */
+ private List resourceList;
+
+ /**
+ * 上级菜单名称
+ */
+ private String parentName;
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java
new file mode 100644
index 0000000000..9a1cd25769
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java
@@ -0,0 +1,101 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 资源管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperResourceDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ */
+ private String id;
+
+ /**
+ * 资源编码,如菜单ID
+ */
+ private String resourceCode;
+
+ /**
+ * 资源名称
+ */
+ private String resourceName;
+
+ /**
+ * 资源URL
+ */
+ private String resourceUrl;
+
+ /**
+ * 请求方式(如:GET、POST、PUT、DELETE)
+ */
+ private String resourceMethod;
+
+ /**
+ * 菜单标识 0:非菜单资源 1:菜单资源
+ */
+ private Integer menuFlag;
+
+ /**
+ * 认证等级 0:权限认证 1:登录认证 2:无需认证
+ */
+ private Integer authLevel;
+
+ /**
+ * 删除标识:0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java
new file mode 100644
index 0000000000..b8710f2c47
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java
@@ -0,0 +1,86 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 角色管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperRoleDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ */
+ private String id;
+
+ /**
+ * 角色名称
+ */
+ private String name;
+
+ /**
+ * 备注
+ */
+ private String remark;
+
+ /**
+ * 部门ID
+ */
+ private Long deptId;
+
+ /**
+ * 删除标识:0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java
new file mode 100644
index 0000000000..334ef8cf38
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 角色菜单关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperRoleMenuDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ */
+ private String id;
+
+ /**
+ * 角色ID
+ */
+ private String roleId;
+
+ /**
+ * 菜单ID
+ */
+ private String menuId;
+
+ /**
+ * 删除标识:0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java
new file mode 100644
index 0000000000..51bd851cc2
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+
+/**
+ * 角色用户关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperRoleUserDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ */
+ private String id;
+
+ /**
+ * 角色ID
+ */
+ private String roleId;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * 删除标识:0.未删除 1.已删除
+ */
+ private Integer delFlag;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 创建时间
+ */
+ private Date createdTime;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+ /**
+ * 更新时间
+ */
+ private Date updatedTime;
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java
new file mode 100644
index 0000000000..faa2fc297a
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java
@@ -0,0 +1,49 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * 用户信息token
+ *
+ * @author zhaoqifeng
+ * @date 2020/3/18 10:23
+ */
+@Data
+public class UserInfoDto implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 政府端:gov、居民端:resi、运营端:oper
+ */
+ private String app;
+
+ /**
+ * PC端:web、微信小程序:wxmp
+ */
+ private String client;
+
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+ /**
+ * openId
+ */
+ private String openId;
+
+ /**
+ * unionId
+ */
+ private String unionId;
+
+ /**
+ * 超级管理员 0:否 1:是
+ */
+ private Integer superAdmin;
+
+}
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java
new file mode 100644
index 0000000000..86df7d55ca
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dto.result;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 菜单资源
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Data
+@ApiModel(value = "菜单资源")
+public class MenuResourceDTO {
+ @ApiModelProperty(value = "资源URL")
+ private String resourceUrl;
+ @ApiModelProperty(value = "请求方式(如:GET、POST、PUT、DELETE)")
+ private String resourceMethod;
+
+}
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java
new file mode 100644
index 0000000000..41f02723df
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java
@@ -0,0 +1,158 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dto.result;
+
+import com.epmet.commons.tools.utils.TreeNode;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Range;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Null;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 菜单管理
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@ApiModel(value = "菜单管理")
+public class OperMenuDTO extends TreeNode implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "id")
+ @Null(message="{id.null}", groups = AddGroup.class)
+ @NotNull(message="{id.require}", groups = UpdateGroup.class)
+ private Long id;
+
+ @ApiModelProperty(value = "上级ID")
+ @NotNull(message="{sysmenu.pid.require}", groups = DefaultGroup.class)
+ private Long pid;
+
+ @ApiModelProperty(value = "菜单名称")
+ @NotBlank(message="{sysmenu.name.require}", groups = DefaultGroup.class)
+ private String name;
+
+ @ApiModelProperty(value = "菜单URL")
+ private String url;
+
+ @ApiModelProperty(value = "类型 0:菜单 1:按钮")
+ @Range(min=0, max=1, message = "{sysmenu.type.range}", groups = DefaultGroup.class)
+ private Integer type;
+
+ @ApiModelProperty(value = "菜单图标")
+ private String icon;
+
+ @ApiModelProperty(value = "权限标识,如:sys:menu:save")
+ private String permissions;
+
+ @ApiModelProperty(value = "排序")
+ @Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class)
+ private Integer sort;
+
+ @ApiModelProperty(value = "创建时间")
+ @JsonProperty(access = JsonProperty.Access.READ_ONLY)
+ private Date createDate;
+
+ @ApiModelProperty(value = "菜单资源")
+ private List resourceList;
+
+ @ApiModelProperty(value = "上级菜单名称")
+ private String parentName;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+ public String getUrl() {
+ return url;
+ }
+ public void setType(Integer type) {
+ this.type = type;
+ }
+ public Integer getType() {
+ return type;
+ }
+ public void setIcon(String icon) {
+ this.icon = icon;
+ }
+ public String getIcon() {
+ return icon;
+ }
+ public void setSort(Integer sort) {
+ this.sort = sort;
+ }
+ public Integer getSort() {
+ return sort;
+ }
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+ public Date getCreateDate() {
+ return createDate;
+ }
+
+ public String getPermissions() {
+ return permissions;
+ }
+
+ public void setPermissions(String permissions) {
+ this.permissions = permissions;
+ }
+
+ public List getResourceList() {
+ return resourceList;
+ }
+
+ public void setResourceList(List resourceList) {
+ this.resourceList = resourceList;
+ }
+
+ @Override
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Override
+ public Long getPid() {
+ return pid;
+ }
+
+ @Override
+ public void setPid(Long pid) {
+ this.pid = pid;
+ }
+
+ public String getParentName() {
+ return parentName;
+ }
+
+ public void setParentName(String parentName) {
+ this.parentName = parentName;
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java
new file mode 100644
index 0000000000..2a880a728a
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.enums;
+
+/**
+ * 菜单资源标识
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+public enum MenuFlagEnum {
+ /**
+ * 菜单资源
+ */
+ YES(1),
+ /**
+ * 非菜单资源
+ */
+ NO(0);
+
+ private int value;
+
+ MenuFlagEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java
new file mode 100644
index 0000000000..7132fa2ce3
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.enums;
+
+/**
+ * 菜单类型枚举
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+public enum MenuTypeEnum {
+ /**
+ * 菜单
+ */
+ MENU(0),
+ /**
+ * 按钮
+ */
+ BUTTON(1);
+
+ private int value;
+
+ MenuTypeEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java
new file mode 100644
index 0000000000..36300e201f
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.enums;
+
+/**
+ * 叶子节点枚举
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+public enum RegionLeafEnum {
+ YES(1),
+ NO(0);
+
+ private int value;
+
+ RegionLeafEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java
new file mode 100644
index 0000000000..b29c456897
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2019 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.enums;
+
+/**
+ * 行政区域 级别枚举
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+public enum RegionLevelEnum {
+ ONE(1),
+ TWO(2),
+ THREE(3);
+
+ private int value;
+
+ RegionLevelEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java
new file mode 100644
index 0000000000..dbc043f529
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.enums;
+
+/**
+ * 用户状态
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+public enum UserStatusEnum {
+ DISABLE(0),
+ ENABLED(1);
+
+ private int value;
+
+ UserStatusEnum(int value) {
+ this.value = value;
+ }
+
+ public int value() {
+ return this.value;
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-server/pom.xml b/epmet-module/oper-access/oper-access-server/pom.xml
new file mode 100644
index 0000000000..18362708dc
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/pom.xml
@@ -0,0 +1,156 @@
+
+
+
+ oper-access
+ com.epmet
+ 2.0.0
+
+ 4.0.0
+
+ oper-access-server
+ jar
+
+
+
+ com.epmet
+ oper-access-client
+ 2.0.0
+
+
+ com.epmet
+ epmet-commons-tools
+ 2.0.0
+
+
+ com.epmet
+ epmet-commons-mybatis
+ 2.0.0
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework
+ spring-context-support
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ de.codecentric
+ spring-boot-admin-starter-client
+ ${spring.boot.admin.version}
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+ com.epmet
+ epmet-user-client
+ 2.0.0
+ compile
+
+
+
+ io.github.openfeign
+ feign-httpclient
+ 10.3.0
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ ${project.basedir}/src/main/java
+
+
+ true
+ ${basedir}/src/main/resources
+
+
+
+
+
+ dev
+
+ true
+
+
+ 8093
+ dev
+
+
+
+
+
+ epmet
+ elink@833066
+
+ 0
+ 122.152.200.70
+ 6379
+ 123456
+
+ false
+ 122.152.200.70:8848
+ fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b
+
+
+ false
+
+
+
+
+ test
+
+
+ 8093
+ test
+
+
+
+
+
+ epmet
+ elink@833066
+
+ 0
+ 122.152.200.70
+ 6379
+ 123456
+
+ true
+ 122.152.200.70:8848
+ fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b
+
+
+ false
+
+
+
+
+
+
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/OperAccessApplication.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/OperAccessApplication.java
new file mode 100644
index 0000000000..6656d79909
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/OperAccessApplication.java
@@ -0,0 +1,21 @@
+package com.epmet;
+
+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.0.0
+ */
+@SpringBootApplication
+@EnableDiscoveryClient
+@EnableFeignClients
+public class OperAccessApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(OperAccessApplication.class, args);
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java
new file mode 100644
index 0000000000..c48da20571
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java
@@ -0,0 +1,26 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.config;
+
+import com.epmet.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 "operaccess";
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java
new file mode 100644
index 0000000000..af0772f36d
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ExcelUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.dto.OperLanguageDTO;
+import com.epmet.excel.OperLanguageExcel;
+import com.epmet.service.OperLanguageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 国际化
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@RestController
+@RequestMapping("operlanguage")
+public class OperLanguageController {
+
+ @Autowired
+ private OperLanguageService operLanguageService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = operLanguageService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ OperLanguageDTO data = operLanguageService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody OperLanguageDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ operLanguageService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody OperLanguageDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ operLanguageService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ operLanguageService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = operLanguageService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, OperLanguageExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java
new file mode 100644
index 0000000000..5ad9450e87
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java
@@ -0,0 +1,102 @@
+package com.epmet.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ExcelUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.dto.OperMenuDTO;
+import com.epmet.dto.form.UserInfoDto;
+import com.epmet.excel.OperMenuExcel;
+import com.epmet.service.OperMenuService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * 菜单管理
+ *
+ * @author zhaoqifeng
+ * @date 2020/3/17 16:35
+ */
+@RestController
+@RequestMapping("menu")
+public class OperMenuController {
+
+ @Autowired
+ private OperMenuService operMenuService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = operMenuService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ OperMenuDTO data = operMenuService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody OperMenuDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ operMenuService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody OperMenuDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ operMenuService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ operMenuService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = operMenuService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, OperMenuExcel.class);
+ }
+
+ /**
+ * 导航
+ * @param userInfo token
+ * @return List
+ */
+ @PostMapping("nav")
+ public Result> nav(@RequestBody UserInfoDto userInfo){
+ List list = operMenuService.getUserMenuNavList(userInfo);
+ return new Result>().ok(list);
+ }
+
+ /**
+ * 权限标识
+ * @param userInfo token
+ * @return Set
+ */
+ @PostMapping("permissions")
+ public Result> permissions(@RequestBody UserInfoDto userInfo){
+ Set set = operMenuService.getUserPermissions(userInfo);
+ return new Result>().ok(set);
+ }
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java
new file mode 100644
index 0000000000..160079f2dd
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ExcelUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.dto.OperResourceDTO;
+import com.epmet.excel.OperResourceExcel;
+import com.epmet.service.OperResourceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 资源管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@RestController
+@RequestMapping("operresource")
+public class OperResourceController {
+
+ @Autowired
+ private OperResourceService operResourceService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = operResourceService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ OperResourceDTO data = operResourceService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody OperResourceDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ operResourceService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody OperResourceDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ operResourceService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ operResourceService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = operResourceService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, OperResourceExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java
new file mode 100644
index 0000000000..c7c672b951
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ExcelUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.dto.OperRoleDTO;
+import com.epmet.excel.OperRoleExcel;
+import com.epmet.service.OperRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 角色管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@RestController
+@RequestMapping("operrole")
+public class OperRoleController {
+
+ @Autowired
+ private OperRoleService operRoleService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = operRoleService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ OperRoleDTO data = operRoleService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody OperRoleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ operRoleService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody OperRoleDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ operRoleService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ operRoleService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = operRoleService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, OperRoleExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java
new file mode 100644
index 0000000000..e4ff35888b
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ExcelUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.dto.OperRoleMenuDTO;
+import com.epmet.excel.OperRoleMenuExcel;
+import com.epmet.service.OperRoleMenuService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 角色菜单关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@RestController
+@RequestMapping("operrolemenu")
+public class OperRoleMenuController {
+
+ @Autowired
+ private OperRoleMenuService operRoleMenuService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = operRoleMenuService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ OperRoleMenuDTO data = operRoleMenuService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody OperRoleMenuDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ operRoleMenuService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody OperRoleMenuDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ operRoleMenuService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ operRoleMenuService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = operRoleMenuService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, OperRoleMenuExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java
new file mode 100644
index 0000000000..ccc4c56920
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.controller;
+
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.utils.ExcelUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.validator.AssertUtils;
+import com.epmet.commons.tools.validator.ValidatorUtils;
+import com.epmet.commons.tools.validator.group.AddGroup;
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import com.epmet.commons.tools.validator.group.DefaultGroup;
+import com.epmet.dto.OperRoleUserDTO;
+import com.epmet.excel.OperRoleUserExcel;
+import com.epmet.service.OperRoleUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 角色用户关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@RestController
+@RequestMapping("operroleuser")
+public class OperRoleUserController {
+
+ @Autowired
+ private OperRoleUserService operRoleUserService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = operRoleUserService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ OperRoleUserDTO data = operRoleUserService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody OperRoleUserDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ operRoleUserService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody OperRoleUserDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ operRoleUserService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ operRoleUserService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = operRoleUserService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, OperRoleUserExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java
new file mode 100644
index 0000000000..d681d328c3
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.OperLanguageEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 国际化
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Mapper
+public interface OperLanguageDao extends BaseDao {
+
+ OperLanguageEntity getLanguage(OperLanguageEntity entity);
+
+ void updateLanguage(OperLanguageEntity entity);
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java
new file mode 100644
index 0000000000..2858a76f24
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.OperMenuEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 菜单管理
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Mapper
+public interface OperMenuDao extends BaseDao {
+
+ OperMenuEntity getById(@Param("id") String id, @Param("language") String language);
+
+ /**
+ * 查询所有菜单列表
+ *
+ * @param type 菜单类型
+ * @param language 语言
+ */
+ List getMenuList(@Param("type") Integer type, @Param("language") String language);
+
+ /**
+ * 查询用户菜单列表
+ *
+ * @param userId 用户ID
+ * @param type 菜单类型
+ * @param language 语言
+ */
+ List getUserMenuList(@Param("userId") String userId, @Param("type") Integer type, @Param("language") String language);
+
+
+ /**
+ * 根据父菜单,查询子菜单
+ * @param pid 父菜单ID
+ */
+ List getListPid(String pid);
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java
new file mode 100644
index 0000000000..b92caee0d7
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.OperResourceEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 资源管理
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Mapper
+public interface OperResourceDao extends BaseDao {
+ /**
+ * 根据资源编码,删除对应的资源
+ * @param code 资源编码
+ */
+ void deleteByCode(String code);
+
+ /**
+ * 获取资源列表
+ * @param menuId 菜单ID
+ */
+ List getMenuResourceList(String menuId);
+
+ /**
+ * 获取所有资源列表
+ */
+ List getResourceList();
+
+ /**
+ * 获取用户资源列表
+ * @param userId 用户ID
+ */
+ List getUserResourceList(@Param("userId") String userId);
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java
new file mode 100644
index 0000000000..408a5275f5
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.OperRoleEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 角色管理
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Mapper
+public interface OperRoleDao extends BaseDao {
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java
new file mode 100644
index 0000000000..5e915925a4
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.OperRoleMenuEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 角色菜单关系
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Mapper
+public interface OperRoleMenuDao extends BaseDao {
+
+ /**
+ * 根据角色ID,获取菜单ID列表
+ */
+ List getMenuIdList(String roleId);
+
+ /**
+ * 根据角色id,删除角色菜单关系
+ * @param roleId 角色id
+ */
+ void deleteByRoleId(String roleId);
+
+ /**
+ * 根据菜单id,删除角色菜单关系
+ * @param menuId 菜单id
+ */
+ void deleteByMenuId(String menuId);
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java
new file mode 100644
index 0000000000..4741b5b91a
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.dao;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.OperRoleUserEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 角色用户关系
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Mapper
+public interface OperRoleUserDao extends BaseDao {
+
+ /**
+ * 根据角色ids,删除角色用户关系
+ * @param roleIds 角色ids
+ */
+ void deleteByRoleIds(String[] roleIds);
+
+ /**
+ * 根据用户id,删除角色用户关系
+ * @param userId 用户id
+ */
+ void deleteByUserId(String userId);
+
+ /**
+ * 角色ID列表
+ * @param userId 用户ID
+ *
+ * @return
+ */
+ List getRoleIdList(String userId);
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java
new file mode 100644
index 0000000000..685c9fdd29
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * 国际化
+ *
+ * @author Mark sunlightcs@gmail.com
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_language")
+public class OperLanguageEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 表名
+ */
+ private String tableName;
+ /**
+ * 表主键
+ */
+ private String tableId;
+ /**
+ * 字段名
+ */
+ private String fieldName;
+ /**
+ * 字段值
+ */
+ private String fieldValue;
+ /**
+ * 语言
+ */
+ private String language;
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java
new file mode 100644
index 0000000000..dd5b161730
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 菜单管理
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_menu")
+public class OperMenuEntity extends BaseEpmetEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 上级ID,一级菜单为0
+ */
+ private String pid;
+ /**
+ * 菜单名称
+ */
+ @TableField(exist = false)
+ private String name;
+ /**
+ * 菜单URL
+ */
+ private String url;
+ /**
+ * 类型 0:菜单 1:按钮
+ */
+ private Integer type;
+ /**
+ * 菜单图标
+ */
+ private String icon;
+ /**
+ * 权限标识,如:sys:menu:save
+ */
+ private String permissions;
+ /**
+ * 排序
+ */
+ private Integer sort;
+ /**
+ * 上级菜单名称
+ */
+ @TableField(exist = false)
+ private String parentName;
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java
new file mode 100644
index 0000000000..19d5718d0a
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 资源管理
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_resource")
+public class OperResourceEntity extends BaseEpmetEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 资源编码,如菜单ID
+ */
+ private String resourceCode;
+ /**
+ * 资源名称
+ */
+ private String resourceName;
+ /**
+ * 资源URL
+ */
+ private String resourceUrl;
+ /**
+ * 请求方式(如:GET、POST、PUT、DELETE)
+ */
+ private String resourceMethod;
+ /**
+ * 菜单标识 0:非菜单资源 1:菜单资源
+ */
+ private Integer menuFlag;
+ /**
+ * 认证等级 0:权限认证 1:登录认证 2:无需认证
+ */
+ private Integer authLevel;
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java
new file mode 100644
index 0000000000..18b34f123f
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 角色管理
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_role")
+public class OperRoleEntity extends BaseEpmetEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 角色名称
+ */
+ private String name;
+ /**
+ * 备注
+ */
+ private String remark;
+ /**
+ * 部门ID
+ */
+ @TableField(fill = FieldFill.INSERT)
+ private Long deptId;
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java
new file mode 100644
index 0000000000..f467f8ace2
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEntity;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 角色菜单关系
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_role_menu")
+public class OperRoleMenuEntity extends BaseEpmetEntity {
+ private static final long serialVersionUID = 1L;
+ /**
+ * 角色ID
+ */
+ private String roleId;
+ /**
+ * 菜单ID
+ */
+ private String menuId;
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java
new file mode 100644
index 0000000000..4cf1925259
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 角色用户关系
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("sys_role_user")
+public class OperRoleUserEntity extends BaseEpmetEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 角色ID
+ */
+ private String roleId;
+ /**
+ * 用户ID
+ */
+ private String userId;
+
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java
new file mode 100644
index 0000000000..13c8cc8ccf
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 国际化
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperLanguageExcel {
+
+ @Excel(name = "表名")
+ private String tableName;
+
+ @Excel(name = "表主键")
+ private String tableId;
+
+ @Excel(name = "字段名")
+ private String fieldName;
+
+ @Excel(name = "字段值")
+ private String fieldValue;
+
+ @Excel(name = "语言")
+ private String language;
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java
new file mode 100644
index 0000000000..883591d105
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java
@@ -0,0 +1,74 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 菜单管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperMenuExcel {
+
+ @Excel(name = "id")
+ private String id;
+
+ @Excel(name = "上级ID,一级菜单为0")
+ private String pid;
+
+ @Excel(name = "菜单URL")
+ private String url;
+
+ @Excel(name = "类型 0:菜单 1:按钮")
+ private Integer type;
+
+ @Excel(name = "菜单图标")
+ private String icon;
+
+ @Excel(name = "权限标识,如:sys:menu:save")
+ private String permissions;
+
+ @Excel(name = "排序")
+ private Integer sort;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "删除标识 0:未删除 1:删除")
+ private Integer delFlag;
+
+ @Excel(name = "创建者")
+ private String createdBy;
+
+ @Excel(name = "创建时间")
+ private Date createdTime;
+
+ @Excel(name = "更新者")
+ private String updatedBy;
+
+ @Excel(name = "更新时间")
+ private Date updatedTime;
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java
new file mode 100644
index 0000000000..5365542ada
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java
@@ -0,0 +1,74 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 资源管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperResourceExcel {
+
+ @Excel(name = "id")
+ private String id;
+
+ @Excel(name = "资源编码,如菜单ID")
+ private String resourceCode;
+
+ @Excel(name = "资源名称")
+ private String resourceName;
+
+ @Excel(name = "资源URL")
+ private String resourceUrl;
+
+ @Excel(name = "请求方式(如:GET、POST、PUT、DELETE)")
+ private String resourceMethod;
+
+ @Excel(name = "菜单标识 0:非菜单资源 1:菜单资源")
+ private Integer menuFlag;
+
+ @Excel(name = "认证等级 0:权限认证 1:登录认证 2:无需认证")
+ private Integer authLevel;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "删除标识 0:未删除 1:删除")
+ private Integer delFlag;
+
+ @Excel(name = "创建者")
+ private String createdBy;
+
+ @Excel(name = "创建时间")
+ private Date createdTime;
+
+ @Excel(name = "更新者")
+ private String updatedBy;
+
+ @Excel(name = "更新时间")
+ private Date updatedTime;
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java
new file mode 100644
index 0000000000..f7b5ebf4bc
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 角色管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperRoleExcel {
+
+ @Excel(name = "id")
+ private String id;
+
+ @Excel(name = "角色名称")
+ private String name;
+
+ @Excel(name = "备注")
+ private String remark;
+
+ @Excel(name = "部门ID")
+ private Long deptId;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "删除标识 0:未删除 1:删除")
+ private Integer delFlag;
+
+ @Excel(name = "创建者")
+ private String createdBy;
+
+ @Excel(name = "创建时间")
+ private Date createdTime;
+
+ @Excel(name = "更新者")
+ private String updatedBy;
+
+ @Excel(name = "更新时间")
+ private Date updatedTime;
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java
new file mode 100644
index 0000000000..de81137dd3
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 角色菜单关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperRoleMenuExcel {
+
+ @Excel(name = "id")
+ private String id;
+
+ @Excel(name = "角色ID")
+ private String roleId;
+
+ @Excel(name = "菜单ID")
+ private String menuId;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "删除标识 0:未删除 1:删除")
+ private Integer delFlag;
+
+ @Excel(name = "创建者")
+ private String createdBy;
+
+ @Excel(name = "创建时间")
+ private Date createdTime;
+
+ @Excel(name = "更新者")
+ private String updatedBy;
+
+ @Excel(name = "更新时间")
+ private Date updatedTime;
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java
new file mode 100644
index 0000000000..86a8e6846e
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 角色用户关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Data
+public class OperRoleUserExcel {
+
+ @Excel(name = "id")
+ private String id;
+
+ @Excel(name = "角色ID")
+ private String roleId;
+
+ @Excel(name = "用户ID")
+ private String userId;
+
+ @Excel(name = "乐观锁")
+ private Integer revision;
+
+ @Excel(name = "删除标识 0:未删除 1:删除")
+ private Integer delFlag;
+
+ @Excel(name = "创建者")
+ private String createdBy;
+
+ @Excel(name = "创建时间")
+ private Date createdTime;
+
+ @Excel(name = "更新者")
+ private String updatedBy;
+
+ @Excel(name = "更新时间")
+ private Date updatedTime;
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
new file mode 100644
index 0000000000..c3f44bbc57
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
@@ -0,0 +1,29 @@
+package com.epmet.feign;
+
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.OperUserDTO;
+import com.epmet.feign.fallback.EpmetUserFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author zhaoqifeng
+ * @dscription
+ * @date 2020/3/19 9:32
+ */
+@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, path="/epmetuser", fallback = EpmetUserFeignClientFallback.class)
+public interface EpmetUserFeignClient {
+
+ /**
+ *
+ * 根据id查询运营人员详情
+ *
+ * @param operUserId oper_user表主键
+ * @return com.epmet.commons.tools.utils.Result>
+ * @author zhaoqifeng
+ * @date 2020/3/19 09:28
+ **/
+ @GetMapping("/operuser/queryOperUserDtoById/{operUserId}")
+ Result info(@PathVariable("operUserId") String operUserId);
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
new file mode 100644
index 0000000000..067e5ca5a8
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
@@ -0,0 +1,21 @@
+package com.epmet.feign.fallback;
+
+import com.epmet.commons.tools.constant.ServiceConstant;
+import com.epmet.commons.tools.utils.ModuleUtils;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.dto.OperUserDTO;
+import com.epmet.feign.EpmetUserFeignClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * 用户模块
+ * @author zhaoqifeng
+ * @date 2020/3/19 9:34
+ */
+@Component
+public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
+ @Override
+ public Result info(String id) {
+ return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "info",id);
+ }
+}
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java
new file mode 100644
index 0000000000..fa479f92ca
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.redis;
+
+import com.epmet.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 国际化
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Component
+public class OperLanguageRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java
new file mode 100644
index 0000000000..d86846c7d8
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java
@@ -0,0 +1,73 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.redis;
+
+import com.epmet.commons.tools.redis.RedisKeys;
+import com.epmet.commons.tools.redis.RedisUtils;
+import com.epmet.commons.tools.utils.HttpContextUtils;
+import com.epmet.dto.OperMenuDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 菜单管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Component
+public class OperMenuRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+ public void setUserMenuNavList(String userId, String app, String client, List menuList){
+ String key = RedisKeys.getUserMenuNavKey(userId, app, client, HttpContextUtils.getLanguage());
+ redisUtils.set(key, menuList);
+ }
+
+ public List getUserMenuNavList(String userId, String app, String client){
+ String key = RedisKeys.getUserMenuNavKey(userId, app, client, HttpContextUtils.getLanguage());
+ return (List)redisUtils.get(key);
+ }
+
+ public void setUserPermissions(String userId, String app, String client, Set permsSet){
+ String key = RedisKeys.getUserPermissionsKey(userId, app, client);
+ redisUtils.set(key, permsSet);
+ }
+
+ public Set getUserPermissions(String userId, String app, String client){
+ String key = RedisKeys.getUserPermissionsKey(userId, app, client);
+ return (Set)redisUtils.get(key);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java
new file mode 100644
index 0000000000..4c79c26170
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.redis;
+
+import com.epmet.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 资源管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Component
+public class OperResourceRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java
new file mode 100644
index 0000000000..28f98c5615
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.redis;
+
+import com.epmet.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 角色菜单关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Component
+public class OperRoleMenuRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java
new file mode 100644
index 0000000000..15e6682155
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.redis;
+
+import com.epmet.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 角色管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Component
+public class OperRoleRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java
new file mode 100644
index 0000000000..7f6df90fa3
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.redis;
+
+import com.epmet.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 角色用户关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+@Component
+public class OperRoleUserRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java
new file mode 100644
index 0000000000..366c48bd0b
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.dto.OperLanguageDTO;
+import com.epmet.entity.OperLanguageEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 国际化
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+public interface OperLanguageService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-03-18
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-03-18
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return OperLanguageDTO
+ * @author generator
+ * @date 2020-03-18
+ */
+ OperLanguageDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void save(OperLanguageDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void update(OperLanguageDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void delete(String[] ids);
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java
new file mode 100644
index 0000000000..148ddc55f7
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java
@@ -0,0 +1,121 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.security.user.UserDetail;
+import com.epmet.dto.OperMenuDTO;
+import com.epmet.dto.form.UserInfoDto;
+import com.epmet.entity.OperMenuEntity;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 菜单管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+public interface OperMenuService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-03-18
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-03-18
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return OperMenuDTO
+ * @author generator
+ * @date 2020-03-18
+ */
+ OperMenuDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void save(OperMenuDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void update(OperMenuDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void delete(String[] ids);
+
+ /**
+ * 用户菜单列表
+ *
+ * @param userInfo 用户信息
+ * @param type 菜单类型
+ * @return java.util.List
+ */
+ List getUserMenuList(UserInfoDto userInfo, Integer type);
+
+ /**
+ * 用户菜单导航
+ * @param userInfo 用户信息
+ * @return java.util.List
+ */
+ List getUserMenuNavList(UserInfoDto userInfo);
+
+ /**
+ * 获取用户权限标识
+ * @param userInfo 用户信息
+ * @return java.util.Set
+ */
+ Set getUserPermissions(UserInfoDto userInfo);
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java
new file mode 100644
index 0000000000..1433da0ac6
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.dto.OperResourceDTO;
+import com.epmet.entity.OperResourceEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 资源管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+public interface OperResourceService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-03-18
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-03-18
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return OperResourceDTO
+ * @author generator
+ * @date 2020-03-18
+ */
+ OperResourceDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void save(OperResourceDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void update(OperResourceDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void delete(String[] ids);
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java
new file mode 100644
index 0000000000..20510c8edc
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.dto.OperRoleMenuDTO;
+import com.epmet.entity.OperRoleMenuEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 角色菜单关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+public interface OperRoleMenuService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-03-18
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-03-18
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return OperRoleMenuDTO
+ * @author generator
+ * @date 2020-03-18
+ */
+ OperRoleMenuDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void save(OperRoleMenuDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void update(OperRoleMenuDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void delete(String[] ids);
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java
new file mode 100644
index 0000000000..b4368ca747
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.dto.OperRoleDTO;
+import com.epmet.entity.OperRoleEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 角色管理
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+public interface OperRoleService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-03-18
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-03-18
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return OperRoleDTO
+ * @author generator
+ * @date 2020-03-18
+ */
+ OperRoleDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void save(OperRoleDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void update(OperRoleDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void delete(String[] ids);
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java
new file mode 100644
index 0000000000..f569984008
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.service;
+
+import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.tools.page.PageData;
+import com.epmet.dto.OperRoleUserDTO;
+import com.epmet.entity.OperRoleUserEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 角色用户关系
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-18
+ */
+public interface OperRoleUserService extends BaseService {
+
+ /**
+ * 默认分页
+ *
+ * @param params
+ * @return PageData
+ * @author generator
+ * @date 2020-03-18
+ */
+ PageData page(Map params);
+
+ /**
+ * 默认查询
+ *
+ * @param params
+ * @return java.util.List
+ * @author generator
+ * @date 2020-03-18
+ */
+ List list(Map params);
+
+ /**
+ * 单条查询
+ *
+ * @param id
+ * @return OperRoleUserDTO
+ * @author generator
+ * @date 2020-03-18
+ */
+ OperRoleUserDTO get(String id);
+
+ /**
+ * 默认保存
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void save(OperRoleUserDTO dto);
+
+ /**
+ * 默认更新
+ *
+ * @param dto
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void update(OperRoleUserDTO dto);
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return void
+ * @author generator
+ * @date 2020-03-18
+ */
+ void delete(String[] ids);
+}
\ No newline at end of file
diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java
new file mode 100644
index 0000000000..3ff21c04c1
--- /dev/null
+++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java
@@ -0,0 +1,104 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see