|
@@ -44,7 +44,6 @@ import org.jeecg.modules.adweb.subscription.service.IUserPlanSubscriptionService
|
|
import org.jeecg.modules.adweb.system.service.SysAdwebApi;
|
|
import org.jeecg.modules.adweb.system.service.SysAdwebApi;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
@@ -58,10 +57,7 @@ import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * @Description: 关键词
|
|
|
|
- * @Author: jeecg-boot
|
|
|
|
- * @Date: 2024-10-15
|
|
|
|
- * @Version: V1.0
|
|
|
|
|
|
+ * @Description: 关键词 @Author: jeecg-boot @Date: 2024-10-15 @Version: V1.0
|
|
*/
|
|
*/
|
|
@Tag(name = "关键词")
|
|
@Tag(name = "关键词")
|
|
@RestController
|
|
@RestController
|
|
@@ -131,19 +127,26 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
*/
|
|
*/
|
|
@AutoLog(value = "关键词-添加")
|
|
@AutoLog(value = "关键词-添加")
|
|
@Operation(summary = "关键词-添加")
|
|
@Operation(summary = "关键词-添加")
|
|
- @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:add')")
|
|
|
|
|
|
+ // @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:add')")
|
|
@PostMapping(value = "/add")
|
|
@PostMapping(value = "/add")
|
|
public Result<String> add(@RequestBody SeoKeywords seoKeywords) {
|
|
public Result<String> add(@RequestBody SeoKeywords seoKeywords) {
|
|
- // AdwebSite siteByCode = adwebSiteService.getSiteByCode(seoKeywords.getSiteCode());
|
|
|
|
- // if (siteByCode == null) {
|
|
|
|
- // return Result.error("未找到对应站点");
|
|
|
|
- // }
|
|
|
|
|
|
+ AdwebSite site = adwebSiteService.getSiteByCode(seoKeywords.getSiteCode());
|
|
|
|
+ if (site == null) {
|
|
|
|
+ return Result.error("未找到对应站点");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isEmpty(site.getDomain()) || Objects.equals(site.getIsDomain(), 0)) {
|
|
|
|
+ return Result.error("站点域名未设置!");
|
|
|
|
+ }
|
|
|
|
+
|
|
seoKeywords.setAppKey(AdwebConstant.APPKEY);
|
|
seoKeywords.setAppKey(AdwebConstant.APPKEY);
|
|
- // 根据siteCode获取站点域名
|
|
|
|
- // String domain = siteByCode.getDomain();
|
|
|
|
- // seoKeywords.setDomain(domain);
|
|
|
|
|
|
+ seoKeywords.setDomain(site.getDomain());
|
|
seoKeywords.setStatus(1);
|
|
seoKeywords.setStatus(1);
|
|
- // seoKeywords.setLang("en");
|
|
|
|
|
|
+ seoKeywords.setPriority(3);
|
|
|
|
+ seoKeywords.setOptimizeProcess(0);
|
|
|
|
+ seoKeywords.setOptimizeStatus(0);
|
|
|
|
+ seoKeywords.setLastRank(0);
|
|
|
|
+ seoKeywords.setSearchStatus(0);
|
|
|
|
+
|
|
seoKeywordsService.save(seoKeywords);
|
|
seoKeywordsService.save(seoKeywords);
|
|
return Result.OK("添加成功!");
|
|
return Result.OK("添加成功!");
|
|
}
|
|
}
|
|
@@ -156,7 +159,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
*/
|
|
*/
|
|
@AutoLog(value = "关键词-编辑")
|
|
@AutoLog(value = "关键词-编辑")
|
|
@Operation(summary = "关键词-编辑")
|
|
@Operation(summary = "关键词-编辑")
|
|
- @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:edit')")
|
|
|
|
|
|
+ // @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:edit')")
|
|
@RequestMapping(
|
|
@RequestMapping(
|
|
value = "/edit",
|
|
value = "/edit",
|
|
method = {RequestMethod.PUT, RequestMethod.POST})
|
|
method = {RequestMethod.PUT, RequestMethod.POST})
|
|
@@ -173,7 +176,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
*/
|
|
*/
|
|
@AutoLog(value = "关键词-通过id删除")
|
|
@AutoLog(value = "关键词-通过id删除")
|
|
@Operation(summary = "关键词-通过id删除")
|
|
@Operation(summary = "关键词-通过id删除")
|
|
- @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:delete')")
|
|
|
|
|
|
+ // @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:delete')")
|
|
@DeleteMapping(value = "/delete")
|
|
@DeleteMapping(value = "/delete")
|
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
seoKeywordsService.removeById(id);
|
|
seoKeywordsService.removeById(id);
|
|
@@ -188,7 +191,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
*/
|
|
*/
|
|
@AutoLog(value = "关键词-批量删除")
|
|
@AutoLog(value = "关键词-批量删除")
|
|
@Operation(summary = "关键词-批量删除")
|
|
@Operation(summary = "关键词-批量删除")
|
|
- @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:deleteBatch')")
|
|
|
|
|
|
+ // @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:deleteBatch')")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
this.seoKeywordsService.removeByIds(Arrays.asList(ids.split(",")));
|
|
this.seoKeywordsService.removeByIds(Arrays.asList(ids.split(",")));
|
|
@@ -217,7 +220,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
*
|
|
*
|
|
* @param request
|
|
* @param request
|
|
*/
|
|
*/
|
|
- @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:exportXls')")
|
|
|
|
|
|
+ // @PreAuthorize("@jps.requiresPermissions('seo:seo_keywords:exportXls')")
|
|
@RequestMapping(value = "/exportXls")
|
|
@RequestMapping(value = "/exportXls")
|
|
public ModelAndView exportXls(HttpServletRequest request, SeoKeywords seoKeywords) {
|
|
public ModelAndView exportXls(HttpServletRequest request, SeoKeywords seoKeywords) {
|
|
return super.exportXls(request, seoKeywords, SeoKeywords.class, "关键词");
|
|
return super.exportXls(request, seoKeywords, SeoKeywords.class, "关键词");
|
|
@@ -253,8 +256,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
String buttonColumn = req.getParameter("buttonColmn");
|
|
String buttonColumn = req.getParameter("buttonColmn");
|
|
String buttonSort = req.getParameter("buttonSort");
|
|
String buttonSort = req.getParameter("buttonSort");
|
|
Page<SeoKeywords> page = new Page<SeoKeywords>(pageNo, pageSize);
|
|
Page<SeoKeywords> page = new Page<SeoKeywords>(pageNo, pageSize);
|
|
- List<String> dateList =
|
|
|
|
- seoKeywordsService.getKeywordsLastSevenDays(siteCode, keywordType, subscriptionId);
|
|
|
|
|
|
+ List<String> dateList = seoKeywordsService.getKeywordsLastSevenDays(siteCode, keywordType);
|
|
pageList =
|
|
pageList =
|
|
seoKeywordsService.getKeywordList(
|
|
seoKeywordsService.getKeywordList(
|
|
page,
|
|
page,
|
|
@@ -265,7 +267,6 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
keywordType,
|
|
keywordType,
|
|
avesApiSearchKeywordsDTO.getReachStandard() != null
|
|
avesApiSearchKeywordsDTO.getReachStandard() != null
|
|
&& avesApiSearchKeywordsDTO.getReachStandard() == 1,
|
|
&& avesApiSearchKeywordsDTO.getReachStandard() == 1,
|
|
- subscriptionId,
|
|
|
|
column,
|
|
column,
|
|
order,
|
|
order,
|
|
buttonColumn,
|
|
buttonColumn,
|
|
@@ -399,7 +400,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
if (site == null) {
|
|
if (site == null) {
|
|
return Result.error("站点不存在!");
|
|
return Result.error("站点不存在!");
|
|
}
|
|
}
|
|
- if (StringUtil.isEmpty(site.getDomain())) {
|
|
|
|
|
|
+ if (StringUtil.isEmpty(site.getDomain()) || Objects.equals(site.getIsDomain(), 0)) {
|
|
return Result.error("站点域名未设置!");
|
|
return Result.error("站点域名未设置!");
|
|
}
|
|
}
|
|
UserPlanSubscription currentSeoAndSiteSubscription =
|
|
UserPlanSubscription currentSeoAndSiteSubscription =
|
|
@@ -454,7 +455,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
SeoKeywords seoKeywords = new SeoKeywords();
|
|
SeoKeywords seoKeywords = new SeoKeywords();
|
|
- seoKeywords.setAppKey("adweb");
|
|
|
|
|
|
+ seoKeywords.setAppKey(AdwebConstant.APPKEY);
|
|
seoKeywords.setSiteCode(site.getCode());
|
|
seoKeywords.setSiteCode(site.getCode());
|
|
seoKeywords.setKeywords(value2);
|
|
seoKeywords.setKeywords(value2);
|
|
seoKeywords.setDomain(site.getDomain());
|
|
seoKeywords.setDomain(site.getDomain());
|
|
@@ -470,7 +471,6 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
}
|
|
}
|
|
seoKeywords.setLastRank(0);
|
|
seoKeywords.setLastRank(0);
|
|
seoKeywords.setSearchStatus(0);
|
|
seoKeywords.setSearchStatus(0);
|
|
- seoKeywords.setSubscriptionId(currentSeoAndSiteSubscription.getId());
|
|
|
|
list.add(seoKeywords);
|
|
list.add(seoKeywords);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -481,8 +481,7 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
LambdaQueryWrapper<SeoKeywords> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SeoKeywords> queryWrapper = new LambdaQueryWrapper<>();
|
|
queryWrapper.eq(SeoKeywords::getSiteCode, site.getCode());
|
|
queryWrapper.eq(SeoKeywords::getSiteCode, site.getCode());
|
|
queryWrapper.ne(SeoKeywords::getStatus, 0);
|
|
queryWrapper.ne(SeoKeywords::getStatus, 0);
|
|
- queryWrapper.eq(
|
|
|
|
- SeoKeywords::getSubscriptionId, currentSeoAndSiteSubscription.getId());
|
|
|
|
|
|
+
|
|
List<SeoKeywords> existingKeywordList = seoKeywordsService.list(queryWrapper);
|
|
List<SeoKeywords> existingKeywordList = seoKeywordsService.list(queryWrapper);
|
|
if (CollectionUtil.isNotEmpty(existingKeywordList)) {
|
|
if (CollectionUtil.isNotEmpty(existingKeywordList)) {
|
|
List<String> existingKeywords = new ArrayList<>();
|
|
List<String> existingKeywords = new ArrayList<>();
|
|
@@ -538,7 +537,6 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
queryWrapper.eq(SeoKeywords::getKeywords, seoKeywords.getKeywords());
|
|
queryWrapper.eq(SeoKeywords::getKeywords, seoKeywords.getKeywords());
|
|
queryWrapper.eq(SeoKeywords::getSiteCode, seoKeywords.getSiteCode());
|
|
queryWrapper.eq(SeoKeywords::getSiteCode, seoKeywords.getSiteCode());
|
|
queryWrapper.ne(SeoKeywords::getStatus, 0);
|
|
queryWrapper.ne(SeoKeywords::getStatus, 0);
|
|
- queryWrapper.eq(SeoKeywords::getSubscriptionId, seoKeywords.getSubscriptionId());
|
|
|
|
List<SeoKeywords> seoKeywordsList = seoKeywordsService.list(queryWrapper);
|
|
List<SeoKeywords> seoKeywordsList = seoKeywordsService.list(queryWrapper);
|
|
if (!seoKeywordsList.isEmpty()) {
|
|
if (!seoKeywordsList.isEmpty()) {
|
|
return Result.OK(false);
|
|
return Result.OK(false);
|
|
@@ -563,7 +561,6 @@ public class SeoKeywordsController extends JeecgController<SeoKeywords, ISeoKeyw
|
|
if (type == 2) {
|
|
if (type == 2) {
|
|
LambdaQueryWrapper<SeoKeywords> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SeoKeywords> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
queryWrapper2.ne(SeoKeywords::getStatus, 0);
|
|
queryWrapper2.ne(SeoKeywords::getStatus, 0);
|
|
- queryWrapper2.eq(SeoKeywords::getSubscriptionId, temp.getSubscriptionId());
|
|
|
|
queryWrapper2.eq(SeoKeywords::getRelatedKeywordId, id);
|
|
queryWrapper2.eq(SeoKeywords::getRelatedKeywordId, id);
|
|
if (seoKeywordsService.count(queryWrapper2) > 0) {
|
|
if (seoKeywordsService.count(queryWrapper2) > 0) {
|
|
return Result.error("此关键词已经关联长尾词!");
|
|
return Result.error("此关键词已经关联长尾词!");
|