Commit d9384ae6 by zhangxingmin

Merge remote-tracking branch 'origin/dev_zxm' into test

parents 6071270a e51854d3
...@@ -70,6 +70,13 @@ ...@@ -70,6 +70,13 @@
<artifactId>yd-email-service</artifactId> <artifactId>yd-email-service</artifactId>
</dependency> </dependency>
<!-- 实体类模块 -->
<dependency>
<groupId>com.yd</groupId>
<artifactId>yd-oss-feign</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.yd.email.api.controller; package com.yd.email.api.controller;
import com.yd.common.result.Result;
import com.yd.email.api.service.ApiEmailFileService;
import com.yd.email.feign.client.ApiEmailFileFeignClient; import com.yd.email.feign.client.ApiEmailFileFeignClient;
import com.yd.email.feign.request.ApiExportVariableExcelRequest;
import com.yd.email.feign.response.ApiExportVariableExcelResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -16,5 +21,16 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -16,5 +21,16 @@ import org.springframework.web.bind.annotation.RestController;
@Validated @Validated
public class ApiEmailFileController implements ApiEmailFileFeignClient { public class ApiEmailFileController implements ApiEmailFileFeignClient {
@Autowired
private ApiEmailFileService apiEmailFileService;
/**
* 导出-变量excel
* @param request
* @return
*/
@Override
public Result<ApiExportVariableExcelResponse> exportVariableExcel(ApiExportVariableExcelRequest request) {
return apiEmailFileService.exportVariableExcel(request);
}
} }
package com.yd.email.api.service;
import com.yd.common.result.Result;
import com.yd.email.feign.request.ApiExportVariableExcelRequest;
import com.yd.email.feign.response.ApiExportVariableExcelResponse;
public interface ApiEmailFileService {
Result<ApiExportVariableExcelResponse> exportVariableExcel(ApiExportVariableExcelRequest request);
}
...@@ -7,6 +7,7 @@ import com.yd.email.feign.request.ApiEmailVariableGroupEditRequest; ...@@ -7,6 +7,7 @@ import com.yd.email.feign.request.ApiEmailVariableGroupEditRequest;
import com.yd.email.feign.request.ApiEmailVariableGroupPageRequest; import com.yd.email.feign.request.ApiEmailVariableGroupPageRequest;
import com.yd.email.feign.response.ApiEmailVariableGroupDetailResponse; import com.yd.email.feign.response.ApiEmailVariableGroupDetailResponse;
import com.yd.email.feign.response.ApiEmailVariableGroupPageResponse; import com.yd.email.feign.response.ApiEmailVariableGroupPageResponse;
import com.yd.email.service.model.EmailVariableGroup;
public interface ApiEmailVariableGroupService { public interface ApiEmailVariableGroupService {
Result<IPage<ApiEmailVariableGroupPageResponse>> page(ApiEmailVariableGroupPageRequest request); Result<IPage<ApiEmailVariableGroupPageResponse>> page(ApiEmailVariableGroupPageRequest request);
...@@ -18,4 +19,6 @@ public interface ApiEmailVariableGroupService { ...@@ -18,4 +19,6 @@ public interface ApiEmailVariableGroupService {
Result<ApiEmailVariableGroupDetailResponse> detail(String variableGroupBizId); Result<ApiEmailVariableGroupDetailResponse> detail(String variableGroupBizId);
Result del(String variableGroupBizId); Result del(String variableGroupBizId);
Result<EmailVariableGroup> checkEmailVariableGroupIsExist(String variableGroupBizId);
} }
package com.yd.email.api.service.impl;
import com.yd.common.result.Result;
import com.yd.email.api.service.ApiEmailFileService;
import com.yd.email.api.service.ApiEmailVariableGroupService;
import com.yd.email.feign.dto.ApiEmailVariableDto;
import com.yd.email.feign.request.ApiExportVariableExcelRequest;
import com.yd.email.feign.response.ApiEmailVariableGroupDetailResponse;
import com.yd.email.feign.response.ApiExportVariableExcelResponse;
import com.yd.oss.feign.client.ApiExcelFeignClient;
import com.yd.oss.feign.dto.ExportParam;
import com.yd.oss.feign.dto.ExportResult;
import com.yd.oss.feign.request.ApiExportRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j
@Service
public class ApiEmailFileServiceImpl implements ApiEmailFileService {
@Autowired
private ApiExcelFeignClient apiExcelFeignClient;
@Autowired
private ApiEmailVariableGroupService apiEmailVariableGroupService;
/**
* 导出-变量excel
* @param request
* @return
*/
@Override
public Result<ApiExportVariableExcelResponse> exportVariableExcel(ApiExportVariableExcelRequest request) {
Result<ApiEmailVariableGroupDetailResponse> result = apiEmailVariableGroupService.detail(request.getVariableGroupBizId());
ApiEmailVariableGroupDetailResponse response = result.getData();
//分组绑定的变量列表
List<ApiEmailVariableDto> emailVariableDtoList = response.getEmailVariableDtoList();
List<String> FieldNameList = Arrays.asList("联系人", "邮箱", "抄送人");
if (!CollectionUtils.isEmpty(emailVariableDtoList)) {
FieldNameList.addAll(emailVariableDtoList.stream().map(ApiEmailVariableDto::getVariableNameCn).collect(Collectors.toList()));
}
//构建导出参数
ExportParam exportParam = new ExportParam();
exportParam.setFileName("变量"); // 基础文件名
exportParam.setFieldNames(FieldNameList); // 要导出的字段
exportParam.setUploadToOss(true); // 设置为true表示上传到OSS
ApiExportRequest exportRequest = new ApiExportRequest();
exportRequest.setExportParam(exportParam);
Result<ExportResult> resultResult = apiExcelFeignClient.export(exportRequest);
ApiExportVariableExcelResponse response1 = new ApiExportVariableExcelResponse();
if (!Objects.isNull(resultResult.getData())) {
response1.setUrl(resultResult.getData().getOssUrl());
}
return Result.success(response1);
}
}
...@@ -145,6 +145,7 @@ public class ApiEmailVariableGroupServiceImpl implements ApiEmailVariableGroupSe ...@@ -145,6 +145,7 @@ public class ApiEmailVariableGroupServiceImpl implements ApiEmailVariableGroupSe
* @param variableGroupBizId * @param variableGroupBizId
* @return * @return
*/ */
@Override
public Result<EmailVariableGroup> checkEmailVariableGroupIsExist(String variableGroupBizId) { public Result<EmailVariableGroup> checkEmailVariableGroupIsExist(String variableGroupBizId) {
EmailVariableGroup emailVariableGroup = iEmailVariableGroupService.queryOne(variableGroupBizId); EmailVariableGroup emailVariableGroup = iEmailVariableGroupService.queryOne(variableGroupBizId);
if (Objects.isNull(emailVariableGroup)) { if (Objects.isNull(emailVariableGroup)) {
......
...@@ -117,27 +117,6 @@ ...@@ -117,27 +117,6 @@
<orderEntry type="library" name="Maven: p6spy:p6spy:3.9.1" level="project" /> <orderEntry type="library" name="Maven: p6spy:p6spy:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" /> <orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.31" level="project" />
<orderEntry type="module" module-name="yd-email-feign" /> <orderEntry type="module" module-name="yd-email-feign" />
<orderEntry type="library" name="Maven: com.yd:yd-feign:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:3.1.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:3.1.1" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:11.8" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:11.8" level="project" />
<orderEntry type="library" name="Maven: com.yd:yd-common:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.83" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.3.Final" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.3.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.6.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.6.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.6.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.18" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.6.6" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.18" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.18" level="project" />
<orderEntry type="library" name="Maven: com.sun.mail:jakarta.mail:1.6.7" level="project" /> <orderEntry type="library" name="Maven: com.sun.mail:jakarta.mail:1.6.7" level="project" />
...@@ -234,5 +213,27 @@ ...@@ -234,5 +213,27 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.2" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-bean:5.1.6" level="project" /> <orderEntry type="library" name="Maven: org.jodd:jodd-bean:5.1.6" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-core:5.1.6" level="project" /> <orderEntry type="library" name="Maven: org.jodd:jodd-core:5.1.6" level="project" />
<orderEntry type="library" name="Maven: com.yd:yd-oss-feign:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.yd:yd-feign:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-openfeign:3.1.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-openfeign-core:3.1.1" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form-spring:3.8.0" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign.form:feign-form:3.8.0" level="project" />
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-core:11.8" level="project" />
<orderEntry type="library" name="Maven: io.github.openfeign:feign-slf4j:11.8" level="project" />
<orderEntry type="library" name="Maven: com.yd:yd-common:1.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.83" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.3.Final" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.3.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.14.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.6.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.6.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.6.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.18" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.8.RELEASE" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
package com.yd.email.feign.client; package com.yd.email.feign.client;
import com.yd.common.result.Result;
import com.yd.email.feign.fallback.ApiEmailFileFeignFallbackFactory; import com.yd.email.feign.fallback.ApiEmailFileFeignFallbackFactory;
import com.yd.email.feign.request.ApiExportVariableExcelRequest;
import com.yd.email.feign.response.ApiExportVariableExcelResponse;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/** /**
* 邮箱服务-邮件文件信息Feign客户端 * 邮箱服务-邮件文件信息Feign客户端
...@@ -9,4 +15,11 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -9,4 +15,11 @@ import org.springframework.cloud.openfeign.FeignClient;
@FeignClient(name = "yd-email-api", fallbackFactory = ApiEmailFileFeignFallbackFactory.class) @FeignClient(name = "yd-email-api", fallbackFactory = ApiEmailFileFeignFallbackFactory.class)
public interface ApiEmailFileFeignClient { public interface ApiEmailFileFeignClient {
/**
* 导出-变量excel
* @param request
* @return
*/
@PostMapping("/export/excel/variable")
Result<ApiExportVariableExcelResponse> exportVariableExcel(@Validated @RequestBody ApiExportVariableExcelRequest request);
} }
package com.yd.email.feign.fallback; package com.yd.email.feign.fallback;
import com.yd.common.result.Result;
import com.yd.email.feign.client.ApiEmailFileFeignClient; import com.yd.email.feign.client.ApiEmailFileFeignClient;
import com.yd.email.feign.request.ApiExportVariableExcelRequest;
import com.yd.email.feign.response.ApiExportVariableExcelResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -13,6 +16,11 @@ import org.springframework.stereotype.Component; ...@@ -13,6 +16,11 @@ import org.springframework.stereotype.Component;
public class ApiEmailFileFeignFallbackFactory implements FallbackFactory<ApiEmailFileFeignClient> { public class ApiEmailFileFeignFallbackFactory implements FallbackFactory<ApiEmailFileFeignClient> {
@Override @Override
public ApiEmailFileFeignClient create(Throwable cause) { public ApiEmailFileFeignClient create(Throwable cause) {
return null; return new ApiEmailFileFeignClient() {
@Override
public Result<ApiExportVariableExcelResponse> exportVariableExcel(ApiExportVariableExcelRequest request) {
return null;
}
};
} }
} }
package com.yd.email.feign.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class ApiExportVariableExcelRequest {
/**
* 变量分组唯一业务ID
*/
@NotBlank(message = "变量分组唯一业务ID不能为空")
private String variableGroupBizId;
}
package com.yd.email.feign.response;
import lombok.Data;
@Data
public class ApiExportVariableExcelResponse {
/**
* 导出的文件访问路径
*/
private String url;
}
...@@ -78,6 +78,8 @@ ...@@ -78,6 +78,8 @@
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.18" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.18" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.18" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.18" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.8.RELEASE" level="project" /> <orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.60" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-annotations-api:9.0.60" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.6.6" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.6.6" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.6.6" level="project" />
......
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.6.3" level="project" /> <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.6.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.18" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.18" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.8.RELEASE" level="project" /> <orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.60" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-annotations-api:9.0.60" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.6.6" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.18" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.18" level="project" />
...@@ -158,7 +160,6 @@ ...@@ -158,7 +160,6 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.6.6" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.6.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.60" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.60" level="project" /> <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.60" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.18" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.18" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.18" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.18" level="project" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment