|
@@ -1,9 +1,14 @@
|
|
|
package org.jeecg.modules.adweb.site.controller;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
@@ -16,6 +21,7 @@ import org.jeecg.modules.adweb.site.service.SiteManageService;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -70,4 +76,34 @@ public class AdwebSiteManageController extends JeecgController<AdwebSite, IAdweb
|
|
|
SiteBasicInfo basicInfo = siteManageService.getSiteBasicInfo(siteCode);
|
|
|
return Result.OK(basicInfo);
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping(value = "/setEnquiryEmailListBySiteCode")
|
|
|
+ public Result<?> setEnquiryEmailListBySiteCode(String siteCode, String companyName, @RequestParam List<String> emailList) {
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(siteCode)) {
|
|
|
+ return Result.error("参数错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断emailList是否存在重复
|
|
|
+ if (emailList.size() != new HashSet<>(emailList).size()) {
|
|
|
+ return Result.error("邮箱列表存在重复");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 去除邮箱前后空格
|
|
|
+ emailList.replaceAll(String::trim);
|
|
|
+
|
|
|
+ int count = (int) adwebSiteManageService.count(new QueryWrapper<AdwebSite>().eq("code", siteCode));
|
|
|
+ if (count == 0) {
|
|
|
+ return Result.error("站点不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("设置站点询盘邮箱列表,站点code:{},邮箱列表:{}", siteCode, emailList);
|
|
|
+
|
|
|
+ boolean update = adwebSiteManageService.update(new UpdateWrapper<AdwebSite>()
|
|
|
+ .set("company_name", companyName)
|
|
|
+ .set("enquiry_email_list", CollectionUtils.isEmpty(emailList) ? null : JSON.toJSONString(emailList))
|
|
|
+ .eq("code", siteCode));
|
|
|
+
|
|
|
+ return update ? Result.OK("设置成功") : Result.error("设置失败");
|
|
|
+ }
|
|
|
}
|