修复优惠券模块

This commit is contained in:
2025-08-09 16:44:32 +08:00
parent d214e4b3cc
commit c93eeaa5e3
8 changed files with 77 additions and 40 deletions

View File

@@ -13,6 +13,7 @@ import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -34,6 +35,7 @@ public class BszxBmController extends BaseController {
@Resource
private BszxBmService bszxBmService;
@Resource
@Lazy
private CmsArticleService cmsArticleService;
@PreAuthorize("hasAuthority('bszx:bszxBm:list')")

View File

@@ -24,6 +24,7 @@ import com.gxwebsoft.common.core.utils.ImageUtil;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -49,6 +50,7 @@ public class BszxBmServiceImpl extends ServiceImpl<BszxBmMapper, BszxBm> impleme
@Resource
private ConfigProperties config;
@Resource
@Lazy
private CmsArticleService cmsArticleService;
@Resource
private BszxClassService bszxClassService;

View File

@@ -20,6 +20,7 @@ import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.service.UserService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -52,6 +53,7 @@ public class CmsArticleController extends BaseController {
@Resource
private CmsArticleContentService articleContentService;
@Resource
@Lazy
private CmsNavigationService cmsNavigationService;
@Resource
private CmsModelService cmsModelService;

View File

@@ -17,6 +17,7 @@ import com.gxwebsoft.common.core.utils.AliYunSender;
import com.gxwebsoft.common.core.utils.JSONUtil;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -33,12 +34,12 @@ import java.util.Map;
@Service
public class CmsArticleContentServiceImpl extends ServiceImpl<CmsArticleContentMapper, CmsArticleContent> implements CmsArticleContentService {
@Resource
@Lazy
private CmsNavigationService cmsNavigationService;
@Resource
@Lazy
private CmsArticleService cmsArticleService;
@Resource
private CmsArticleContentService cmsArticleContentService;
@Resource
private CmsLangLogService cmsLangLogService;
@Override
public PageResult<CmsArticleContent> pageRel(CmsArticleContentParam param) {
@@ -139,7 +140,7 @@ public class CmsArticleContentServiceImpl extends ServiceImpl<CmsArticleContentM
target.setContent(article.getContent());
System.out.println("target = " + target);
cmsArticleService.updateById(target);
cmsArticleContentService.update(new LambdaUpdateWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, target.getArticleId()).set(CmsArticleContent::getContent,target.getContent()));
this.update(new LambdaUpdateWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, target.getArticleId()).set(CmsArticleContent::getContent,target.getContent()));
}
}else {
// 新增操作
@@ -149,7 +150,7 @@ public class CmsArticleContentServiceImpl extends ServiceImpl<CmsArticleContentM
content.setArticleId(article.getArticleId());
content.setContent(article.getContent());
content.setTenantId(article.getTenantId());
cmsArticleContentService.save(content);
this.save(content);
}
}

View File

@@ -20,6 +20,7 @@ import com.gxwebsoft.common.core.utils.RedisUtil;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.service.UserService;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -41,12 +42,11 @@ import static com.gxwebsoft.common.core.constants.ArticleConstants.CACHE_KEY_ART
@Service
public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArticle> implements CmsArticleService {
@Resource
@Lazy
private CmsNavigationService cmsNavigationService;
@Resource
private CmsArticleContentService cmsArticleContentService;
@Resource
private CmsArticleContentService articleContentService;
@Resource
private UserService userService;
@Resource
private CmsModelService cmsModelService;
@@ -122,7 +122,7 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti
// article.setBanner(model.getBanner());
// }
// 附加文字内容
CmsArticleContent content = articleContentService.getOne(new LambdaQueryWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).last("limit 1"));
CmsArticleContent content = cmsArticleContentService.getOne(new LambdaQueryWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).last("limit 1"));
if (content != null) {
article.setContent(content.getContent());
}
@@ -172,9 +172,9 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti
content.setArticleId(article.getArticleId());
content.setContent(article.getContent());
content.setTenantId(article.getTenantId());
articleContentService.save(content);
cmsArticleContentService.save(content);
// 同步翻译并保存
articleContentService.translate(article);
cmsArticleContentService.translate(article);
return true;
}
} catch (Exception e) {
@@ -221,11 +221,11 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti
String key = CACHE_KEY_ARTICLE + article.getArticleId();
redisUtil.delete(key);
// 更新内容
final boolean update = articleContentService.update(new LambdaUpdateWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).set(CmsArticleContent::getContent, article.getContent()));
final boolean update = cmsArticleContentService.update(new LambdaUpdateWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).set(CmsArticleContent::getContent, article.getContent()));
if (update) {
// 同步翻译并保存
article.setIsUpdate(true);
articleContentService.translate(article);
cmsArticleContentService.translate(article);
return true;
} else {
// 添加内容
@@ -233,7 +233,7 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti
content.setArticleId(article.getArticleId());
content.setContent(article.getContent());
content.setTenantId(article.getTenantId());
articleContentService.save(content);
cmsArticleContentService.save(content);
}
return true;
}

View File

@@ -43,6 +43,7 @@ public class CmsDesignServiceImpl extends ServiceImpl<CmsDesignMapper, CmsDesign
@Lazy
private CmsNavigationService cmsNavigationService;
@Resource
@Lazy
private CmsArticleContentService cmsArticleContentService;
@Override

View File

@@ -16,6 +16,7 @@ import com.gxwebsoft.common.core.exception.BusinessException;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.service.UserService;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -31,6 +32,7 @@ import java.util.List;
@Service
public class CmsNavigationServiceImpl extends ServiceImpl<CmsNavigationMapper, CmsNavigation> implements CmsNavigationService {
@Resource
@Lazy
private CmsDesignService cmsDesignService;
@Resource
private CmsModelService cmsModelService;