|
@@ -1,102 +0,0 @@
|
|
|
-package com.storlead.mail.controller.mkt;
|
|
|
|
|
-
|
|
|
|
|
-import com.storlead.framework.common.dto.page.PageDTO;
|
|
|
|
|
-import com.storlead.framework.common.result.Result;
|
|
|
|
|
-import com.storlead.mail.pojo.entity.SmtpPopSettingsEntity;
|
|
|
|
|
-import com.storlead.mail.webclient.client.MktAccountRemoteClient;
|
|
|
|
|
-import io.swagger.annotations.Api;
|
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
-import lombok.extern.log4j.Log4j2;
|
|
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
|
|
-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;
|
|
|
|
|
-
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * 营销邮箱账户(转发独立邮件服务 /mkt/account/**)。
|
|
|
|
|
- */
|
|
|
|
|
-@Log4j2
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/mkt/email/account")
|
|
|
|
|
-@Api(tags = "营销邮件: 邮箱账户")
|
|
|
|
|
-public class SmtpPopSettingsApiController {
|
|
|
|
|
-
|
|
|
|
|
- private static final String SCENE_MKT = "MKT";
|
|
|
|
|
- private static final String SCOPE_ORG = "ORG";
|
|
|
|
|
- private static final String SCOPE_PERSONAL = "PERSONAL";
|
|
|
|
|
-
|
|
|
|
|
- @Resource
|
|
|
|
|
- private MktAccountRemoteClient mktAccountRemoteClient;
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/page_list")
|
|
|
|
|
- @ApiOperation("获取营销邮箱配置信息")
|
|
|
|
|
- public Result<?> pageList(PageDTO dto) {
|
|
|
|
|
- return mktAccountRemoteClient.pageList(dto);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/list")
|
|
|
|
|
- @ApiOperation("营销邮箱账户列表")
|
|
|
|
|
- public Result<?> list(Long orgId) {
|
|
|
|
|
- return mktAccountRemoteClient.list(orgId);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/save")
|
|
|
|
|
- @ApiOperation("保存/修改营销邮箱")
|
|
|
|
|
- public Result<?> save(@RequestBody SmtpPopSettingsEntity entity) {
|
|
|
|
|
- applyMktDefaults(entity);
|
|
|
|
|
- return mktAccountRemoteClient.save(entity);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/delete")
|
|
|
|
|
- @ApiOperation("删除营销邮箱")
|
|
|
|
|
- public Result<?> delete(Long id) {
|
|
|
|
|
- return mktAccountRemoteClient.delete(id);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/default_use")
|
|
|
|
|
- @ApiOperation("设置默认营销发信账户")
|
|
|
|
|
- public Result<?> defaultUse(Long id) {
|
|
|
|
|
- return mktAccountRemoteClient.defaultUse(id);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/test_connect")
|
|
|
|
|
- @ApiOperation("测试营销邮箱连通性")
|
|
|
|
|
- public Result<?> testConnect(@RequestBody SmtpPopSettingsEntity mailSet) {
|
|
|
|
|
- applyMktDefaults(mailSet);
|
|
|
|
|
- return mktAccountRemoteClient.testConnect(mailSet);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 营销账户默认必填:scene 固定 MKT,避免落入 CRM;其余空值补默认。
|
|
|
|
|
- */
|
|
|
|
|
- private void applyMktDefaults(SmtpPopSettingsEntity entity) {
|
|
|
|
|
- if (entity == null) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- entity.setScene(SCENE_MKT);
|
|
|
|
|
- if (!StringUtils.hasText(entity.getAccountScope())) {
|
|
|
|
|
- entity.setAccountScope(entity.getOrgId() != null ? SCOPE_ORG : SCOPE_PERSONAL);
|
|
|
|
|
- }
|
|
|
|
|
- if (entity.getEnableReceive() == null) {
|
|
|
|
|
- entity.setEnableReceive(0);
|
|
|
|
|
- }
|
|
|
|
|
- if (entity.getUseDefault() == null) {
|
|
|
|
|
- entity.setUseDefault(0);
|
|
|
|
|
- }
|
|
|
|
|
- if (entity.getIsAutoReply() == null) {
|
|
|
|
|
- entity.setIsAutoReply(0);
|
|
|
|
|
- }
|
|
|
|
|
- if (entity.getIsDelete() == null) {
|
|
|
|
|
- entity.setIsDelete(0);
|
|
|
|
|
- }
|
|
|
|
|
- if (entity.getEnabled() == null) {
|
|
|
|
|
- entity.setEnabled(Boolean.TRUE);
|
|
|
|
|
- }
|
|
|
|
|
- if (entity.getIsDeleteMail() == null) {
|
|
|
|
|
- entity.setIsDeleteMail(0);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|