| | |
| | | package com.xcong.farmer.cms.modules.system.service.Impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.xcong.farmer.cms.common.utils.FileUtils; |
| | | import com.xcong.farmer.cms.configurations.properties.CmsProperties; |
| | | import com.xcong.farmer.cms.modules.core.service.ICmsCoreService; |
| | | import com.xcong.farmer.cms.modules.system.entity.ArticleEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.ColumnEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.CompanyEntity; |
| | | import com.xcong.farmer.cms.modules.system.entity.WebSettingEntity; |
| | | import com.xcong.farmer.cms.modules.system.mapper.ArticleMapper; |
| | | import com.xcong.farmer.cms.modules.system.mapper.ColumnMapper; |
| | |
| | | |
| | | @Autowired |
| | | private ICmsCoreService cmsCoreService; |
| | | |
| | | @Autowired |
| | | private CmsProperties cmsProperties; |
| | | |
| | | @Autowired |
| | | private CompanyMapper companyMapper; |
| | | |
| | | @Autowired |
| | | private WebSetMapper webSetMapper; |
| | |
| | | ColumnEntity columnEntity = columnMapper.selectById(id); |
| | | Map<String, Object> map = buildColumnData(columnEntity); |
| | | |
| | | if (columnEntity.getBeforeParentId() != -1 || !"-1".equals(columnEntity.getBeforeColumnCode())) { |
| | | CompanyEntity company = companyMapper.selectById(companyId); |
| | | if (!"-1".equals(columnEntity.getBeforeColumnCode())) { |
| | | String outputPath = FileUtils.path(cmsProperties.getOutputPath(), company.getCode()) + "/" + columnEntity.getBeforeColumnCode(); |
| | | log.info("删除路径为:{}", outputPath); |
| | | FileUtil.del(outputPath); |
| | | } |
| | | |
| | | if (columnEntity.getBeforeParentId() != -1) { |
| | | ColumnEntity parent = columnMapper.selectById(columnEntity.getBeforeParentId()); |
| | | String path = cmsProperties.getOutputPath() + parent.getPath() + "/" + columnEntity.getColumnCode(); |
| | | log.info("删除路径为:{}", path); |
| | | FileUtil.del(path); |
| | | } |
| | | |
| | | columnEntity.setBeforeColumnCode("-1"); |
| | | columnEntity.setBeforeParentId(-1L); |
| | | columnMapper.updateById(columnEntity); |
| | | releaseAll(companyId); |
| | | return; |
| | | } |
| | | |
| | | executor.execute(() -> { |
| | | List<ArticleEntity> articles = articleMapper.selectArticleByColumnId(columnEntity.getId(), companyId, type); |
| | | if (CollUtil.isNotEmpty(articles)) { |
| | |
| | | } |
| | | |
| | | map.put("id", columnEntity.getId()); |
| | | |
| | | cmsCoreService.columnProcess(map, columnEntity.getListTemplate()); |
| | | if (columnEntity.getParentId() != 0L) { |
| | | ColumnEntity parentColumn = columnMapper.selectById(columnEntity.getParentId()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | column.setBeforeColumnCode("-1"); |
| | | column.setParentId(-1L); |
| | | columnMapper.updateById(column); |
| | | Map<String, Object> data = buildColumnData(column); |
| | | cmsCoreService.columnProcess(data, column.getListTemplate()); |
| | | } |