252 changed files with 10568 additions and 97 deletions
@ -0,0 +1,12 @@ |
|||
package com.epmet.commons.dynamic.datasource.bean; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
public class DataSourceParam { |
|||
|
|||
private String datasourceName; |
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<parent> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons</artifactId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
|
|||
<artifactId>epmet-commons-extapp-auth</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<properties> |
|||
<hibernate.validator.version>6.0.17.Final</hibernate.validator.version> |
|||
<commons.lang.version>3.7</commons.lang.version> |
|||
<commons.fileupload.version>1.3.3</commons.fileupload.version> |
|||
<commons.io.version>2.6</commons.io.version> |
|||
<hutool.version>4.6.1</hutool.version> |
|||
<easypoi.version>4.1.0</easypoi.version> |
|||
<joda.time.version>2.9.9</joda.time.version> |
|||
<fastjson.version>1.2.60</fastjson.version> |
|||
<gson.version>2.8.6</gson.version> |
|||
<jsoup.version>1.11.3</jsoup.version> |
|||
<lombok.version>1.18.4</lombok.version> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-aop</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-openfeign</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>common-service-client</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
</build> |
|||
|
|||
</project> |
@ -0,0 +1,32 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 http://www.renren.io
|
|||
* <p> |
|||
* 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 |
|||
* <p> |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* <p> |
|||
* 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.extappauth.annotation; |
|||
|
|||
import java.lang.annotation.*; |
|||
|
|||
/** |
|||
* 需要认证的外部请求 |
|||
* @Author wxz |
|||
* @Description |
|||
* @Date 2020/4/23 16:17 |
|||
**/ |
|||
@Target(ElementType.METHOD) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
@Documented |
|||
public @interface ExternalAppRequestAuth { |
|||
|
|||
} |
@ -0,0 +1,99 @@ |
|||
package com.epmet.commons.extappauth.aspect; |
|||
|
|||
|
|||
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.ExternalAppAuthFormDTO; |
|||
import com.epmet.dto.result.ExternalAppAuthResultDTO; |
|||
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.aspectj.lang.JoinPoint; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.aspectj.lang.annotation.Before; |
|||
import org.aspectj.lang.reflect.MethodSignature; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.core.annotation.Order; |
|||
import org.springframework.stereotype.Component; |
|||
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; |
|||
import java.lang.reflect.Parameter; |
|||
|
|||
/** |
|||
* 外部应用请求认证切面 |
|||
*/ |
|||
@Aspect |
|||
@Component |
|||
@Order(100) |
|||
public class ExternalAppRequestAuthAspect { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(ExternalAppRequestAuthAspect.class); |
|||
|
|||
public static final String ACCESS_TOKEN_HEADER_KEY = "AccessToken"; |
|||
public static final String APP_ID_HEADER_KEY = "appId"; |
|||
|
|||
@Autowired |
|||
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|||
|
|||
/** |
|||
* 拦截加了ExternalRequestAuth注解的方法 |
|||
* |
|||
* @param point |
|||
* @throws Throwable |
|||
*/ |
|||
@Before("@annotation(com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth)") |
|||
public void auth(JoinPoint point) throws Throwable { |
|||
HttpServletRequest request = getRequest(); |
|||
String token = request.getHeader(ACCESS_TOKEN_HEADER_KEY); |
|||
String appId = request.getHeader(APP_ID_HEADER_KEY); |
|||
|
|||
if (StringUtils.isAnyBlank(token, appId)) { |
|||
throw new RenException("请求头中的token和appId不能为空"); |
|||
} |
|||
|
|||
logger.info("外部应用请求认证拦截Aspect执行,appId:{}, token:{}", appId, token); |
|||
|
|||
ExternalAppAuthFormDTO form = new ExternalAppAuthFormDTO(); |
|||
form.setAppId(appId); |
|||
form.setToken(token); |
|||
Result<ExternalAppAuthResultDTO> result = commonServiceOpenFeignClient.externalAppAuth(form); |
|||
if (result == null) { |
|||
throw new RenException("调用服务进行外部应用认证,返回null"); |
|||
} |
|||
if (!result.success()) { |
|||
throw new RenException(result.getInternalMsg()); |
|||
} |
|||
ExternalAppAuthResultDTO authResult = result.getData(); |
|||
if (!authResult.getSuccess()) { |
|||
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), |
|||
result.getData().getMessage()); |
|||
} |
|||
|
|||
|
|||
// header参数赋值
|
|||
MethodSignature signature = (MethodSignature) point.getSignature(); |
|||
Parameter[] parameters = signature.getMethod().getParameters(); |
|||
if (parameters != null && parameters.length != 0) { |
|||
for (int i = 0; i < parameters.length; i++) { |
|||
if (parameters[i].getType() == ExternalAppRequestParam.class) { |
|||
ExternalAppRequestParam requestParam = (ExternalAppRequestParam) point.getArgs()[i]; |
|||
requestParam.setAppId(appId); |
|||
requestParam.setCustomerId(authResult.getCustomerId()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public HttpServletRequest getRequest() { |
|||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); |
|||
ServletRequestAttributes sra = (ServletRequestAttributes) requestAttributes; |
|||
return sra.getRequest(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package com.epmet.commons.extappauth.bean; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 外部应用请求信息 |
|||
*/ |
|||
@Data |
|||
public class ExternalAppRequestParam { |
|||
private String customerId; |
|||
private String appId; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.controller.test; |
|||
|
|||
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; |
|||
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("test") |
|||
public class TestController { |
|||
|
|||
@ExternalAppRequestAuth |
|||
@RequestMapping("/test") |
|||
public Result test(ExternalAppRequestParam externalAppRequestParam, String ext) { |
|||
return new Result().ok("调用成功,客户信息:"+externalAppRequestParam); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ExternalAppAuthFormDTO { |
|||
|
|||
/** |
|||
* 应用ID |
|||
*/ |
|||
private String appId; |
|||
|
|||
/** |
|||
* token字符串 |
|||
*/ |
|||
private String token; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class ExternalAppFormDTO { |
|||
|
|||
public interface AddExternalApp {} |
|||
public interface UpdateExternalApp {} |
|||
|
|||
@NotBlank(message = "缺少应用ID", groups = { UpdateExternalApp.class }) |
|||
private String appId; |
|||
|
|||
@NotBlank(message = "缺少应用名称", groups = { AddExternalApp.class, UpdateExternalApp.class }) |
|||
private String appName; |
|||
|
|||
@NotBlank(message = "缺少所属客户ID", groups = { AddExternalApp.class, UpdateExternalApp.class }) |
|||
private String customerId; |
|||
|
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class ExternalCustomerFormDTO { |
|||
|
|||
public interface ListExternalCustomerGroup {} |
|||
public interface AddExternalCustomerGroup {} |
|||
public interface UpdateExternalCustomerGroup {} |
|||
|
|||
|
|||
@NotBlank(message = "缺少客户ID参数", groups = { UpdateExternalCustomerGroup.class }) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
@NotBlank(message = "请填写客户名称", groups = { AddExternalCustomerGroup.class, UpdateExternalCustomerGroup.class }) |
|||
private String customerName; |
|||
|
|||
@Min(value = 0, groups = { ListExternalCustomerGroup.class }) |
|||
private Integer pageNo = 1; |
|||
|
|||
@Min(value = 0, groups = { ListExternalCustomerGroup.class }) |
|||
private Integer pageSize = 10; |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ExternalAppAuthResultDTO { |
|||
private Boolean success; |
|||
private String message; |
|||
private String customerId; |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ExternalAppResultDTO { |
|||
|
|||
public String appId; |
|||
/** |
|||
* APP名字 |
|||
*/ |
|||
private String appName; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String customerName; |
|||
|
|||
/** |
|||
* 秘钥 |
|||
*/ |
|||
private String secret; |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.result; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-19 |
|||
*/ |
|||
@Data |
|||
public class ExternalCustomerResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String customerName; |
|||
|
|||
} |
@ -0,0 +1,98 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.ExternalAppAuthFormDTO; |
|||
import com.epmet.dto.form.ExternalAppFormDTO; |
|||
import com.epmet.dto.result.ExternalAppAuthResultDTO; |
|||
import com.epmet.dto.result.ExternalAppResultDTO; |
|||
import com.epmet.service.ExternalAppAuthService; |
|||
import com.epmet.service.ExternalAppService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequestMapping("/externalapp") |
|||
public class ExternalAppController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(ExternalAppController.class); |
|||
|
|||
@Autowired |
|||
private ExternalAppAuthService externalAppAuthService; |
|||
|
|||
@Autowired |
|||
private ExternalAppService externalAppService; |
|||
|
|||
/** |
|||
* 外部请求认证 |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("/auth") |
|||
public Result<ExternalAppAuthResultDTO> auth(@RequestBody ExternalAppAuthFormDTO formDTO) { |
|||
String appId = formDTO.getAppId(); |
|||
String token = formDTO.getToken(); |
|||
if (StringUtils.isAnyBlank(token, appId)) { |
|||
throw new RenException("请求头中的token和appId不能为空"); |
|||
} |
|||
|
|||
logger.info("外部应用请求认证拦截Aspect。appId:{}, token:{}", appId, token); |
|||
ExternalAppAuthResultDTO auth = externalAppAuthService.auth(appId, token); |
|||
return new Result<ExternalAppAuthResultDTO>().ok(auth); |
|||
} |
|||
|
|||
/** |
|||
* 添加应用 |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("/add") |
|||
public Result<ExternalAppResultDTO> add(@RequestBody ExternalAppFormDTO formDTO) { |
|||
|
|||
ValidatorUtils.validateEntity(formDTO, ExternalAppFormDTO.AddExternalApp.class); |
|||
|
|||
String appName = formDTO.getAppName(); |
|||
String customerId = formDTO.getCustomerId(); |
|||
|
|||
ExternalAppResultDTO dto = externalAppService.add(appName, customerId); |
|||
return new Result<ExternalAppResultDTO>().ok(dto); |
|||
} |
|||
|
|||
/** |
|||
* 修改应用 |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("/update") |
|||
public Result<ExternalAppResultDTO> update(@RequestBody ExternalAppFormDTO formDTO) { |
|||
|
|||
ValidatorUtils.validateEntity(formDTO, ExternalAppFormDTO.UpdateExternalApp.class); |
|||
|
|||
String appId = formDTO.getAppId(); |
|||
String appName = formDTO.getAppName(); |
|||
String customerId = formDTO.getCustomerId(); |
|||
|
|||
ExternalAppResultDTO dto = externalAppService.updateById(appId, appName, customerId); |
|||
return new Result<ExternalAppResultDTO>().ok(dto); |
|||
} |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("/list") |
|||
public Result<PageData<ExternalAppResultDTO>> list(@RequestBody ExternalAppFormDTO formDTO) { |
|||
PageData<ExternalAppResultDTO> page = externalAppService.listPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getCustomerId()); |
|||
return new Result<PageData<ExternalAppResultDTO>>().ok(page); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.ExternalCustomerFormDTO; |
|||
import com.epmet.dto.result.ExternalCustomerResultDTO; |
|||
import com.epmet.service.ExternalCustomerService; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 外部客户管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/externalcustomer") |
|||
public class ExternalCustomerController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(ExternalCustomerController.class); |
|||
|
|||
@Autowired |
|||
private ExternalCustomerService externalCustomerService; |
|||
|
|||
/** |
|||
* 外部客户管理 |
|||
* @return |
|||
*/ |
|||
@PostMapping("/list") |
|||
public Result<PageData<ExternalCustomerResultDTO>> list(@RequestBody ExternalCustomerFormDTO form) { |
|||
ValidatorUtils.validateEntity(form, ExternalCustomerFormDTO.ListExternalCustomerGroup.class); |
|||
Integer pageNo = form.getPageNo(); |
|||
Integer pageSize = form.getPageSize(); |
|||
PageData<ExternalCustomerResultDTO> page = externalCustomerService.listPage(pageNo, pageSize); |
|||
return new Result<PageData<ExternalCustomerResultDTO>>().ok(page); |
|||
} |
|||
|
|||
/** |
|||
* 添加外部客户 |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("add") |
|||
public Result<ExternalCustomerResultDTO> add(@RequestBody ExternalCustomerFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.AddExternalCustomerGroup.class); |
|||
String customerName = formDTO.getCustomerName(); |
|||
ExternalCustomerResultDTO result = externalCustomerService.add(customerName); |
|||
return new Result<ExternalCustomerResultDTO>().ok(result); |
|||
} |
|||
|
|||
/** |
|||
* 更新客户信息 |
|||
* @param formDTO |
|||
* @return |
|||
*/ |
|||
@PostMapping("update") |
|||
public Result<ExternalCustomerResultDTO> update(@RequestBody ExternalCustomerFormDTO formDTO) { |
|||
ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.UpdateExternalCustomerGroup.class); |
|||
String customerId = formDTO.getCustomerId(); |
|||
String customerName = formDTO.getCustomerName(); |
|||
ExternalCustomerResultDTO result = externalCustomerService.update(customerId, customerName); |
|||
return new Result<ExternalCustomerResultDTO>().ok(result); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.result.ExternalAppResultDTO; |
|||
import com.epmet.entity.ExternalAppEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 外部应用列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
@Mapper |
|||
public interface ExternalAppDao extends BaseDao<ExternalAppEntity> { |
|||
|
|||
Integer countByAppNameAndCustomerId(@Param("appName") String appName, @Param("customerId") String customerId); |
|||
|
|||
ExternalAppResultDTO getByNameAndCustomerId(@Param("appName") String appName, @Param("customerId") String customerId); |
|||
|
|||
List<ExternalAppResultDTO> list(@Param("customerId") String customerId); |
|||
} |
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.ExternalAppSecretEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 外部应用秘钥列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
@Mapper |
|||
public interface ExternalAppSecretDao extends BaseDao<ExternalAppSecretEntity> { |
|||
|
|||
/** |
|||
* 查询app对应的秘钥 |
|||
* @param appId |
|||
* @return |
|||
*/ |
|||
ExternalAppSecretEntity getSecretsByAppId(@Param("appId") String appId); |
|||
|
|||
} |
@ -0,0 +1,56 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.result.ExternalCustomerResultDTO; |
|||
import com.epmet.entity.ExternalCustomerEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-19 |
|||
*/ |
|||
@Mapper |
|||
public interface ExternalCustomerDao extends BaseDao<ExternalCustomerEntity> { |
|||
|
|||
/** |
|||
* 列出客户基本信息 |
|||
* @return |
|||
*/ |
|||
List<ExternalCustomerResultDTO> listBaseInfo(); |
|||
|
|||
/** |
|||
* 根据名称查询客户 |
|||
* @param customerName |
|||
* @return |
|||
*/ |
|||
ExternalCustomerResultDTO getByCustomerName(@Param("customerName") String customerName); |
|||
|
|||
/** |
|||
* 根据客户名称计数 |
|||
* @param customerName |
|||
* @return |
|||
*/ |
|||
Integer countByCustomerName(@Param("customerName") String customerName); |
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 外部应用列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("external_app") |
|||
public class ExternalAppEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* APP名字 |
|||
*/ |
|||
private String appName; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 外部应用秘钥列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("external_app_secret") |
|||
public class ExternalAppSecretEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* APP ID |
|||
*/ |
|||
private String appId; |
|||
|
|||
/** |
|||
* 秘钥 |
|||
*/ |
|||
private String secret; |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("external_customer") |
|||
public class ExternalCustomerEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String customerName; |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.result.ExternalAppAuthResultDTO; |
|||
import com.epmet.dto.result.ExternalAppResultDTO; |
|||
|
|||
public interface ExternalAppAuthService { |
|||
|
|||
ExternalAppAuthResultDTO auth(String appId, String token); |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
|
|||
/** |
|||
* 外部应用秘钥列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
public interface ExternalAppSecretService { |
|||
} |
@ -0,0 +1,35 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.result.ExternalAppResultDTO; |
|||
|
|||
/** |
|||
* 外部应用列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
public interface ExternalAppService { |
|||
ExternalAppResultDTO add(String appName, String customerId); |
|||
|
|||
ExternalAppResultDTO updateById(String appId, String appName, String customerId); |
|||
|
|||
PageData<ExternalAppResultDTO> listPage(Integer pageNo, Integer pageSize, String customerId); |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.result.ExternalCustomerResultDTO; |
|||
import com.epmet.entity.ExternalCustomerEntity; |
|||
|
|||
public interface ExternalCustomerService { |
|||
|
|||
PageData<ExternalCustomerResultDTO> listPage(Integer pageNo, Integer pageSize); |
|||
|
|||
ExternalCustomerResultDTO add(String customerName); |
|||
|
|||
ExternalCustomerResultDTO update(String customerId, String customerName); |
|||
} |
@ -0,0 +1,115 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.redis.RedisKeys; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.dao.ExternalAppDao; |
|||
import com.epmet.dao.ExternalAppSecretDao; |
|||
import com.epmet.dto.result.ExternalAppAuthResultDTO; |
|||
import com.epmet.dto.result.ExternalAppResultDTO; |
|||
import com.epmet.entity.ExternalAppEntity; |
|||
import com.epmet.entity.ExternalAppSecretEntity; |
|||
import com.epmet.service.ExternalAppAuthService; |
|||
import com.epmet.utils.externalapp.ExtAppJwtTokenUtils; |
|||
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.stereotype.Service; |
|||
|
|||
@Service |
|||
public class ExternalAppAuthServiceImpl implements ExternalAppAuthService { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(ExternalAppAuthServiceImpl.class); |
|||
|
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
@Autowired |
|||
private ExtAppJwtTokenUtils jwtTokenUtils; |
|||
|
|||
@Autowired |
|||
private ExternalAppSecretDao externalAppSecretDao; |
|||
|
|||
@Autowired |
|||
private ExternalAppDao externalAppDao; |
|||
|
|||
private int diffMillins = 1000 * 60 * 5; |
|||
|
|||
@Override |
|||
public ExternalAppAuthResultDTO auth(String appId, String token) { |
|||
String secret; |
|||
if (StringUtils.isBlank(secret = getTokenByAppId(appId))) { |
|||
return fillAuthResult(false, String.format("根据AppId:%s没有找到对应的秘钥", appId), null); |
|||
} |
|||
|
|||
Claims claim; |
|||
try { |
|||
claim = jwtTokenUtils.getClaimByToken(token, secret); |
|||
} catch (Exception e) { |
|||
String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); |
|||
logger.error("解析token失败:{}", errorStackTrace); |
|||
return fillAuthResult(false, "解析token失败", null); |
|||
} |
|||
|
|||
String appIdIn = (String)claim.get("appId"); |
|||
String customerId = (String)claim.get("customerId"); |
|||
Long timestamp = (Long)claim.get("ts"); |
|||
|
|||
//校验时间戳,允许5分钟误差
|
|||
if (StringUtils.isAnyBlank(appIdIn, customerId) || timestamp == null) { |
|||
logger.error("access token不完整。{},{},{}", appIdIn, customerId, timestamp); |
|||
return fillAuthResult(false, "access token不完整。", null); |
|||
} |
|||
|
|||
// TODO
|
|||
// if (!validTimeStamp(timestamp)) {
|
|||
// logger.error("服务器存在时差过大,请求被拒绝", appId, appIdIn);
|
|||
// return fillAuthResult(false, "服务器存在时差过大,请求被拒绝", null);
|
|||
// }
|
|||
|
|||
if (!appId.equals(appIdIn)) { |
|||
logger.error("AppId不对应,token外部的:{}, token内部解析出来的:{}", appId, appIdIn); |
|||
return fillAuthResult(false, "Header中的AppId不匹配", null); |
|||
} |
|||
return fillAuthResult(true, "解析成功", customerId); |
|||
} |
|||
|
|||
private boolean validTimeStamp(Long timestamp) { |
|||
long now = System.currentTimeMillis(); |
|||
// System.out.println(new Date(timestamp));
|
|||
if (Math.abs(now - timestamp) > diffMillins) { |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 通过APP ID查询对应的秘钥 |
|||
* @param appId |
|||
* @return |
|||
*/ |
|||
public String getTokenByAppId(String appId) { |
|||
String secret = (String)redisUtils.get(RedisKeys.getExternalAppSecretKey(appId)); |
|||
if (StringUtils.isBlank(secret)) { |
|||
ExternalAppSecretEntity secretEntity = externalAppSecretDao.getSecretsByAppId(appId); |
|||
if (secretEntity == null) { |
|||
return null; |
|||
} |
|||
secret = secretEntity.getSecret(); |
|||
redisUtils.set(RedisKeys.getExternalAppSecretKey(appId), secret); |
|||
} |
|||
return secret; |
|||
} |
|||
|
|||
public ExternalAppAuthResultDTO fillAuthResult(Boolean result, String message, String customerId) { |
|||
ExternalAppAuthResultDTO authResult = new ExternalAppAuthResultDTO(); |
|||
authResult.setSuccess(result); |
|||
authResult.setMessage(message); |
|||
authResult.setCustomerId(customerId); |
|||
return authResult; |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.service.ExternalAppSecretService; |
|||
import org.springframework.stereotype.Service; |
|||
/** |
|||
* 外部应用秘钥列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
@Service |
|||
public class ExternalAppSecretServiceImpl implements ExternalAppSecretService { |
|||
|
|||
} |
@ -0,0 +1,133 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dao.ExternalAppDao; |
|||
import com.epmet.dao.ExternalAppSecretDao; |
|||
import com.epmet.dao.ExternalCustomerDao; |
|||
import com.epmet.dto.result.ExternalAppResultDTO; |
|||
import com.epmet.entity.ExternalAppEntity; |
|||
import com.epmet.entity.ExternalAppSecretEntity; |
|||
import com.epmet.service.ExternalAppService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* 外部应用列表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
@Service |
|||
public class ExternalAppServiceImpl implements ExternalAppService { |
|||
|
|||
@Autowired |
|||
private ExternalAppDao externalAppDao; |
|||
|
|||
@Autowired |
|||
private ExternalAppSecretDao externalAppSecretDao; |
|||
|
|||
@Autowired |
|||
private ExternalCustomerDao externalCustomerDao; |
|||
|
|||
@Transactional |
|||
@Override |
|||
public ExternalAppResultDTO add(String appName, String customerId) { |
|||
Integer count = externalAppDao.countByAppNameAndCustomerId(appName, customerId); |
|||
if (count > 0) { |
|||
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_EXISTS.getCode(), |
|||
EpmetErrorCode.OPER_EXTERNAL_APP_EXISTS.getMsg()); |
|||
} |
|||
|
|||
if (externalCustomerDao.selectById(customerId) == null) { |
|||
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), |
|||
EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); |
|||
} |
|||
|
|||
// 应用表插入
|
|||
ExternalAppEntity appEntity = new ExternalAppEntity(); |
|||
appEntity.setAppName(appName); |
|||
appEntity.setCustomerId(customerId); |
|||
externalAppDao.insert(appEntity); |
|||
|
|||
// 秘钥表插入
|
|||
ExternalAppSecretEntity secretEntity = new ExternalAppSecretEntity(); |
|||
secretEntity.setAppId(appEntity.getId()); |
|||
secretEntity.setSecret(genSecret()); |
|||
externalAppSecretDao.insert(secretEntity); |
|||
|
|||
ExternalAppResultDTO dto = new ExternalAppResultDTO(); |
|||
dto.setAppName(appName); |
|||
dto.setCustomerId(customerId); |
|||
dto.setAppId(appEntity.getId()); |
|||
return dto; |
|||
} |
|||
|
|||
/** |
|||
* 生成秘钥 |
|||
* @return |
|||
*/ |
|||
private String genSecret() { |
|||
String part1 = UUID.randomUUID().toString(); |
|||
String part2 = UUID.randomUUID().toString(); |
|||
return part1.concat(part2).replace("-", ""); |
|||
} |
|||
|
|||
@Override |
|||
public ExternalAppResultDTO updateById(String appId, String appName, String customerId) { |
|||
ExternalAppEntity exists = externalAppDao.selectById(appId); |
|||
if (exists == null) { |
|||
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), |
|||
EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); |
|||
} |
|||
|
|||
ExternalAppResultDTO byName = externalAppDao.getByNameAndCustomerId(appName, customerId); |
|||
if (byName != null && !byName.getAppId().equals(appId)) { |
|||
// 说明改了之后的名字跟当前客户内的其他应用重复
|
|||
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_EXISTS.getCode(), "应用名称重复"); |
|||
} |
|||
|
|||
exists.setAppName(appName); |
|||
exists.setCustomerId(customerId); |
|||
externalAppDao.updateById(exists); |
|||
|
|||
ExternalAppResultDTO resultDTO = new ExternalAppResultDTO(); |
|||
resultDTO.setAppId(appId); |
|||
resultDTO.setCustomerId(customerId); |
|||
resultDTO.setAppName(appName); |
|||
return resultDTO; |
|||
} |
|||
|
|||
@Override |
|||
public PageData<ExternalAppResultDTO> listPage(Integer pageNo, Integer pageSize, String customerId) { |
|||
PageHelper.startPage(pageNo, pageSize); |
|||
List<ExternalAppResultDTO> list = externalAppDao.list(customerId); |
|||
PageInfo<ExternalAppResultDTO> pageInfo = new PageInfo<>(list); |
|||
return new PageData<>(list, pageInfo.getTotal()); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,64 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dao.ExternalCustomerDao; |
|||
import com.epmet.dto.result.ExternalCustomerResultDTO; |
|||
import com.epmet.entity.ExternalCustomerEntity; |
|||
import com.epmet.service.ExternalCustomerService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class ExternalCustomerServiceImpl implements ExternalCustomerService { |
|||
|
|||
@Autowired |
|||
private ExternalCustomerDao externalCustomerDao; |
|||
|
|||
@Override |
|||
public PageData<ExternalCustomerResultDTO> listPage(Integer pageNo, Integer pageSize) { |
|||
PageHelper.startPage(pageNo, pageSize); |
|||
List<ExternalCustomerResultDTO> customers = externalCustomerDao.listBaseInfo(); |
|||
long total = new PageInfo<>(customers).getTotal(); |
|||
|
|||
PageData<ExternalCustomerResultDTO> pageData = new PageData<>(customers, (int) total); |
|||
return pageData; |
|||
} |
|||
|
|||
@Override |
|||
public ExternalCustomerResultDTO add(String customerName) { |
|||
Integer exitsCustomerCount = externalCustomerDao.countByCustomerName(customerName); |
|||
if (exitsCustomerCount > 0) { |
|||
throw new RenException(EpmetErrorCode.OPER_CUSTOMER_EXISTS.getCode(), "客户已存在"); |
|||
} |
|||
ExternalCustomerEntity entity = new ExternalCustomerEntity(); |
|||
entity.setCustomerName(customerName); |
|||
externalCustomerDao.insert(entity); |
|||
|
|||
ExternalCustomerResultDTO resultDTO = new ExternalCustomerResultDTO(); |
|||
resultDTO.setCustomerId(entity.getId()); |
|||
resultDTO.setCustomerName(customerName); |
|||
return resultDTO; |
|||
} |
|||
|
|||
@Override |
|||
public ExternalCustomerResultDTO update(String customerId, String customerName) { |
|||
ExternalCustomerEntity existsCustomer = externalCustomerDao.selectById(customerId); |
|||
if (existsCustomer == null) { |
|||
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), |
|||
EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); |
|||
} |
|||
existsCustomer.setCustomerName(customerName); |
|||
externalCustomerDao.updateById(existsCustomer); |
|||
|
|||
ExternalCustomerResultDTO resultDTO = new ExternalCustomerResultDTO(); |
|||
resultDTO.setCustomerId(customerId); |
|||
resultDTO.setCustomerName(customerName); |
|||
return resultDTO; |
|||
} |
|||
} |
@ -0,0 +1,93 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.epmet.utils.externalapp; |
|||
|
|||
import io.jsonwebtoken.Claims; |
|||
import io.jsonwebtoken.Jwts; |
|||
import io.jsonwebtoken.SignatureAlgorithm; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
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 ExtAppJwtTokenUtils { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(ExtAppJwtTokenUtils.class); |
|||
|
|||
public Claims getClaimByToken(String token, String secret) { |
|||
return Jwts.parser() |
|||
.setSigningKey(secret) |
|||
.parseClaimsJws(token) |
|||
.getBody(); |
|||
} |
|||
|
|||
public Claims tryGetClaimByToken(String token, String secret) { |
|||
try { |
|||
return Jwts.parser() |
|||
.setSigningKey(secret) |
|||
.parseClaimsJws(token) |
|||
.getBody(); |
|||
} catch (Exception e) { |
|||
logger.debug("validate is token error, token = " + token, e); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public String createToken(Map<String, Object> map, String secret) { |
|||
return Jwts.builder() |
|||
.setHeaderParam("typ", "JWT") |
|||
.setClaims(map) |
|||
.setIssuedAt(new Date()) |
|||
// .setExpiration(DateTime.now().plusSeconds(jwtProperties.getExpire()).toDate())
|
|||
.signWith(SignatureAlgorithm.HS512, secret) |
|||
.compact(); |
|||
} |
|||
|
|||
// /**
|
|||
// * token是否过期
|
|||
// *
|
|||
// * @return true:过期
|
|||
// */
|
|||
// public boolean isTokenExpired(Date expiration) {
|
|||
// return expiration.before(new Date());
|
|||
// }
|
|||
|
|||
public static void main(String[] args) { |
|||
genToken(); |
|||
// getClaim();
|
|||
} |
|||
|
|||
public static void genToken() { |
|||
HashMap<String, Object> claim = new HashMap<>(); |
|||
claim.put("appId", "227fb75ae4baa820755aaf43bf7f0a69"); |
|||
claim.put("customerId", "c1"); |
|||
claim.put("ts", System.currentTimeMillis() - 1000 * 60 * 4); |
|||
|
|||
String abc = new ExtAppJwtTokenUtils().createToken(claim, "4a762660254c57996343f8ee42fbc0a6"); |
|||
System.out.println(abc); |
|||
} |
|||
|
|||
public static void getClaim() { |
|||
String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJhcHBJZCI6IjEiLCJjdXN0b21lcklkIjoiYzEiLCJpYXQiOjE1OTc3NDI2NTB9.09Vop0Nobg3LENAJoAZaCUKtgAjADAK48BS11ky3YdAp6h-cXYtGeqUxbgvE_4F6239rc7UE2fjxtEvMuWEJuA"; |
|||
|
|||
Claims claimByToken = new ExtAppJwtTokenUtils().getClaimByToken(token, "4a762660254c57996343f8ee42fbc0a6"); |
|||
System.out.println(claimByToken); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,64 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.ExternalAppDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.ExternalAppEntity" id="externalAppMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="appName" column="APP_NAME"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<!-- appName和客户ID查询--> |
|||
<select id="countByAppNameAndCustomerId" resultType="java.lang.Integer"> |
|||
SELECT |
|||
count(0) |
|||
FROM |
|||
external_app |
|||
WHERE |
|||
APP_NAME = #{appName} |
|||
AND CUSTOMER_ID = #{customerId} |
|||
AND DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
<select id="list" resultType="com.epmet.dto.result.ExternalAppResultDTO"> |
|||
SELECT |
|||
ea.ID appId, |
|||
ea.APP_NAME, |
|||
ea.CUSTOMER_ID, |
|||
ec.CUSTOMER_NAME , |
|||
eas.SECRET |
|||
FROM |
|||
external_app ea |
|||
INNER JOIN external_customer ec ON ( ea.CUSTOMER_ID = ec.ID ) |
|||
LEFT JOIN external_app_secret eas ON (ea.ID = eas.APP_ID) |
|||
<where> |
|||
ea.DEL_FLAG = 0 |
|||
<if test="customerId != null and customerId != ''"> |
|||
AND ea.CUSTOMER_ID = #{customerId} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="getByNameAndCustomerId" resultType="com.epmet.dto.result.ExternalAppResultDTO"> |
|||
SELECT |
|||
ID AS appId, |
|||
APP_NAME , |
|||
CUSTOMER_ID |
|||
FROM |
|||
external_app |
|||
WHERE |
|||
APP_NAME = #{appName} |
|||
AND |
|||
CUSTOMER_ID = #{customerId} |
|||
AND DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.ExternalAppSecretDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.ExternalAppSecretEntity" id="externalAppSecretMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="appId" column="APP_ID"/> |
|||
<result property="secret" column="SECRET"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<select id="getSecretsByAppId" resultType="com.epmet.entity.ExternalAppSecretEntity"> |
|||
SELECT |
|||
ID, |
|||
APP_ID, |
|||
SECRET, |
|||
DEL_FLAG, |
|||
REVISION, |
|||
CREATED_BY, |
|||
CREATED_TIME, |
|||
UPDATED_BY, |
|||
UPDATED_TIME |
|||
FROM |
|||
external_app_secret |
|||
WHERE |
|||
APP_ID = #{appId} |
|||
AND DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,45 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.ExternalCustomerDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.ExternalCustomerEntity" id="externalCustomerMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerName" column="CUSTOMER_NAME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
<!-- 列出客户基本信息--> |
|||
<select id="listBaseInfo" resultType="com.epmet.dto.result.ExternalCustomerResultDTO"> |
|||
SELECT |
|||
id customerId, |
|||
CUSTOMER_NAME |
|||
FROM |
|||
external_customer |
|||
WHERE |
|||
DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
<select id="getByCustomerName" resultType="com.epmet.dto.result.ExternalCustomerResultDTO"> |
|||
SELECT |
|||
ID, CUSTOMER_NAME |
|||
from |
|||
external_customer |
|||
WHERE CUSTOMER_NAME = #{customerName} |
|||
</select> |
|||
|
|||
<select id="countByCustomerName" resultType="int"> |
|||
SELECT |
|||
count(1) |
|||
from |
|||
external_customer |
|||
WHERE CUSTOMER_NAME = #{customerName} |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,41 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<parent> |
|||
<artifactId>epmet-ext</artifactId> |
|||
<groupId>com.epmet</groupId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
|
|||
|
|||
<artifactId>epmet-ext-client</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-tools</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.binarywang</groupId> |
|||
<artifactId>weixin-java-mp</artifactId> |
|||
<version>3.6.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-user-client</artifactId> |
|||
<version>2.0.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
</build> |
|||
|
|||
</project> |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:33 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinAgencyFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1827402498483127629L; |
|||
|
|||
//后端自己看
|
|||
public interface StaffSinAgency{} |
|||
|
|||
/** |
|||
* 机关Id |
|||
*/ |
|||
@NotBlank(message = "机关Id不能为空",groups = {StaffSinAgency.class}) |
|||
private String agencyId; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:33 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinDeptFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1827404498483127629L; |
|||
|
|||
//后端自己看
|
|||
public interface StaffSinDept{} |
|||
|
|||
/** |
|||
* 部门Id |
|||
*/ |
|||
@NotBlank(message = "部门Id不能为空",groups = {StaffSinDept.class}) |
|||
private String departmentId; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:33 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinGridFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1827404498483127629L; |
|||
|
|||
//后端自己看
|
|||
public interface StaffSinGrid{} |
|||
|
|||
/** |
|||
* 网格Id |
|||
*/ |
|||
@NotBlank(message = "网格Id不能为空",groups = {StaffSinGrid.class}) |
|||
private String gridId; |
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:30 上午 |
|||
*/ |
|||
@Data |
|||
public class RoleResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -4321366067217459L; |
|||
|
|||
/** |
|||
* 角色key |
|||
*/ |
|||
private String roleKey; |
|||
|
|||
/** |
|||
* 角色名称 |
|||
*/ |
|||
private String roleName; |
|||
|
|||
/** |
|||
* 用户id |
|||
*/ |
|||
@JsonIgnore |
|||
private String userId; |
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:25 上午 |
|||
*/ |
|||
@Data |
|||
public class StaffSinDeptResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3440415466710443002L; |
|||
|
|||
/** |
|||
* 工作人员Id |
|||
*/ |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 工作人员名称 |
|||
*/ |
|||
private String staffName; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headPhoto; |
|||
|
|||
/** |
|||
* 性别,1男2女0未知 |
|||
*/ |
|||
private Integer gender; |
|||
|
|||
/** |
|||
* 角色列表 |
|||
*/ |
|||
private List<RoleResultDTO> roleList; |
|||
|
|||
} |
@ -0,0 +1,11 @@ |
|||
FROM java:8 |
|||
|
|||
RUN export LANG="zh_CN.UTF-8" |
|||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime |
|||
RUN echo 'Asia/Shanghai' > /etc/timezone |
|||
|
|||
COPY ./target/*.jar ./app.jar |
|||
|
|||
EXPOSE 8113 |
|||
|
|||
ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"] |
@ -0,0 +1,17 @@ |
|||
version: "3.7" |
|||
services: |
|||
epmet-ext-server: |
|||
container_name: epmet-ext-server-dev |
|||
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-ext-server:0.0.4 |
|||
ports: |
|||
- "8113:8113" |
|||
network_mode: host # 使用现有网络 |
|||
volumes: |
|||
- "/opt/epmet-cloud-logs/dev:/logs" |
|||
environment: |
|||
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
|||
deploy: |
|||
resources: |
|||
limits: |
|||
cpus: '0.1' |
|||
memory: 250M |
@ -0,0 +1,17 @@ |
|||
version: "3.7" |
|||
services: |
|||
epmet-ext-server: |
|||
container_name: epmet-ext-server-prod |
|||
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-ext-server:0.0.1 |
|||
ports: |
|||
- "8113:8113" |
|||
network_mode: host # 使用现有网络 |
|||
volumes: |
|||
- "/opt/epmet-cloud-logs/prod:/logs" |
|||
environment: |
|||
RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./app.jar" |
|||
deploy: |
|||
resources: |
|||
limits: |
|||
cpus: '0.1' |
|||
memory: 600M |
@ -0,0 +1,17 @@ |
|||
version: "3.7" |
|||
services: |
|||
epmet-ext-server: |
|||
container_name: epmet-ext-server-test |
|||
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-ext-server:0.0.1 |
|||
ports: |
|||
- "8113:8113" |
|||
network_mode: host # 使用现有网络 |
|||
volumes: |
|||
- "/opt/epmet-cloud-logs/test:/logs" |
|||
environment: |
|||
RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar" |
|||
deploy: |
|||
resources: |
|||
limits: |
|||
cpus: '0.1' |
|||
memory: 250M |
@ -0,0 +1,272 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<version>0.0.4</version> |
|||
|
|||
<parent> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-ext</artifactId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
|
|||
<artifactId>epmet-ext-server</artifactId> |
|||
<packaging>jar</packaging> |
|||
|
|||
<properties> |
|||
<aliyun.core.version>3.2.2</aliyun.core.version> |
|||
<aliyun.dysmsapi.version>1.1.0</aliyun.dysmsapi.version> |
|||
<qcloud.qcloudsms.version>1.0.5</qcloud.qcloudsms.version> |
|||
<freemarker.version>2.3.28</freemarker.version> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-ext-client</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-extapp-auth</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-tools</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-user-client</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>gov-org-client</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.epmet</groupId> |
|||
<artifactId>epmet-commons-mybatis</artifactId> |
|||
<version>2.0.0</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework</groupId> |
|||
<artifactId>spring-context-support</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-actuator</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.alibaba.cloud</groupId> |
|||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-core</artifactId> |
|||
<version>${aliyun.core.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.aliyun</groupId> |
|||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId> |
|||
<version>${aliyun.dysmsapi.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.qcloudsms</groupId> |
|||
<artifactId>qcloudsms</artifactId> |
|||
<version>${qcloud.qcloudsms.version}</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.sun.mail</groupId> |
|||
<artifactId>javax.mail</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.freemarker</groupId> |
|||
<artifactId>freemarker</artifactId> |
|||
<version>${freemarker.version}</version> |
|||
</dependency> |
|||
<!-- 替换Feign原生httpclient --> |
|||
<dependency> |
|||
<groupId>io.github.openfeign</groupId> |
|||
<artifactId>feign-httpclient</artifactId> |
|||
<version>10.3.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.flywaydb</groupId> |
|||
<artifactId>flyway-core</artifactId> |
|||
<!--<version>5.1.1</version>--> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp --> |
|||
<dependency> |
|||
<groupId>com.squareup.okhttp3</groupId> |
|||
<artifactId>okhttp</artifactId> |
|||
<version>4.0.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
<exclusions> |
|||
<exclusion> |
|||
<groupId>org.junit.vintage</groupId> |
|||
<artifactId>junit-vintage-engine</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.dom4j</groupId> |
|||
<artifactId>dom4j</artifactId> |
|||
<version>2.1.3</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.github.binarywang</groupId> |
|||
<artifactId>weixin-java-common</artifactId> |
|||
<version>3.6.0</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework</groupId> |
|||
<artifactId>spring-test</artifactId> |
|||
<version>5.1.12.RELEASE</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<finalName>${project.artifactId}</finalName> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-surefire-plugin</artifactId> |
|||
<configuration> |
|||
<skipTests>true</skipTests> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
|||
<resources> |
|||
<resource> |
|||
<filtering>true</filtering> |
|||
<directory>${basedir}/src/main/resources</directory> |
|||
</resource> |
|||
</resources> |
|||
</build> |
|||
<profiles> |
|||
<profile> |
|||
<id>dev</id> |
|||
<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation> |
|||
<properties> |
|||
<server.port>8113</server.port> |
|||
<spring.profiles.active>dev</spring.profiles.active> |
|||
|
|||
<!-- 数据库配置--> |
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epmet_third_user</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> |
|||
<!-- redis配置 --> |
|||
<spring.redis.index>0</spring.redis.index> |
|||
<spring.redis.host>192.168.1.130</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>123456</spring.redis.password> |
|||
<!-- nacos --> |
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr> |
|||
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace> |
|||
<nacos.config.namespace></nacos.config.namespace> |
|||
<nacos.config.group></nacos.config.group> |
|||
<nacos.config-enabled>false</nacos.config-enabled> |
|||
<nacos.ip/> |
|||
|
|||
<spring.flyway.enabled>false</spring.flyway.enabled> |
|||
</properties> |
|||
</profile> |
|||
<profile> |
|||
<id>test</id> |
|||
<!--<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation>--> |
|||
<properties> |
|||
<server.port>8113</server.port> |
|||
<spring.profiles.active>test</spring.profiles.active> |
|||
|
|||
<!-- 数据库配置--> |
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epmet</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password> |
|||
<!-- redis配置 --> |
|||
<spring.redis.index>0</spring.redis.index> |
|||
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>EpmEtrEdIs!q@w</spring.redis.password> |
|||
<!-- nacos --> |
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>192.168.10.150:8848</nacos.server-addr> |
|||
<nacos.discovery.namespace>67e3c350-533e-4d7c-9f8f-faf1b4aa82ae</nacos.discovery.namespace> |
|||
<nacos.config.namespace></nacos.config.namespace> |
|||
<nacos.config.group></nacos.config.group> |
|||
<nacos.config-enabled>false</nacos.config-enabled> |
|||
<nacos.ip/> |
|||
|
|||
<spring.flyway.enabled>true</spring.flyway.enabled> |
|||
</properties> |
|||
</profile> |
|||
|
|||
<profile> |
|||
<id>prod</id> |
|||
<!--<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation>--> |
|||
<properties> |
|||
<server.port>8113</server.port> |
|||
<spring.profiles.active>prod</spring.profiles.active> |
|||
|
|||
<!-- 数据库配置--> |
|||
<spring.datasource.druid.url> |
|||
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_third?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> |
|||
</spring.datasource.druid.url> |
|||
<spring.datasource.druid.username>epmet_third_user</spring.datasource.druid.username> |
|||
<spring.datasource.druid.password>EpmEt-db-UsEr</spring.datasource.druid.password> |
|||
<!-- redis配置 --> |
|||
<spring.redis.index>0</spring.redis.index> |
|||
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host> |
|||
<spring.redis.port>6379</spring.redis.port> |
|||
<spring.redis.password>EpmEtclOUdrEdIs!Q2w</spring.redis.password> |
|||
<!-- nacos --> |
|||
<nacos.register-enabled>true</nacos.register-enabled> |
|||
<nacos.server-addr>192.168.11.180:8848</nacos.server-addr> |
|||
<nacos.discovery.namespace>bd205d23-e696-47be-b995-916313f86e99</nacos.discovery.namespace> |
|||
<nacos.config.namespace></nacos.config.namespace> |
|||
<nacos.config.group></nacos.config.group> |
|||
<nacos.config-enabled>false</nacos.config-enabled> |
|||
<nacos.ip/> |
|||
|
|||
<spring.flyway.enabled>true</spring.flyway.enabled> |
|||
</properties> |
|||
</profile> |
|||
</profiles> |
|||
|
|||
</project> |
@ -0,0 +1,17 @@ |
|||
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; |
|||
|
|||
@SpringBootApplication |
|||
@EnableDiscoveryClient |
|||
@EnableFeignClients |
|||
public class EpmetExtApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(EpmetExtApplication.class, args); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.epmet.aspect; |
|||
|
|||
import com.epmet.commons.tools.aspect.BaseRequestLogAspect; |
|||
import org.aspectj.lang.ProceedingJoinPoint; |
|||
import org.aspectj.lang.annotation.Around; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.springframework.core.annotation.Order; |
|||
import org.springframework.stereotype.Component; |
|||
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; |
|||
|
|||
/** |
|||
* 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。 |
|||
*/ |
|||
@Aspect |
|||
@Component |
|||
@Order(0) |
|||
public class RequestLogAspect extends BaseRequestLogAspect { |
|||
|
|||
@Override |
|||
@Around(value = "execution(* com.epmet.controller.*Controller*.*(..)) ") |
|||
public Object proceed(ProceedingJoinPoint point) throws Throwable { |
|||
return super.proceed(point, getRequest()); |
|||
} |
|||
|
|||
/** |
|||
* 获取Request对象 |
|||
* |
|||
* @return |
|||
*/ |
|||
private HttpServletRequest getRequest() { |
|||
RequestAttributes ra = RequestContextHolder.getRequestAttributes(); |
|||
ServletRequestAttributes sra = (ServletRequestAttributes) ra; |
|||
return sra.getRequest(); |
|||
} |
|||
|
|||
} |
@ -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 "epmetext"; |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* @Description |
|||
* @author zxc |
|||
*/ |
|||
public interface ModuleConstant { |
|||
|
|||
String ERROR_GOV_ORG_GRID = "调用gov_org服务查询【网格】下的所有工作人员失败"; |
|||
|
|||
String ERROR_GOV_ORG_DEPARTMENT = "调用gov_org服务查询【部门】下的所有工作人员失败"; |
|||
|
|||
String ERROR_GOV_ORG_AGENCY = "调用gov_org服务查询【机关】下的所有工作人员失败"; |
|||
|
|||
String ERROR_EPMET_USER = "调用epmet_user服务查询网格下的所有工作人员失败"; |
|||
|
|||
} |
@ -0,0 +1,105 @@ |
|||
package com.epmet.controller; |
|||
|
|||
|
|||
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.*; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.OpenUpService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:16 上午 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("staff") |
|||
public class OpenUpController { |
|||
|
|||
@Autowired |
|||
private OpenUpService openUpService; |
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
/** |
|||
* @Description 网格工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:42 上午 |
|||
*/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffsingrid") |
|||
public Result<List<StaffSinGridResultDTO>> staffSinGrid(@RequestBody StaffSinGridFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StaffSinGridFormDTO.StaffSinGrid.class); |
|||
return new Result<List<StaffSinGridResultDTO>>().ok(openUpService.staffSinGrid(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 部门工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:51 上午 |
|||
*/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffsindept") |
|||
public Result<List<StaffSinDeptResultDTO>> staffSinDept(@RequestBody StaffSinDeptFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StaffSinDeptFormDTO.StaffSinDept.class); |
|||
return new Result<List<StaffSinDeptResultDTO>>().ok(openUpService.staffSinDept(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 机关工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/17 9:59 上午 |
|||
*/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffsinagency") |
|||
public Result<List<StaffSinAgencyResultDTO>> staffSinAgency(@RequestBody StaffSinAgencyFormDTO formDTO){ |
|||
ValidatorUtils.validateEntity(formDTO, StaffSinAgencyFormDTO.StaffSinAgency.class); |
|||
return new Result<List<StaffSinAgencyResultDTO>>().ok(openUpService.staffSinAgency(formDTO)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 查找工作人员的信息 |
|||
* @param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.08.17 10:30 |
|||
**/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("staffinfo") |
|||
public Result<ExtStaffInfoResultDTO> staffInfo(@LoginUser TokenDto token){ |
|||
CommonStaffIdFormDTO commonStaffIdFormDTO = new CommonStaffIdFormDTO(); |
|||
commonStaffIdFormDTO.setStaffId(token.getUserId()); |
|||
ValidatorUtils.validateEntity(commonStaffIdFormDTO, CommonStaffIdFormDTO.StaffIdGroup.class); |
|||
return epmetUserOpenFeignClient.extStaffInfo(commonStaffIdFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @Description 根据staffId,查询当前这个用户的数据权限 |
|||
* @param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.08.17 17:30 |
|||
**/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("permission") |
|||
Result<ExtStaffPermissionResultDTO> staffPermissionExt(@RequestBody CommonStaffIdFormDTO commonStaffIdFormDTO){ |
|||
ValidatorUtils.validateEntity(commonStaffIdFormDTO, CommonStaffIdFormDTO.StaffIdGroup.class); |
|||
return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId()); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,44 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; |
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.dto.form.CommonUserIdFormDTO; |
|||
import com.epmet.dto.result.ExtUserInfoResultDTO; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName OpenUpUserController |
|||
* @Auth wangc |
|||
* @Date 2020-08-21 17:56 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("user") |
|||
public class OpenUpUserController { |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
|
|||
/** |
|||
* @Description 查找当前用户的信息 |
|||
* @param |
|||
* @return |
|||
* @author wangc |
|||
* @date 2020.08.17 10:30 |
|||
**/ |
|||
@ExternalAppRequestAuth |
|||
@PostMapping("userinfo") |
|||
Result<ExtUserInfoResultDTO> userInfo(@LoginUser TokenDto token){ |
|||
CommonUserIdFormDTO userParam = new CommonUserIdFormDTO(); |
|||
userParam.setUserId(token.getUserId()); |
|||
ValidatorUtils.validateEntity(userParam, CommonUserIdFormDTO.CommonUserIdGroup.class); |
|||
return epmetUserOpenFeignClient.extUserInfo(userParam); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.StaffSinAgencyFormDTO; |
|||
import com.epmet.dto.form.StaffSinDeptFormDTO; |
|||
import com.epmet.dto.form.StaffSinGridFormDTO; |
|||
import com.epmet.dto.result.StaffSinAgencyResultDTO; |
|||
import com.epmet.dto.result.StaffSinDeptResultDTO; |
|||
import com.epmet.dto.result.StaffSinGridResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:17 上午 |
|||
*/ |
|||
public interface OpenUpService { |
|||
|
|||
/** |
|||
* @Description 网格工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:42 上午 |
|||
*/ |
|||
List<StaffSinGridResultDTO> staffSinGrid(StaffSinGridFormDTO formDTO); |
|||
|
|||
/** |
|||
* @Description 部门工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:51 上午 |
|||
*/ |
|||
List<StaffSinDeptResultDTO> staffSinDept(StaffSinDeptFormDTO formDTO); |
|||
|
|||
/** |
|||
* @Description 机关工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/17 9:59 上午 |
|||
*/ |
|||
List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO); |
|||
} |
@ -0,0 +1,126 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.constant.ModuleConstant; |
|||
import com.epmet.dto.form.*; |
|||
import com.epmet.dto.result.StaffSinAgencyResultDTO; |
|||
import com.epmet.dto.result.StaffSinDeptResultDTO; |
|||
import com.epmet.dto.result.StaffSinGridResultDTO; |
|||
import com.epmet.feign.EpmetUserOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.OpenUpService; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 9:18 上午 |
|||
*/ |
|||
@Service |
|||
public class OpenUpServiceImpl implements OpenUpService { |
|||
|
|||
@Autowired |
|||
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
/** |
|||
* @Description 网格工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:42 上午 |
|||
*/ |
|||
@Override |
|||
public List<StaffSinGridResultDTO> staffSinGrid(StaffSinGridFormDTO formDTO) { |
|||
CommonGridIdFormDTO commonGridId = new CommonGridIdFormDTO(); |
|||
commonGridId.setGridId(formDTO.getGridId()); |
|||
commonGridId.setUserId(UUID.randomUUID().toString().replace(StrConstant.HYPHEN, "")); |
|||
Result<List<String>> gridStaffs = govOrgOpenFeignClient.getGridStaffs(commonGridId); |
|||
if (!gridStaffs.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_GOV_ORG_GRID); |
|||
} |
|||
if (gridStaffs.getData().size() == NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
return this.getStaffList(gridStaffs.getData()); |
|||
} |
|||
|
|||
/** |
|||
* @Description 部门工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/13 9:51 上午 |
|||
*/ |
|||
@Override |
|||
public List<StaffSinDeptResultDTO> staffSinDept(StaffSinDeptFormDTO formDTO) { |
|||
DepartmentIdFormDTO departmentId = new DepartmentIdFormDTO(); |
|||
departmentId.setDepartmentId(formDTO.getDepartmentId()); |
|||
Result<List<String>> departmentStaffs = govOrgOpenFeignClient.getDepartmentStaffs(departmentId); |
|||
if (!departmentStaffs.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_GOV_ORG_DEPARTMENT); |
|||
} |
|||
if (departmentStaffs.getData().size() == NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
List<StaffSinGridResultDTO> data = this.getStaffList(departmentStaffs.getData()); |
|||
List<StaffSinDeptResultDTO> result = new ArrayList<>(); |
|||
data.forEach(staff -> { |
|||
StaffSinDeptResultDTO dept = new StaffSinDeptResultDTO(); |
|||
BeanUtils.copyProperties(staff,dept); |
|||
result.add(dept); |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* @Description 机关工作人员 被禁用的、未激活的不显示 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2020/8/17 9:59 上午 |
|||
*/ |
|||
@Override |
|||
public List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO) { |
|||
AgencyIdFormDTO agencyId = new AgencyIdFormDTO(); |
|||
agencyId.setAgencyId(formDTO.getAgencyId()); |
|||
Result<List<String>> agencyStaffs = govOrgOpenFeignClient.getAgencyStaffs(agencyId); |
|||
if (!agencyStaffs.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_GOV_ORG_AGENCY); |
|||
} |
|||
if (agencyStaffs.getData().size() == NumConstant.ZERO){ |
|||
return new ArrayList<>(); |
|||
} |
|||
List<StaffSinGridResultDTO> staffList = this.getStaffList(agencyStaffs.getData()); |
|||
List<StaffSinAgencyResultDTO> result = new ArrayList<>(); |
|||
staffList.forEach(staff -> { |
|||
StaffSinAgencyResultDTO agency = new StaffSinAgencyResultDTO(); |
|||
BeanUtils.copyProperties(staff,agency); |
|||
result.add(agency); |
|||
}); |
|||
return result; |
|||
} |
|||
|
|||
/** |
|||
* @Description 获取工作人员信息 |
|||
* @param userIds |
|||
* @author zxc |
|||
* @date 2020/8/17 1:30 下午 |
|||
*/ |
|||
public List<StaffSinGridResultDTO> getStaffList(List<String> userIds){ |
|||
UserIdsFormDTO userIdsForm = new UserIdsFormDTO(); |
|||
userIdsForm.setUserIds(userIds); |
|||
Result<List<StaffSinGridResultDTO>> staffInfoList = epmetUserOpenFeignClient.getStaffInfoList(userIdsForm); |
|||
if (!staffInfoList.success()){ |
|||
throw new RenException(ModuleConstant.ERROR_EPMET_USER); |
|||
} |
|||
return staffInfoList.getData(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,100 @@ |
|||
server: |
|||
port: @server.port@ |
|||
servlet: |
|||
context-path: /epmet/ext |
|||
|
|||
spring: |
|||
main: |
|||
allow-bean-definition-overriding: true |
|||
application: |
|||
name: epmet-ext-server |
|||
# dev|test|prod |
|||
profiles: |
|||
active: dev |
|||
jackson: |
|||
time-zone: GMT+8 |
|||
date-format: yyyy-MM-dd HH:mm:ss |
|||
redis: |
|||
database: @spring.redis.index@ |
|||
host: @spring.redis.host@ |
|||
port: @spring.redis.port@ |
|||
password: @spring.redis.password@ |
|||
timeout: 30s |
|||
datasource: |
|||
druid: |
|||
#MySQL |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
url: @spring.datasource.druid.url@ |
|||
username: @spring.datasource.druid.username@ |
|||
password: @spring.datasource.druid.password@ |
|||
cloud: |
|||
nacos: |
|||
discovery: |
|||
server-addr: @nacos.server-addr@ |
|||
namespace: @nacos.discovery.namespace@ |
|||
register-enabled: @nacos.register-enabled@ |
|||
ip: @nacos.ip@ |
|||
config: |
|||
enabled: @nacos.config-enabled@ |
|||
server-addr: @nacos.server-addr@ |
|||
namespace: @nacos.config.namespace@ |
|||
group: @nacos.config.group@ |
|||
file-extension: yaml |
|||
flyway: |
|||
enabled: @spring.flyway.enabled@ |
|||
locations: classpath:db/migration |
|||
url: @spring.datasource.druid.url@ |
|||
user: @spring.datasource.druid.username@ |
|||
password: @spring.datasource.druid.password@ |
|||
baseline-on-migrate: true |
|||
baseline-version: 0 |
|||
management: |
|||
endpoints: |
|||
web: |
|||
exposure: |
|||
include: "*" |
|||
endpoint: |
|||
health: |
|||
show-details: ALWAYS |
|||
|
|||
mybatis-plus: |
|||
mapper-locations: classpath:/mapper/**/*.xml |
|||
typeAliasesPackage: com.epmet.entity |
|||
global-config: |
|||
db-config: |
|||
id-type: ID_WORKER |
|||
field-strategy: NOT_NULL |
|||
column-underline: true |
|||
banner: false |
|||
|
|||
configuration: |
|||
map-underscore-to-camel-case: true |
|||
cache-enabled: false |
|||
call-setters-on-nulls: true |
|||
jdbc-type-for-null: 'null' |
|||
|
|||
feign: |
|||
hystrix: |
|||
enabled: true |
|||
client: |
|||
config: |
|||
default: |
|||
loggerLevel: BASIC |
|||
httpclient: |
|||
enabled: true |
|||
|
|||
hystrix: |
|||
command: |
|||
default: |
|||
execution: |
|||
isolation: |
|||
thread: |
|||
timeoutInMilliseconds: 60000 |
|||
|
|||
ribbon: |
|||
ReadTimeout: 300000 |
|||
ConnectTimeout: 300000 |
|||
|
|||
pagehelper: |
|||
helper-dialect: mysql |
|||
reasonable: false |
@ -0,0 +1 @@ |
|||
select 0; |
@ -0,0 +1,164 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<configuration> |
|||
<include resource="org/springframework/boot/logging/logback/base.xml"/> |
|||
|
|||
<property name="log.path" value="logs/ext"/> |
|||
|
|||
<springProperty scope="context" name="appname" source="spring.application.name"/> |
|||
|
|||
<!-- 日志上下文名称 --> |
|||
<contextName>${appname}</contextName> |
|||
|
|||
<!-- 彩色日志格式 --> |
|||
<property name="CONSOLE_LOG_PATTERN" |
|||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
|||
|
|||
<!--1. 输出到控制台--> |
|||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
|||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
|||
<level>debug</level> |
|||
</filter> |
|||
<encoder> |
|||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
|||
<!-- 设置字符集 --> |
|||
<charset>UTF-8</charset> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<!--2. 输出到文档--> |
|||
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
|||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/debug.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 日志归档 --> |
|||
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录debug级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>debug</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
|||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/info.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 每天日志归档路径以及格式 --> |
|||
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录info级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>info</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
|||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/warn.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录warn级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>warn</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
|||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<!-- 正在记录的日志文档的路径及文档名 --> |
|||
<file>${log.path}/error.log</file> |
|||
<!--日志文档输出格式--> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n</pattern> |
|||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
|||
</encoder> |
|||
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>100MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
<!--日志文档保留天数--> |
|||
<maxHistory>15</maxHistory> |
|||
</rollingPolicy> |
|||
<!-- 此日志文档只记录ERROR级别的 --> |
|||
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
|||
<level>ERROR</level> |
|||
<onMatch>ACCEPT</onMatch> |
|||
<onMismatch>DENY</onMismatch> |
|||
</filter> |
|||
</appender> |
|||
|
|||
<!-- 开发、测试环境 --> |
|||
<springProfile name="dev,test"> |
|||
<logger name="org.springframework.web" level="INFO"/> |
|||
<logger name="org.springboot.sample" level="INFO"/> |
|||
<logger name="com.epmet.dao" level="INFO"/> |
|||
<logger name="com.epmet.dao" level="DEBUG"/> |
|||
<root level="INFO"> |
|||
<appender-ref ref="DEBUG_FILE"/> |
|||
<appender-ref ref="INFO_FILE"/> |
|||
<appender-ref ref="WARN_FILE"/> |
|||
<appender-ref ref="ERROR_FILE"/> |
|||
</root> |
|||
</springProfile> |
|||
|
|||
<!-- 生产环境 --> |
|||
<springProfile name="prod"> |
|||
<logger name="org.springframework.web" level="INFO"/> |
|||
<logger name="org.springboot.sample" level="INFO"/> |
|||
<logger name="com.epmet.dao" level="INFO"/> |
|||
<root level="INFO"> |
|||
<appender-ref ref="CONSOLE"/> |
|||
<appender-ref ref="DEBUG_FILE"/> |
|||
<appender-ref ref="INFO_FILE"/> |
|||
<appender-ref ref="WARN_FILE"/> |
|||
<appender-ref ref="ERROR_FILE"/> |
|||
</root> |
|||
</springProfile> |
|||
|
|||
</configuration> |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<artifactId>epmet-module</artifactId> |
|||
<groupId>com.epmet</groupId> |
|||
<version>2.0.0</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>epmet-ext</artifactId> |
|||
<packaging>pom</packaging> |
|||
|
|||
<modules> |
|||
<module>epmet-ext-client</module> |
|||
<module>epmet-ext-server</module> |
|||
</modules> |
|||
|
|||
|
|||
</project> |
@ -0,0 +1,29 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/24 10:03 上午 |
|||
*/ |
|||
@Data |
|||
public class CustomerAccessTokenInfoFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 6514918025012507710L; |
|||
|
|||
public interface CustomerAccessTokenInfo{} |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
@NotBlank(message = "客户ID不能为空",groups = {CustomerAccessTokenInfo.class}) |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 客户端类型 |
|||
*/ |
|||
private String clientType; |
|||
} |
@ -0,0 +1,56 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/24 10:08 上午 |
|||
*/ |
|||
@Data |
|||
public class CustomerAccessTokenInfoResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7008455455787166150L; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
*/ |
|||
private String customerName; |
|||
|
|||
/** |
|||
* 环境类型 |
|||
*/ |
|||
private String source; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 授权方AppId |
|||
*/ |
|||
private String authAppId; |
|||
|
|||
/** |
|||
* 授权方的 accessToken |
|||
*/ |
|||
private String authorizerAccessToken; |
|||
|
|||
/** |
|||
* 授权方的 refreshToken |
|||
*/ |
|||
private String authorizerRefreshToken; |
|||
|
|||
/** |
|||
* accessToken过期事件 |
|||
*/ |
|||
private String expiresInTime; |
|||
|
|||
/** |
|||
* 客户端类型 |
|||
*/ |
|||
private String clientType; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/17 10:37 上午 |
|||
*/ |
|||
@Data |
|||
public class AgencyIdFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1719033407335647411L; |
|||
|
|||
/** |
|||
* 部门Id |
|||
*/ |
|||
private String agencyId; |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 5:56 下午 |
|||
*/ |
|||
@Data |
|||
public class CustomerIdFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4512080710854617599L; |
|||
|
|||
public interface Customer{} |
|||
|
|||
@NotBlank(message = "customerId不能为空",groups = {Customer.class}) |
|||
private String customerId; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 10:37 上午 |
|||
*/ |
|||
@Data |
|||
public class DepartmentIdFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1718433407335647411L; |
|||
|
|||
/** |
|||
* 部门Id |
|||
*/ |
|||
private String departmentId; |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/13 10:35 上午 |
|||
*/ |
|||
@Data |
|||
public class GridIdFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1062540828459359881L; |
|||
|
|||
/** |
|||
* 网格Id |
|||
*/ |
|||
private String gridId; |
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 修改客户网格数和有效期-接口入参 |
|||
* @Author sun |
|||
*/ |
|||
@Data |
|||
public class UpdateCustomerParameterFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4512080710854617599L; |
|||
/** |
|||
* 客户Id |
|||
*/ |
|||
@NotBlank(message = "customerId不能为空",groups = {Customer.class}) |
|||
private String customerId; |
|||
/** |
|||
* 有效期 |
|||
*/ |
|||
private String validityTime; |
|||
/** |
|||
* 最大允许创建网格数 |
|||
*/ |
|||
private Integer gridNumber; |
|||
|
|||
public interface Customer{} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/8/14 9:27 上午 |
|||
*/ |
|||
@Data |
|||
public class CustomerGridCountResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 386294009143897744L; |
|||
|
|||
/** |
|||
* 客户下的网格数量 |
|||
*/ |
|||
private Integer gridCount; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 部门信息 |
|||
* @ClassName ExtDeptResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-08-17 17:16 |
|||
*/ |
|||
@Data |
|||
public class ExtDeptResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 1792371558965832432L; |
|||
|
|||
/** |
|||
* 部门Id |
|||
* */ |
|||
private String deptId; |
|||
|
|||
/** |
|||
* 部门名称 |
|||
* */ |
|||
private String deptName; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 网格信息 |
|||
* @ClassName ExtGridResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-08-17 15:28 |
|||
*/ |
|||
@Data |
|||
public class ExtGridResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -4531574240525562587L; |
|||
|
|||
/** |
|||
* 网格Id |
|||
* */ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格名称 |
|||
* */ |
|||
private String gridName; |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ExtRoleMapResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-08-17 09:19 |
|||
*/ |
|||
@Data |
|||
public class ExtRoleMapResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 4988555173286922503L; |
|||
|
|||
/** |
|||
* 角色key |
|||
* */ |
|||
private String roleKey; |
|||
|
|||
/** |
|||
* 角色名称 |
|||
* */ |
|||
private String roleName; |
|||
} |
@ -0,0 +1,86 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ExtStaffInfoResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-08-17 09:14 |
|||
*/ |
|||
@Data |
|||
public class ExtStaffInfoResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 3874334777882476292L; |
|||
|
|||
/** |
|||
* 当前用户id |
|||
* */ |
|||
private String userId; |
|||
/** |
|||
* 工作人员昵称 |
|||
* */ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 工作人员头像 |
|||
* */ |
|||
private String profile; |
|||
|
|||
/** |
|||
* |
|||
* */ |
|||
private String realName; |
|||
|
|||
/** |
|||
* 客户Id |
|||
* */ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
* */ |
|||
private String customerName; |
|||
|
|||
/** |
|||
* 机关Id |
|||
* */ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 机关名称 |
|||
* */ |
|||
private String agencyName; |
|||
|
|||
/** |
|||
* 机关路径Id |
|||
* */ |
|||
private String agencyIdPath; |
|||
|
|||
/** |
|||
* 机关路径名称 |
|||
* */ |
|||
private String agencyNamePath; |
|||
|
|||
/** |
|||
* 网格Id |
|||
* */ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格名称 |
|||
* */ |
|||
private String gridName; |
|||
|
|||
/** |
|||
* 是否管理员标识 1是0否 |
|||
* */ |
|||
private String adminFlag; |
|||
|
|||
/** |
|||
* 用户角色列表 |
|||
* */ |
|||
private List<ExtRoleMapResultDTO> roleList; |
|||
} |
@ -0,0 +1,43 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 工作人员数据权限 |
|||
* @ClassName ExtStaffPermissionResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-08-17 15:24 |
|||
*/ |
|||
@Data |
|||
public class ExtStaffPermissionResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 2513553862809278219L; |
|||
|
|||
/** |
|||
* 直属机关Id |
|||
* */ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* 直属机关名称 |
|||
* */ |
|||
private String agencyName; |
|||
|
|||
/** |
|||
* 直属机关直属网格列表 |
|||
* */ |
|||
private List<ExtGridResultDTO> gridList = new ArrayList<>(); |
|||
|
|||
/** |
|||
* 直属机关直属部门列表 |
|||
* */ |
|||
private List<ExtDeptResultDTO> departmentList = new ArrayList<>(); |
|||
|
|||
/** |
|||
* 子集机关列表 |
|||
* */ |
|||
private List<ExtStaffPermissionResultDTO> subAgencyList = new ArrayList<>(); |
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ExtUserInfoResultDTO |
|||
* @Auth wangc |
|||
* @Date 2020-08-21 17:09 |
|||
*/ |
|||
@Data |
|||
public class ExtUserInfoResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 5888986115026957874L; |
|||
|
|||
/** |
|||
* 当前用户id |
|||
* */ |
|||
private String userId = ""; |
|||
/** |
|||
* 工作人员昵称 |
|||
* */ |
|||
private String nickname = ""; |
|||
|
|||
/** |
|||
* 工作人员头像 |
|||
* */ |
|||
private String profile = ""; |
|||
|
|||
/** |
|||
* |
|||
* */ |
|||
private String realName = ""; |
|||
|
|||
/** |
|||
* 客户Id |
|||
* */ |
|||
private String customerId = ""; |
|||
|
|||
/** |
|||
* 客户名称 |
|||
* */ |
|||
private String customerName = ""; |
|||
|
|||
/** |
|||
* 机关Id |
|||
* */ |
|||
private String agencyId = ""; |
|||
|
|||
/** |
|||
* 机关名称 |
|||
* */ |
|||
private String agencyName = ""; |
|||
|
|||
/** |
|||
* 机关路径Id |
|||
* */ |
|||
private String agencyIdPath = ""; |
|||
|
|||
/** |
|||
* 机关路径名称 |
|||
* */ |
|||
private String agencyNamePath = ""; |
|||
|
|||
/** |
|||
* 网格Id |
|||
* */ |
|||
private String gridId = ""; |
|||
|
|||
/** |
|||
* 网格名称 |
|||
* */ |
|||
private String gridName = ""; |
|||
|
|||
/** |
|||
* 用户角色列表 |
|||
* */ |
|||
private List<ExtRoleMapResultDTO> roleList = new ArrayList<>(); |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue