Browse Source

feat(web): 实现新闻动态、产品中心和解决方案的增删改查功能

- 新增 NewsUpdatesDto 和 ProductCenterDto 数据传输对象
- 修改文件上传逻辑,支持封面图片和内容图片的上传与关联
- 实现文件批量删除功能
- 添加发布时间字段到新闻动态和解决方案实体- 更新资源映射路径前缀
-为网站前端提供完整的数据查询接口-优化文件管理服务,增加批量删除方法- 调整 BasicInfoController 中文件上传处理方式- 新增 WebSiteController 接口用于前端数据展示
- 完善 WebSiteService 及其实现类,支持分页和条件查询
nahida 8 tháng trước cách đây
mục cha
commit
678da1f945
20 tập tin đã thay đổi với 609 bổ sung53 xóa
  1. 37 15
      zksy-admin/src/main/java/com/zksy/web/controller/base/BasicInfoController.java
  2. 78 9
      zksy-admin/src/main/java/com/zksy/web/controller/base/NewsUpdatesController.java
  3. 74 8
      zksy-admin/src/main/java/com/zksy/web/controller/base/ProductCenterController.java
  4. 15 2
      zksy-admin/src/main/java/com/zksy/web/controller/base/QualificationCertificateController.java
  5. 74 8
      zksy-admin/src/main/java/com/zksy/web/controller/base/SolutionController.java
  6. 86 0
      zksy-admin/src/main/java/com/zksy/web/controller/base/WebSiteController.java
  7. 1 1
      zksy-common/src/main/java/com/zksy/common/constant/Constants.java
  8. 9 1
      zksy-system/src/main/java/com/zksy/base/domain/NewsUpdates.java
  9. 8 0
      zksy-system/src/main/java/com/zksy/base/domain/Solution.java
  10. 17 0
      zksy-system/src/main/java/com/zksy/base/domain/dto/NewsUpdatesDto.java
  11. 16 0
      zksy-system/src/main/java/com/zksy/base/domain/dto/ProductCenterDto.java
  12. 16 0
      zksy-system/src/main/java/com/zksy/base/domain/dto/SolutionDto.java
  13. 36 0
      zksy-system/src/main/java/com/zksy/base/domain/vo/ProductCenterVo.java
  14. 2 0
      zksy-system/src/main/java/com/zksy/base/service/FileManageService.java
  15. 22 2
      zksy-system/src/main/java/com/zksy/base/service/WebSiteService.java
  16. 13 0
      zksy-system/src/main/java/com/zksy/base/service/impl/FileManageServiceImpl.java
  17. 4 2
      zksy-system/src/main/java/com/zksy/base/service/impl/QualificationCertificateServiceImpl.java
  18. 97 4
      zksy-system/src/main/java/com/zksy/base/service/impl/WebSiteServiceImpl.java
  19. 2 0
      zksy-system/src/main/resources/mapper/base/NewsUpdatesMapper.xml
  20. 2 1
      zksy-system/src/main/resources/mapper/base/SolutionMapper.xml

+ 37 - 15
zksy-admin/src/main/java/com/zksy/web/controller/base/BasicInfoController.java

@@ -1,7 +1,9 @@
 package com.zksy.web.controller.base;
 
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zksy.base.domain.BasicInfo;
+import com.zksy.base.domain.FileManage;
 import com.zksy.base.service.BasicInfoService;
 import com.zksy.base.service.FileManageService;
 import com.zksy.common.core.domain.AjaxResult;
@@ -51,28 +53,48 @@ public class BasicInfoController {
     @PostMapping("/save")
     @ApiOperation(value = "首页信息保存")
     @Transactional
-    public AjaxResult save(@RequestBody BasicInfo entity) {
-        if(!entity.getCompanyProMultipartFile().isEmpty()) {
-            String companyProfilePath = fileManageService.uploadFilePath(entity.getCompanyProMultipartFile());
-            entity.setCompanyProfileUrl(companyProfilePath);
+    public AjaxResult save(@ModelAttribute BasicInfo entity) {
+        FileManage cover1 = null;
+        if(entity.getCompanyProMultipartFile() != null && !entity.getCompanyProMultipartFile().isEmpty()) {
+            AjaxResult result = fileManageService.uploadFile(entity.getCompanyProMultipartFile(), "0", "company_profile");
+            cover1 = (FileManage) result.get("data");
+            entity.setCompanyProfileUrl(cover1.getFileUrl());
         }
-        if(!entity.getQrCodeMultipartFile().isEmpty()){
-            String qrCodeMultipartFilePath = fileManageService.uploadFilePath(entity.getQrCodeMultipartFile());
-            entity.setQrCodeUrl(qrCodeMultipartFilePath);
+        FileManage cover2 = null;
+        if(entity.getQrCodeMultipartFile() != null && !entity.getQrCodeMultipartFile().isEmpty()){
+            AjaxResult result = fileManageService.uploadFile(entity.getQrCodeMultipartFile(), "0", "qr_code");
+            cover2 = (FileManage) result.get("data");
+            entity.setQrCodeUrl(cover2.getFileUrl());
         }
-        return service.save(entity) ? AjaxResult.success(entity): AjaxResult.error("保存失败");
+
+        service.save(entity);
+        if (cover1 != null ) {
+            LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(FileManage::getId, cover1.getId());
+            updateWrapper.set(FileManage::getFid, entity.getId());
+            fileManageService.update(updateWrapper);
+        }
+        if (cover2 != null) {
+            LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(FileManage::getId, cover2.getId());
+            updateWrapper.set(FileManage::getFid, entity.getId());
+            fileManageService.update(updateWrapper);
+        }
+        return AjaxResult.success(entity);
     }
     @PostMapping("/update")
     @ApiOperation(value = "首页信息修改")
     @Transactional
-    public AjaxResult update(@RequestBody BasicInfo entity) {
-        if(!entity.getCompanyProMultipartFile().isEmpty()) {
-            String companyProfilePath = fileManageService.uploadFilePath(entity.getCompanyProMultipartFile());
-            entity.setCompanyProfileUrl(companyProfilePath);
+    public AjaxResult update(@ModelAttribute BasicInfo entity) {
+        if(entity.getCompanyProMultipartFile() != null && !entity.getCompanyProMultipartFile().isEmpty()) {
+            AjaxResult result = fileManageService.uploadFile(entity.getCompanyProMultipartFile(), entity.getId(), "company_profile");
+            FileManage data = (FileManage) result.get("data");
+            entity.setCompanyProfileUrl(data.getFileUrl());
         }
-        if(!entity.getQrCodeMultipartFile().isEmpty()){
-            String qrCodeMultipartFilePath = fileManageService.uploadFilePath(entity.getQrCodeMultipartFile());
-            entity.setQrCodeUrl(qrCodeMultipartFilePath);
+        if(entity.getQrCodeMultipartFile() != null && !entity.getQrCodeMultipartFile().isEmpty()){
+            AjaxResult result = fileManageService.uploadFile(entity.getQrCodeMultipartFile(), entity.getId(), "qr_code");
+            FileManage data = (FileManage) result.get("data");
+            entity.setQrCodeUrl(data.getFileUrl());
         }
         entity.setUpdateTime(LocalDateTime.now());
         return service.updateById(entity) ? AjaxResult.success(entity): AjaxResult.error("修改失败");

+ 78 - 9
zksy-admin/src/main/java/com/zksy/web/controller/base/NewsUpdatesController.java

@@ -1,7 +1,13 @@
 package com.zksy.web.controller.base;
 
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.base.domain.FileManage;
 import com.zksy.base.domain.NewsUpdates;
+import com.zksy.base.domain.dto.NewsUpdatesDto;
 import com.zksy.base.service.FileManageService;
 import com.zksy.base.service.NewsUpdatesService;
 import com.zksy.common.core.domain.AjaxResult;
@@ -14,6 +20,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author Administrator
@@ -38,6 +46,7 @@ public class NewsUpdatesController {
         Page<NewsUpdates> page = new Page<>(pageNum, pageSize);
         return AjaxResult.success(service.page(page));
     }
+
     @GetMapping("/getNewsUpdatesList")
     @ApiOperation(value = "新闻动态查询")
     public AjaxResult getNewsUpdatesList(){
@@ -51,20 +60,80 @@ public class NewsUpdatesController {
     @PostMapping("/save")
     @ApiOperation(value = "新闻动态保存")
     @Transactional
-    public AjaxResult save(@RequestBody NewsUpdates entity) {
-        if(entity.getNewsMultipartFile() != null){
-            String filePath = fileManageService.uploadFilePath(entity.getNewsMultipartFile());
-            entity.setNewsUrl(filePath);
+    public AjaxResult save(@ModelAttribute NewsUpdatesDto entity) {
+        FileManage cover = null;
+        if (entity.getFile() != null) {
+            AjaxResult result = fileManageService.uploadFile(entity.getFile(), "0", "news_cover");
+            cover = (FileManage) result.get("data");
+            entity.setNewsUrl(cover.getFileUrl());
+        }
+        service.save(entity);
+        if (cover != null) {
+            LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(FileManage::getId, cover.getId());
+            updateWrapper.set(FileManage::getFid, entity.getId());
+            fileManageService.update(updateWrapper);
+        }
+        // 删除图片
+        if (entity.getDeletedImages() != null) {
+            JSON.parseArray(entity.getDeletedImages()).forEach(q -> {
+                int idIndex = q.toString().indexOf("id=");
+                if (idIndex != -1) {
+                    String id = q.toString().substring(idIndex + 3);
+                    fileManageService.deleteFile(id);
+                }
+            });
+        }
+
+        // 插入图片
+        if (entity.getInsertedImages() != null) {
+            JSON.parseArray(entity.getInsertedImages()).forEach(q -> {
+                int idIndex = q.toString().indexOf("id=");
+                if (idIndex != -1) {
+                    String id = q.toString().substring(idIndex + 3);
+                    LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.eq(FileManage::getId, id);
+                    updateWrapper.set(FileManage::getFid, entity.getId());
+                    fileManageService.update(updateWrapper);
+                }
+            });
         }
-        return service.save(entity) ? AjaxResult.success(entity): AjaxResult.error("保存失败");
+
+        return AjaxResult.success(entity);
     }
     @PostMapping("/update")
     @ApiOperation(value = "新闻动态修改")
     @Transactional
-    public AjaxResult update(@RequestBody NewsUpdates entity) {
-        if(entity.getNewsMultipartFile() != null){
-            String filePath = fileManageService.uploadFilePath(entity.getNewsMultipartFile());
-            entity.setNewsUrl(filePath);
+    public AjaxResult update(@ModelAttribute NewsUpdatesDto entity) {
+        if(entity.getFile() != null){
+            // 先删除旧的封面
+            List<FileManage> oldCovers = fileManageService.listFileByFid(entity.getId());
+            fileManageService.deleteFiles(oldCovers.stream().filter(q->q.getModuleName().equals("news_cover")).map(FileManage::getId).collect(Collectors.toList()));
+            // 上传新的封面
+            AjaxResult result = fileManageService.uploadFile(entity.getFile(), entity.getId(), "news_cover");
+            FileManage data = (FileManage) result.get("data");
+            entity.setNewsUrl(data.getFileUrl());
+        }
+        if(entity.getDeletedImages() != null){
+            JSON.parseArray(entity.getDeletedImages()).forEach(q->{
+                int idIndex = q.toString().indexOf("id=");
+                if(idIndex != -1){
+                    String id = q.toString().substring(idIndex + 3);
+                    fileManageService.deleteFile(id);
+                }
+            });
+        }
+        if(entity.getInsertedImages() != null){
+            JSON.parseArray(entity.getInsertedImages()).forEach(q->{
+                int idIndex = q.toString().indexOf("id=");
+                if(idIndex != -1){
+                    String id = q.toString().substring(idIndex + 3);
+                    LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.eq(FileManage::getId, id);
+                    updateWrapper.set(FileManage::getFid, entity.getId());
+                    fileManageService.update(updateWrapper);
+                }
+            });
         }
         entity.setUpdateTime(LocalDateTime.now());
         return service.updateById(entity) ? AjaxResult.success(entity): AjaxResult.error("修改失败");

+ 74 - 8
zksy-admin/src/main/java/com/zksy/web/controller/base/ProductCenterController.java

@@ -1,7 +1,11 @@
 package com.zksy.web.controller.base;
 
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.base.domain.FileManage;
 import com.zksy.base.domain.ProductCenter;
+import com.zksy.base.domain.dto.ProductCenterDto;
 import com.zksy.base.service.FileManageService;
 import com.zksy.base.service.ProductCenterService;
 import com.zksy.common.core.domain.AjaxResult;
@@ -14,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author Administrator
@@ -51,20 +57,80 @@ public class ProductCenterController {
     @PostMapping("/save")
     @ApiOperation(value = "产品中心保存")
     @Transactional
-    public AjaxResult save(@RequestBody ProductCenter entity) {
-        if(entity.getProductMultipartFile() != null){
-            String filePath = fileManageService.uploadFilePath(entity.getProductMultipartFile());
-            entity.setProductUrl(filePath);
+    public AjaxResult save(@ModelAttribute ProductCenterDto entity) {
+        FileManage cover = null;
+        if (entity.getProductMultipartFile() != null) {
+            AjaxResult result = fileManageService.uploadFile(entity.getProductMultipartFile(), "0", "product_cover");
+            cover = (FileManage) result.get("data");
+            entity.setProductUrl(cover.getFileUrl());
+        }
+        service.save(entity);
+        if (cover != null) {
+            LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(FileManage::getId, cover.getId());
+            updateWrapper.set(FileManage::getFid, entity.getId());
+            fileManageService.update(updateWrapper);
+        }
+        // 删除图片
+        if (entity.getDeletedImages() != null) {
+            JSON.parseArray(entity.getDeletedImages()).forEach(q -> {
+                int idIndex = q.toString().indexOf("id=");
+                if (idIndex != -1) {
+                    String id = q.toString().substring(idIndex + 3);
+                    fileManageService.deleteFile(id);
+                }
+            });
+        }
+
+        // 插入图片
+        if (entity.getInsertedImages() != null) {
+            JSON.parseArray(entity.getInsertedImages()).forEach(q -> {
+                int idIndex = q.toString().indexOf("id=");
+                if (idIndex != -1) {
+                    String id = q.toString().substring(idIndex + 3);
+                    LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.eq(FileManage::getId, id);
+                    updateWrapper.set(FileManage::getFid, entity.getId());
+                    fileManageService.update(updateWrapper);
+                }
+            });
         }
-        return service.save(entity) ? AjaxResult.success(entity): AjaxResult.error("保存失败");
+
+        return AjaxResult.success(entity);
     }
     @PostMapping("/update")
     @ApiOperation(value = "产品中心修改")
     @Transactional
-    public AjaxResult update(@RequestBody ProductCenter entity) {
+    public AjaxResult update(@ModelAttribute ProductCenterDto entity) {
         if(entity.getProductMultipartFile() != null){
-            String filePath = fileManageService.uploadFilePath(entity.getProductMultipartFile());
-            entity.setProductUrl(filePath);
+            // 先删除旧的封面
+            List<FileManage> oldCovers = fileManageService.listFileByFid(entity.getId());
+            fileManageService.deleteFiles(oldCovers.stream().filter(q->q.getModuleName().equals("product_cover")).map(FileManage::getId).collect(Collectors.toList()));
+            // 上传新的封面
+            AjaxResult result = fileManageService.uploadFile(entity.getProductMultipartFile(), entity.getId(), "product_cover");
+            FileManage data = (FileManage) result.get("data");
+            entity.setProductUrl(data.getFileUrl());
+        }
+        if(entity.getDeletedImages() != null){
+            JSON.parseArray(entity.getDeletedImages()).forEach(q->{
+                int idIndex = q.toString().indexOf("id=");
+                if(idIndex != -1){
+                    String id = q.toString().substring(idIndex + 3);
+                    fileManageService.deleteFile(id);
+                }
+            });
+        }
+        if(entity.getInsertedImages() != null){
+            JSON.parseArray(entity.getInsertedImages()).forEach(q->{
+                int idIndex = q.toString().indexOf("id=");
+                if(idIndex != -1){
+                    String id = q.toString().substring(idIndex + 3);
+                    LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.eq(FileManage::getId, id);
+                    updateWrapper.set(FileManage::getFid, entity.getId());
+                    fileManageService.update(updateWrapper);
+                }
+            });
         }
         entity.setUpdateTime(LocalDateTime.now());
         return service.updateById(entity) ? AjaxResult.success(entity): AjaxResult.error("修改失败");

+ 15 - 2
zksy-admin/src/main/java/com/zksy/web/controller/base/QualificationCertificateController.java

@@ -1,5 +1,7 @@
 package com.zksy.web.controller.base;
 
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.zksy.base.domain.QualificationCertificate;
 import com.zksy.base.service.QualificationCertificateService;
 import com.zksy.common.annotation.Anonymous;
@@ -11,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Administrator
@@ -49,8 +53,17 @@ public class QualificationCertificateController {
         return AjaxResult.success(service.saveQualificationCertificate( entity));
     }
     @PostMapping("/update")
-    @ApiOperation(value = "荣誉资质修改")
-    public AjaxResult update(@ModelAttribute QualificationCertificate entity) {
+    public AjaxResult update(@ModelAttribute QualificationCertificate entity,
+                             @RequestParam(value = "fileListJson", required = false) String fileListJson) {
+        if (fileListJson != null) {
+            ObjectMapper mapper = new ObjectMapper();
+            try {
+                List<Map<String,String>> list = mapper.readValue(fileListJson, new TypeReference<List<Map<String,String>>>() {});
+                entity.setFileList(list);
+            } catch (Exception e) {
+                throw new RuntimeException("fileList 解析失败", e);
+            }
+        }
         return AjaxResult.success(service.updateQualificationCertificate(entity));
     }
     @PostMapping("/deleteBatch")

+ 74 - 8
zksy-admin/src/main/java/com/zksy/web/controller/base/SolutionController.java

@@ -1,7 +1,11 @@
 package com.zksy.web.controller.base;
 
+import com.alibaba.fastjson2.JSON;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.base.domain.FileManage;
 import com.zksy.base.domain.Solution;
+import com.zksy.base.domain.dto.SolutionDto;
 import com.zksy.base.service.FileManageService;
 import com.zksy.base.service.SolutionService;
 import com.zksy.common.core.domain.AjaxResult;
@@ -14,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author Administrator
@@ -51,20 +57,80 @@ public class SolutionController {
     @PostMapping("/save")
     @ApiOperation(value = "解决方案保存")
     @Transactional
-    public AjaxResult save(@RequestBody Solution entity) {
-        if(entity.getSolutionMultipartFile() != null){
-            String filePath = fileManageService.uploadFilePath(entity.getSolutionMultipartFile());
-            entity.setProductUrl(filePath);
+    public AjaxResult save(@ModelAttribute SolutionDto entity) {
+        FileManage cover = null;
+        if (entity.getSolutionMultipartFile() != null) {
+            AjaxResult result = fileManageService.uploadFile(entity.getSolutionMultipartFile(), "0", "solution_cover");
+            cover = (FileManage) result.get("data");
+            entity.setProductUrl(cover.getFileUrl());
+        }
+        service.save(entity);
+        if (cover != null) {
+            LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(FileManage::getId, cover.getId());
+            updateWrapper.set(FileManage::getFid, entity.getId());
+            fileManageService.update(updateWrapper);
+        }
+        // 删除图片
+        if (entity.getDeletedImages() != null) {
+            JSON.parseArray(entity.getDeletedImages()).forEach(q -> {
+                int idIndex = q.toString().indexOf("id=");
+                if (idIndex != -1) {
+                    String id = q.toString().substring(idIndex + 3);
+                    fileManageService.deleteFile(id);
+                }
+            });
+        }
+
+        // 插入图片
+        if (entity.getInsertedImages() != null) {
+            JSON.parseArray(entity.getInsertedImages()).forEach(q -> {
+                int idIndex = q.toString().indexOf("id=");
+                if (idIndex != -1) {
+                    String id = q.toString().substring(idIndex + 3);
+                    LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.eq(FileManage::getId, id);
+                    updateWrapper.set(FileManage::getFid, entity.getId());
+                    fileManageService.update(updateWrapper);
+                }
+            });
         }
-        return service.save(entity) ? AjaxResult.success(entity): AjaxResult.error("保存失败");
+
+        return AjaxResult.success(entity);
     }
     @PostMapping("/update")
     @ApiOperation(value = "解决方案修改")
     @Transactional
-    public AjaxResult update(@RequestBody Solution entity) {
+    public AjaxResult update(@ModelAttribute SolutionDto entity) {
         if(entity.getSolutionMultipartFile() != null){
-            String filePath = fileManageService.uploadFilePath(entity.getSolutionMultipartFile());
-            entity.setProductUrl(filePath);
+            // 先删除旧的封面
+            List<FileManage> oldCovers = fileManageService.listFileByFid(entity.getId());
+            fileManageService.deleteFiles(oldCovers.stream().filter(q->q.getModuleName().equals("solution_cover")).map(FileManage::getId).collect(Collectors.toList()));
+            // 上传新的封面
+            AjaxResult result = fileManageService.uploadFile(entity.getSolutionMultipartFile(), entity.getId(), "solution_cover");
+            FileManage data = (FileManage) result.get("data");
+            entity.setProductUrl(data.getFileUrl());
+        }
+        if(entity.getDeletedImages() != null){
+            JSON.parseArray(entity.getDeletedImages()).forEach(q->{
+                int idIndex = q.toString().indexOf("id=");
+                if(idIndex != -1){
+                    String id = q.toString().substring(idIndex + 3);
+                    fileManageService.deleteFile(id);
+                }
+            });
+        }
+        if(entity.getInsertedImages() != null){
+            JSON.parseArray(entity.getInsertedImages()).forEach(q->{
+                int idIndex = q.toString().indexOf("id=");
+                if(idIndex != -1){
+                    String id = q.toString().substring(idIndex + 3);
+                    LambdaUpdateWrapper<FileManage> updateWrapper = new LambdaUpdateWrapper<>();
+                    updateWrapper.eq(FileManage::getId, id);
+                    updateWrapper.set(FileManage::getFid, entity.getId());
+                    fileManageService.update(updateWrapper);
+                }
+            });
         }
         entity.setUpdateTime(LocalDateTime.now());
         return service.updateById(entity) ? AjaxResult.success(entity): AjaxResult.error("修改失败");

+ 86 - 0
zksy-admin/src/main/java/com/zksy/web/controller/base/WebSiteController.java

@@ -42,4 +42,90 @@ public class WebSiteController {
         return AjaxResult.success(webSiteService.getDevelopmentHistory());
     }
 
+    @GetMapping("/getHonor")
+    @ApiOperation("获取荣誉资质")
+    @Anonymous
+    public AjaxResult getHoner() {
+        return AjaxResult.success(webSiteService.getHoner());
+    }
+
+    @GetMapping("/getBasicInfo")
+    @ApiOperation("获取基本信息")
+    @Anonymous
+    public AjaxResult getBasicInfo() {
+        return AjaxResult.success(webSiteService.getBasicInfo());
+    }
+
+    @GetMapping("/getNewsUpdatesListWithoutSpecialNews")
+    @ApiOperation("获取新闻动态")
+    @Anonymous
+    public AjaxResult getNewsUpdatesListWithoutSpecialNews(
+            Integer pageNum,
+            Integer pageSize
+    ) {
+        return AjaxResult.success(webSiteService.getNewsUpdatesListWithoutSpecialNews(pageNum, pageSize));
+    }
+
+    @GetMapping("/getSpecialNewsUpdatesList")
+    @ApiOperation("获取特别新闻")
+    @Anonymous
+    public AjaxResult getSpecialNewsUpdatesList(
+            Integer pageNum,
+            Integer pageSize
+    ) {
+        return AjaxResult.success(webSiteService.getSpecialNewsUpdatesList(pageNum, pageSize));
+    }
+
+    @GetMapping("/getNewsUpdatesById")
+    @ApiOperation("根据id获取新闻动态")
+    @Anonymous
+    public AjaxResult getNewsUpdatesById(
+            String id
+    ) {
+        return AjaxResult.success(webSiteService.getNewsUpdatesById(id));
+    }
+
+    @GetMapping("/getSolution")
+    @ApiOperation("获取解决方案")
+    @Anonymous
+    public AjaxResult getSolution(
+            Integer pageNum,
+            Integer pageSize
+    ) {
+        return AjaxResult.success(webSiteService.getSolution(pageNum, pageSize));
+    }
+
+    @GetMapping("/getSolutionById")
+    @ApiOperation("根据id获取解决方案")
+    @Anonymous
+    public AjaxResult getSolutionById(
+            String id
+    ) {
+        return AjaxResult.success(webSiteService.getSolutionById(id));
+    }
+
+    @GetMapping("/getProductCategoryAndType")
+    @ApiOperation("获取产品分类和类型")
+    @Anonymous
+    public AjaxResult getProductCategoryAndType() {
+        return AjaxResult.success(webSiteService.getProductCategoryAndType());
+    }
+
+    @GetMapping("/getProductByPage")
+    @ApiOperation("分页获取产品列表")
+    @Anonymous
+    public AjaxResult getProductByPage(
+            Integer pageNum,
+            Integer pageSize
+    ) {
+        return AjaxResult.success(webSiteService.getProductByPage(pageNum, pageSize));
+    }
+    @GetMapping("/getProductById")
+    @ApiOperation("根据id获取产品详情")
+    @Anonymous
+    public AjaxResult getProductById(
+            String id
+    ) {
+        return AjaxResult.success(webSiteService.getProductById(id));
+    }
 }

+ 1 - 1
zksy-common/src/main/java/com/zksy/common/constant/Constants.java

@@ -138,7 +138,7 @@ public class Constants
     /**
      * 资源映射路径 前缀
      */
-    public static final String RESOURCE_PREFIX = "/profile";
+    public static final String RESOURCE_PREFIX = "/profile/zksy/website";
 
     /**
      * RMI 远程方法调用

+ 9 - 1
zksy-system/src/main/java/com/zksy/base/domain/NewsUpdates.java

@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -42,9 +44,15 @@ public class NewsUpdates implements Serializable {
     @TableField(value = "news_url")
     private String newsUrl;
 
+    /**
+     * 发布时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate releaseTime;
+
     @TableField(exist = false)
     @JsonIgnore
-    private MultipartFile newsMultipartFile;
+    private MultipartFile file;
 
     /**
      * 创建人

+ 8 - 0
zksy-system/src/main/java/com/zksy/base/domain/Solution.java

@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -36,6 +38,12 @@ public class Solution implements Serializable {
     @TableField(value = "program_details")
     private String programDetails;
 
+    /**
+     * 发布时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate releaseTime;
+
     /**
      * 方案图片地址
      */

+ 17 - 0
zksy-system/src/main/java/com/zksy/base/domain/dto/NewsUpdatesDto.java

@@ -0,0 +1,17 @@
+package com.zksy.base.domain.dto;
+
+import com.zksy.base.domain.NewsUpdates;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class NewsUpdatesDto extends NewsUpdates {
+    private String deletedImages;
+    private String insertedImages;
+}

+ 16 - 0
zksy-system/src/main/java/com/zksy/base/domain/dto/ProductCenterDto.java

@@ -0,0 +1,16 @@
+package com.zksy.base.domain.dto;
+
+import com.zksy.base.domain.ProductCenter;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class ProductCenterDto extends ProductCenter {
+    private String deletedImages;
+    private String insertedImages;
+}

+ 16 - 0
zksy-system/src/main/java/com/zksy/base/domain/dto/SolutionDto.java

@@ -0,0 +1,16 @@
+package com.zksy.base.domain.dto;
+
+import com.zksy.base.domain.Solution;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SolutionDto extends Solution {
+    private String deletedImages;
+    private String insertedImages;
+}

+ 36 - 0
zksy-system/src/main/java/com/zksy/base/domain/vo/ProductCenterVo.java

@@ -0,0 +1,36 @@
+package com.zksy.base.domain.vo;
+
+import com.zksy.base.domain.ProductCenter;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+public class ProductCenterVo {
+    private String productCategoryName;
+    private List<ProductType> productTypes;
+
+    @AllArgsConstructor
+    @NoArgsConstructor
+    @Data
+    public static class ProductType{
+        private String productTypeName;
+        private List<ProductItem> productCenters;
+    }
+
+    @AllArgsConstructor
+    @NoArgsConstructor
+    @Data
+    public static class ProductItem{
+        private String productId;
+        private String productCategory;
+        private String productType;
+        private String productName;
+        private String productUrl;
+    }
+}
+

+ 2 - 0
zksy-system/src/main/java/com/zksy/base/service/FileManageService.java

@@ -48,6 +48,8 @@ public interface FileManageService extends IService<FileManage> {
      */
     AjaxResult deleteFile(String id);
 
+    String deleteFiles(List<String> ids);
+
     List<FileManage> listFileByFid(String id);
     /**
      * 根据多个 fid 批量查询文件列表

+ 22 - 2
zksy-system/src/main/java/com/zksy/base/service/WebSiteService.java

@@ -1,8 +1,8 @@
 package com.zksy.base.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zksy.base.domain.AboutDevelopmentHistory;
-import com.zksy.base.domain.SmartEmployment;
+import com.zksy.base.domain.*;
+import com.zksy.base.domain.vo.ProductCenterVo;
 
 import java.util.List;
 
@@ -13,4 +13,24 @@ public interface WebSiteService {
     SmartEmployment getRecruitmentInfoById(String id);
 
     List<AboutDevelopmentHistory> getDevelopmentHistory();
+
+    List<QualificationCertificate> getHoner();
+
+    List<BasicInfo> getBasicInfo();
+
+    Page<NewsUpdates> getNewsUpdatesListWithoutSpecialNews(Integer pageNum, Integer pageSize);
+
+    Page<NewsUpdates> getSpecialNewsUpdatesList(Integer pageNum, Integer pageSize);
+
+    NewsUpdates getNewsUpdatesById(String id);
+
+    Solution getSolutionById(String id);
+
+    Page<Solution> getSolution(Integer pageNum, Integer pageSize);
+
+    List<ProductCenterVo> getProductCategoryAndType();
+
+    ProductCenter getProductById(String id);
+
+    Page<ProductCenter> getProductByPage(Integer pageNum, Integer pageSize);
 }

+ 13 - 0
zksy-system/src/main/java/com/zksy/base/service/impl/FileManageServiceImpl.java

@@ -89,6 +89,7 @@ public class FileManageServiceImpl extends ServiceImpl<FileManageMapper, FileMan
             uploadRes.setCreateBy("管理员");
             uploadRes.setModuleName(moduleName);
             mapper.insert(uploadRes);
+            uploadRes.setFileUrl(url+"?id="+uploadRes.getId());
             return AjaxResult.success("文件上传成功",uploadRes);
         } catch (IOException e) {
             log.error("文件上传异常!");
@@ -214,6 +215,18 @@ public class FileManageServiceImpl extends ServiceImpl<FileManageMapper, FileMan
         }
     }
 
+    @Override
+    @Transactional
+    public String deleteFiles(List<String> ids) {
+        if (ids == null || ids.isEmpty()) {
+            return "删除失败:文件ID集合不能为空";
+        }
+        for (String id : ids) {
+            deleteFile(id);
+        }
+        return "删除成功";
+    }
+
     @Override
     public List<FileManage> listFileByFid(String id) {
         LambdaQueryWrapper<FileManage> wrapper = new LambdaQueryWrapper<>();

+ 4 - 2
zksy-system/src/main/java/com/zksy/base/service/impl/QualificationCertificateServiceImpl.java

@@ -119,8 +119,10 @@ public class QualificationCertificateServiceImpl extends ServiceImpl<Qualificati
             List<String> mapIds = entity.getFileList().stream().map(map -> map.get("id")).collect(Collectors.toList());
             //找到他们不等于的进行文件删除
             List<String> removeIds = ids.stream().filter(id -> !mapIds.contains(id)).collect(Collectors.toList());
-            AjaxResult ajaxResult = fileManageService.deleteFileByFids(removeIds);
-            if(!ajaxResult.isSuccess()){
+            try {
+                fileManageService.deleteFiles(removeIds);
+            } catch (Exception e) {
+                log.error("文件删除失败", e);
                 throw new RuntimeException("文件删除失败");
             }
         }

+ 97 - 4
zksy-system/src/main/java/com/zksy/base/service/impl/WebSiteServiceImpl.java

@@ -1,17 +1,21 @@
 package com.zksy.base.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zksy.base.domain.AboutDevelopmentHistory;
-import com.zksy.base.domain.SmartEmployment;
-import com.zksy.base.mapper.AboutDevelopmentHistoryMapper;
-import com.zksy.base.mapper.SmartEmploymentMapper;
+import com.zksy.base.domain.*;
+import com.zksy.base.domain.vo.ProductCenterVo;
+import com.zksy.base.mapper.*;
+import com.zksy.base.service.BasicInfoService;
+import com.zksy.base.service.QualificationCertificateService;
 import com.zksy.base.service.WebSiteService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class WebSiteServiceImpl implements WebSiteService {
@@ -19,6 +23,17 @@ public class WebSiteServiceImpl implements WebSiteService {
     private SmartEmploymentMapper smartEmploymentMapper;
     @Autowired
     private AboutDevelopmentHistoryMapper aboutDevelopmentHistoryMapper;
+    @Autowired
+    private QualificationCertificateService qualificationCertificateService;
+    @Autowired
+    private BasicInfoService basicInfoService;
+    @Autowired
+    private NewsUpdatesMapper newsUpdatesMapper;
+    @Autowired
+    private SolutionMapper solutionMapper;
+    @Autowired
+    private ProductCenterMapper productCenterMapper;
+
     @Override
     public Page<SmartEmployment> getRecruitmentInfoByPage(Integer pageNum, Integer pageSize) {
         Page<SmartEmployment> page = new Page<>(pageNum, pageSize);
@@ -36,4 +51,82 @@ public class WebSiteServiceImpl implements WebSiteService {
         wrapper.orderByAsc(AboutDevelopmentHistory::getYear);
         return aboutDevelopmentHistoryMapper.selectList(wrapper);
     }
+
+    @Override
+    public List<QualificationCertificate> getHoner() {
+        return qualificationCertificateService.listQualificationCertificate();
+    }
+
+    @Override
+    public List<BasicInfo> getBasicInfo() {
+        return basicInfoService.list();
+    }
+
+    @Override
+    public Page<NewsUpdates> getNewsUpdatesListWithoutSpecialNews(Integer pageNum, Integer pageSize) {
+        return newsUpdatesMapper.selectPage(new Page<>(pageNum, pageSize), Wrappers.lambdaQuery(NewsUpdates.class).eq(NewsUpdates::getIsSpecial, false));
+    }
+
+    @Override
+    public Page<NewsUpdates> getSpecialNewsUpdatesList(Integer pageNum, Integer pageSize) {
+        return newsUpdatesMapper.selectPage(new Page<>(pageNum, pageSize), Wrappers.lambdaQuery(NewsUpdates.class).eq(NewsUpdates::getIsSpecial, true));
+    }
+
+    @Override
+    public NewsUpdates getNewsUpdatesById(String id) {
+        return newsUpdatesMapper.selectById(id);
+    }
+
+    @Override
+    public Solution getSolutionById(String id) {
+        return solutionMapper.selectById(id);
+    }
+
+    @Override
+    public Page<Solution> getSolution(Integer pageNum, Integer pageSize) {
+        return solutionMapper.selectPage(new Page<>(pageNum, pageSize), Wrappers.emptyWrapper());
+    }
+
+    @Override
+    public List<ProductCenterVo> getProductCategoryAndType() {
+        return productCenterMapper.selectList(Wrappers.emptyWrapper())
+                .stream()
+                .collect(
+                        Collectors.groupingBy(ProductCenter::getProductCategory)
+                )
+                .entrySet()
+                .stream()
+                .map(entry -> new ProductCenterVo(
+                                entry.getKey(),
+                                entry.getValue().stream().collect(
+                                        Collectors.groupingBy(ProductCenter::getProductType)
+                                ).entrySet().stream().map(
+                                        typeEntry -> new ProductCenterVo.ProductType(
+                                                typeEntry.getKey(),
+                                                typeEntry.getValue().stream().map(
+                                                        productCenter -> new ProductCenterVo.ProductItem(
+                                                                productCenter.getId(),
+                                                                productCenter.getProductCategory(),
+                                                                productCenter.getProductType(),
+                                                                productCenter.getProductName(),
+                                                                productCenter.getProductUrl()
+                                                        )
+                                                ).collect(Collectors.toList())
+                                        )
+                                ).collect(Collectors.toList())
+                        )
+                ).collect(Collectors.toList());
+    }
+
+    @Override
+    public ProductCenter getProductById(String id) {
+        return productCenterMapper.selectById(id);
+    }
+
+    @Override
+    public Page<ProductCenter> getProductByPage(Integer pageNum, Integer pageSize) {
+        Page<ProductCenter> page = new Page<>(pageNum, pageSize);
+        return productCenterMapper.selectPage(page, Wrappers.emptyWrapper());
+    }
+
 }

+ 2 - 0
zksy-system/src/main/resources/mapper/base/NewsUpdatesMapper.xml

@@ -14,11 +14,13 @@
             <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
             <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
             <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="releaseTime" column="release_time" jdbcType="DATE"/>
     </resultMap>
 
     <sql id="Base_Column_List">
         id,news_name,news_details,
         news_url,is_special,create_by,create_time,
+        release_time,
         update_by,update_time
     </sql>
 </mapper>

+ 2 - 1
zksy-system/src/main/resources/mapper/base/SolutionMapper.xml

@@ -9,6 +9,7 @@
             <result property="programName" column="program_name" jdbcType="VARCHAR"/>
             <result property="programDetails" column="program_details" jdbcType="VARCHAR"/>
             <result property="productUrl" column="product_url" jdbcType="VARCHAR"/>
+            <result property="releaseTime" column="release_time" jdbcType="DATE"/>
             <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
             <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
             <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
@@ -16,7 +17,7 @@
     </resultMap>
 
     <sql id="Base_Column_List">
-        id,program_name,program_details,
+        id,program_name,program_details,release_time,
         product_url,create_by,create_time,
         update_by,update_time
     </sql>