diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java index 3a8ac1ae8f..e0675092c8 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java @@ -21,5 +21,15 @@ import java.lang.annotation.*; @Documented @Inherited public @interface DataSource { + /** + * 直接指定数据源名称 + * @return + */ String value() default ""; + + /** + * 是否从参数中获取数据源名称,优先级高于value + * @return + */ + boolean datasourceNameFromArg() default false; } diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java index d636568425..45113847c6 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java @@ -9,7 +9,9 @@ package com.epmet.commons.dynamic.datasource.aspect; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.dynamic.datasource.bean.DataSourceParam; import com.epmet.commons.dynamic.datasource.config.DynamicContextHolder; +import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @@ -22,6 +24,7 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import java.lang.reflect.Method; +import java.lang.reflect.Parameter; /** * 多数据源,切面处理类 @@ -52,9 +55,9 @@ public class DataSourceAspect { if(targetDataSource != null || methodDataSource != null){ String value; if(methodDataSource != null){ - value = methodDataSource.value(); + value = getDatasourceName(methodDataSource, signature.getMethod().getParameters(), point.getArgs()); }else { - value = targetDataSource.value(); + value = getDatasourceName(targetDataSource, signature.getMethod().getParameters(), point.getArgs()); } DynamicContextHolder.push(value); @@ -68,4 +71,39 @@ public class DataSourceAspect { logger.debug("clean datasource"); } } + + /** + * 获取要用到的数据源名称 + * @param dataSource + * @return + */ + public String getDatasourceName(DataSource dataSource, Parameter[] methodParameters, Object[] methodArgValues) { + if (dataSource.datasourceNameFromArg()) { + // 1.从参数中动态获取数据源名称 + String datasourceNameFromParam = getDatasourceNameFromArg(methodParameters, methodArgValues); + if (StringUtils.isNotBlank(datasourceNameFromParam)) { + // 如果有DatasourceParam类型的参数并且设置了datasourceName值,那么返回这个值,否则使用硬编码的 + return datasourceNameFromParam; + } + } + // 2.硬编码指定数据源名称 + return dataSource.value(); + } + + /** + * 从参数中取数据源名称 + * @param parameters + * @param argsObject + * @return + */ + public String getDatasourceNameFromArg(Parameter[] parameters, Object[] argsObject) { + for (int i = 0; i < parameters.length; i++) { + if (parameters[i].getType() == DataSourceParam.class) { + DataSourceParam param = (DataSourceParam) argsObject[i]; + return param.getDatasourceName(); + } + } + + return null; + } } diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java new file mode 100644 index 0000000000..19b5905588 --- /dev/null +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java @@ -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; + +} diff --git a/epmet-commons/epmet-commons-extapp-auth/pom.xml b/epmet-commons/epmet-commons-extapp-auth/pom.xml new file mode 100644 index 0000000000..de7060d57f --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + + com.epmet + epmet-commons + 2.0.0 + + + epmet-commons-extapp-auth + jar + + + 6.0.17.Final + 3.7 + 1.3.3 + 2.6 + 4.6.1 + 4.1.0 + 2.9.9 + 1.2.60 + 2.8.6 + 1.11.3 + 1.18.4 + + + + + org.springframework.boot + spring-boot-starter-web + provided + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.cloud + spring-cloud-starter-openfeign + + + com.epmet + common-service-client + 2.0.0 + + + + + ${project.artifactId} + + + diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/ExternalAppRequestAuth.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/ExternalAppRequestAuth.java new file mode 100644 index 0000000000..c71ca89816 --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/annotation/ExternalAppRequestAuth.java @@ -0,0 +1,32 @@ +/** + * Copyright 2018 人人开源 http://www.renren.io + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.epmet.commons.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 { + +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java new file mode 100644 index 0000000000..b4cfd11c27 --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/aspect/ExternalAppRequestAuthAspect.java @@ -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 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(); + } + +} diff --git a/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/bean/ExternalAppRequestParam.java b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/bean/ExternalAppRequestParam.java new file mode 100644 index 0000000000..97ebf3c2c6 --- /dev/null +++ b/epmet-commons/epmet-commons-extapp-auth/src/main/java/com/epmet/commons/extappauth/bean/ExternalAppRequestParam.java @@ -0,0 +1,12 @@ +package com.epmet.commons.extappauth.bean; + +import lombok.Data; + +/** + * 外部应用请求信息 + */ +@Data +public class ExternalAppRequestParam { + private String customerId; + private String appId; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index db6dea1b61..b66c3c33d2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -133,4 +133,9 @@ public interface ServiceConstant { * 积分银行 * */ String EPMET_POINT_SERVER = "epmet-point-server"; + + /** + * 开放接口服务 + */ + String EPMET_EXT_SERVER = "epmet-ext-server"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index fbbeebccbf..d3d2b8ccd1 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -75,6 +75,8 @@ public enum EpmetErrorCode { STAFF_ADD_FAILED(8403,"人员添加失败"), STAFF_EDIT_FAILED(8404,"人员编辑失败"), CANNOT_DISABLE_YOURSELF(8405,"您不能禁用自己"), + NO_SET_GRID_COUNT(8406,"您还未设置创建网格数量上限,请联系管理员设置"), + GRID_COUNT_UP(8407,"您的创建网格数量已到达上限,请联系管理员设置"), ALREADY_EVALUATE(8501,"您已评价"), ALREADY_VOTE(8502,"您已表态"), @@ -99,6 +101,9 @@ public enum EpmetErrorCode { OPER_ADD_CUSTOMER_MANAGER_ERROR(8706, "新增客户管理员失败"), OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"), OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"), + OPER_EXTERNAL_APP_AUTH_ERROR(8709, "外部应用认证失败"), + OPER_EXTERNAL_CUSTOMER_NOT_EXISTS(8710, "该客户不存在"), + OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index bf7c8f1a83..a5be29eb58 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -288,4 +288,13 @@ public class RedisKeys { public static String getVolunteerSmsCodeKey(String phone) { return String.format(rootPrefix+"smscode:regvolunteer:%s",phone); } + + /** + * 外部应用的secret key + * @param appId + * @return + */ + public static String getExternalAppSecretKey(String appId) { + return String.format(rootPrefix+"externalapp:secret:%s",appId); + } } diff --git a/epmet-commons/pom.xml b/epmet-commons/pom.xml index 3f25f5b1b5..d4b8e270b4 100644 --- a/epmet-commons/pom.xml +++ b/epmet-commons/pom.xml @@ -22,6 +22,7 @@ epmet-commons-tools-wx-ma epmet-commons-tools-wx-mp epmet-commons-service-call + epmet-commons-extapp-auth diff --git a/epmet-gateway/deploy/docker-compose-dev.yml b/epmet-gateway/deploy/docker-compose-dev.yml index de78c36557..82a1bb2c15 100644 --- a/epmet-gateway/deploy/docker-compose-dev.yml +++ b/epmet-gateway/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.31 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.32 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index b8996a9f75..d595ba019c 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.31 + 0.3.32 com.epmet epmet-cloud @@ -190,12 +190,15 @@ lb://epmet-third-server - + lb://epmet-heart-server - + lb://epmet-point-server + + lb://epmet-ext-server + @@ -284,6 +287,8 @@ lb://epmet-heart-server lb://epmet-point-server + + lb://epmet-ext-server @@ -369,6 +374,8 @@ lb://epmet-heart-server lb://epmet-point-server + + lb://epmet-ext-server diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index 7aec3a7f6f..43fbf6d0cb 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -208,11 +208,19 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory urls; + /** + * 白名单 + */ + private List urlWhiteList; + /** * 不处理token,直接通过 */ diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index c2105542bb..a7b442dba7 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -313,6 +313,15 @@ spring: filters: - StripPrefix=1 - CpAuth=true + # 开放接口服务 + - id: epmet-ext-server + uri: @gateway.routes.epmet-ext-server.url@ + order: 34 + predicates: + - Path=${server.servlet.context-path}/epmet/ext/** + filters: + - StripPrefix=1 + - CpAuth=true nacos: discovery: server-addr: @nacos.server-addr@ @@ -427,6 +436,12 @@ epmet: - /gov/issue/** - /gov/project/** - /resi/home/** + - /data/report/** + + # url认证白名单,先判断白名单,在白名单中的url直接放行,不再判断上述需要认证的名单 + urlWhiteList: + - /data/report/test/test + swaggerUrls: jwt: diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 7f96938c28..a859f98664 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -62,6 +62,11 @@ 0.3.1 + + com.epmet + epmet-commons-extapp-auth + 2.0.0 + diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java new file mode 100644 index 0000000000..a16df89c2a --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/controller/test/TestController.java @@ -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); + } + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppAuthFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppAuthFormDTO.java new file mode 100644 index 0000000000..2d6470db80 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppAuthFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class ExternalAppAuthFormDTO { + + /** + * 应用ID + */ + private String appId; + + /** + * token字符串 + */ + private String token; + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java new file mode 100644 index 0000000000..36a504a135 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java @@ -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; + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalCustomerFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalCustomerFormDTO.java new file mode 100644 index 0000000000..3ec9ccecac --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalCustomerFormDTO.java @@ -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; +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppAuthResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppAuthResultDTO.java new file mode 100644 index 0000000000..ff7e76dd1e --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppAuthResultDTO.java @@ -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; +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppResultDTO.java new file mode 100644 index 0000000000..e4cf3fedb6 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppResultDTO.java @@ -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; + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalCustomerResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalCustomerResultDTO.java new file mode 100644 index 0000000000..177b49575b --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalCustomerResultDTO.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.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; + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index be5117fbf1..d23de0c0e2 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -2,7 +2,9 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ExternalAppAuthFormDTO; import com.epmet.dto.form.WorkDayFormDTO; +import com.epmet.dto.result.ExternalAppAuthResultDTO; import com.epmet.dto.result.WorkDayResultDTO; import com.epmet.feign.fallback.EpmetCommonServiceOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -18,6 +20,7 @@ import java.util.List; * @date 2020/6/4 10:28 */ @FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class) +//@FeignClient(name = ServiceConstant.EPMET_COMMON_SERVICE, fallback = EpmetCommonServiceOpenFeignClientFallback.class, url = "http://localhost:8103") public interface EpmetCommonServiceOpenFeignClient { /** * @param formDTO @@ -28,4 +31,12 @@ public interface EpmetCommonServiceOpenFeignClient { **/ @PostMapping("commonservice/workday/detentiondays") Result> detentionDays(@RequestBody List formDTO); + + /** + * 外部应用认证接口 + * @param formDTO + * @return + */ + @PostMapping("/commonservice/externalapp/auth") + Result externalAppAuth(@RequestBody ExternalAppAuthFormDTO formDTO); } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java index 2a83a94bfc..555e502062 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java @@ -3,7 +3,9 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ExternalAppAuthFormDTO; import com.epmet.dto.form.WorkDayFormDTO; +import com.epmet.dto.result.ExternalAppAuthResultDTO; import com.epmet.dto.result.WorkDayResultDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import org.springframework.stereotype.Component; @@ -22,4 +24,9 @@ public class EpmetCommonServiceOpenFeignClientFallback implements EpmetCommonSer public Result> detentionDays(List formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "detentionDays", formDTO); } + + @Override + public Result externalAppAuth(ExternalAppAuthFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "externalAppAuth", formDTO); + } } diff --git a/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-dev.yml index 18920f1ad9..047408c5df 100644 --- a/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-common-service/common-service-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: common-service-server: container_name: common-service-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/common-service-server:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/common-service-server:0.3.16 ports: - "8103:8103" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-common-service/common-service-server/pom.xml b/epmet-module/epmet-common-service/common-service-server/pom.xml index a46a1332ee..be30c3a282 100644 --- a/epmet-module/epmet-common-service/common-service-server/pom.xml +++ b/epmet-module/epmet-common-service/common-service-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.9 + 0.3.16 com.epmet epmet-common-service @@ -58,6 +58,12 @@ feign-httpclient 10.3.0 + + + io.jsonwebtoken + jjwt + 0.7.0 + diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java new file mode 100644 index 0000000000..976c4e4ef0 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java @@ -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 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().ok(auth); + } + + /** + * 添加应用 + * @param formDTO + * @return + */ + @PostMapping("/add") + public Result 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().ok(dto); + } + + /** + * 修改应用 + * @param formDTO + * @return + */ + @PostMapping("/update") + public Result 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().ok(dto); + } + + /** + * 查询列表 + * @param formDTO + * @return + */ + @PostMapping("/list") + public Result> list(@RequestBody ExternalAppFormDTO formDTO) { + PageData page = externalAppService.listPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getCustomerId()); + return new Result>().ok(page); + } + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalCustomerController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalCustomerController.java new file mode 100644 index 0000000000..becc72c341 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalCustomerController.java @@ -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> list(@RequestBody ExternalCustomerFormDTO form) { + ValidatorUtils.validateEntity(form, ExternalCustomerFormDTO.ListExternalCustomerGroup.class); + Integer pageNo = form.getPageNo(); + Integer pageSize = form.getPageSize(); + PageData page = externalCustomerService.listPage(pageNo, pageSize); + return new Result>().ok(page); + } + + /** + * 添加外部客户 + * @param formDTO + * @return + */ + @PostMapping("add") + public Result add(@RequestBody ExternalCustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.AddExternalCustomerGroup.class); + String customerName = formDTO.getCustomerName(); + ExternalCustomerResultDTO result = externalCustomerService.add(customerName); + return new Result().ok(result); + } + + /** + * 更新客户信息 + * @param formDTO + * @return + */ + @PostMapping("update") + public Result 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().ok(result); + } + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java new file mode 100644 index 0000000000..73f6bd3407 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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 { + + Integer countByAppNameAndCustomerId(@Param("appName") String appName, @Param("customerId") String customerId); + + ExternalAppResultDTO getByNameAndCustomerId(@Param("appName") String appName, @Param("customerId") String customerId); + + List list(@Param("customerId") String customerId); +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java new file mode 100644 index 0000000000..f56aa08cb0 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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 { + + /** + * 查询app对应的秘钥 + * @param appId + * @return + */ + ExternalAppSecretEntity getSecretsByAppId(@Param("appId") String appId); + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalCustomerDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalCustomerDao.java new file mode 100644 index 0000000000..e8d67410ac --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalCustomerDao.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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 { + + /** + * 列出客户基本信息 + * @return + */ + List listBaseInfo(); + + /** + * 根据名称查询客户 + * @param customerName + * @return + */ + ExternalCustomerResultDTO getByCustomerName(@Param("customerName") String customerName); + + /** + * 根据客户名称计数 + * @param customerName + * @return + */ + Integer countByCustomerName(@Param("customerName") String customerName); +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppEntity.java new file mode 100644 index 0000000000..e4a4056108 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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; + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppSecretEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppSecretEntity.java new file mode 100644 index 0000000000..0977e12264 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalAppSecretEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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; + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalCustomerEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalCustomerEntity.java new file mode 100644 index 0000000000..fccfbbb6a1 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ExternalCustomerEntity.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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; + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java new file mode 100644 index 0000000000..e1158c592c --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java @@ -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); + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java new file mode 100644 index 0000000000..7f6be4bd5a --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppSecretService.java @@ -0,0 +1,28 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + + +/** + * 外部应用秘钥列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-18 + */ +public interface ExternalAppSecretService { +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java new file mode 100644 index 0000000000..dff718695f --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.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 listPage(Integer pageNo, Integer pageSize, String customerId); +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalCustomerService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalCustomerService.java new file mode 100644 index 0000000000..25645bea0b --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalCustomerService.java @@ -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 listPage(Integer pageNo, Integer pageSize); + + ExternalCustomerResultDTO add(String customerName); + + ExternalCustomerResultDTO update(String customerId, String customerName); +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java new file mode 100644 index 0000000000..e87a4c6f46 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java @@ -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; + } +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java new file mode 100644 index 0000000000..567baf3fb2 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppSecretServiceImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.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 { + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java new file mode 100644 index 0000000000..5f92de268e --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java @@ -0,0 +1,133 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.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 listPage(Integer pageNo, Integer pageSize, String customerId) { + PageHelper.startPage(pageNo, pageSize); + List list = externalAppDao.list(customerId); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalCustomerServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalCustomerServiceImpl.java new file mode 100644 index 0000000000..728e588e80 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalCustomerServiceImpl.java @@ -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 listPage(Integer pageNo, Integer pageSize) { + PageHelper.startPage(pageNo, pageSize); + List customers = externalCustomerDao.listBaseInfo(); + long total = new PageInfo<>(customers).getTotal(); + + PageData 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; + } +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java new file mode 100644 index 0000000000..1c3a326c75 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/utils/externalapp/ExtAppJwtTokenUtils.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

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

+ * 版权所有,侵权必究! + */ + +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 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 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); + } + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml new file mode 100644 index 0000000000..588f735da7 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml new file mode 100644 index 0000000000..e207a36013 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalCustomerDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalCustomerDao.xml new file mode 100644 index 0000000000..3950f8d014 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalCustomerDao.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-client/pom.xml b/epmet-module/epmet-ext/epmet-ext-client/pom.xml new file mode 100644 index 0000000000..925703ab91 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + + epmet-ext + com.epmet + 2.0.0 + + + + epmet-ext-client + jar + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + com.github.binarywang + weixin-java-mp + 3.6.0 + compile + + + com.epmet + epmet-user-client + 2.0.0 + compile + + + + + ${project.artifactId} + + + \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java new file mode 100644 index 0000000000..0403bf52b1 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java @@ -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; +} diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java new file mode 100644 index 0000000000..3e69297c27 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java @@ -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; +} diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java new file mode 100644 index 0000000000..8b93d60979 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java @@ -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; +} diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/RoleResultDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/RoleResultDTO.java new file mode 100644 index 0000000000..a15e6b5827 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/RoleResultDTO.java @@ -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; +} diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/StaffSinDeptResultDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/StaffSinDeptResultDTO.java new file mode 100644 index 0000000000..dca9c292a3 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/StaffSinDeptResultDTO.java @@ -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 roleList; + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/Dockerfile b/epmet-module/epmet-ext/epmet-ext-server/Dockerfile new file mode 100644 index 0000000000..2a18b4bf3a --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/Dockerfile @@ -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"] \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-dev.yml new file mode 100644 index 0000000000..e733e25d1b --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-dev.yml @@ -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 \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml new file mode 100644 index 0000000000..14e6df41ba --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-prod.yml @@ -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 \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-test.yml b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-test.yml new file mode 100644 index 0000000000..4335ec3381 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/deploy/docker-compose-test.yml @@ -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 \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-server/pom.xml b/epmet-module/epmet-ext/epmet-ext-server/pom.xml new file mode 100644 index 0000000000..fe31340f73 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/pom.xml @@ -0,0 +1,272 @@ + + + 4.0.0 + 0.0.4 + + + com.epmet + epmet-ext + 2.0.0 + + + epmet-ext-server + jar + + + 3.2.2 + 1.1.0 + 1.0.5 + 2.3.28 + + + + + com.epmet + epmet-ext-client + 2.0.0 + + + com.epmet + epmet-commons-extapp-auth + 2.0.0 + + + com.epmet + epmet-commons-tools + 2.0.0 + + + com.epmet + epmet-user-client + 2.0.0 + + + com.epmet + gov-org-client + 2.0.0 + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + com.aliyun + aliyun-java-sdk-core + ${aliyun.core.version} + + + com.aliyun + aliyun-java-sdk-dysmsapi + ${aliyun.dysmsapi.version} + + + com.github.qcloudsms + qcloudsms + ${qcloud.qcloudsms.version} + + + com.sun.mail + javax.mail + + + org.freemarker + freemarker + ${freemarker.version} + + + + io.github.openfeign + feign-httpclient + 10.3.0 + + + + org.flywaydb + flyway-core + + + + + + com.squareup.okhttp3 + okhttp + 4.0.0 + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.dom4j + dom4j + 2.1.3 + compile + + + com.github.binarywang + weixin-java-common + 3.6.0 + compile + + + org.springframework + spring-test + 5.1.12.RELEASE + compile + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + dev + + true + + + 8113 + dev + + + + + + epmet_third_user + EpmEt-db-UsEr + + 0 + 192.168.1.130 + 6379 + 123456 + + true + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + false + + + + test + + + 8113 + test + + + + + + epmet + elink@833066 + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + true + + + + + prod + + + 8113 + prod + + + + + + epmet_third_user + EpmEt-db-UsEr + + 0 + r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com + 6379 + EpmEtclOUdrEdIs!Q2w + + true + 192.168.11.180:8848 + bd205d23-e696-47be-b995-916313f86e99 + + + false + + + true + + + + + diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/EpmetExtApplication.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/EpmetExtApplication.java new file mode 100644 index 0000000000..89508e7873 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/EpmetExtApplication.java @@ -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); + } + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/RequestLogAspect.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/RequestLogAspect.java new file mode 100644 index 0000000000..49581cf63c --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/aspect/RequestLogAspect.java @@ -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(); + } + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..5cc47783e6 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "epmetext"; + } +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java new file mode 100644 index 0000000000..d8b34dc284 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -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服务查询网格下的所有工作人员失败"; + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java new file mode 100644 index 0000000000..147308f38e --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -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> staffSinGrid(@RequestBody StaffSinGridFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StaffSinGridFormDTO.StaffSinGrid.class); + return new Result>().ok(openUpService.staffSinGrid(formDTO)); + } + + /** + * @Description 部门工作人员 被禁用的、未激活的不显示 + * @param formDTO + * @author zxc + * @date 2020/8/13 9:51 上午 + */ + @ExternalAppRequestAuth + @PostMapping("staffsindept") + public Result> staffSinDept(@RequestBody StaffSinDeptFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StaffSinDeptFormDTO.StaffSinDept.class); + return new Result>().ok(openUpService.staffSinDept(formDTO)); + } + + /** + * @Description 机关工作人员 被禁用的、未激活的不显示 + * @param formDTO + * @author zxc + * @date 2020/8/17 9:59 上午 + */ + @ExternalAppRequestAuth + @PostMapping("staffsinagency") + public Result> staffSinAgency(@RequestBody StaffSinAgencyFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StaffSinAgencyFormDTO.StaffSinAgency.class); + return new Result>().ok(openUpService.staffSinAgency(formDTO)); + } + + /** + * @Description 查找工作人员的信息 + * @param + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + @ExternalAppRequestAuth + @PostMapping("staffinfo") + public Result 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 staffPermissionExt(@RequestBody CommonStaffIdFormDTO commonStaffIdFormDTO){ + ValidatorUtils.validateEntity(commonStaffIdFormDTO, CommonStaffIdFormDTO.StaffIdGroup.class); + return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId()); + } + +} + diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpUserController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpUserController.java new file mode 100644 index 0000000000..341715b6ae --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpUserController.java @@ -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 userInfo(@LoginUser TokenDto token){ + CommonUserIdFormDTO userParam = new CommonUserIdFormDTO(); + userParam.setUserId(token.getUserId()); + ValidatorUtils.validateEntity(userParam, CommonUserIdFormDTO.CommonUserIdGroup.class); + return epmetUserOpenFeignClient.extUserInfo(userParam); + } +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java new file mode 100644 index 0000000000..5ecbf7aedb --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java @@ -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 staffSinGrid(StaffSinGridFormDTO formDTO); + + /** + * @Description 部门工作人员 被禁用的、未激活的不显示 + * @param formDTO + * @author zxc + * @date 2020/8/13 9:51 上午 + */ + List staffSinDept(StaffSinDeptFormDTO formDTO); + + /** + * @Description 机关工作人员 被禁用的、未激活的不显示 + * @param formDTO + * @author zxc + * @date 2020/8/17 9:59 上午 + */ + List staffSinAgency(StaffSinAgencyFormDTO formDTO); +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java new file mode 100644 index 0000000000..38120535b9 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -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 staffSinGrid(StaffSinGridFormDTO formDTO) { + CommonGridIdFormDTO commonGridId = new CommonGridIdFormDTO(); + commonGridId.setGridId(formDTO.getGridId()); + commonGridId.setUserId(UUID.randomUUID().toString().replace(StrConstant.HYPHEN, "")); + Result> 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 staffSinDept(StaffSinDeptFormDTO formDTO) { + DepartmentIdFormDTO departmentId = new DepartmentIdFormDTO(); + departmentId.setDepartmentId(formDTO.getDepartmentId()); + Result> 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 data = this.getStaffList(departmentStaffs.getData()); + List 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 staffSinAgency(StaffSinAgencyFormDTO formDTO) { + AgencyIdFormDTO agencyId = new AgencyIdFormDTO(); + agencyId.setAgencyId(formDTO.getAgencyId()); + Result> 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 staffList = this.getStaffList(agencyStaffs.getData()); + List 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 getStaffList(List userIds){ + UserIdsFormDTO userIdsForm = new UserIdsFormDTO(); + userIdsForm.setUserIds(userIds); + Result> staffInfoList = epmetUserOpenFeignClient.getStaffInfoList(userIdsForm); + if (!staffInfoList.success()){ + throw new RenException(ModuleConstant.ERROR_EPMET_USER); + } + return staffInfoList.getData(); + } + +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..8f43acbf19 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml @@ -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 \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/db/migration/V0.0.1__demo.sql b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/db/migration/V0.0.1__demo.sql new file mode 100644 index 0000000000..7a51a3f595 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/db/migration/V0.0.1__demo.sql @@ -0,0 +1 @@ +select 0; \ No newline at end of file diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..ec4a9fc8e0 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/logback-spring.xml @@ -0,0 +1,164 @@ + + + + + + + + + + ${appname} + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/epmet-ext/pom.xml b/epmet-module/epmet-ext/pom.xml new file mode 100644 index 0000000000..795eb9a45f --- /dev/null +++ b/epmet-module/epmet-ext/pom.xml @@ -0,0 +1,21 @@ + + + + epmet-module + com.epmet + 2.0.0 + + 4.0.0 + + epmet-ext + pom + + + epmet-ext-client + epmet-ext-server + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java new file mode 100644 index 0000000000..6f544e6f11 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerAccessTokenInfoFormDTO.java @@ -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; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ModifyDomainFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ModifyDomainFormDTO.java index d8b78838e4..600b4d6b83 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ModifyDomainFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ModifyDomainFormDTO.java @@ -22,6 +22,10 @@ public class ModifyDomainFormDTO implements Serializable { * 客户端类型 */ private String clientType; + /** + * 操作类型:add 添加,delete 删除,set 覆盖 + */ + private String action; /** * request 合法域名 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WebviewDomainFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WebviewDomainFormDTO.java index dc951e1b7b..2518bb28b4 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WebviewDomainFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/WebviewDomainFormDTO.java @@ -21,6 +21,10 @@ public class WebviewDomainFormDTO implements Serializable { * 客户端类型 */ private String clientType; + /** + * 操作类型:add 添加,delete 删除,set 覆盖 + */ + private String action; /** * 业务域名 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java new file mode 100644 index 0000000000..33e8129004 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/CustomerAccessTokenInfoResultDTO.java @@ -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; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index c0110e464b..d4706c5733 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.132 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.134 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 6c703dd85f..c1fe6fbd85 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.132 + 0.0.134 com.epmet diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java index 64a4bb3376..ec2f5e13a6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java @@ -4,14 +4,18 @@ 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.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.RemoveBindFormDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.service.AppLetAuthorizationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * @Author zxc * @CreateTime 2020/7/10 15:48 @@ -31,6 +35,7 @@ public class AppLetAuthorizationController { @PostMapping("gotoauth") public Result goToAuth(@LoginUser TokenDto tokenDto, @RequestBody GoToAuthFormDTO formDTO, @RequestHeader("source")String source){ ValidatorUtils.validateEntity(formDTO); + GoToAuthResultDTO goToAuthResultDTO = appLetAuthorizationService.goToAuth(tokenDto,formDTO,source); return new Result().ok(goToAuthResultDTO); } @@ -59,4 +64,16 @@ public class AppLetAuthorizationController { return new Result().ok(openAppId); } + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + @PostMapping("getcustomeraccesstokeninfo") + public Result> getCustomerAccessTokenInfo(@RequestBody CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO){ + ValidatorUtils.validateEntity(customerAccessTokenInfoFormDTO, CustomerAccessTokenInfoFormDTO.CustomerAccessTokenInfo.class); + return new Result>().ok(appLetAuthorizationService.getCustomerAccessTokenInfo(customerAccessTokenInfoFormDTO)); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index 88ba820fba..b5c24edf2f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -21,7 +21,9 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.AuthorizationInfoDTO; import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; +import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.result.AuthCodeResultDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.entity.AuthorizationInfoEntity; import org.apache.ibatis.annotations.Mapper; @@ -99,4 +101,12 @@ public interface AuthorizationInfoDao extends BaseDao { */ List getAuthInfoByCustomerId(@Param("customerId") String customerId); + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + List getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO); + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java index 0d00e16505..3a4167ea99 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java @@ -1,11 +1,15 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.RemoveBindFormDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; +import java.util.List; + /** * @Author zxc * @CreateTime 2020/7/10 15:52 @@ -34,4 +38,12 @@ public interface AppLetAuthorizationService { */ String getOpenAppId(OpenAppIdFormDTO formDTO); + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + List getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO); + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java index 069b6d0f40..823697b5bb 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java @@ -8,13 +8,16 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.constant.ModuleConstant; +import com.epmet.dao.AuthorizationInfoDao; import com.epmet.dao.BindingAccountDao; import com.epmet.dao.CustomerMpDao; import com.epmet.dao.OpenPlatformAccountDao; +import com.epmet.dto.form.CustomerAccessTokenInfoFormDTO; import com.epmet.dto.form.GoToAuthFormDTO; import com.epmet.dto.form.OpenAppIdFormDTO; import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.result.AuthorizationInfoResultDTO; +import com.epmet.dto.result.CustomerAccessTokenInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.redis.RedisThird; import com.epmet.service.AppLetAuthorizationService; @@ -25,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -45,6 +49,8 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic private RedisThird redisThird; @Autowired private BindingAccountDao bindingAccountDao; + @Autowired + private AuthorizationInfoDao authorizationInfoDao; @Value("${third.platform.appId}") private String componentAppId; @@ -117,4 +123,15 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic } return map.get(ModuleConstant.ERR_MSG).toString(); } + + /** + * @Description 查询客户下的小程序基本信息 + * @param customerAccessTokenInfoFormDTO + * @author zxc + * @date 2020/8/24 10:26 上午 + */ + @Override + public List getCustomerAccessTokenInfo(CustomerAccessTokenInfoFormDTO customerAccessTokenInfoFormDTO) { + return authorizationInfoDao.getCustomerAccessTokenInfo(customerAccessTokenInfoFormDTO); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index ce3a43181d..020dcf8782 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -408,20 +408,23 @@ public class CodeServiceImpl implements CodeService { @Override public List reason(CodeCommonFormDTO formDTO) { List resultList = new ArrayList<>(); - - //获取上传代码信息 - CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); + if (StringUtils.isNotBlank(formDTO.getCodeId())) { + //获取上传代码信息 + CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); + formDTO.setCustomerId(codeCustomerDTO.getCustomerId()); + formDTO.setClientType(codeCustomerDTO.getClientType()); + } //是否授权 - if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) { throw new RenException("未授权"); } - AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); if (null == authInfo) { throw new RenException("未授权"); } //获取审核结果信息 - List codeAuditResultList = codeAuditResultService.getAuditFailedList(codeCustomerDTO.getCustomerId(), - codeCustomerDTO.getClientType()); + List codeAuditResultList = codeAuditResultService.getAuditFailedList(formDTO.getCustomerId(), + formDTO.getClientType()); codeAuditResultList.forEach(dto -> { ReasonResultDTO result = new ReasonResultDTO(); result.setReason(dto.getReason()); @@ -500,9 +503,9 @@ public class CodeServiceImpl implements CodeService { public PageData history(CodeCommonFormDTO formDTO) { PageHelper.startPage(formDTO.getPage(), formDTO.getLimit()); //获取上传代码信息 - CodeCustomerDTO code = codeCustomerService.get(formDTO.getCodeId()); +// CodeCustomerDTO code = codeCustomerService.get(formDTO.getCodeId()); //获取上传代码信息 - List list = codeOperationHistoryService.getHistoryList(code.getCustomerId(), code.getClientType()); + List list = codeOperationHistoryService.getHistoryList(formDTO.getCustomerId(), formDTO.getClientType()); PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal()); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SettingServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SettingServiceImpl.java index 134ab97c06..e66d9b086f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SettingServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SettingServiceImpl.java @@ -33,6 +33,7 @@ public class SettingServiceImpl implements SettingService { throw new RenException("未授权"); } WxMaModifyDomainReq request = new WxMaModifyDomainReq(); + request.setAction(formDTO.getAction()); request.setDownloadDomain(formDTO.getDownloadDomain()); request.setRequestDomain(formDTO.getRequestDomain()); request.setWsRequestDomain(formDTO.getWsRequestDomain()); @@ -52,7 +53,7 @@ public class SettingServiceImpl implements SettingService { throw new RenException("未授权"); } WxMaSetWebviewDomainReq request = new WxMaSetWebviewDomainReq(); - request.setAction("set"); + request.setAction(formDTO.getAction()); request.setWebViewDomain(formDTO.getWebViewDomain()); //设置业务域名 WxResult setWebviewDomain = wxMaSettingService.setWebviewDomain(authInfo.getAuthorizerAccessToken(), request); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java index 0c12488f48..23e1077e7c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/enums/WxMaErrorMsgEnum.java @@ -354,6 +354,8 @@ public enum WxMaErrorMsgEnum { CODE_85062(85062, "手机号黑名单"), + CODE_85015(85015, "该账号不是小程序账号"), + CODE_85016(85016, "域名数量超过限制"), CODE_85017(85017, "没有新增域名,请确认小程序已经添加了域名或该域名是否没有在第三方平台添加"), diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index b06647013c..61f441b6b8 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -99,4 +99,26 @@ AND EXPIRES_IN_TIME > NOW() + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyIdFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyIdFormDTO.java new file mode 100644 index 0000000000..44777f5886 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyIdFormDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerIdFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerIdFormDTO.java new file mode 100644 index 0000000000..0e853c6275 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerIdFormDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentIdFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentIdFormDTO.java new file mode 100644 index 0000000000..326a86860b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentIdFormDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridIdFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridIdFormDTO.java new file mode 100644 index 0000000000..89f7e8489b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GridIdFormDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java new file mode 100644 index 0000000000..f522bfab50 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java @@ -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{} +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridCountResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridCountResultDTO.java new file mode 100644 index 0000000000..1f583338a2 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridCountResultDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java new file mode 100644 index 0000000000..4b0d67ca35 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java new file mode 100644 index 0000000000..018c298c50 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java new file mode 100644 index 0000000000..fc2083b935 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java @@ -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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java new file mode 100644 index 0000000000..e8d385c116 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java @@ -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 roleList; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java new file mode 100644 index 0000000000..8408c42dbf --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java @@ -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 gridList = new ArrayList<>(); + + /** + * 直属机关直属部门列表 + * */ + private List departmentList = new ArrayList<>(); + + /** + * 子集机关列表 + * */ + private List subAgencyList = new ArrayList<>(); +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtUserInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtUserInfoResultDTO.java new file mode 100644 index 0000000000..a7649e03a2 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtUserInfoResultDTO.java @@ -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 roleList = new ArrayList<>(); +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index a6bcb7d128..2ebce80475 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -4,10 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerPartyBranchDTO; -import com.epmet.dto.form.AddAgencyAndStaffFormDTO; -import com.epmet.dto.form.BelongGridNameFormDTO; -import com.epmet.dto.form.ListPartyBranchFormDTO; -import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -22,7 +19,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:37 */ -// @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092") +//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092") @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class) public interface GovOrgOpenFeignClient { @@ -187,4 +184,70 @@ public interface GovOrgOpenFeignClient { **/ @PostMapping(value = "/gov/org/customeragency/getStaffOrgList",consumes = MediaType.APPLICATION_JSON_VALUE) Result> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO); + + /** + * @Description 查询一个网格下的所有工作人员 + * @param gridIdFormDTO + * @author zxc + * @date 2020/8/13 10:46 上午 + */ + @PostMapping(value = "/gov/org/customerstaffgrid/getgridstaffs") + Result> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO); + + /** + * @Description 查询部门下工作人员 + * @param formDTO + * @author zxc + * @date 2020/8/13 2:46 下午 + */ + @PostMapping(value = "/gov/org/customerstaffdepartment/getdepartmentstaffs") + Result> getDepartmentStaffs(@RequestBody DepartmentIdFormDTO formDTO); + + /** + * @Description 查询客户下的网格数量 + * @param customerIdFormDTO + * @author zxc + * @date 2020/8/14 9:31 上午 + */ + @PostMapping(value = "/gov/org/customergrid/gridcount") + Result selectGridCount(@RequestBody CustomerIdFormDTO customerIdFormDTO); + + /** + * @Description 查询机关下工作人员 + * @param formDTO + * @author zxc + * @date 2020/8/17 + */ + @PostMapping(value = "/gov/org/customerstaffagency/getagencystaffs") + Result> getAgencyStaffs(@RequestBody AgencyIdFormDTO formDTO); + + /** + * @Description User模块调用gov-org查询工作人员所在机关的信息以及客户信息 + * @param result + * @return + * @author wangc + * @date 2020.08.17 14:11 + **/ + @PostMapping("/gov/org/customeragency/staffinfoext") + Result staffInfoExt(@RequestBody ExtStaffInfoResultDTO result); + + /** + * @Description 根据staffId,查询当前这个用户的数据权限,对外接口 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + @PostMapping("/gov/org/customeragency/permissionext/{staffId}") + Result staffPermissionExt(@PathVariable(value = "staffId") String staffId); + + /** + * @Description User模块调用gov-org查询用户所在机关的信息以及客户信息 + * @param result ExtStaffInfoResultDTO.class + * @return Result + * @author wangc + * @date 2020.08.17 13:52 + **/ + @PostMapping("/gov/org/customeragency/userinfoext") + Result userInfoExt(@RequestBody ExtUserInfoResultDTO result); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 6824fa5e65..8f70da4530 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -5,10 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerPartyBranchDTO; -import com.epmet.dto.form.AddAgencyAndStaffFormDTO; -import com.epmet.dto.form.BelongGridNameFormDTO; -import com.epmet.dto.form.ListPartyBranchFormDTO; -import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.GovOrgOpenFeignClient; import org.springframework.stereotype.Component; @@ -114,4 +111,39 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffOrgList", staffOrgFormDTO); } + + @Override + public Result> getGridStaffs(CommonGridIdFormDTO gridIdFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO); + } + + @Override + public Result> getDepartmentStaffs(DepartmentIdFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getDepartmentStaffs", formDTO); + } + + @Override + public Result selectGridCount(CustomerIdFormDTO customerIdFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridCount", customerIdFormDTO); + } + + @Override + public Result> getAgencyStaffs(AgencyIdFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyStaffs", formDTO); + } + + @Override + public Result staffInfoExt(ExtStaffInfoResultDTO result) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "staffInfoExt", result); + } + + @Override + public Result staffPermissionExt(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "staffPermissionExt", staffId); + } + + @Override + public Result userInfoExt(ExtUserInfoResultDTO result) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "userInfoExt", result); + } } diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index c682941726..080702e2ab 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.83 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.86 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index bff2680d39..b082115778 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.83 + 0.3.86 com.epmet gov-org @@ -18,6 +18,11 @@ gov-org-client 2.0.0 + + com.epmet + oper-crm-client + 2.0.0 + com.epmet epmet-commons-mybatis diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 83250c4c17..fb76995133 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -193,4 +193,40 @@ public class CustomerAgencyController { Result querySponsorList(@PathVariable("staffId") String staffId){ return new Result().ok(customerAgencyService.querySponsorList(staffId)); } + + /** + * @Description 对外接口 获取工作人员基本信息 + * @param result ExtStaffInfoResultDTO.class + * @return Result + * @author wangc + * @date 2020.08.17 13:52 + **/ + @PostMapping("staffinfoext") + Result staffInfoExt(@RequestBody ExtStaffInfoResultDTO result){ + return new Result().ok(customerAgencyService.staffInfoExt(result)); + } + + /** + * @Description 根据staffId,查询当前这个用户的数据权限,对外接口 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + @PostMapping("permissionext/{staffId}") + Result staffPermissionExt(@PathVariable(value = "staffId") String staffId){ + return new Result().ok(customerAgencyService.staffPermissionExt(staffId)); + } + + /** + * @Description 对外接口 获用户员基本信息 + * @param result ExtUserInfoResultDTO.class + * @return Result + * @author wangc + * @date 2020.08.17 13:52 + **/ + @PostMapping("userinfoext") + Result userInfoExt(@RequestBody ExtUserInfoResultDTO result){ + return new Result().ok(customerAgencyService.extUserInfo(result)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 69eecc5d2c..b86bb7df20 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -216,4 +216,16 @@ public class CustomerGridController { return customerGridService.queryCustomerGridList(formDTO); } + /** + * @Description 查询客户下的网格数量 + * @param customerIdFormDTO + * @author zxc + * @date 2020/8/14 9:31 上午 + */ + @PostMapping("gridcount") + public Result selectGridCount(@RequestBody CustomerIdFormDTO customerIdFormDTO){ + ValidatorUtils.validateEntity(customerIdFormDTO, CustomerIdFormDTO.Customer.class); + return new Result().ok(customerGridService.selectGridCount(customerIdFormDTO)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java index a92d2d8826..ad965efef7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java @@ -17,9 +17,7 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -28,12 +26,8 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.CustomerStaffAgencyDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; -import com.epmet.dto.form.CommonGridIdFormDTO; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.result.CommonStaffInfoResultDTO; +import com.epmet.dto.form.AgencyIdFormDTO; import com.epmet.dto.result.LatestCustomerResultDTO; -import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.excel.CustomerStaffAgencyExcel; import com.epmet.service.CustomerStaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -111,7 +105,15 @@ public class CustomerStaffAgencyController { return customerStaffAgencyService.getLatestCustomer(userId); } - - + /** + * @Description 查询机关下工作人员 + * @param agencyIdFormDTO + * @author zxc + * @date 2020/8/17 10:14 上午 + */ + @PostMapping("getagencystaffs") + public Result> getAgencyStaffs(@RequestBody AgencyIdFormDTO agencyIdFormDTO){ + return new Result>().ok(customerStaffAgencyService.getAgencyStaffs(agencyIdFormDTO)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffDepartmentController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffDepartmentController.java index ee22c850bb..e61828a3c4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffDepartmentController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffDepartmentController.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.CustomerStaffDepartmentDTO; +import com.epmet.dto.form.DepartmentIdFormDTO; import com.epmet.excel.CustomerStaffDepartmentExcel; import com.epmet.service.CustomerStaffDepartmentService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,4 +92,16 @@ public class CustomerStaffDepartmentController { ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffDepartmentExcel.class); } + /** + * @Description 查询部门下工作人员 + * @param formDTO + * @author zxc + * @date 2020/8/13 2:46 下午 + */ + @PostMapping("getdepartmentstaffs") + public Result> getDepartmentStaffs(@RequestBody DepartmentIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(customerStaffDepartmentService.getDepartmentStaffs(formDTO)); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 8a51d3ad19..26ec50ed8e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -124,4 +124,41 @@ public interface CustomerAgencyDao extends BaseDao { * @Description 递归查询当前机关的下一级机关列表 **/ List selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids); + + /** + * @Description 查询一个工作人员最近登录的网格以及机关信息 + * @param gridId + * @return + * @author wangc + * @date 2020.08.17 09:50 + **/ + ExtStaffInfoResultDTO selectAgencyAndGridInfoExt(@Param("gridId") String gridId); + + /** + * @Description 根据agencyId查找指定机构的信息,直属网格、部门 + * @param agencyId + * @return + * @author wangc + * @date 2020.08.18 13:41 + **/ + ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId")String agencyId); + + /** + * @Description 根绝agencyId查找其下属机构的信息 + * @param pid + * @return + * @author wangc + * @date 2020.08.18 13:42 + **/ + List selectSubAgencyByPid(@Param("pid") String pid); + + /** + * @Description 根据agencyId查找指定机构直属的部门,将grid与dept分开是因为grid与dept的数量可能不等,造成重复数据无法去重 + * @param agencyId + * @return + * @author wangc + * @date 2020.08.18 13:42 + **/ + List selectDeptList(@Param("agencyId") String agencyId); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 09f71efd99..1d50d1453a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -216,4 +216,12 @@ public interface CustomerGridDao extends BaseDao { * @Description 单客户-指定区时查询当前城市下除该区之外其余的网格 **/ List selectThirdRestGridWithoutGivenAreaCode(Map map); + + /** + * @Description 查询当前客户已有网格数量 + * @param customerId + * @author zxc + * @date 2020/8/12 5:10 下午 + */ + Integer selectGridCount(@Param("customerId")String customerId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 8cfef54079..ffc46fa725 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java @@ -100,4 +100,12 @@ public interface CustomerStaffAgencyDao extends BaseDao getAgencyStaffList(@Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java index 88fc246656..363e575499 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java @@ -66,4 +66,12 @@ public interface CustomerStaffDepartmentDao extends BaseDao selectDeptStaffs(@Param("deptIdList") List deptIdList); + + /** + * @Description 查询部门下的工作人员userId + * @param departmentId + * @author zxc + * @date 2020/8/13 2:53 下午 + */ + List getDepartmentStaffList(@Param("departmentId")String departmentId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index cacba8512e..02d05a373c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -178,4 +178,31 @@ public interface CustomerAgencyService extends BaseService * @Date 2020/7/23 20:50 **/ ActSponsorResultDTO querySponsorList(String staffId); + + /** + * @Description 查询工作人员的信息,多客户/单客户,epmet-plugin,对外开放调用 + * @param result + * @return + * @author wangc + * @date 2020.08.17 09:29 + **/ + ExtStaffInfoResultDTO staffInfoExt(ExtStaffInfoResultDTO result); + + /** + * @Description 根据staffId,查询当前这个用户的数据权限 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + ExtStaffPermissionResultDTO staffPermissionExt(String staffId); + + /** + * @Description 查询当前用户的信息,多客户/单客户,epmet-plugin,对外开放调用 + * @param result + * @return + * @author wangc + * @date 2020.08.21 17:31 + **/ + ExtUserInfoResultDTO extUserInfo(ExtUserInfoResultDTO result); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 518e20fdb5..67c425915f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -251,4 +251,12 @@ public interface CustomerGridService extends BaseService { * @Description 单客户-陌生人导览模块调用-根据地区编码查询客户下的网格列表 **/ Result> queryCustomerGridList(ThirdCustomerGridListFormDTO formDTO); + + /** + * @Description 查询客户下的网格数量 + * @param customerIdFormDTO + * @author zxc + * @date 2020/8/14 9:31 上午 + */ + CustomerGridCountResultDTO selectGridCount( CustomerIdFormDTO customerIdFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java index 6691351505..8f6f47dfdb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.form.AgencyIdFormDTO; import com.epmet.dto.form.CommonDepartmentFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.form.CommonGridIdFormDTO; @@ -142,4 +143,12 @@ public interface CustomerStaffAgencyService extends BaseService getAgencyStaffs(AgencyIdFormDTO agencyIdFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffDepartmentService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffDepartmentService.java index f34735eeef..db5fa63d2e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffDepartmentService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffDepartmentService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.CustomerStaffDepartmentDTO; +import com.epmet.dto.form.DepartmentIdFormDTO; import com.epmet.entity.CustomerStaffDepartmentEntity; import java.util.List; @@ -92,4 +93,12 @@ public interface CustomerStaffDepartmentService extends BaseService getDepartmentStaffs(DepartmentIdFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index e399d29b85..c401f89afc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -39,6 +39,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; +import com.epmet.util.ModuleConstant; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -834,4 +836,139 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl customerResult = + operCrmFeignClient.getCustomerInfo(customerParam); + if(customerResult.success() && null != customerResult.getData()){ + result.setCustomerName(customerResult.getData().getCustomerName()); + } + checkFieldAndSetDefault(result); + result.setAdminFlag(NumConstant.ZERO_STR); + if(null != result.getRoleList() && !result.getRoleList().isEmpty()){ + result.getRoleList().forEach(o -> { + if(StringUtils.equals("root_manager",o.getRoleKey())){ + result.setAdminFlag(NumConstant.ONE_STR); + } + }); + } + return result; + } + + /** + * @Description 根据staffId,查询当前这个用户的数据权限 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + @Override + public ExtStaffPermissionResultDTO staffPermissionExt(String staffId) { + + //1.通过staffId去user服务查询最近一次登陆的agencyId + Result agency = + epmetUserOpenFeignClient.latestAgency(staffId); + if(agency.success() && StringUtils.isNotBlank(agency.getData())){ + //2.根据此agencyId查询数据权限 + ExtStaffPermissionResultDTO res = baseDao.selectAgencyById(agency.getData()); + return res; + }else{ + logger.error("com.epmet.service.impl.CustomerAgencyServiceImpl.staffPermissionExt,没有找到工作人员最近一次登陆的Agency信息,用户Id:{}",staffId); + ExtStaffPermissionResultDTO emptyResult = new ExtStaffPermissionResultDTO(); + checkFieldAndSetDefault(emptyResult); + return emptyResult; + } + + + + } + + /** + * @Description 查询当前用户的信息,多客户/单客户,epmet-plugin,对外开放调用 + * @param result + * @return + * @author wangc + * @date 2020.08.21 17:31 + **/ + @Override + public ExtUserInfoResultDTO extUserInfo(ExtUserInfoResultDTO result) { + //1.查找对应的所属关系,通过最近一次登陆的网格,通过网格查找对应的机关和客户 + ExtStaffInfoResultDTO orgInfo = + baseDao.selectAgencyAndGridInfoExt(result.getGridId()); + if(null != orgInfo){ + result.setAgencyId(orgInfo.getAgencyId()); + result.setAgencyIdPath(orgInfo.getAgencyIdPath()); + result.setAgencyName(orgInfo.getAgencyName()); + result.setAgencyNamePath(orgInfo.getAgencyNamePath()); + result.setGridName(orgInfo.getGridName()); + } + //2.查找客户名称 + CustomerDTO customerParam = new CustomerDTO(); + customerParam.setId(orgInfo.getCustomerId()); + Result customerResult = + operCrmFeignClient.getCustomerInfo(customerParam); + if(customerResult.success() && null != customerResult.getData()){ + result.setCustomerName(customerResult.getData().getCustomerName()); + } + return result; + } + + + public void mergeObject(T origin, T destination) { + if (origin == null || destination == null) + return; + if (!origin.getClass().equals(destination.getClass())) + return; + + Field[] fields = origin.getClass().getDeclaredFields(); + for (int i = 0; i < fields.length; i++) { + try { + fields[i].setAccessible(true); + Object value = fields[i].get(origin); + if (null != value) { + fields[i].set(destination, value); + } + fields[i].setAccessible(false); + } catch (Exception e) { + + } + } + } + + + + public void checkFieldAndSetDefault(T origin) { + if (origin == null) + return; + Field[] fields = origin.getClass().getDeclaredFields(); + for (int i = 0; i < fields.length; i++) { + try { + fields[i].setAccessible(true); + Object value = fields[i].get(origin); + if (null == value && value.getClass().getName().equals("java.lang.String")) { + fields[i].set(origin, ModuleConstant.EMPTY_STR); + } + fields[i].setAccessible(false); + } catch (Exception e) { + + } + } + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 8f023276a3..afece523c4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -29,7 +29,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerGridConstant; -import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.CustomerGridDao; import com.epmet.dao.CustomerStaffGridDao; import com.epmet.dto.*; @@ -37,9 +36,9 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerGridEntity; import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerGridService; -import com.epmet.service.CustomerStaffGridService; import com.epmet.util.ModuleConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -69,11 +68,11 @@ public class CustomerGridServiceImpl extends BaseServiceImpl page(Map params) { @@ -206,15 +205,36 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(griddetail); } + /** + * @Desc 网格添加 + * @Author zxc + * @param tokenDto + * @param addGridFormDTO + * @return + */ @Override @Transactional(rollbackFor = Exception.class) public Result addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) { - //查询是否重名 + CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(addGridFormDTO.getAgencyId()); + // 1. 查询该客户下可创建网格的最大数量 + GridCountFormDTO gridCount = new GridCountFormDTO(); + String customerId = customerAgencyDTO.getCustomerId(); + gridCount.setCustomerId(customerId); + GridCountResultDTO grid = operCrmOpenFeignClient.getGridCount(gridCount).getData(); + if (grid.getGridCount().equals(NumConstant.ZERO)){ + throw new RenException(EpmetErrorCode.GRID_COUNT_UP.getCode()); + } + // 2. 判断当前客户下存在的网格数量 + Integer gridCounts = customerGridDao.selectGridCount(customerId); + if (gridCounts >= grid.getGridCount()){ + throw new RenException(EpmetErrorCode.GRID_COUNT_UP.getCode()); + } + // 3. 查询网格名称是否重名 AddGridResultDTO gridResult = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(), addGridFormDTO.getAgencyId(), null); if (gridResult!=null){ return new Result().error(EpmetErrorCode.NOT_ADD_GRID.getCode()); } - CustomerAgencyDTO customerAgencyDTO=customerAgencyService.get(addGridFormDTO.getAgencyId()); + CustomerGridEntity customerGridEntity = new CustomerGridEntity(); BeanUtils.copyProperties(addGridFormDTO,customerGridEntity); customerGridEntity.setAreaCode(customerAgencyDTO.getAreaCode()); @@ -615,4 +635,18 @@ public class CustomerGridServiceImpl extends BaseServiceImpl page(Map params) { @@ -213,4 +212,15 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl getAgencyStaffs(AgencyIdFormDTO agencyIdFormDTO) { + return customerStaffAgencyDao.getAgencyStaffList(agencyIdFormDTO.getAgencyId()); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffDepartmentServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffDepartmentServiceImpl.java index 81cf6dafd9..4e6a504c2e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffDepartmentServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffDepartmentServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.CustomerStaffDepartmentDao; import com.epmet.dto.CustomerStaffDepartmentDTO; +import com.epmet.dto.form.DepartmentIdFormDTO; import com.epmet.entity.CustomerStaffDepartmentEntity; import com.epmet.redis.CustomerStaffDepartmentRedis; import com.epmet.service.CustomerStaffDepartmentService; @@ -47,7 +48,7 @@ import java.util.Map; public class CustomerStaffDepartmentServiceImpl extends BaseServiceImpl implements CustomerStaffDepartmentService { @Autowired - private CustomerStaffDepartmentRedis customerStaffDepartmentRedis; + private CustomerStaffDepartmentDao customerStaffDepartmentDao; @Override public PageData page(Map params) { @@ -101,4 +102,16 @@ public class CustomerStaffDepartmentServiceImpl extends BaseServiceImpl getDepartmentStaffs(DepartmentIdFormDTO formDTO) { + String departmentId = formDTO.getDepartmentId(); + return customerStaffDepartmentDao.getDepartmentStaffList(departmentId); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java index a1539be232..143d496aec 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -71,4 +71,6 @@ public interface ModuleConstant { * 组织类型:网格 * */ String ORG_TYPE_GRID = "grid"; + + String EMPTY_STR = ""; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 61b9011343..c2fb090e3f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -169,4 +169,93 @@ ORDER BY created_time DESC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 802ec9f2f3..b9a98117e1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -462,4 +462,15 @@ ) AS c LIMIT #{pageNo}, #{pageSize} + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml index 2d548065f3..3df433a5b6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml @@ -141,4 +141,15 @@ csa.DEL_FLAG = '0' AND csa.USER_ID = #{staffId} + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml index 927d919372..7e04df040b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml @@ -27,6 +27,17 @@ + + + UPDATE diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectResponseFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectResponseFormDTO.java new file mode 100644 index 0000000000..bd7a69b259 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectResponseFormDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.form; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/12 17:52 + */ +@Data +public class ProjectResponseFormDTO implements Serializable { + private static final long serialVersionUID = -4915724637094689896L; + /** + * 用户Id + */ + private String userId; + /** + * 项目Id + */ + private String projectId; + /** + * 流程节点Id + */ + private String projectProcessId; + /** + * 公开答复内容 + */ + @Length(max = 1000, message = "公开答复不能超过1000个字符") + private String publicReply; + /** + * 内部流转意见 + */ + @NotBlank(message = "内部备注不能为空") + @Length(max = 1000, message = "内部备注不能超过1000个字符") + private String internalRemark; + /** + * 项目人员关联表ID + */ + private String projectStaffId; + /** + * 部门名 + */ + private String departmentName; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java index f44973bcea..4ffddb9ba4 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result; import lombok.Data; +import lombok.NoArgsConstructor; import java.io.Serializable; import java.util.List; @@ -10,6 +11,7 @@ import java.util.List; * @dscription * @date 2020/5/11 15:33 */ +@NoArgsConstructor @Data public class ProjectDetailResultDTO implements Serializable { @@ -49,6 +51,18 @@ public class ProjectDetailResultDTO implements Serializable { /** * 当前跟进部门 */ - private List departmentNameList; + private List departmentNameList; + @NoArgsConstructor + @Data + public static class DepartmentNameListBean { + /** + * 部门名 + */ + private String departmentName; + /** + * 工作人员 + */ + private List staffList; + } } diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index 32758e7186..405b05715e 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.40 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.43 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 79ff122454..35f0402420 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.40 + 0.3.43 gov-project com.epmet diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index ff9dfb0dc1..dd0f37c086 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -59,6 +59,14 @@ public interface ProjectConstant { * 处理名-转项目 */ String OPERATION_CREATED_NAME = "转项目"; + /** + * 处理-退回 + */ + String OPERATION_RESPONSES = "response"; + /** + * 处理名-退回 + */ + String OPERATION_RESPONSES_NAME = "处理/响应"; /** * 是否处理-未处理 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java index 7f90d5e362..d32f28f8de 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java @@ -232,5 +232,21 @@ public class ProjectTraceController { ValidatorUtils.validateEntity(formDTO); return new Result().ok(projectTraceService.processorList(formDTO)); } + + /** + * 处理响应 + * @author zhaoqifeng + * @date 2020/8/20 10:16 + * @param tokenDTO + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("response") + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_TRANSFER) + public Result response(@LoginUser TokenDto tokenDTO, @RequestBody ProjectResponseFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + projectTraceService.response(tokenDTO, formDTO); + return new Result(); + } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java index a45b46bb0a..4d20d6327c 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ProjectDTO; +import com.epmet.dto.ProjectStaffDTO; import com.epmet.dto.form.LatestListFormDTO; import com.epmet.dto.form.ProjectListFromDTO; import com.epmet.dto.form.ShiftProjectsFromDTO; @@ -78,6 +79,15 @@ public interface ProjectDao extends BaseDao { */ List selectDepartmentNameList(ProjectDTO dto); + /** + * 当前处理部门及工作人员 + * @author zhaoqifeng + * @date 2020/8/14 10:56 + * @param dto + * @return java.util.List + */ + List selectCurrentDepartmentList(ProjectDTO dto); + /** * 获取项目详情 * @author zhaoqifeng diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java index 9dafa894ab..e34e2ecd21 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectService.java @@ -178,4 +178,13 @@ public interface ProjectService extends BaseService { * @Description 获取客户下已结案项目列表,按结案时间倒序 **/ List getClosedProjectList(LatestListFormDTO formDTO); + + /** + * 处理响应 + * @author zhaoqifeng + * @date 2020/8/14 9:42 + * @param formDTO + * @return void + */ + void response(ProjectResponseFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java index a3ebf9d74c..d41408524c 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java @@ -107,4 +107,14 @@ public interface ProjectTraceService { * @Description 项目跟踪-项目人员选择 **/ ProcessorListResultDTO processorList(ProcessorListFormDTO formDTO); + + /** + * 处理响应 + * @author zhaoqifeng + * @date 2020/8/12 17:54 + * @param tokenDto + * @param formDTO + * @return void + */ + void response(TokenDto tokenDto, ProjectResponseFormDTO formDTO); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index ea153d138d..3c572a6eac 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -44,10 +44,7 @@ import com.epmet.entity.ProjectEntity; import com.epmet.entity.ProjectProcessEntity; import com.epmet.entity.ProjectRelatedPersonnelEntity; import com.epmet.entity.ProjectStaffEntity; -import com.epmet.feign.EpmetCommonServiceOpenFeignClient; -import com.epmet.feign.EpmetUserFeignClient; -import com.epmet.feign.GovOrgFeignClient; -import com.epmet.feign.MessageFeignClient; +import com.epmet.feign.*; import com.epmet.redis.ProjectRedis; import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; @@ -87,6 +84,8 @@ public class ProjectServiceImpl extends BaseServiceImpl departmentNameList = new ArrayList<>(); + List departmentNameList = new ArrayList<>(); + List departmentList = new ArrayList<>(); if (ProjectConstant.CLOSED.equals(resultDTO.getProjectStatus())) { //项目已结案,跟进部门为空 - resultDTO.setDepartmentNameList(departmentNameList); + resultDTO.setDepartmentNameList(departmentList); } else { //项目未结案,找出所有跟进部门 ProjectDTO projectDTO = new ProjectDTO(); projectDTO.setId(fromDTO.getProjectId()); - departmentNameList = baseDao.selectDepartmentNameList(projectDTO); - resultDTO.setDepartmentNameList(departmentNameList); + departmentNameList = baseDao.selectCurrentDepartmentList(projectDTO); + //提取工作人员ID + List staffIdList = departmentNameList.stream().map(ProjectStaffDTO::getStaffId).collect(Collectors.toList()); + staffIdList = staffIdList.stream().distinct().collect(Collectors.toList()); + //根据部门分组 + Map> departmentMap = + departmentNameList.stream().collect(Collectors.groupingBy(ProjectStaffDTO::getDepartmentName)); + //获取工作人员信息(姓名) + UserIdsFormDTO userIdsFormDTO = new UserIdsFormDTO(); + userIdsFormDTO.setUserIds(staffIdList); + Result> staffListResult = epmetUserOpenFeignClient.getStaffInfoList(userIdsFormDTO); + if (!staffListResult.success()) { + throw new RenException(staffListResult.getCode(), staffListResult.getMsg()); + } + List staffList = staffListResult.getData(); + for (String departmentName : departmentMap.keySet()) { + ProjectDetailResultDTO.DepartmentNameListBean bean = new ProjectDetailResultDTO.DepartmentNameListBean(); + bean.setDepartmentName(departmentName); + List staffDTOList = departmentMap.get(departmentName); + List staffNameList = + staffDTOList.stream().flatMap(staffDto -> staffList.stream().filter(staffInfo -> + staffDto.getStaffId().equals(staffInfo.getStaffId())).map((StaffSinGridResultDTO::getStaffName))).collect(Collectors.toList()); + bean.setStaffList(staffNameList); + departmentList.add(bean); + } + resultDTO.setDepartmentNameList(departmentList); } return resultDTO; @@ -635,4 +659,41 @@ public class ProjectServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + + //获取项目相关信息 + ProjectEntity projectEntity = baseDao.selectById(formDTO.getProjectId()); + if (ProjectConstant.CLOSED.equals(projectEntity.getStatus())) { + throw new RenException(EpmetErrorCode.PROJECT_IS_CLOSED.getCode()); + } + + //处理响应记录加入项目进展表 + ProjectProcessEntity projectProcessEntity = new ProjectProcessEntity(); + projectProcessEntity.setProjectId(formDTO.getProjectId()); + projectProcessEntity.setDepartmentName(formDTO.getDepartmentName()); + projectProcessEntity.setOperation(ProjectConstant.OPERATION_RESPONSES); + projectProcessEntity.setOperationName(ProjectConstant.OPERATION_RESPONSES_NAME); + projectProcessEntity.setPublicReply(formDTO.getPublicReply()); + projectProcessEntity.setInternalRemark(formDTO.getInternalRemark()); + projectProcessEntity.setStaffId(formDTO.getUserId()); + projectProcessService.insert(projectProcessEntity); + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java index fb608230b0..d8ddde09ba 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java @@ -95,4 +95,10 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { Result resultDTOResult = govOrgFeignClient.getProcessorList(staffEntity.getOrgId()); return resultDTOResult.getData(); } + + @Override + public void response(TokenDto tokenDto, ProjectResponseFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + projectService.response(formDTO); + } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index db34280061..8979d90f57 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -183,5 +183,16 @@ AND origin = #{origin} AND origin_id = #{originId} - + \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java index a98dcff26b..cdbc9567c2 100644 --- a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java @@ -117,4 +117,8 @@ public class OperMenuDTO extends TreeStringNode implements Serializ */ private String parentName; + /** + * 是否显示,1:显示 0不显示 + */ + private Integer showFlag; } \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java index 41f02723df..f71e1f5adc 100644 --- a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java @@ -74,6 +74,10 @@ public class OperMenuDTO extends TreeNode implements Serializable { @ApiModelProperty(value = "上级菜单名称") private String parentName; + /** + * 是否显示,1:显示 0不显示 + */ + private Integer showFlag; public void setName(String name) { this.name = name; @@ -155,4 +159,12 @@ public class OperMenuDTO extends TreeNode implements Serializable { public void setParentName(String parentName) { this.parentName = parentName; } + + public Integer getShowFlag() { + return showFlag; + } + + public void setShowFlag(Integer showFlag) { + this.showFlag = showFlag; + } } diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java index 549246c970..b1f69647c7 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java @@ -64,4 +64,8 @@ public class OperMenuEntity extends BaseEpmetEntity { @TableField(exist = false) private String parentName; + /** + * 是否显示,1:显示 0不显示 + */ + private Integer showFlag; } diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/db/migration/V0.0.2__OperMenuAddShowFlag.sql b/epmet-module/oper-access/oper-access-server/src/main/resources/db/migration/V0.0.2__OperMenuAddShowFlag.sql new file mode 100644 index 0000000000..e7494131cc --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/db/migration/V0.0.2__OperMenuAddShowFlag.sql @@ -0,0 +1 @@ +alter table oper_menu add COLUMN `SHOW_FLAG` varchar(1) NOT NULL DEFAULT '1' COMMENT '是否显示,1:显示 0不显示'; diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/db/migration/V0.0.3__OperMenuAddShowFlagV1.sql b/epmet-module/oper-access/oper-access-server/src/main/resources/db/migration/V0.0.3__OperMenuAddShowFlagV1.sql new file mode 100644 index 0000000000..e9764bc121 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/db/migration/V0.0.3__OperMenuAddShowFlagV1.sql @@ -0,0 +1 @@ +alter table oper_menu MODIFY COLUMN `SHOW_FLAG` int(11) NOT NULL DEFAULT 1 COMMENT '是否显示,1:显示 0不显示'; \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java index 7a78fbb209..8e752eb744 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerDTO.java @@ -88,6 +88,11 @@ public class CustomerDTO implements Serializable { */ private String logo; + /** + * 客户允许创建的网格数 + */ + private Integer gridNumber; + /** * 删除标识:0.未删除 1.已删除 */ diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/GridCountFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/GridCountFormDTO.java new file mode 100644 index 0000000000..a4ebfedc5c --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/GridCountFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/12 4:34 下午 + */ +@Data +public class GridCountFormDTO implements Serializable { + + private static final long serialVersionUID = 3121175488079594627L; + + private String customerId; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java new file mode 100644 index 0000000000..6186d67bfb --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 10:53 + */ +@NoArgsConstructor +@Data +public class UpdateCustomerFormDTO implements Serializable { + + private static final long serialVersionUID = 1296290251616658023L; + /** + * 客户ID + */ + private String customerId; + /** + * 客户名 + */ + private String customerName; + /** + * logo + */ + private String logo; +// /** +// * 根管理员姓名 +// */ +// private String rootManageName; +// /** +// * 根管理员电话 +// */ +// private String rootManagePhone; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java new file mode 100644 index 0000000000..95047cf9e9 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2020/8/14 9:01 上午 + */ +@Data +public class CustomerInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 7653925905635170972L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 客户名称 + */ + private String customerName; + + /** + * 有效期 + */ + private Date validityTime; + + /** + * 已创建网格数 + */ + private Integer createGridNumber; + + /** + * 最大允许创建数 + */ + private Integer maxGridNumber; + +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java new file mode 100644 index 0000000000..3d08316bb9 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java @@ -0,0 +1,66 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 9:53 + */ +@NoArgsConstructor +@Data +public class CustomerListResultDTO implements Serializable { + + private static final long serialVersionUID = -2167406082548134982L; + /** + * 客户id + */ + private String customerId; + /** + * 客户名称 + */ + private String customerName; + /** + * 产品标题 显示在产品顶端的标题 + */ + private String title; + /** + * 有效期 + */ + private String validityTime; + /** + * 客户组织级别:0.省级,1市级,2.区县级,3.乡镇街道级 字典表key:organizationlevel + */ + private String organizationLevels; + /** + * 客户logo + */ + private String logo; + /** + * 客户允许创建的网格数 + */ + private Integer gridNumber; + /** + * 跟管理员姓名 + */ + private String rootManageName; + /** + * 跟管理员电话 + */ + private String rootManagePhone; + /** + * 省份 + */ + private String province; + /** + * 城市 + */ + private String city; + /** + * 区县 + */ + private String county; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/GridCountResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/GridCountResultDTO.java new file mode 100644 index 0000000000..7264a71c72 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/GridCountResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/8/12 4:31 下午 + */ +@Data +public class GridCountResultDTO implements Serializable { + + private static final long serialVersionUID = -5523213918272649646L; + + private Integer gridCount; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java index 7b426012b4..8262bba0f9 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java @@ -6,6 +6,8 @@ import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.dto.form.CustomerManagerFormDTO; +import com.epmet.dto.form.GridCountFormDTO; +import com.epmet.dto.result.GridCountResultDTO; import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -55,11 +57,20 @@ public interface OperCrmOpenFeignClient { Result addManager(@RequestBody CustomerManagerFormDTO form); /** - * 获取客户李彪 + * 获取客户列表 * @author zhaoqifeng * @date 2020/8/3 15:24 * @return com.epmet.commons.tools.utils.Result */ @PostMapping("/oper/crm/customer/getalllist") Result> getAllCustomerList(); + + /** + * @Description 查询客户下可以创建网格的最大数 + * @param formDTO + * @author zxc + * @date 2020/8/12 4:37 下午 + */ + @PostMapping("/oper/crm/customer/getgridcount") + Result getGridCount(@RequestBody GridCountFormDTO formDTO); } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java index b4f3947ed7..f4ad95f4ca 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java @@ -7,6 +7,8 @@ import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.dto.form.CustomerManagerFormDTO; +import com.epmet.dto.form.GridCountFormDTO; +import com.epmet.dto.result.GridCountResultDTO; import com.epmet.feign.OperCrmOpenFeignClient; import org.springframework.stereotype.Component; @@ -50,4 +52,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient { public Result> getAllCustomerList() { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getAllCustomerList", null); } + + @Override + public Result getGridCount(GridCountFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getGridCount", formDTO); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml index 108c608acc..d7be013098 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.66 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.69 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index 4ae4fb79aa..cd3d7832e0 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.66 + 0.3.69 com.epmet oper-crm diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java new file mode 100644 index 0000000000..c78e0e799e --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -0,0 +1,19 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2020/8/14 9:46 上午 + */ +public interface ModuleConstant { + + String ERROR_GOV_ORG_COUNT = "调用gov_org服务【查询客户下网格数量】失败"; + + String SELECT_CUSTOMER_ERROR = "根据客户Id查询客户基本信息失败"; + + String GRID_NUMBER_ERROR = "最大网格数不能小于之前设定数"; + + String VALIDITY_TIME_ERROR = "客户有效期不能早于之前设定值"; + + String UPDATE_CUSTOMER_ERROR = "更新客户基本信息失败"; + +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 79c49245b6..30bde5bb69 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -31,8 +31,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.CustomerDetailResultDTO; -import com.epmet.dto.result.ValidCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.excel.CustomerExcel; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.CustomerService; @@ -42,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.text.ParseException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -256,4 +256,75 @@ public class CustomerController { return new Result>().ok(customerService.getAllList()); } + /** + * @Description 查询客户下可以创建网格的最大数 + * @author zxc + * @date 2020/8/12 4:30 下午 + */ + @PostMapping("getgridcount") + public Result getGridCount(@RequestBody GridCountFormDTO formDTO){ + return new Result().ok(customerService.getGridCount(formDTO)); + } + + /** + * @Description 查询客户基本信息 + * @param formDTO + * @author zxc + * @date 2020/8/14 9:08 上午 + */ + @PostMapping("getcustomer") + public Result getCustomer(@RequestBody CustomerIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class); + return new Result().ok(customerService.getCustomer(formDTO)); + } + + /** + * 获取crm客户列表 + * @author zhaoqifeng + * @date 2020/8/19 10:46 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("customerlist") + public Result customerList(@RequestBody PageQueryFormDTO formDTO) { + PageData result = customerService.customerList(formDTO); + return new Result().ok(result); + } + + /** + * 修改客户信息 + * @author zhaoqifeng + * @date 2020/8/19 15:23 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("updatecustomer") + public Result updateCustomer(@RequestBody UpdateCustomerFormDTO formDTO) { + customerService.updateCustomer(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @Description 获取客户最大网格数和有效期 + * @author sun + */ + @PostMapping("getcustomerparameter") + public Result getCustomerParameter(@RequestBody CustomerIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class); + return new Result().ok(customerService.getCustomerParameter(formDTO)); + } + + /** + * @param formDTO + * @Description 修改客户网格数和有效期 + * @author sun + */ + @PostMapping("updatecustomerparameter") + public Result updateCustomerParameter(@RequestBody UpdateCustomerParameterFormDTO formDTO) throws ParseException { + ValidatorUtils.validateEntity(formDTO, UpdateCustomerParameterFormDTO.Customer.class); + customerService.updateCustomerParameter(formDTO); + return new Result(); + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java index dea5f2f40b..b7aed8f55a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java @@ -19,8 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerDTO; -import com.epmet.dto.result.CustomerResultDTO; -import com.epmet.dto.result.ValidCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -74,4 +73,29 @@ public interface CustomerDao extends BaseDao { */ List getAllList(); + /** + * @Description 查询客户下可以创建网格的最大数 + * @param customerId + * @author zxc + * @date 2020/8/12 4:46 下午 + */ + GridCountResultDTO getGridCount(@Param("customerId")String customerId); + + /** + * @Description 根据客户Id查询客户基本信息 + * @param customerId + * @author zxc + * @date 2020/8/14 9:12 上午 + */ + CustomerInfoResultDTO selectCustomerBasicInfo(@Param("customerId")String customerId); + + /** + * 获取crm客户列表 + * @author zhaoqifeng + * @date 2020/8/19 10:17 + * @param customerName + * @return java.util.List + */ + List selectAllCustomerList(@Param("customerName") String customerName); + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java index c5c511cbed..6e56fbee35 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerEntity.java @@ -88,4 +88,9 @@ public class CustomerEntity extends BaseEpmetEntity { */ private String logo; + /** + * 客户允许创建的网格数 + */ + private Integer gridNumber; + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/excel/CustomerExcel.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/excel/CustomerExcel.java index 1708a19dbc..7bd1260e8d 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/excel/CustomerExcel.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/excel/CustomerExcel.java @@ -76,5 +76,8 @@ public class CustomerExcel { @Excel(name = "更新时间") private Date updatedTime; + @Excel(name = "客户允许创建的网格数") + private Integer gridNumber; + } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index b815474688..6749bd9763 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -21,14 +21,11 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; -import com.epmet.dto.form.CustomerFormDTO; -import com.epmet.dto.form.CustomerInitFormDTO; -import com.epmet.dto.form.CustomerManagerFormDTO; -import com.epmet.dto.form.PageQueryFormDTO; -import com.epmet.dto.result.CustomerDetailResultDTO; -import com.epmet.dto.result.ValidCustomerResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; +import java.text.ParseException; import java.util.List; import java.util.Map; @@ -174,4 +171,52 @@ public interface CustomerService extends BaseService { * @return */ List getAllList(); + + /** + * @Description 查询客户下可以创建网格的最大数 + * @author zxc + * @date 2020/8/12 4:30 下午 + */ + GridCountResultDTO getGridCount( GridCountFormDTO formDTO); + + /** + * @Description 查询客户基本信息 + * @param formDTO + * @author zxc + * @date 2020/8/14 9:08 上午 + */ + CustomerInfoResultDTO getCustomer( CustomerIdFormDTO formDTO); + + /** + * 获取crm客户列表 + * @author zhaoqifeng + * @date 2020/8/19 10:12 + * @param formDTO + * @return com.epmet.dto.result.CustomerListResultDTO + */ + PageData customerList(PageQueryFormDTO formDTO); + + /** + * 客户基本信息修改 + * @author zhaoqifeng + * @date 2020/8/19 10:58 + * @param formDTO + * @return void + */ + void updateCustomer(UpdateCustomerFormDTO formDTO); + + /** + * @param formDTO + * @Description 获取客户最大网格数和有效期 + * @author sun + */ + CustomerInfoResultDTO getCustomerParameter( CustomerIdFormDTO formDTO); + + /** + * @param formDTO + * @Description 修改客户网格数和有效期 + * @author sun + */ + void updateCustomerParameter(UpdateCustomerParameterFormDTO formDTO) throws ParseException; + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 219ad17f20..323388de35 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -30,6 +30,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ModuleConstant; import com.epmet.constant.RoleKeyConstants; import com.epmet.constant.UserWorkType; import com.epmet.dao.CustomerDao; @@ -37,10 +38,7 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; -import com.epmet.feign.EpmetUserFeignClient; -import com.epmet.feign.GovOrgFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.OperCustomizeFeignClient; +import com.epmet.feign.*; import com.epmet.redis.CustomerRedis; import com.epmet.service.CustomerService; import com.github.pagehelper.PageHelper; @@ -53,6 +51,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -76,6 +76,10 @@ public class CustomerServiceImpl extends BaseServiceImpl page(Map params) { @@ -470,6 +474,8 @@ public class CustomerServiceImpl extends BaseServiceImpl result = govOrgOpenFeignClient.selectGridCount(formDTO); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_GOV_ORG_COUNT); + } + customerInfoResultDTO.setCreateGridNumber(result.getData().getGridCount()); + return customerInfoResultDTO; + } + + @Override + public PageData customerList(PageQueryFormDTO formDTO) { + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()) + .doSelectPageInfo(() -> baseDao.selectAllCustomerList(formDTO.getCustomerName())); + List list = pageInfo.getList(); + if(null != list) { + list.forEach(dto -> { + // 根级组织 + Result customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(dto.getCustomerId()); + if (!customerRootAgencyRst.success()) { + throw new RenException("查询客户详情:查询客户根级组织失败:".concat(customerRootAgencyRst.toString())); + } + CustomerAgencyDTO agency = customerRootAgencyRst.getData(); + + // 管理员 + if (agency != null) { + StaffRoleFormDTO staffsInRoleForm = new StaffRoleFormDTO(); + staffsInRoleForm.setOrgId(agency.getId()); + staffsInRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); + Result> managersResult = epmetUserFeignClient.getStaffsInRole(staffsInRoleForm); + if (!managersResult.success()) { + throw new RenException("查询客户详情:查询客户管理员失败:".concat(managersResult.toString())); + } + + dto.setProvince(agency.getProvince()); + dto.setCity(agency.getCity()); + dto.setCounty(agency.getDistrict()); + if (null != managersResult.getData() && managersResult.getData().size() > NumConstant.ZERO) { + GovStaffRoleResultDTO manager = managersResult.getData().get(NumConstant.ZERO); + dto.setRootManageName(manager.getRealName()); + dto.setRootManagePhone(manager.getMobile()); + } + + } + }); + } + pageInfo.setList(list); + return new PageData<>(pageInfo.getList(),pageInfo.getTotal()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateCustomer(UpdateCustomerFormDTO formDTO) { + CustomerEntity entity = new CustomerEntity(); + entity.setId(formDTO.getCustomerId()); + if (StringUtils.isNotBlank(formDTO.getCustomerName())){ + entity.setCustomerName(formDTO.getCustomerName()); + } + if (StringUtils.isNotBlank(formDTO.getLogo())){ + entity.setLogo(formDTO.getLogo()); + } + entity.setLogo(formDTO.getLogo()); + baseDao.updateById(entity); +// if (StringUtils.isNotBlank(formDTO.getRootManageName()) || StringUtils.isNotBlank(formDTO.getRootManagePhone())) { +// // 根级组织 +// Result customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(formDTO.getCustomerId()); +// if (!customerRootAgencyRst.success() || null == customerRootAgencyRst.getData()) { +// throw new RenException("客户基本信息修改:查询客户根级组织失败:".concat(customerRootAgencyRst.toString())); +// } +// CustomerAgencyDTO agency = customerRootAgencyRst.getData(); +// UpdateRootManageFormDTO updateRootManageFormDTO = new UpdateRootManageFormDTO(); +// updateRootManageFormDTO.setOrgId(agency.getId()); +// updateRootManageFormDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); +// if (StringUtils.isNotBlank(formDTO.getRootManageName())){ +// updateRootManageFormDTO.setRootManageName(formDTO.getRootManageName()); +// } +// if (StringUtils.isNotBlank(formDTO.getRootManageName())){ +// updateRootManageFormDTO.setRootManagePhone(formDTO.getRootManagePhone()); +// } +// Result rootManageResult = epmetUserOpenFeignClient.updateRootManage(updateRootManageFormDTO); +// if (!rootManageResult.success()) { +// throw new RenException("客户基本信息修改:修改根管理员信息失败:".concat(rootManageResult.toString())); +// } +// } + } + + /** + * @param formDTO + * @Description 获取客户最大网格数和有效期 + * @author sun + */ + @Override + public CustomerInfoResultDTO getCustomerParameter(CustomerIdFormDTO formDTO) { + //1.查询客户基本信息 + CustomerInfoResultDTO customerInfoResultDTO = customerDao.selectCustomerBasicInfo(formDTO.getCustomerId()); + if (null == customerInfoResultDTO) { + throw new RenException(ModuleConstant.SELECT_CUSTOMER_ERROR); + } + + //2.查询客户实际网格数 + Result result = govOrgOpenFeignClient.selectGridCount(formDTO); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_GOV_ORG_COUNT); + } + CustomerGridCountResultDTO resultDTO = result.getData(); + customerInfoResultDTO.setCreateGridNumber(resultDTO.getGridCount()); + + return customerInfoResultDTO; + } + + + /** + * @param formDTO + * @Description 修改客户网格数和有效期 + * @author sun + */ + @Override + public void updateCustomerParameter(UpdateCustomerParameterFormDTO formDTO) throws ParseException { + //1.查询客户基本信息 + CustomerEntity entity = baseDao.selectById(formDTO.getCustomerId()); + if (null == entity) { + throw new RenException(ModuleConstant.SELECT_CUSTOMER_ERROR); + } + //2.校验数据合格性 + if (entity.getGridNumber() > formDTO.getGridNumber()) { + throw new RenException(ModuleConstant.GRID_NUMBER_ERROR); + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Date dt1 = df.parse(formDTO.getValidityTime()); + Date dt2 = entity.getValidityTime(); + if (dt1.getTime() < dt2.getTime()) { + throw new RenException(ModuleConstant.VALIDITY_TIME_ERROR); + } + //3.更新数据 + CustomerEntity customerEntity = new CustomerEntity(); + customerEntity.setId(formDTO.getCustomerId()); + customerEntity.setGridNumber(formDTO.getGridNumber()); + customerEntity.setValidityTime(dt1); + if (baseDao.updateById(customerEntity) < NumConstant.ONE) { + throw new RenException(ModuleConstant.UPDATE_CUSTOMER_ERROR); + } + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.2__update_customer.sql b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.2__update_customer.sql new file mode 100644 index 0000000000..27379d7feb --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/db/migration/V0.0.2__update_customer.sql @@ -0,0 +1,5 @@ + +ALTER TABLE `customer` +ADD COLUMN `GRID_NUMBER` int(11) NULL COMMENT '客户允许创建的网格数' AFTER `ORGANIZATION_LEVEL`; + +UPDATE customer SET GRID_NUMBER = 10; \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml index a0d49c5172..b1d219013a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml @@ -78,4 +78,46 @@ WHERE del_flag = '0' + + + + + + + + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFunctionDetailDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFunctionDetailDTO.java new file mode 100644 index 0000000000..8f2d7d09b7 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFunctionDetailDTO.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 客户定制功能详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Data +public class CustomerFunctionDetailDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 功能Id + */ + private String functionId; + + /** + * 自定义功能名称 + */ + private String functionName; + + /** + * 自定义大图标 + */ + private String iconLargeImg; + + /** + * 自定义小图标 + */ + private String iconSmallImg; + + /** + * 自定义业务域名 + */ + private String domainName; + + /** + * 外链地址 + */ + private String targetLink; + + /** + * 上架状态:0:下架、1:上架 + */ + private Integer shoppingStatus; + + /** + * 自定义排序 + */ + private Integer displayOrder; + + /** + * 删除标识(0.未删除 1.已删除) + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomizedDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomizedDTO.java new file mode 100644 index 0000000000..aa54ed57bf --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomizedDTO.java @@ -0,0 +1,67 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 定制功能修改 入参 + * + * @author zhangyong + * @since v1.0.0 2020-08-13 + */ +@Data +public class CustomizedDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 定制功能ID + */ + private String functionId; + + /** + * 上架状态:0:下架、1:上架 + */ + private String shoppingStatus; + + /** + * 功能说明 + */ + private String functionExplain; + + /** + * 定制功能详情ID + */ + private String customizedId; + + /** + * 默认名称 + */ + private String customizedName; + + /** + * 默认大图标 + */ + private String iconLargeImg; + + /** + * 默认小图标 + */ + private String iconSmallImg; + + + /** + * 外链地址 + */ + private String targetLink; + + /** + * 业务域名 + */ + private String domainName; + + /** + * 来源app(政府端:gov、居民端:resi) + */ + private String fromApp; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java new file mode 100644 index 0000000000..9fb059d520 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 定制功能 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Data +public class FunctionCustomizedDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 功能ID(function.ID) + */ + private String functionId; + + /** + * 默认名称 + */ + private String customizedName; + + /** + * 默认大图标 + */ + private String iconLargeImg; + + /** + * 默认小图标 + */ + private String iconSmallImg; + + /** + * 外链地址(必须是https的请求) + */ + private String targetLink; + + /** + * 删除标识(0.未删除 1.已删除) + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 业务域名 + */ + private String domainName; + + /** + * 来源app(政府端:gov、居民端:resi) + */ + private String fromApp; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedVisitedDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedVisitedDTO.java new file mode 100644 index 0000000000..84d2b50095 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedVisitedDTO.java @@ -0,0 +1,106 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-13 + */ +@Data +public class FunctionCustomizedVisitedDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 用户Id + */ + private String userId; + + /** + * 所属端 居民端:resi工作端:work + */ + private String clientType; + + /** + * 功能Id + */ + private String functionId; + + /** + * 请求地址 访问的url地址 + */ + private String url; + + /** + * 结果 成功success失败error + */ + private String result; + + /** + * 原因 失败的原因(例:请求超时、404、500等) + */ + private String msg; + + /** + * 删除标识(0.未删除 1.已删除) + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionShoppingHistoryDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionShoppingHistoryDTO.java new file mode 100644 index 0000000000..3426469343 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionShoppingHistoryDTO.java @@ -0,0 +1,90 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 客户定制功能上下架历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-14 + */ +@Data +public class FunctionShoppingHistoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 功能Id + */ + private String functionId; + + /** + * 上下架状态 上架状态:0:下架、1:上架 + */ + private Integer shoppingStatus; + + /** + * 理由 + */ + private String reason; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 删除标识(0.未删除 1.已删除) + */ + private Integer delFlag; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CommonFunctionIdFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CommonFunctionIdFormDTO.java new file mode 100644 index 0000000000..a2200fdf5c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CommonFunctionIdFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 入参为:定制功能ID + * + * @author zhangyong + * @since v1.0.0 2020-08-13 + */ +@Data +public class CommonFunctionIdFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 定制功能ID + */ + @NotBlank(message = "定制功能ID不能为空") + private String functionId; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerDomainFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerDomainFormDTO.java new file mode 100644 index 0000000000..a7c053df2c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerDomainFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 16:13 + */ +@Data +public class CustomerDomainFormDTO implements Serializable { + private static final long serialVersionUID = 6766612197218605922L; + private String customerId; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java new file mode 100644 index 0000000000..b29c199c3a --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java @@ -0,0 +1,36 @@ +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; + +/** + * @Description 运营端-定制功能采集-接口入参 + * @Author sun + */ +@Data +public class CustomerFunctionCollectFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + /** + * 功能ID + */ + @NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class}) + private String functionId; + /** + * 上架理由 + */ + @NotBlank(message = "上架理由不能为空", groups = {AddUserShowGroup.class}) + private String reason; + + public interface AddUserInternalGroup {} + + public interface AddUserShowGroup extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionCustomizedListFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionCustomizedListFormDTO.java new file mode 100644 index 0000000000..2c6e3c037a --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionCustomizedListFormDTO.java @@ -0,0 +1,59 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import java.io.Serializable; + +/** + * 定制功能列表 入参 + * + * @author zhangyong + * @since v1.0.0 2020-08-14 + */ +@Data +public class FunctionCustomizedListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 功能名称 + */ + private String customizedName; + + + /** + * 所属端 + */ + private String fromApp; + + /** + * 页码,从1开始 + */ + @Min(value = 1, message = "页码必须大于0") + private Integer pageNo; + + /** + * 页容量,默认20页 + */ + @Min(value = 1, message = "每页条数必须大于必须大于0") + private Integer pageSize; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionDetailFromDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionDetailFromDTO.java new file mode 100644 index 0000000000..ee133cd136 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionDetailFromDTO.java @@ -0,0 +1,35 @@ +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 sun + */ +@Data +public class FunctionDetailFromDTO implements Serializable { + + private static final long serialVersionUID = -6163303184086480522L; + + public interface AddUserInternalGroup { + } + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 客户ID + */ + @NotBlank(message = "客户Id不能为空", groups = {AddUserShowGroup.class}) + private String customerId; + + /** + * resi:居民端,work:工作端 + */ + @NotBlank(message = "所属端不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class}) + private String clientType; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionVisitedFromDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionVisitedFromDTO.java new file mode 100644 index 0000000000..829e019fac --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionVisitedFromDTO.java @@ -0,0 +1,56 @@ +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 sun + */ +@Data +public class FunctionVisitedFromDTO implements Serializable { + + private static final long serialVersionUID = -6163303184086480522L; + + public interface AddUserInternalGroup { + } + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 用户Id + */ + private String userId; + /** + * 客户Id + */ + private String customerId; + /** + * 所属端 + */ + @NotBlank(message = "所属端不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class}) + private String clientType; + /** + * 功能Id + */ + @NotBlank(message = "功能Id不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class}) + private String functionId; + /** + * 请求地址 + */ + @NotBlank(message = "请求地址不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class}) + private String url; + /** + * 结果 + */ + @NotBlank(message = "结果不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class}) + private String result; + /** + * 原因 + */ + private String msg; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveFunctionCustomizedFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveFunctionCustomizedFormDTO.java new file mode 100644 index 0000000000..20d3fd5298 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/SaveFunctionCustomizedFormDTO.java @@ -0,0 +1,72 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 定制功能新增 入参 + * + * @author zhangyong + * @since v1.0.0 2020-08-13 + */ +@Data +public class SaveFunctionCustomizedFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 功能名称 + */ + @NotBlank(message = "功能名称不能为空") + private String functionName; + + /** + * 功能类型:0.默认功能,1.定制功能 + */ + @NotBlank(message = "功能类型:0.默认功能,1.定制功能不能为空") + private String functionGroup; + + /** + * 功能说明 + */ + @NotBlank(message = "功能说明不能为空") + private String functionExplain; + + /** + * 默认大图标 + */ + @NotBlank(message = "默认大图标不能为空") + private String iconLargeImg; + + /** + * 默认小图标 + */ + @NotBlank(message = "默认小图标不能为空") + private String iconSmallImg; + + /** + * 外链地址 + */ + @NotBlank(message = "外链地址不能为空") + private String targetLink; + + /** + * 上架状态:0:下架、1:上架 + */ + @NotBlank(message = "上架状态:0:下架、1:上架不能为空") + private String shoppingStatus; + + /** + * 业务域名(https;//... 无端口号) + */ + @NotBlank(message = "业务域名(https;//... 无端口号)不能为空") + private String domainName; + + /** + * 来源app(工作端:gov、居民端:resi) + */ + @NotBlank(message = "来源app(工作端:gov、居民端:resi)不能为空") + private String fromApp; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java new file mode 100644 index 0000000000..83800e2af5 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java @@ -0,0 +1,53 @@ +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 zhangyong + * @since v1.0.0 2020-08-13 + */ +@Data +public class UpdateCustomerFunctionFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + + /** + * 功能ID + */ + @NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class}) + private String functionId; + + /** + * 自定义功能名称 + */ + @NotBlank(message = "自定义功能名称不能为空", groups = {AddUserShowGroup.class}) + private String functionName; + + /** + * 自定义大图标 + */ + @NotBlank(message = "自定义大图标不能为空", groups = {AddUserShowGroup.class}) + private String iconLargeImg; + + /** + * 自定义小图标 + */ + @NotBlank(message = "自定义小图标不能为空", groups = {AddUserShowGroup.class}) + private String iconSmallImg; + + private String userId; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java new file mode 100644 index 0000000000..ec690c3a49 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java @@ -0,0 +1,72 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 定制功能修改 入参 + * + * @author zhangyong + * @since v1.0.0 2020-08-13 + */ +@Data +public class UpdateCustomizedFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 定制功能ID + */ + @NotBlank(message = "定制功能ID不能为空") + private String functionId; + + /** + * 上架状态:0:下架、1:上架 + */ + @NotBlank(message = "上架状态:0:下架、1:上架不能为空") + private String shoppingStatus; + + /** + * 功能说明 + */ + @NotBlank(message = "功能说明不能为空") + private String functionExplain; + + /** + * 默认名称 + */ + @NotBlank(message = "功能名称不能为空") + private String functionName; + + /** + * 默认大图标 + */ + @NotBlank(message = "默认大图标不能为空") + private String iconLargeImg; + + /** + * 默认小图标 + */ + @NotBlank(message = "默认小图标不能为空") + private String iconSmallImg; + + + /** + * 外链地址 + */ + @NotBlank(message = "外链地址不能为空") + private String targetLink; + + /** + * 业务域名 + */ + @NotBlank(message = "业务域名不能为空") + private String domainName; + + /** + * 来源app(工作端:gov、居民端:resi) + */ + @NotBlank(message = "来源app(工作端:gov、居民端:resi)不能为空") + private String fromApp; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateShoppingStatusFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateShoppingStatusFormDTO.java new file mode 100644 index 0000000000..2a27cfbc18 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateShoppingStatusFormDTO.java @@ -0,0 +1,47 @@ +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 zhangyong + * @since v1.0.0 2020-08-13 + */ +@Data +public class UpdateShoppingStatusFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + + /** + * 功能ID + */ + @NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class}) + private String functionId; + + /** + * 上架状态:0:下架、1:上架 + */ + @NotBlank(message = "上架状态:0:下架、1:上架不能为空", groups = {AddUserShowGroup.class}) + private String shoppingStatus; + + /** + * 理由 + */ + @NotBlank(message = "上下架理由不能为空", groups = {AddUserShowGroup.class}) + private String reason; + + private String userId; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/WebviewDomainFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/WebviewDomainFormDTO.java new file mode 100644 index 0000000000..2518bb28b4 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/WebviewDomainFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 17:46 + */ +@Data +public class WebviewDomainFormDTO implements Serializable { + private static final long serialVersionUID = 8022056850984848597L; + /** + * 客户ID + */ + private String customerId; + /** + * 客户端类型 + */ + private String clientType; + /** + * 操作类型:add 添加,delete 删除,set 覆盖 + */ + private String action; + /** + * 业务域名 + */ + private List webViewDomain; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java new file mode 100644 index 0000000000..c36d1b609e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java @@ -0,0 +1,36 @@ +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; + +/** + * @Description 运营端-客户定制功能顺序修改-接口入参 + * @Author sun + */ +@Data +public class updatedisplayorderListFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + /** + * 功能ID + */ + @NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class}) + private String functionId; + /** + * 排序号 + */ + @NotBlank(message = "排序号不能为空", groups = {AddUserShowGroup.class}) + private Integer displayOrder; + + public interface AddUserInternalGroup {} + + public interface AddUserShowGroup extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java new file mode 100644 index 0000000000..4c38302f8d --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 运营端-客户定制功能列表-接口返参 + * @Author sun + */ +@Data +public class CustomerFunctionCustomizedListResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + + /** + * 默认功能列表 + */ + private List customerList = new ArrayList<>(); + + /** + * 定制功能列表 + */ + private List functionList = new ArrayList<>(); + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java new file mode 100644 index 0000000000..3c993374b3 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 运营端-客户定制功能列表-接口返参 + * @Author sun + */ +@Data +public class CustomerResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + /** + * 客户Id + */ + private String customerId; + /** + * 定制功能Id + */ + private String functionId; + /** + * 默认功能名称 + */ + private String customizedName; + /** + * 自定义功能名称 + */ + private String functionName; + /** + * 功能所属端(居民端:resi 工作端:work) + */ + private String fromApp; + /** + * 默认大图标 + */ + private String defaultLargeImg; + /** + * 自定义大图标 + */ + private String iconLargeImg; + /** + * 默认小图标 + */ + private String defaultSmallImg; + /** + * 自定义小图标 + */ + private String iconSmallImg; + /** + * 上下架(0:下架、1:上架) + */ + private Integer shoppingStatus; + /** + * 业务域名 + */ + private String domainName; + /** + * 外链地址 + */ + private String targetLink; + /** + * 排序 + */ + private Integer displayOrder; + /** + * 功能说明 + */ + private String functionExplain; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedDetailResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedDetailResultDTO.java new file mode 100644 index 0000000000..e232ce5f2f --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedDetailResultDTO.java @@ -0,0 +1,66 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 定制功能详情 返回值 + * + * @author zhangyong + * @since v1.0.0 2020-08-13 + */ +@Data +public class FunctionCustomizedDetailResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 功能ID(function.ID) + */ + private String functionId; + + /** + * 上架状态:0:下架、1:上架 + */ + private String shoppingStatus; + + /** + * 功能说明 + */ + private String functionExplain; + + /** + * 默认名称 + */ + private String functionName; + + /** + * 默认大图标 + */ + private String iconLargeImg; + + /** + * 默认小图标 + */ + private String iconSmallImg; + + /** + * 外链地址 + */ + private String targetLink; + + /** + * 业务域名 + */ + private String domainName; + + /** + * 来源app(工作端:gov、居民端:resi) + */ + private String fromApp; + + /** + * 是否有客户在使用(0:否 1:是) + */ + private Integer isApply; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedListDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedListDTO.java new file mode 100644 index 0000000000..85faedd828 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedListDTO.java @@ -0,0 +1,61 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 定制功能列表 返回值 + * + * @author zhangyong + * @since v1.0.0 2020-08-14 + */ +@Data +public class FunctionCustomizedListDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 功能ID(function.ID) + */ + private String functionId; + + /** + * 上架状态:0:下架、1:上架 + */ + private String shoppingStatus; + + /** + * 功能说明 + */ + private String functionExplain; + + /** + * 默认名称 + */ + private String customizedName; + + /** + * 默认大图标 + */ + private String iconLargeImg; + + /** + * 默认小图标 + */ + private String iconSmallImg; + + /** + * 外链地址 + */ + private String targetLink; + + /** + * 业务域名 + */ + private String domainName; + + /** + * 来源app(政府端:gov、居民端:resi) + */ + private String fromApp; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedListResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedListResultDTO.java new file mode 100644 index 0000000000..2428e4d441 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionCustomizedListResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 定制功能列表 返回值 + * + * @author zhangyong + * @since v1.0.0 2020-08-14 + */ +@Data +public class FunctionCustomizedListResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 列表总条数 + */ + private Integer total; + + /** + * 列表内容 + */ + private List list; + + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java new file mode 100644 index 0000000000..ebbcd3ea9b --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java @@ -0,0 +1,50 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; + +/** + * 查询客户定制功能列表-接口返参 + * @Author sun + */ +@Data +public class FunctionDetailResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + /** + * 功能Id + */ + private String functionId; + + /** + * 自定义功能名称 + */ + private String functionName; + + /** + * 自定义大图标 + */ + private String iconLargeImg; + + /** + * 自定义小图标 + */ + private String iconSmallImg; + + /** + * 请求地址(https://+业务域名+外链地址) + */ + private String url; + + /** + * 自定义排序 + */ + private String dispalyOrder; + + /** + * 自定义json(目前是空值)【集合对象经过urlencode转化】 + */ + private String customerParameter; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java new file mode 100644 index 0000000000..7c211434c6 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 运营端-客户定制功能列表-接口返参 + * @Author sun + */ +@Data +public class FunctionResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + /** + * 客户Id + */ + private String customerId; + /** + * 定制功能Id + */ + private String functionId; + /** + * 默认功能名称 + */ + private String customizedName; + /** + * 功能所属端(居民端:resi 工作端:work) + */ + private String fromApp; + /** + * 功能说明 + */ + private String functionExplain; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml index 21d31ea187..3b7127b0f4 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-customize-server: container_name: oper-customize-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.26 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.37 ports: - "8089:8089" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index d6ce7700ad..0cd9b6fb4a 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.26 + 0.3.37 com.epmet oper-customize diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java new file mode 100644 index 0000000000..42f69d00e2 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java @@ -0,0 +1,196 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.CustomerFunctionDetailDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerFunctionCustomizedListResultDTO; +import com.epmet.dto.result.FunctionDetailResultDTO; +import com.epmet.excel.CustomerFunctionDetailExcel; +import com.epmet.service.CustomerFunctionDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 客户定制功能详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@RestController +@RequestMapping("customerfunctiondetail") +public class CustomerFunctionDetailController { + + @Autowired + private CustomerFunctionDetailService customerFunctionDetailService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = customerFunctionDetailService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CustomerFunctionDetailDTO data = customerFunctionDetailService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CustomerFunctionDetailDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerFunctionDetailService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CustomerFunctionDetailDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerFunctionDetailService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + customerFunctionDetailService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = customerFunctionDetailService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, CustomerFunctionDetailExcel.class); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 居民端-获取客户定制功能列表 + **/ + @PostMapping("resifunctiondetaillist") + public Result> resiFunctionDetail(@LoginUser TokenDto tokenDto, @RequestBody FunctionDetailFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, FunctionDetailFromDTO.AddUserShowGroup.class); + return new Result>().ok(customerFunctionDetailService.resiAndWorkFunctionDetail(formDTO)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 工作端-获取客户定制功能列表 + **/ + @PostMapping("workfunctiondetaillist") + public Result> workFunctionDetail(@LoginUser TokenDto tokenDto, @RequestBody FunctionDetailFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, FunctionDetailFromDTO.AddUserInternalGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(customerFunctionDetailService.resiAndWorkFunctionDetail(formDTO)); + } + + /** + * 修改客户定制功能上下架 + * 修改上下架状态,保存上下架历史 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:17 2020-08-17 + **/ + @PostMapping("updateshoppingstatus") + public Result updateShoppingStatus(@LoginUser TokenDto tokenDto, @RequestBody UpdateShoppingStatusFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UpdateShoppingStatusFormDTO.AddUserInternalGroup.class, UpdateShoppingStatusFormDTO.AddUserShowGroup.class); + formDTO.setUserId(tokenDto.getUserId()); + return customerFunctionDetailService.updateShoppingStatus(formDTO); + } + + /** + * 客户定制功能修改 入参 + * 目前允许修改功能名称、大小图标 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:17 2020-08-17 + **/ + @PostMapping("updatecustomerfunction") + public Result updateCustomerFunction(@LoginUser TokenDto tokenDto, @RequestBody UpdateCustomerFunctionFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, UpdateCustomerFunctionFormDTO.AddUserInternalGroup.class, UpdateCustomerFunctionFormDTO.AddUserShowGroup.class); + formDTO.setUserId(tokenDto.getUserId()); + return customerFunctionDetailService.updateCustomerFunction(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 客户定制功能列表 + **/ + @PostMapping("customerfunctionlist") + public Result customerFunctionList(@LoginUser TokenDto tokenDto, @RequestBody CustomerFunctionListFormDTO formDTO) { + return new Result().ok(customerFunctionDetailService.customerFunctionList(formDTO.getCustomerId())); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 客户定制功能顺序修改 + **/ + @PostMapping("updatedisplayorder") + //public Result updateDisplayOrder(@LoginUser TokenDto tokenDto, @RequestParam("formDTO") List formDTO) { + public Result updateDisplayOrder(@LoginUser TokenDto tokenDto, @RequestBody(required = true) List formDTO) { + customerFunctionDetailService.updateDisplayOrder(tokenDto, formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 定制功能采集 + **/ + @PostMapping("customerfunctioncollect") + public Result customerFunctionCollect(@LoginUser TokenDto tokenDto, @RequestBody CustomerFunctionCollectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerFunctionCollectFormDTO.AddUserInternalGroup.class, CustomerFunctionCollectFormDTO.AddUserShowGroup.class); + customerFunctionDetailService.customerFunctionCollect(formDTO); + return new Result(); + } + + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionController.java index ef7eec6d02..1862cb7ceb 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionController.java @@ -17,14 +17,16 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.FunctionDTO; import com.epmet.excel.FunctionExcel; import com.epmet.service.FunctionService; @@ -102,4 +104,19 @@ public class FunctionController { public Result> queryFunctionList() { return functionService.queryFunctionList(); } + + /** + * @param dto + * @return + * @Author sun + * @Description 默认功能新增 + **/ + @PostMapping("savefunction") + public Result saveFunction(@LoginUser TokenDto tokenDto, @RequestBody FunctionDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + functionService.saveFunction(dto); + return new Result(); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedController.java new file mode 100644 index 0000000000..fd82ce4fb6 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedController.java @@ -0,0 +1,180 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.FunctionCustomizedDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; +import com.epmet.dto.result.FunctionCustomizedListResultDTO; +import com.epmet.excel.FunctionCustomizedExcel; +import com.epmet.service.FunctionCustomizedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 定制功能 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@RestController +@RequestMapping("functioncustomized") +public class FunctionCustomizedController { + + @Autowired + private FunctionCustomizedService functionCustomizedService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = functionCustomizedService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + FunctionCustomizedDTO data = functionCustomizedService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody FunctionCustomizedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + functionCustomizedService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody FunctionCustomizedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + functionCustomizedService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + functionCustomizedService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = functionCustomizedService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, FunctionCustomizedExcel.class); + } + + /** + * 定制功能新增(功能表、定制功能表) + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:54 2020-08-13 + **/ + @PostMapping("savefunctioncustomized") + public Result saveFunctionCustomized(@RequestBody SaveFunctionCustomizedFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + functionCustomizedService.saveFunctionCustomized(formDTO); + return new Result(); + } + + /** + * 定制功能详情 + * 根据定制功能Id查询对应的详情数据 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:36 2020-08-13 + **/ + @PostMapping("getfunctioncustomized") + public Result getFunctionCustomized(@RequestBody CommonFunctionIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return functionCustomizedService.getFunctionCustomized(formDTO); + } + + /** + * 定制功能删除 + * 单条删除,在没有客户使用的前提下可以逻辑删除(客户定制功能详情表 ,没查到就是没人在使用) + * 当功能 有客户在使用时,返回code: 8000 + * msg: 功能正在使用中,不允许删除! + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 11:03 2020-08-13 + **/ + @PostMapping("deletefunctioncustomized") + public Result deleteFunctionCustomized(@RequestBody CommonFunctionIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return functionCustomizedService.deleteFunctionCustomized(formDTO); + } + + /** + * 定制功能修改 + * 有客户在使用该功能时则不允许修改上下架状态、业务域名和外链地址、所属端app, + * 只能修改功能名称和大小图标 + * 修改的要判断是否有客户在使用,有用的要批量更新已使用客户数据 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:52 2020-08-13 + **/ + @PostMapping("updatecustomized") + public Result updateCustomized(@RequestBody UpdateCustomizedFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return functionCustomizedService.updateCustomized(formDTO); + } + + /** + * 定制功能列表 + * 按功能分组,先工作端在居民端,在按创建时间倒序 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:07 2020-08-14 + **/ + @PostMapping("functioncustomizedlist") + public Result functionCustomizedList(@RequestBody FunctionCustomizedListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return functionCustomizedService.functionCustomizedList(formDTO); + } + + @PostMapping("customerdomainname") + public Result customerDomain(@RequestBody CustomerDomainFormDTO formDTO) { + functionCustomizedService.customerDomain(formDTO); + return new Result(); + } +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedVisitedController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedVisitedController.java new file mode 100644 index 0000000000..faea8de9e9 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedVisitedController.java @@ -0,0 +1,128 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.FunctionCustomizedVisitedDTO; +import com.epmet.dto.form.FunctionDetailFromDTO; +import com.epmet.dto.form.FunctionVisitedFromDTO; +import com.epmet.dto.result.FunctionDetailResultDTO; +import com.epmet.excel.FunctionCustomizedVisitedExcel; +import com.epmet.service.FunctionCustomizedVisitedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-13 + */ +@RestController +@RequestMapping("functioncustomizedvisited") +public class FunctionCustomizedVisitedController { + + @Autowired + private FunctionCustomizedVisitedService functionCustomizedVisitedService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = functionCustomizedVisitedService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + FunctionCustomizedVisitedDTO data = functionCustomizedVisitedService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody FunctionCustomizedVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + functionCustomizedVisitedService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody FunctionCustomizedVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + functionCustomizedVisitedService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + functionCustomizedVisitedService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = functionCustomizedVisitedService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, FunctionCustomizedVisitedExcel.class); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 居民端-保存定制功能访问记录 + **/ + @PostMapping("saveresifunctionvisited") + public Result saveResiFunctionVisited(@LoginUser TokenDto tokenDto, @RequestBody FunctionVisitedFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, FunctionVisitedFromDTO.AddUserInternalGroup.class, FunctionVisitedFromDTO.AddUserShowGroup.class); + formDTO.setUserId(tokenDto.getUserId()); + functionCustomizedVisitedService.saveFunctionVisited(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 工作端-保存定制功能访问记录 + **/ + @PostMapping("saveworkfunctionvisited") + public Result> saveWorkFunctionVisited(@LoginUser TokenDto tokenDto, @RequestBody FunctionVisitedFromDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, FunctionVisitedFromDTO.AddUserInternalGroup.class, FunctionVisitedFromDTO.AddUserShowGroup.class); + formDTO.setUserId(tokenDto.getUserId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + functionCustomizedVisitedService.saveFunctionVisited(formDTO); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionShoppingHistoryController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionShoppingHistoryController.java new file mode 100644 index 0000000000..51e1c62815 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionShoppingHistoryController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.FunctionShoppingHistoryDTO; +import com.epmet.excel.FunctionShoppingHistoryExcel; +import com.epmet.service.FunctionShoppingHistoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 客户定制功能上下架历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-14 + */ +@RestController +@RequestMapping("functionshoppinghistory") +public class FunctionShoppingHistoryController { + + @Autowired + private FunctionShoppingHistoryService functionShoppingHistoryService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = functionShoppingHistoryService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + FunctionShoppingHistoryDTO data = functionShoppingHistoryService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody FunctionShoppingHistoryDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + functionShoppingHistoryService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody FunctionShoppingHistoryDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + functionShoppingHistoryService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + functionShoppingHistoryService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = functionShoppingHistoryService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, FunctionShoppingHistoryExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java new file mode 100644 index 0000000000..1a6572179d --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerFunctionDetailDTO; +import com.epmet.dto.form.FunctionDetailFromDTO; +import com.epmet.dto.form.UpdateCustomerFunctionFormDTO; +import com.epmet.dto.form.UpdateShoppingStatusFormDTO; +import com.epmet.dto.result.CustomerResultDTO; +import com.epmet.dto.result.FunctionDetailResultDTO; +import com.epmet.entity.CustomerFunctionDetailEntity; +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-11 + */ +@Mapper +public interface CustomerFunctionDetailDao extends BaseDao { + + /** + * 根据functionId查询使用该功能的,客户id: customizedId + * 可用来判断该功能,是否有客户在使用 + * + * @param functionId + * @return java.util.List + * @Author zhangyong + * @Date 11:14 2020-08-13 + **/ + List selectCustomerIdByFunctionId(@Param("functionId") String functionId); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 根据所属端和客户Id查询客户定制功能列表 + **/ + List selectFunctionDetailList(FunctionDetailFromDTO formDTO); + + /** + * 修改客户定制功能上下架 + * 修改上下架状态,保存上下架历史 + * + * @param formDTO + * @Author zhangyong + * @Date 09:17 2020-08-17 + **/ + void updateShoppingStatus(UpdateShoppingStatusFormDTO formDTO); + + /** + * 客户定制功能修改 入参 + * 目前允许修改功能名称、大小图标 + * + * @param formDTO + * @Author zhangyong + * @Date 10:00 2020-08-17 + **/ + void updateCustomerFunction(UpdateCustomerFunctionFormDTO formDTO); + + /** + * @param customerId + * @return + * @Author sun + * @Description 获取客户已有定制功能列表信息 + **/ + List selectCustomerFunction(@Param("customerId") String customerId); + + /** + * @param list + * @return + * @Author sun + * @Description 批量更新客户定制功能排序号信息 + **/ + void updateFunctionDetailList(@Param("list") List list); + + /** + * @param customerId + * @return + * @Author sun + * @Description .查询客户当前已有定制功能最大排序号 + **/ + CustomerFunctionDetailDTO selectOrderByCustomerId(@Param("customerId") String customerId); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java new file mode 100644 index 0000000000..87a877214b --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java @@ -0,0 +1,128 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomizedDTO; +import com.epmet.dto.FunctionCustomizedDTO; +import com.epmet.dto.form.CommonFunctionIdFormDTO; +import com.epmet.dto.form.FunctionCustomizedListFormDTO; +import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; +import com.epmet.dto.result.FunctionCustomizedListDTO; +import com.epmet.dto.result.FunctionResultDTO; +import com.epmet.entity.FunctionCustomizedEntity; +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-11 + */ +@Mapper +public interface FunctionCustomizedDao extends BaseDao { + + /** + * 定制功能详情 + * 根据定制功能Id查询对应的详情数据 + * + * @param formDTO + * @return com.epmet.dto.result.FunctionCustomizedDetailResultDTO + * @Author zhangyong + * @Date 10:36 2020-08-13 + **/ + FunctionCustomizedDetailResultDTO getFunctionCustomizedByFunctionId(CommonFunctionIdFormDTO formDTO); + + /** + * 根据functionId, 对定制功能表,进行逻辑删除 + * + * @param functionId + * @return void + * @Author zhangyong + * @Date 13:31 2020-08-13 + **/ + void delByFunctionId(@Param("functionId") String functionId); + + /** + * 根据功能id,查询定制功能全部信息(定制功能表+功能表) + * @param functionId + * @return com.epmet.dto.CustomizedDTO + * @Author zhangyong + * @Date 16:21 2020-08-13 + **/ + CustomizedDTO selectCustomized(@Param("functionId") String functionId); + + /** + * 定制功能列表 + * 按功能分组,先工作端在居民端,在按创建时间倒序 + * + * @param formDTO + * @return java.lang.util + * @Author zhangyong + * @Date 10:07 2020-08-14 + **/ + List selectListFunctionCustomizedList(FunctionCustomizedListFormDTO formDTO); + + /** + * 定制功能列表 - 总数 + * + * @param formDTO + * @return java.lang.Integer + * @Author zhangyong + * @Date 10:10 2020-08-14 + **/ + Integer countTotalFunctionCustomizedList(FunctionCustomizedListFormDTO formDTO); + + /** + * 根据功能id,修改定制功能表 + * + * @param entity + * @return void + * @Author zhangyong + * @Date 13:26 2020-08-14 + **/ + void updateFunctionCustomized(FunctionCustomizedEntity entity); + + /** + * @param functionIds + * @return + * @Author sun + * @Description 获取不包含的定制功能列表 + **/ + List selectFunctionCustomizedList(@Param("functionIds") List functionIds); + + /** + * @param functionId + * @return + * @Author sun + * @Description 查询定制功能信息 + **/ + FunctionCustomizedDTO selectByFunctionId(@Param("functionId") String functionId); + + /** + * 获取业务域名 + * @author zhaoqifeng + * @date 2020/8/20 9:36 + * @param customerId + * @return java.util.List + */ + List selectDomains(@Param("customerId") String customerId); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedVisitedDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedVisitedDao.java new file mode 100644 index 0000000000..471724a387 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedVisitedDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.FunctionCustomizedVisitedEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-13 + */ +@Mapper +public interface FunctionCustomizedVisitedDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionShoppingHistoryDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionShoppingHistoryDao.java new file mode 100644 index 0000000000..674482045f --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionShoppingHistoryDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.FunctionShoppingHistoryEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户定制功能上下架历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-14 + */ +@Mapper +public interface FunctionShoppingHistoryDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFunctionDetailEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFunctionDetailEntity.java new file mode 100644 index 0000000000..53931cb040 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFunctionDetailEntity.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_function_detail") +public class CustomerFunctionDetailEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 功能Id + */ + private String functionId; + + /** + * 自定义功能名称 + */ + private String functionName; + + /** + * 自定义大图标 + */ + private String iconLargeImg; + + /** + * 自定义小图标 + */ + private String iconSmallImg; + + /** + * 自定义业务域名 + */ + private String domainName; + + /** + * 外链地址 + */ + private String targetLink; + + /** + * 上架状态:0:下架、1:上架 + */ + private Integer shoppingStatus; + + /** + * 自定义排序 + */ + private Integer displayOrder; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedEntity.java new file mode 100644 index 0000000000..45983b12b0 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedEntity.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("function_customized") +public class FunctionCustomizedEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 功能ID(function.ID) + */ + private String functionId; + + /** + * 默认名称 + */ + private String customizedName; + + /** + * 默认大图标 + */ + private String iconLargeImg; + + /** + * 默认小图标 + */ + private String iconSmallImg; + + /** + * 外链地址(必须是https的请求) + */ + private String targetLink; + + /** + * 业务域名 + */ + private String domainName; + + /** + * 来源app(政府端:gov、居民端:resi) + */ + private String fromApp; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedVisitedEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedVisitedEntity.java new file mode 100644 index 0000000000..6e9dfb53cd --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedVisitedEntity.java @@ -0,0 +1,76 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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-13 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("function_customized_visited") +public class FunctionCustomizedVisitedEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 用户Id + */ + private String userId; + + /** + * 所属端 居民端:resi工作端:work + */ + private String clientType; + + /** + * 功能Id + */ + private String functionId; + + /** + * 请求地址 访问的url地址 + */ + private String url; + + /** + * 结果 成功success失败error + */ + private String result; + + /** + * 原因 失败的原因(例:请求超时、404、500等) + */ + private String msg; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionShoppingHistoryEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionShoppingHistoryEntity.java new file mode 100644 index 0000000000..6d8f479bac --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionShoppingHistoryEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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-14 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("function_shopping_history") +public class FunctionShoppingHistoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 功能Id + */ + private String functionId; + + /** + * 上下架状态 上架状态:0:下架、1:上架 + */ + private Integer shoppingStatus; + + /** + * 理由 + */ + private String reason; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/CustomerFunctionDetailExcel.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/CustomerFunctionDetailExcel.java new file mode 100644 index 0000000000..13c88668e8 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/CustomerFunctionDetailExcel.java @@ -0,0 +1,83 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 客户定制功能详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Data +public class CustomerFunctionDetailExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id") + private String customerId; + + @Excel(name = "功能Id") + private String functionId; + + @Excel(name = "自定义功能名称") + private String functionName; + + @Excel(name = "自定义大图标") + private String iconLargeImg; + + @Excel(name = "自定义小图标") + private String iconSmallImg; + + @Excel(name = "自定义业务域名") + private String realmName; + + @Excel(name = "外链地址") + private String targetLink; + + @Excel(name = "自定义排序") + private Integer shoppingStatus; + + @Excel(name = "自定义排序") + private Integer displayOrder; + + @Excel(name = "删除标识(0.未删除 1.已删除)") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java new file mode 100644 index 0000000000..42cc63eaa9 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java @@ -0,0 +1,77 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 定制功能 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Data +public class FunctionCustomizedExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "功能ID(function.ID)") + private String functionId; + + @Excel(name = "默认名称") + private String customizedName; + + @Excel(name = "默认大图标") + private String iconLargeImg; + + @Excel(name = "默认小图标") + private String iconSmallImg; + + @Excel(name = "外链地址(必须是https的请求)") + private String targetLink; + + @Excel(name = "删除标识(0.未删除 1.已删除)") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "业务域名") + private String domainName; + + @Excel(name = "来源app(政府端:gov、居民端:resi)") + private String fromApp; + + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedVisitedExcel.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedVisitedExcel.java new file mode 100644 index 0000000000..6d631d8380 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedVisitedExcel.java @@ -0,0 +1,77 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-13 + */ +@Data +public class FunctionCustomizedVisitedExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "用户Id") + private String userId; + + @Excel(name = "所属端 居民端:resi工作端:work") + private String clientType; + + @Excel(name = "功能Id") + private String functionId; + + @Excel(name = "请求地址 访问的url地址") + private String url; + + @Excel(name = "结果 成功success失败error") + private String result; + + @Excel(name = "原因 失败的原因(例:请求超时、404、500等)") + private String msg; + + @Excel(name = "删除标识(0.未删除 1.已删除)") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionShoppingHistoryExcel.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionShoppingHistoryExcel.java new file mode 100644 index 0000000000..a99dfed1f6 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionShoppingHistoryExcel.java @@ -0,0 +1,65 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 客户定制功能上下架历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-14 + */ +@Data +public class FunctionShoppingHistoryExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户Id") + private String customerId; + + @Excel(name = "功能Id") + private String functionId; + + @Excel(name = "上下架状态 上架状态:0:下架、1:上架") + private Integer shoppingStatus; + + @Excel(name = "理由") + private String reason; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFunctionDetailRedis.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFunctionDetailRedis.java new file mode 100644 index 0000000000..c60f3b338f --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFunctionDetailRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 客户定制功能详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Component +public class CustomerFunctionDetailRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedRedis.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedRedis.java new file mode 100644 index 0000000000..f2854b11ef --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 定制功能 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Component +public class FunctionCustomizedRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedVisitedRedis.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedVisitedRedis.java new file mode 100644 index 0000000000..fabdc63ff3 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedVisitedRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-13 + */ +@Component +public class FunctionCustomizedVisitedRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionShoppingHistoryRedis.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionShoppingHistoryRedis.java new file mode 100644 index 0000000000..ebe8a91096 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionShoppingHistoryRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 客户定制功能上下架历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-14 + */ +@Component +public class FunctionShoppingHistoryRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java new file mode 100644 index 0000000000..7729d60bcd --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java @@ -0,0 +1,154 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFunctionDetailDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerFunctionCustomizedListResultDTO; +import com.epmet.dto.result.FunctionDetailResultDTO; +import com.epmet.entity.CustomerFunctionDetailEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户定制功能详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +public interface CustomerFunctionDetailService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-08-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-08-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerFunctionDetailDTO + * @author generator + * @date 2020-08-11 + */ + CustomerFunctionDetailDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-11 + */ + void save(CustomerFunctionDetailDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-11 + */ + void update(CustomerFunctionDetailDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-08-11 + */ + void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 根据所属端和客户Id查询客户定制功能列表 + **/ + List resiAndWorkFunctionDetail(FunctionDetailFromDTO formDTO); + + /** + * 修改客户定制功能上下架 + * 修改上下架状态,保存上下架历史 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:17 2020-08-17 + **/ + Result updateShoppingStatus(UpdateShoppingStatusFormDTO formDTO); + + /** + * 客户定制功能修改 入参 + * 目前允许修改功能名称、大小图标 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:00 2020-08-17 + **/ + Result updateCustomerFunction(UpdateCustomerFunctionFormDTO formDTO); + + /** + * @param customerId + * @return + * @Author sun + * @Description 客户定制功能列表 + **/ + CustomerFunctionCustomizedListResultDTO customerFunctionList(String customerId); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 客户定制功能顺序修改 + **/ + void updateDisplayOrder(TokenDto tokenDto, List formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 定制功能采集 + **/ + void customerFunctionCollect(CustomerFunctionCollectFormDTO formDTO); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedService.java new file mode 100644 index 0000000000..a02b628755 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedService.java @@ -0,0 +1,162 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.FunctionCustomizedDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; +import com.epmet.dto.result.FunctionCustomizedListResultDTO; +import com.epmet.entity.FunctionCustomizedEntity; + +import java.util.List; +import java.util.Map; + +/** + * 定制功能 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +public interface FunctionCustomizedService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-08-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-08-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FunctionCustomizedDTO + * @author generator + * @date 2020-08-11 + */ + FunctionCustomizedDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-11 + */ + void save(FunctionCustomizedDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-11 + */ + void update(FunctionCustomizedDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-08-11 + */ + void delete(String[] ids); + + /** + * 定制功能新增(功能表、定制功能表) + * + * @param formDTO + * @Author zhangyong + * @Date 09:54 2020-08-13 + **/ + void saveFunctionCustomized(SaveFunctionCustomizedFormDTO formDTO); + + /** + * 定制功能详情 + * 根据定制功能Id查询对应的详情数据 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:36 2020-08-13 + **/ + Result getFunctionCustomized(CommonFunctionIdFormDTO formDTO); + + /** + * 定制功能删除 + * 单条删除,在没有客户使用的前提下可以逻辑删除(客户定制功能详情表 ,没查到就是没人在使用) + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 11:03 2020-08-13 + **/ + Result deleteFunctionCustomized(CommonFunctionIdFormDTO formDTO); + + /** + * 定制功能修改 + * 有客户在使用该功能时则不允许修改上下架状态、业务域名和外链地址、所属端app, + * 只能修改功能名称和大小图标 + * 修改的要判断是否有客户在使用,有用的要批量更新已使用客户数据 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:52 2020-08-13 + **/ + Result updateCustomized(UpdateCustomizedFormDTO formDTO); + + /** + * 定制功能列表 + * 按功能分组,先工作端在居民端,在按创建时间倒序 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:07 2020-08-14 + **/ + Result functionCustomizedList(FunctionCustomizedListFormDTO formDTO); + + /** + * 设置业务域名 + * @author zhaoqifeng + * @date 2020/8/19 16:15 + * @param formDTO + * @return void + */ + void customerDomain(CustomerDomainFormDTO formDTO); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedVisitedService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedVisitedService.java new file mode 100644 index 0000000000..a87e756c02 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedVisitedService.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.FunctionCustomizedVisitedDTO; +import com.epmet.dto.form.FunctionVisitedFromDTO; +import com.epmet.entity.FunctionCustomizedVisitedEntity; + +import java.util.List; +import java.util.Map; + +/** + * 定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-13 + */ +public interface FunctionCustomizedVisitedService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-08-13 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-08-13 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FunctionCustomizedVisitedDTO + * @author generator + * @date 2020-08-13 + */ + FunctionCustomizedVisitedDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-13 + */ + void save(FunctionCustomizedVisitedDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-13 + */ + void update(FunctionCustomizedVisitedDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-08-13 + */ + void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 保存定制功能访问记录 + **/ + void saveFunctionVisited(FunctionVisitedFromDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionService.java index 7717980531..04da335ca9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionService.java @@ -102,4 +102,12 @@ public interface FunctionService extends BaseService { * @Date 2020/3/23 22:10 **/ Result> queryFunctionList(); + + /** + * @param dto + * @return + * @Author sun + * @Description 默认功能新增 + **/ + void saveFunction(FunctionDTO dto); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionShoppingHistoryService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionShoppingHistoryService.java new file mode 100644 index 0000000000..33f6d6ead6 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionShoppingHistoryService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.FunctionShoppingHistoryDTO; +import com.epmet.entity.FunctionShoppingHistoryEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户定制功能上下架历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-14 + */ +public interface FunctionShoppingHistoryService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-08-14 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-08-14 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return FunctionShoppingHistoryDTO + * @author generator + * @date 2020-08-14 + */ + FunctionShoppingHistoryDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-14 + */ + void save(FunctionShoppingHistoryDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-08-14 + */ + void update(FunctionShoppingHistoryDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-08-14 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java new file mode 100644 index 0000000000..73bcd4a0f7 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java @@ -0,0 +1,264 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.CustomerFunctionDao; +import com.epmet.dao.CustomerFunctionDetailDao; +import com.epmet.dao.FunctionCustomizedDao; +import com.epmet.dao.FunctionShoppingHistoryDao; +import com.epmet.dto.CustomerFunctionDetailDTO; +import com.epmet.dto.FunctionCustomizedDTO; +import com.epmet.dto.FunctionShoppingHistoryDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerFunctionCustomizedListResultDTO; +import com.epmet.dto.result.CustomerResultDTO; +import com.epmet.dto.result.FunctionDetailResultDTO; +import com.epmet.dto.result.FunctionResultDTO; +import com.epmet.entity.CustomerFunctionDetailEntity; +import com.epmet.entity.CustomerFunctionEntity; +import com.epmet.entity.FunctionShoppingHistoryEntity; +import com.epmet.redis.CustomerFunctionDetailRedis; +import com.epmet.service.CustomerFunctionDetailService; +import com.epmet.service.FunctionShoppingHistoryService; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 客户定制功能详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Service +public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl implements CustomerFunctionDetailService { + + private Logger logger = LogManager.getLogger(CustomerFunctionDetailServiceImpl.class); + @Autowired + private CustomerFunctionDetailRedis customerFunctionDetailRedis; + @Autowired + private FunctionShoppingHistoryService functionShoppingHistoryService; + @Autowired + private FunctionCustomizedDao functionCustomizedDao; + @Autowired + private CustomerFunctionDao customerFunctionDao; + @Autowired + private FunctionShoppingHistoryDao functionShoppingHistoryDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerFunctionDetailDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerFunctionDetailDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CustomerFunctionDetailDTO get(String id) { + CustomerFunctionDetailEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerFunctionDetailDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerFunctionDetailDTO dto) { + CustomerFunctionDetailEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionDetailEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerFunctionDetailDTO dto) { + CustomerFunctionDetailEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionDetailEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 根据所属端和客户Id查询客户定制功能列表 + **/ + @Override + public List resiAndWorkFunctionDetail(FunctionDetailFromDTO formDTO) { + //根据客户Id和所属端查询客户定制功能列表数据 + logger.info(String.format("根据客户Id和所属端查询客户定制功能列表,对应客户Id->%s,所属端->%s", formDTO.getCustomerId(), formDTO.getClientType())); + List list = baseDao.selectFunctionDetailList(formDTO); + try { + String join = String.join(",", new ArrayList<>()); + String customerParameter = java.net.URLEncoder.encode(join, "utf-8"); + list.forEach(l->{ + l.setCustomerParameter(customerParameter); + }); + } catch (Exception e) { + logger.error("CustomerFunctionDetailServiceImpl.resiAndWorkFunctionDetail->集合参数URLEncode失败"); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } + return list; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result updateShoppingStatus(UpdateShoppingStatusFormDTO formDTO) { + // 修改 客户定制功能详情表,上下架状态 + baseDao.updateShoppingStatus(formDTO); + // 保存日志记录到 客户定制功能上下架历史表 + FunctionShoppingHistoryDTO historyDTO = ConvertUtils.sourceToTarget(formDTO, FunctionShoppingHistoryDTO.class); + historyDTO.setShoppingStatus(Integer.valueOf(formDTO.getShoppingStatus())); + functionShoppingHistoryService.save(historyDTO); + return new Result(); + } + + @Override + public Result updateCustomerFunction(UpdateCustomerFunctionFormDTO formDTO) { + baseDao.updateCustomerFunction(formDTO); + return new Result(); + } + + /** + * @param customerId + * @return + * @Author sun + * @Description 客户定制功能列表 + **/ + @Override + public CustomerFunctionCustomizedListResultDTO customerFunctionList(String customerId) { + CustomerFunctionCustomizedListResultDTO resultDTO = new CustomerFunctionCustomizedListResultDTO(); + //1.获取客户已有定制功能列表,按排序号排序 + List customerList = baseDao.selectCustomerFunction(customerId); + resultDTO.setCustomerList(customerList); + + //2.获取客户未有定制功能列表 + List functionIds = customerList.stream().map(CustomerResultDTO::getFunctionId).collect(Collectors.toList()); + List functionList = functionCustomizedDao.selectFunctionCustomizedList(functionIds); + functionList.forEach(fl->{ + fl.setCustomerId(customerId); + }); + resultDTO.setFunctionList(functionList); + + return resultDTO; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 客户定制功能顺序修改 + **/ + @Override + public void updateDisplayOrder(TokenDto tokenDto, List formDTO) { + //批量更新客户定制功能排序号信息 + List list = ConvertUtils.sourceToTarget(formDTO, CustomerFunctionDetailEntity.class); + list.forEach(l->{ + l.setUpdatedBy(tokenDto.getUserId()); + }); + baseDao.updateFunctionDetailList(list); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 定制功能采集 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void customerFunctionCollect(CustomerFunctionCollectFormDTO formDTO) { + //1.查询定制功能详细信息 + FunctionCustomizedDTO functionDTO = functionCustomizedDao.selectByFunctionId(formDTO.getFunctionId()); + if(functionDTO == null){ + throw new RenException("根据定制功能Id未查询到定制功能详细信息"); + } + + //2.查询客户当前已有定制功能最大排序号 + CustomerFunctionDetailDTO detailDTO = baseDao.selectOrderByCustomerId(formDTO.getCustomerId()); + int displayOrder = NumConstant.ONE; + if(null!=detailDTO&&null!=detailDTO.getDisplayOrder()){ + displayOrder += detailDTO.getDisplayOrder(); + } + //3.给客户初始定制功能数据 + CustomerFunctionDetailEntity entity = new CustomerFunctionDetailEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setFunctionId(formDTO.getFunctionId()); + entity.setFunctionName(functionDTO.getCustomizedName()); + entity.setIconLargeImg(functionDTO.getIconLargeImg()); + entity.setIconSmallImg(functionDTO.getIconSmallImg()); + entity.setDomainName(functionDTO.getDomainName()); + entity.setTargetLink(functionDTO.getTargetLink()); + entity.setShoppingStatus(NumConstant.ONE); + entity.setDisplayOrder(displayOrder); + baseDao.insert(entity); + + //4.客户功能权限表绑定关系 + CustomerFunctionEntity customerFunctionEntity = new CustomerFunctionEntity(); + customerFunctionEntity.setCustomerId(formDTO.getCustomerId()); + customerFunctionEntity.setFunctionId(formDTO.getFunctionId()); + customerFunctionDao.insert(customerFunctionEntity); + + //5.记录上下架操作日志 + FunctionShoppingHistoryEntity historyEntity = new FunctionShoppingHistoryEntity(); + historyEntity.setCustomerId(formDTO.getCustomerId()); + historyEntity.setFunctionId(functionDTO.getFunctionId()); + historyEntity.setShoppingStatus(NumConstant.ONE); + historyEntity.setReason(formDTO.getReason()); + functionShoppingHistoryDao.insert(historyEntity); + + } + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java new file mode 100644 index 0000000000..611f7de98e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java @@ -0,0 +1,384 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.CustomerFunctionDetailDao; +import com.epmet.dao.FunctionCustomizedDao; +import com.epmet.dto.CustomerFunctionDetailDTO; +import com.epmet.dto.CustomizedDTO; +import com.epmet.dto.FunctionCustomizedDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; +import com.epmet.dto.result.FunctionCustomizedListResultDTO; +import com.epmet.entity.CustomerFunctionDetailEntity; +import com.epmet.entity.FunctionCustomizedEntity; +import com.epmet.entity.FunctionEntity; +import com.epmet.redis.FunctionCustomizedRedis; +import com.epmet.service.CustomerFunctionDetailService; +import com.epmet.service.FunctionCustomizedService; +import com.epmet.service.FunctionService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 定制功能 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-11 + */ +@Service +public class FunctionCustomizedServiceImpl extends BaseServiceImpl implements FunctionCustomizedService { + + @Autowired + private FunctionCustomizedRedis functionCustomizedRedis; + @Autowired + private FunctionService functionService; + @Autowired + private CustomerFunctionDetailDao customerFunctionDetailDao; + @Autowired + private CustomerFunctionDetailService customerFunctionDetailService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FunctionCustomizedDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FunctionCustomizedDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FunctionCustomizedDTO get(String id) { + FunctionCustomizedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FunctionCustomizedDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FunctionCustomizedDTO dto) { + FunctionCustomizedEntity entity = ConvertUtils.sourceToTarget(dto, FunctionCustomizedEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FunctionCustomizedDTO dto) { + FunctionCustomizedEntity entity = ConvertUtils.sourceToTarget(dto, FunctionCustomizedEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveFunctionCustomized(SaveFunctionCustomizedFormDTO formDTO) { + // 1、定制功能新增,保存数据到 功能表 + FunctionEntity functionEntity = this.saveFunction(formDTO); + // 2、定制功能新增,保存数据到 定制功能表 + FunctionCustomizedEntity entity = new FunctionCustomizedEntity(); + entity.setFunctionId(functionEntity.getId()); + entity.setCustomizedName(formDTO.getFunctionName()); + entity.setIconLargeImg(formDTO.getIconLargeImg()); + entity.setIconSmallImg(formDTO.getIconSmallImg()); + entity.setTargetLink(formDTO.getTargetLink()); + entity.setDomainName(formDTO.getDomainName()); + entity.setFromApp(formDTO.getFromApp()); + insert(entity); + } + + @Override + public Result getFunctionCustomized(CommonFunctionIdFormDTO formDTO) { + //1.查询定制功能详情信息 + FunctionCustomizedDetailResultDTO resultDTO = baseDao.getFunctionCustomizedByFunctionId(formDTO); + + //2.查询是否有客户在使用当前定制功能 + List list = customerFunctionDetailDao.selectCustomerIdByFunctionId(formDTO.getFunctionId()); + if (null == list || list.size() < NumConstant.ONE) { + resultDTO.setIsApply(NumConstant.ZERO); + } else { + resultDTO.setIsApply(NumConstant.ONE); + } + + return new Result().ok(resultDTO); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result deleteFunctionCustomized(CommonFunctionIdFormDTO formDTO) { + // 1.客户定制功能详情表 ,没查到就是没人在使用 + List customizedId = customerFunctionDetailDao.selectCustomerIdByFunctionId(formDTO.getFunctionId()); + if (customizedId != null && customizedId.size() > NumConstant.ZERO){ + return new Result<>().error(8000, "功能正在使用中,不允许删除!"); + } else { + // 2.单条逻辑删除 - 功能表 + String[] ids = new String[1]; + ids[0] = formDTO.getFunctionId(); + functionService.delete(ids); + // 3.单条逻辑删除 - 定制功能表 + baseDao.delByFunctionId(formDTO.getFunctionId()); + } + return new Result(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result updateCustomized(UpdateCustomizedFormDTO formDTO) { + // 1. 客户定制功能详情表 ,没查到就是没人在使用 + List customizedId = customerFunctionDetailDao.selectCustomerIdByFunctionId(formDTO.getFunctionId()); + if (customizedId != null && customizedId.size() > NumConstant.ZERO){ + // 2.1 根据功能id,查询功能的详细信息 + CustomizedDTO customizedDTO = baseDao.selectCustomized(formDTO.getFunctionId()); + // 该集合,统一修改 客户定制功能详情表 + List upCustomizedInfo = new ArrayList<>(); + // 统一提示 不能进行修改的客户id + StringBuilder tipCustomizedInfoUserId = new StringBuilder(); + // 如果客户全都是使用的自定义模板,则只修改 功能表、定制功能表 + int flag = 0; + + // 如果这个功能,被客户重新定义了,则不会修改 + for (int i = 0; i < customizedId.size(); i++){ + if (null != customizedDTO){ + // 3.1 功能信息和客户信息:判断这个功能,用户使用的是默认的,还是自定义的 + if (customizedDTO.getCustomizedName().equals(customizedId.get(i).getFunctionName()) + && customizedDTO.getIconLargeImg().equals(customizedId.get(i).getIconLargeImg()) + && customizedDTO.getIconSmallImg().equals(customizedId.get(i).getIconSmallImg()) + && customizedDTO.getDomainName().equals(customizedId.get(i).getDomainName()) + && customizedDTO.getTargetLink().equals(customizedId.get(i).getTargetLink()) ){ + // 这个功能,客户使用的是默认的,则判断本次修改的字段,如果是功能名称和大小图标,则批量更新客户数据,负责提示 不能修改 + if (!formDTO.getShoppingStatus().equals(customizedDTO.getShoppingStatus()) + || !formDTO.getFunctionExplain().equals(customizedDTO.getFunctionExplain()) + || !formDTO.getTargetLink().equals(customizedDTO.getTargetLink()) + || !formDTO.getDomainName().equals(customizedDTO.getDomainName()) + || !formDTO.getFromApp().equals(customizedDTO.getFromApp()) ){ + // 4.1 如果修改的内容是其他字段,则返回语句 + tipCustomizedInfoUserId.append(customizedId.get(i).getId() + ","); + } else if (!formDTO.getFunctionName().equals(customizedDTO.getCustomizedName()) + || !formDTO.getIconLargeImg().equals(customizedDTO.getIconLargeImg()) + || !formDTO.getIconSmallImg().equals(customizedDTO.getIconSmallImg())){ + // 4.2 如果修改的内容只是:功能名称和大小图标,, 需要批量更新客户数据 + CustomerFunctionDetailEntity customer = new CustomerFunctionDetailEntity(); + customer.setFunctionName(formDTO.getFunctionName()); + customer.setIconLargeImg(formDTO.getIconLargeImg()); + customer.setIconSmallImg(formDTO.getIconSmallImg()); + customer.setId(customizedId.get(i).getId()); + upCustomizedInfo.add(customer); + } + } else { + // 3.2 用户使用的是自定义的功能,则不予处理 + // 但如果所有的客户,都是使用的自定义功能,则修改 功能表、定制功能表 + flag = flag + NumConstant.ONE; + } + } + } + if(flag == customizedId.size()){ + // 3.3 没有客户使用该 功能,根据入参参数,修改功能表、定制功能表 + this.functionNotUsed(formDTO); + } + if (upCustomizedInfo != null && upCustomizedInfo.size() > NumConstant.ZERO){ + // 5.1 修改 客户定制功能详情表 + customerFunctionDetailService.updateBatchById(upCustomizedInfo); + // 6. 客户正在使用该功能,根据入参参数,修改功能表、定制功能表 + this.functionInUse(formDTO); + } + // 5.2 提示哪些用户不能被修改 + if (tipCustomizedInfoUserId != null && tipCustomizedInfoUserId.length() >NumConstant.ZERO){ + return new Result<>().error(8000, "客户"+ tipCustomizedInfoUserId +"正在使用该功能不允许修改上下架状态、业务域名和外链地址、所属端app!"); + } + } else { + // 2.2 没有客户使用该 功能,根据入参参数,修改功能表、定制功能表 + this.functionNotUsed(formDTO); + } + return new Result(); + } + + @Override + public Result functionCustomizedList(FunctionCustomizedListFormDTO formDTO) { + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + FunctionCustomizedListResultDTO resultDTO = new FunctionCustomizedListResultDTO(); + resultDTO.setList(baseDao.selectListFunctionCustomizedList(formDTO)); + resultDTO.setTotal(baseDao.countTotalFunctionCustomizedList(formDTO)); + return new Result().ok(resultDTO); + } + + @Override + public void customerDomain(CustomerDomainFormDTO formDTO) { + //获取业务域名 + List list = baseDao.selectDomains(formDTO.getCustomerId()); + List workDomains = new ArrayList<>(); + List resiDomains = new ArrayList<>(); + if (null != list) { + for(FunctionCustomizedDTO dto : list) { + if (StringUtils.isNotBlank(dto.getDomainName())) { + String[] domainNames = dto.getDomainName().split(";"); + if (("resi").equals(dto.getFromApp())) { + resiDomains.addAll(Arrays.asList(domainNames)); + } else { + workDomains.addAll(Arrays.asList(domainNames)); + } + } + } + } + + String domainUrl = "https://epmet-cloud.elinkservice.cn/api/third/setting/setwebviewdomain"; + if(resiDomains.size() > NumConstant.ZERO) { + resiDomains = resiDomains.stream().distinct().collect(Collectors.toList()); + WebviewDomainFormDTO domainFormDTO = new WebviewDomainFormDTO(); + domainFormDTO.setCustomerId(formDTO.getCustomerId()); + domainFormDTO.setClientType("resi"); + domainFormDTO.setAction("set"); + domainFormDTO.setWebViewDomain(resiDomains); + String domainData = HttpClientManager.getInstance().sendPostByJSON(domainUrl, JSON.toJSONString(domainFormDTO)).getData(); + JSONObject domainObject = JSON.parseObject(domainData); + Result domainResult = ConvertUtils.mapToEntity(domainObject, Result.class); + domainResult.setCode(domainObject.getInteger("code")); + if (!domainResult.success()) { + throw new RenException(domainResult.getCode(), domainResult.getInternalMsg()); + } + } + + if(workDomains.size() > NumConstant.ZERO) { + workDomains = workDomains.stream().distinct().collect(Collectors.toList()); + WebviewDomainFormDTO domainFormDTO = new WebviewDomainFormDTO(); + domainFormDTO.setCustomerId(formDTO.getCustomerId()); + domainFormDTO.setClientType("work"); + domainFormDTO.setAction("set"); + domainFormDTO.setWebViewDomain(workDomains); + String domainData = HttpClientManager.getInstance().sendPostByJSON(domainUrl, JSON.toJSONString(domainFormDTO)).getData(); + JSONObject domainObject = JSON.parseObject(domainData); + Result domainResult = ConvertUtils.mapToEntity(domainObject, Result.class); + if (!domainResult.success()) { + throw new RenException(domainResult.getCode(), domainResult.getInternalMsg()); + } + } + } + + /** + * 保存数据到 功能表 + * @param formDTO + * @return com.epmet.entity.FunctionEntity + * @Author zhangyong + * @Date 10:03 2020-08-13 + **/ + private FunctionEntity saveFunction(SaveFunctionCustomizedFormDTO formDTO){ + FunctionEntity entity = new FunctionEntity(); + entity.setFunctionName(formDTO.getFunctionName()); + entity.setFunctionIcon(formDTO.getIconLargeImg()); + entity.setFunctionGroup(Integer.valueOf(formDTO.getFunctionGroup())); + entity.setShoppingStatus(Integer.valueOf(formDTO.getShoppingStatus())); + entity.setFunctionExplain(formDTO.getFunctionExplain()); + functionService.insert(entity); + return entity; + } + + /** + * 修改数据到 功能表 + * @param formDTO + * @param flag == 0 只修改图标和名称 + * == 1 修改全部字段 + * @Author zhangyong + * @Date 10:03 2020-08-13 + **/ + private void upFunction(UpdateCustomizedFormDTO formDTO, Integer flag){ + FunctionEntity entity = new FunctionEntity(); + entity.setId(formDTO.getFunctionId()); + entity.setFunctionName(formDTO.getFunctionName()); + entity.setFunctionIcon(formDTO.getIconLargeImg()); + if (NumConstant.ONE == flag){ + entity.setShoppingStatus(Integer.valueOf(formDTO.getShoppingStatus())); + entity.setFunctionExplain(formDTO.getFunctionExplain()); + } + functionService.updateById(entity); + } + + /** + * 客户未使用该功能,根据入参参数,修改功能表、定制功能表 + * @param formDTO + * @return void + * @Author zhangyong + * @Date 11:08 2020-08-14 + **/ + private void functionNotUsed(UpdateCustomizedFormDTO formDTO){ + // 1.修改 功能表, 修改的字段范围,是所有入参字段 + this.upFunction(formDTO, NumConstant.ONE); + // 2.修改 定制功能表, 修改的字段范围,是所有入参字段 + FunctionCustomizedEntity entity = ConvertUtils.sourceToTarget(formDTO, FunctionCustomizedEntity.class); + baseDao.updateFunctionCustomized(entity); + } + + /** + * 客户正在使用该功能,根据入参参数,修改功能表、定制功能表 + * @param formDTO + * @return void + * @Author zhangyong + * @Date 14:00 2020-08-14 + **/ + private void functionInUse(UpdateCustomizedFormDTO formDTO){ + // 1.修改 功能表, 修改的字段范围,是:功能名称和大小图标 + this.upFunction(formDTO, NumConstant.ZERO); + + // 2.修改 定制功能表, 修改的字段范围,是:功能名称和大小图标 + FunctionCustomizedEntity entity = new FunctionCustomizedEntity(); + entity.setFunctionId(formDTO.getFunctionId()); + entity.setCustomizedName(formDTO.getFunctionName()); + entity.setIconLargeImg(formDTO.getIconLargeImg()); + entity.setIconSmallImg(formDTO.getIconSmallImg()); + baseDao.updateFunctionCustomized(entity); + } +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedVisitedServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedVisitedServiceImpl.java new file mode 100644 index 0000000000..481bb68736 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedVisitedServiceImpl.java @@ -0,0 +1,118 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.FunctionCustomizedVisitedDao; +import com.epmet.dto.FunctionCustomizedVisitedDTO; +import com.epmet.dto.form.FunctionVisitedFromDTO; +import com.epmet.entity.FunctionCustomizedVisitedEntity; +import com.epmet.redis.FunctionCustomizedVisitedRedis; +import com.epmet.service.FunctionCustomizedVisitedService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-13 + */ +@Service +public class FunctionCustomizedVisitedServiceImpl extends BaseServiceImpl implements FunctionCustomizedVisitedService { + + @Autowired + private FunctionCustomizedVisitedRedis functionCustomizedVisitedRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FunctionCustomizedVisitedDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FunctionCustomizedVisitedDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FunctionCustomizedVisitedDTO get(String id) { + FunctionCustomizedVisitedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FunctionCustomizedVisitedDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FunctionCustomizedVisitedDTO dto) { + FunctionCustomizedVisitedEntity entity = ConvertUtils.sourceToTarget(dto, FunctionCustomizedVisitedEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FunctionCustomizedVisitedDTO dto) { + FunctionCustomizedVisitedEntity entity = ConvertUtils.sourceToTarget(dto, FunctionCustomizedVisitedEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 保存定制功能访问记录 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveFunctionVisited(FunctionVisitedFromDTO formDTO) { + FunctionCustomizedVisitedEntity entity = ConvertUtils.sourceToTarget(formDTO, FunctionCustomizedVisitedEntity.class); + insert(entity); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionServiceImpl.java index 65631c1b65..8c65c5e64a 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionServiceImpl.java @@ -20,20 +20,26 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.FunctionDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.FunctionDTO; +import com.epmet.entity.CustomerFunctionEntity; import com.epmet.entity.FunctionEntity; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.redis.FunctionRedis; +import com.epmet.service.CustomerFunctionService; import com.epmet.service.FunctionService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -49,6 +55,10 @@ public class FunctionServiceImpl extends BaseServiceImpl page(Map params) { @@ -119,4 +129,36 @@ public class FunctionServiceImpl extends BaseServiceImpl>().ok(baseDao.selectFunctionList()); } + /** + * @param dto + * @return + * @Author sun + * @Description 默认功能新增 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveFunction(FunctionDTO dto) { + //1.调用oper-crm服务,查询有效客户列表 + Result> result = operCrmOpenFeignClient.getAllCustomerList(); + if(!result.success()){ + throw new RenException("调用oper_crm服务 获取有效客户列表失败"); + } + List list = result.getData(); + + //2.新增默认功能 + FunctionEntity functionEntity = ConvertUtils.sourceToTarget(dto, FunctionEntity.class); + insert(functionEntity); + + //3.为已有客户绑定新的默认功能关系 + List listEntity = new ArrayList<>(); + list.forEach(l->{ + CustomerFunctionEntity entity = new CustomerFunctionEntity(); + entity.setCustomerId(l.getId()); + entity.setFunctionId(functionEntity.getId()); + listEntity.add(entity); + }); + customerFunctionService.insertBatch(listEntity); + + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionShoppingHistoryServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionShoppingHistoryServiceImpl.java new file mode 100644 index 0000000000..acd0aed260 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionShoppingHistoryServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.FunctionShoppingHistoryDao; +import com.epmet.dto.FunctionShoppingHistoryDTO; +import com.epmet.entity.FunctionShoppingHistoryEntity; +import com.epmet.redis.FunctionShoppingHistoryRedis; +import com.epmet.service.FunctionShoppingHistoryService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 客户定制功能上下架历史 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-14 + */ +@Service +public class FunctionShoppingHistoryServiceImpl extends BaseServiceImpl implements FunctionShoppingHistoryService { + + @Autowired + private FunctionShoppingHistoryRedis functionShoppingHistoryRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, FunctionShoppingHistoryDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, FunctionShoppingHistoryDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public FunctionShoppingHistoryDTO get(String id) { + FunctionShoppingHistoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, FunctionShoppingHistoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(FunctionShoppingHistoryDTO dto) { + FunctionShoppingHistoryEntity entity = ConvertUtils.sourceToTarget(dto, FunctionShoppingHistoryEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(FunctionShoppingHistoryDTO dto) { + FunctionShoppingHistoryEntity entity = ConvertUtils.sourceToTarget(dto, FunctionShoppingHistoryEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql new file mode 100644 index 0000000000..b792d95677 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql @@ -0,0 +1,60 @@ +CREATE TABLE `customer_function_detail` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', + `FUNCTION_ID` varchar(64) NOT NULL COMMENT '功能Id', + `FUNCTION_NAME` varchar(128) NOT NULL COMMENT '自定义功能名称', + `ICON_LARGE_IMG` varchar(128) NOT NULL COMMENT '自定义大图标', + `ICON_SMALL_IMG` varchar(128) NOT NULL COMMENT '自定义小图标', + `DOMAIN_NAME` varchar(128) NOT NULL COMMENT '自定义业务域名(可设置多个 用分号分隔)', + `TARGET_LINK` varchar(128) NOT NULL COMMENT '外链地址', + `SHOPPING_STATUS` int(11) NOT NULL COMMENT '上架状态(0.下架 1.上架)', + `DISPLAY_ORDER` int(11) NOT NULL COMMENT '自定义排序', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识(0.未删除 1.已删除)', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户定制功能详情表'; + + + +ALTER TABLE `function_customized` +ADD COLUMN `DOMAIN_NAME` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务域名(可设置多个 用分号分隔)' AFTER `UPDATED_TIME`, +ADD COLUMN `FROM_APP` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源app(政府端:gov、居民端:resi)' AFTER `DOMAIN_NAME`; + + +CREATE TABLE function_customized_visited( + ID VARCHAR(64) NOT NULL COMMENT '主键' , + CUSTOMER_ID VARCHAR(32) NOT NULL COMMENT '客户ID' , + USER_ID VARCHAR(64) NOT NULL COMMENT '用户Id' , + CLIENT_TYPE VARCHAR(32) NOT NULL COMMENT '所属端 居民端:resi工作端:work' , + FUNCTION_ID VARCHAR(64) NOT NULL COMMENT '功能Id' , + URL VARCHAR(128) NOT NULL COMMENT '请求地址 访问的url地址' , + RESULT VARCHAR(1024) NOT NULL COMMENT '结果 成功success失败error' , + MSG VARCHAR(128) NOT NULL COMMENT '原因 失败的原因(例:请求超时、404、500等)' , + DEL_FLAG INT NOT NULL COMMENT '删除标识(0.未删除 1.已删除)' , + REVISION INT NOT NULL COMMENT '乐观锁' , + CREATED_BY VARCHAR(32) NOT NULL COMMENT '创建人' , + CREATED_TIME DATETIME NOT NULL COMMENT '创建时间' , + UPDATED_BY VARCHAR(32) NOT NULL COMMENT '更新人' , + UPDATED_TIME DATETIME NOT NULL COMMENT '更新时间' , + PRIMARY KEY (ID) +) COMMENT = '定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果'; + + +CREATE TABLE function_shopping_history( + ID VARCHAR(64) NOT NULL COMMENT '主键' , + CUSTOMER_ID VARCHAR(64) NOT NULL COMMENT '客户Id' , + FUNCTION_ID VARCHAR(64) NOT NULL COMMENT '功能Id' , + SHOPPING_STATUS INT NOT NULL COMMENT '上下架状态 上架状态:0:下架、1:上架' , + REASON VARCHAR(1024) NOT NULL COMMENT '理由' , + DEL_FLAG INT NOT NULL COMMENT '删除标识(0.未删除 1.已删除)' , + REVISION INT NOT NULL COMMENT '乐观锁' , + CREATED_BY VARCHAR(32) NOT NULL COMMENT '创建人' , + CREATED_TIME DATETIME NOT NULL COMMENT '创建时间' , + UPDATED_BY VARCHAR(32) NOT NULL COMMENT '更新人' , + UPDATED_TIME DATETIME NOT NULL COMMENT '更新时间' , + PRIMARY KEY (ID) +) COMMENT = '客户定制功能上下架历史'; \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml new file mode 100644 index 0000000000..3f38163bde --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + UPDATE customer_function_detail + SET + SHOPPING_STATUS = #{shoppingStatus}, + UPDATED_BY = #{userId}, + UPDATED_TIME = now() + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND FUNCTION_ID = #{functionId} + + + + UPDATE customer_function_detail + SET + + FUNCTION_NAME = #{functionName}, + + + ICON_LARGE_IMG = #{iconLargeImg}, + + + ICON_SMALL_IMG = #{iconSmallImg}, + + UPDATED_BY = #{userId}, + UPDATED_TIME = now() + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND FUNCTION_ID = #{functionId} + + + + UPDATE customer_function_detail + + + + + when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.displayOrder} + + + + + + when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.updatedBy} + + + + updated_time = now() + + WHERE + del_flag = '0' + + (customer_id = #{item.customerId} and function_id = #{item.functionId}) + + + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml new file mode 100644 index 0000000000..e1ad29efb4 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml @@ -0,0 +1,163 @@ + + + + + + + + + update function_customized set DEL_FLAG = 1 where FUNCTION_ID = #{functionId} and DEL_FLAG = '0' + + + + + + + + + + + + + + + + + + UPDATE function_customized + SET + + CUSTOMIZED_NAME = #{customizedName}, + + + ICON_LARGE_IMG = #{iconLargeImg}, + + + ICON_SMALL_IMG = #{iconSmallImg}, + + + TARGET_LINK = #{targetLink}, + + + DOMAIN_NAME = #{domainName}, + + + FROM_APP = #{fromApp}, + + UPDATED_TIME = now() + WHERE + DEL_FLAG = '0' + AND FUNCTION_ID = #{functionId} + + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedVisitedDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedVisitedDao.xml new file mode 100644 index 0000000000..938b189b2b --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedVisitedDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionShoppingHistoryDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionShoppingHistoryDao.xml new file mode 100644 index 0000000000..a591988091 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionShoppingHistoryDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index dd7611267b..2f4b8d2ff8 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -42,6 +42,7 @@ epmet-third epmet-heart epmet-point + epmet-ext diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java index 35e6963377..f60ac86651 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicDTO.java @@ -53,6 +53,11 @@ public class ResiTopicDTO implements Serializable { */ private String status; + /** + * 是否解决(已解决 resolved,未解决 unresolved) + */ + private String closedStatus; + /** * 省 */ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java index 58853940ce..de32937a93 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.resi.group.dto.topic.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -25,6 +26,12 @@ public class ResiTopicOperationFormDTO implements Serializable { */ private String operateReason; + /** + * 是否解决(已解决 resolved,未解决 unresolved) + */ + //@NotBlank(message = "解决状态不能为空") + private String closedStatus; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 881374f12c..dacfd6dbb8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -59,6 +59,7 @@ import com.epmet.resi.group.constant.MemberStateConstant; import com.epmet.resi.group.dto.UserRoleDTO; import com.epmet.resi.group.dto.group.*; import com.epmet.resi.group.dto.group.form.*; +import com.epmet.resi.group.dto.group.form.GridIdFormDTO; import com.epmet.resi.group.dto.group.form.ShouldVoteCountFormDTO; import com.epmet.resi.group.dto.group.result.*; import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java index d16ba57c73..1214e5d71a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/ResiTopicEntity.java @@ -53,6 +53,11 @@ public class ResiTopicEntity extends BaseEpmetEntity { */ private String status; + /** + * 是否解决(已解决 resolved,未解决 unresolved) + */ + private String closedStatus; + /** * 省 */ diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index 958b1b4424..1a5d8964a3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -523,6 +523,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl id = new ArrayList<>(); id.add(closeFormDTO.getTopicId()); baseDao.cancelHiddenOrCloseBatch(id,tokenDto.getUserId(),TopicConstant.CLOSED); diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.2__topic.sql b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.2__topic.sql new file mode 100644 index 0000000000..c087db0c7d --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.2__topic.sql @@ -0,0 +1 @@ +ALTER TABLE resi_topic ADD COLUMN CLOSED_STATUS varchar(32) NULL COMMENT '关闭状态:已解决 resolved,未解决 unresolved' AFTER STATUS; \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java new file mode 100644 index 0000000000..95d8b74e9d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java @@ -0,0 +1,24 @@ +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; + +/** + * @Description 工作人员Id + * @ClassName CommonStaffIdFormDTO + * @Auth wangc + * @Date 2020-08-17 10:28 + */ +@Data +public class CommonStaffIdFormDTO implements Serializable { + + private static final long serialVersionUID = -5093758817860808310L; + + public interface StaffIdGroup extends CustomerClientShowGroup{} + + @NotBlank(message = "工作人员Id不能为空" , groups = StaffIdGroup.class) + private String staffId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdFormDTO.java new file mode 100644 index 0000000000..340e91be92 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdFormDTO.java @@ -0,0 +1,22 @@ +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; + +/** + * @Description userId + * @ClassName CommonUserIdFormDTO + * @Auth wangc + * @Date 2020-08-21 17:14 + */ +@Data +public class CommonUserIdFormDTO implements Serializable { + private static final long serialVersionUID = 3934409262981136977L; + public interface CommonUserIdGroup extends CustomerClientShowGroup{} + + @NotBlank(message = "用户Id不可为空", groups = CommonUserIdGroup.class) + private String userId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java new file mode 100644 index 0000000000..9f30b5e4eb --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 14:20 + */ +@Data +public class UpdateRootManageFormDTO implements Serializable { + private static final long serialVersionUID = 3954225931981940018L; + /** + * 根组织ID + */ + private String orgId; + /** + * 角色key + */ + private String roleKey; + /** + * 根管理员姓名 + */ + private String rootManageName; + /** + * 根管理员电话 + */ + private String rootManagePhone; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserIdsFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserIdsFormDTO.java new file mode 100644 index 0000000000..de8c542864 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserIdsFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/8/13 1:36 下午 + */ +@Data +public class UserIdsFormDTO implements Serializable { + + private static final long serialVersionUID = -6168528618954442905L; + + private List userIds; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RoleResultDTO.java new file mode 100644 index 0000000000..c6424eca94 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/RoleResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import jdk.nashorn.internal.ir.annotations.Ignore; +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 = -432136606721817459L; + + /** + * 角色key + */ + private String roleKey; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 用户id + */ + @JsonIgnore + private String userId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinAgencyResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinAgencyResultDTO.java new file mode 100644 index 0000000000..93b650d538 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinAgencyResultDTO.java @@ -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/17 9:25 上午 + */ +@Data +public class StaffSinAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = -3440415906710443002L; + + /** + * 工作人员Id + */ + private String staffId; + + /** + * 工作人员名称 + */ + private String staffName; + + /** + * 头像 + */ + private String headPhoto; + + /** + * 性别,1男2女0未知 + */ + private Integer gender; + + /** + * 角色列表 + */ + private List roleList; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinGridResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinGridResultDTO.java new file mode 100644 index 0000000000..3827b2ea17 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinGridResultDTO.java @@ -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 StaffSinGridResultDTO 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 roleList; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 8ea872a683..63e3380b6b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -1,6 +1,6 @@ package com.epmet.feign; -import com.epmet.commons.tools.annotation.LoginUser; + import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -259,4 +259,53 @@ public interface EpmetUserOpenFeignClient { **/ @PostMapping(value = "epmetuser/gridlatest/latestgridinfo") Result latestGridInfo(@RequestBody LatestGridInfoFormDTO formDTO); + + /** + * @Description 查询工作人员的信息 + * @param formDTO + * @author zxc + * @date 2020/8/13 1:37 下午 + */ + @PostMapping("epmetuser/customerstaff/getstaffinfolist") + Result> getStaffInfoList(@RequestBody UserIdsFormDTO formDTO); + + /** + * @Description 根绝staffId查询最近一次(既当前)登录到的AgencyId + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:45 + **/ + @GetMapping("/epmetuser/staffagencyvisited/latestagency/{staffId}") + Result latestAgency(@PathVariable("staffId") String staffId); + + /** + * 修改根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:31 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("epmetuser/customerstaff/updaterootmanage") + Result updateRootManage(@RequestBody UpdateRootManageFormDTO formDTO); + + /** + * @Description 查找工作人员的信息 - 对外开放接口 + * @param staffParam + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + @PostMapping("epmetuser/customerstaff/extstaffinfo") + Result extStaffInfo(@RequestBody CommonStaffIdFormDTO staffParam); + + /** + * @Description 查询当前用户信息 - 对外接口 + * @param param + * @return + * @author wangc + * @date 2020.08.21 17:16 + **/ + @PostMapping("/epmetuser/userbaseinfo/extuserinfo") + Result extUserInfo( @RequestBody CommonUserIdFormDTO param); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 6e137becc1..480ba8862e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -183,4 +183,29 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result latestGridInfo(LatestGridInfoFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "latestGridInfo", formDTO); } + + @Override + public Result> getStaffInfoList(UserIdsFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoList", formDTO); + } + + @Override + public Result latestAgency(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "latestAgency", staffId); + } + + @Override + public Result updateRootManage(UpdateRootManageFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateRootManage", formDTO); + } + + @Override + public Result extStaffInfo(CommonStaffIdFormDTO staffParam) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "extStaffInfo", staffParam); + } + + @Override + public Result extUserInfo(CommonUserIdFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "extUserInfo", param); + } } diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 15c0789d48..b7e4db73ed 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.118 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.120 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 0d7cdfa705..9bca6edc9e 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.118 + 0.3.120 com.epmet epmet-user diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index fd0c0f5a9e..08ed13c97a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -321,4 +321,42 @@ public class CustomerStaffController { public Result> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO) { return new Result>().ok(customerStaffService.getCustsomerStaffByIdAndPhone(formDTO)); } + + /** + * @Description 查询工作人员的信息 + * @param formDTO + * @author zxc + * @date 2020/8/13 1:45 下午 + */ + @PostMapping("getstaffinfolist") + public Result> getStaffInfoList(@RequestBody UserIdsFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(customerStaffService.getStaffInfoList(formDTO)); + } + + /** + * @Description 查找工作人员的信息 - 对外开放接口 + * @param staffParam + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + @PostMapping("extstaffinfo") + public Result extStaffInfo(@RequestBody CommonStaffIdFormDTO staffParam){ + ValidatorUtils.validateEntity(staffParam, CommonStaffIdFormDTO.StaffIdGroup.class); + return new Result().ok(customerStaffService.extStaffInfo(staffParam)); + } + + /** + * 修改根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:31 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("updaterootmanage") + public Result updateRootManage(@RequestBody UpdateRootManageFormDTO formDTO) { + customerStaffService.updateRootManage(formDTO); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java index 488a103ef0..69ffa0ebd8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java @@ -62,4 +62,17 @@ public class StaffAgencyVisitedController { return staffAgencyVisitedService.saveStaffLoginRecord(formDTO); } + + /** + * @Description 根绝staffId查询最近一次(既当前)登录到的AgencyId + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:45 + **/ + @GetMapping(value = "latestagency/{staffId}") + public Result latestAgency(@PathVariable("staffId") String staffId){ + return new Result().ok(staffAgencyVisitedService.getLatestStaffAgencyId(staffId)); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java index 154ec7d643..d8d9d969f3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java @@ -28,9 +28,11 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.UserBaseInfoDTO; +import com.epmet.dto.form.CommonUserIdFormDTO; import com.epmet.dto.form.IssueInitiatorFormDTO; import com.epmet.dto.form.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.result.CustomerUserDetailResultDTO; +import com.epmet.dto.result.ExtUserInfoResultDTO; import com.epmet.dto.result.ResiUserBaseInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.entity.UserBaseInfoEntity; @@ -188,5 +190,18 @@ public class UserBaseInfoController { userBaseInfoService.clearUserCache(userIds); return new Result(); } + + /** + * @Description 查询当前用户信息 - 对外接口 + * @param param + * @return + * @author wangc + * @date 2020.08.21 17:16 + **/ + @PostMapping("extuserinfo") + Result extUserInfo( @RequestBody CommonUserIdFormDTO param){ + ValidatorUtils.validateEntity(param, CommonUserIdFormDTO.CommonUserIdGroup.class); + return new Result().ok(userBaseInfoService.extUserInfo(param)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index be19478a91..41c7a550e6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.*; import com.epmet.dto.form.*; -import com.epmet.dto.result.DepartInStaffListResultDTO; -import com.epmet.dto.result.StaffInfoResultDTO; -import com.epmet.dto.result.CommonStaffInfoResultDTO; -import com.epmet.dto.result.StaffListResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -148,4 +145,31 @@ public interface CustomerStaffDao extends BaseDao { * @Description 根据客户ID、手机号查询政府端工作人员基本信息 **/ List selectStaff(ThirdCustomerStaffFormDTO formDTO); + + /** + * @Description 查询工作人员的信息 + * @param userIds + * @author zxc + * @date 2020/8/13 1:45 下午 + */ + List getStaffInfoList(@Param("userIds")List userIds); + + /** + * @Description 查询工作人员信息 (对外接口) + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 13:26 + **/ + ExtStaffInfoResultDTO selectStaffInfoExt(@Param("staffId") String staffId); + + /** + * 获取根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:14 + * @param orgId + * @param roleKey + * @return com.epmet.dto.CustomerStaffDTO + */ + CustomerStaffDTO selectRootManage(@Param("orgId") String orgId, @Param("roleKey") String roleKey); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index 275a2e9742..0d019d63f6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -20,6 +20,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; +import com.epmet.dto.result.RoleInfoResultDTO; +import com.epmet.dto.result.RoleResultDTO; import com.epmet.entity.GovStaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -61,4 +63,12 @@ public interface GovStaffRoleDao extends BaseDao { List listRolesByCustomer(@Param("customerId") String customerId); GovStaffRoleResultDTO getDTOById(@Param("roleId") String roleId); + + /** + * @Description 查询用户的权限 + * @param userIds + * @author zxc + * @date 2020/8/13 2:14 下午 + */ + List getRoleInfoList(@Param("userIds")List userIds); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index edbef03d60..3a49fc6f2d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -258,4 +258,30 @@ public interface CustomerStaffService extends BaseService { * @Description 根据客户ID、手机号查询政府端工作人员基本信息,校验用户是否存在 **/ List getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO); + + /** + * @Description 查询工作人员的信息 + * @param formDTO + * @author zxc + * @date 2020/8/13 1:45 下午 + */ + List getStaffInfoList( UserIdsFormDTO formDTO); + + /** + * @Description 查找工作人员的信息 - 对外开放接口 + * @param staffParam + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + ExtStaffInfoResultDTO extStaffInfo(CommonStaffIdFormDTO staffParam); + + /** + * 修改根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:11 + * @param formDTO + * @return com.epmet.dto.CustomerStaffDTO + */ + void updateRootManage(UpdateRootManageFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java index 71622dfa4a..d70addb077 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java @@ -114,4 +114,13 @@ public interface StaffAgencyVisitedService extends BaseService { * @date 2020.08.06 14:38 **/ void clearUserCache(List ids); + + /** + * @Description 查询当前用户信息 - 对外接口 + * @param param + * @return + * @author wangc + * @date 2020.08.21 17:16 + **/ + ExtUserInfoResultDTO extUserInfo(CommonUserIdFormDTO param); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 0f00a32191..030a917e71 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -36,6 +36,7 @@ import com.epmet.constant.RoleKeyConstants; import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; +import com.epmet.dao.GovStaffRoleDao; import com.epmet.dao.StaffRoleDao; import com.epmet.dto.*; import com.epmet.dto.form.*; @@ -56,6 +57,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -93,6 +95,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl page(Map params) { @@ -540,4 +546,69 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl getStaffInfoList(UserIdsFormDTO formDTO) { + List userIds = formDTO.getUserIds(); + // 1. 根据userId查询人员基本信息 + List staffInfoList = customerStaffDao.getStaffInfoList(userIds); + if (staffInfoList.size() == NumConstant.ZERO){ + return staffInfoList; + } + // 2. 根据userId查询权限 + List roleInfoList = govStaffRoleDao.getRoleInfoList(userIds); + staffInfoList.forEach(staffInfo -> { + List roleResult = new ArrayList<>(); + roleInfoList.forEach(role -> { + if (staffInfo.getStaffId().equals(role.getUserId())){ + RoleResultDTO result = new RoleResultDTO(); + BeanUtils.copyProperties(role,result); + roleResult.add(result); + } + }); + staffInfo.setRoleList(roleResult); + }); + return staffInfoList; + } + + + /** + * @Description 查找工作人员的信息 - 对外开放接口 + * @param staffParam + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + @Override + public ExtStaffInfoResultDTO extStaffInfo(CommonStaffIdFormDTO staffParam) { + //查找工作人员信息 + //最近一次登陆的而网格、人员信息、权限 + ExtStaffInfoResultDTO result = baseDao.selectStaffInfoExt(staffParam.getStaffId()); + result.setUserId(staffParam.getStaffId()); + if(null != result) { + Result govOrgResult = + govOrgOpenFeignClient.staffInfoExt(result); + if(govOrgResult.success() && null != govOrgResult.getData()){ + return govOrgResult.getData(); + } + } + return null; + } + + @Override + public void updateRootManage(UpdateRootManageFormDTO formDTO) { + CustomerStaffDTO dto = baseDao.selectRootManage(formDTO.getOrgId(), formDTO.getRoleKey()); + if (null == dto) { + throw new RenException("查询客户管理员失败"); + } + dto.setRealName(formDTO.getRootManageName()); + dto.setMobile(formDTO.getRootManagePhone()); + update(dto); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 11fb4702ca..7e2e2fd706 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -127,4 +127,20 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl implements UserBaseInfoService { + private Logger logger = LogManager.getLogger(getClass()); + @Autowired private UserBaseInfoRedis userBaseInfoRedis; @Autowired @@ -65,6 +68,12 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -296,4 +305,52 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl roleList = userRoleDao.getUserRoleInfo(roleParam); + List roleListFormat = new LinkedList<>(); + if(null != roleList && !roleList.isEmpty()){ + roleList.forEach(role -> { + ExtRoleMapResultDTO object = ConvertUtils.sourceToTarget(role,ExtRoleMapResultDTO.class); + roleListFormat.add(object); + }); + result.setRoleList(roleListFormat); + } + + Result govOrgResult = + govOrgOpenFeignClient.userInfoExt(result); + if(govOrgResult.success() && null != govOrgResult.getData()){ + return govOrgResult.getData();} + + return result; + } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 7466c53d67..81c83553fd 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -215,4 +215,84 @@ AND mobile = #{mobile} ORDER BY active_time DESC, created_time ASC + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 22f47ce8bc..a9da37f9d9 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -68,4 +68,22 @@ gsr.ORG_TYPE AS orgType FROM gov_staff_role gsr WHERE ID = #{roleId} + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ee379a6b7a..dcbdbc44dc 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + org.springframework.boot spring-boot-starter-parent