com.aliyun.oss
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/controller/MatterController.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/controller/MatterController.java
index 1872f26..495d727 100644
--- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/controller/MatterController.java
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/controller/MatterController.java
@@ -11,6 +11,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
/**
*
@@ -56,4 +60,18 @@ public class MatterController {
matterManage.saveOrUpdate(req);
}
+ @PostMapping("/importGovServiceMatter")
+ @WebLog("导入政务服务事项")
+ @ApiOperation("导入政务服务事项")
+ public void importGovServiceMatter(@RequestParam("file") MultipartFile file) {
+ matterManage.govServiceMatterImport(file);
+ }
+
+ @GetMapping("/downloadGovServiceMatterTemplate")
+ @WebLog("下载政策服务事项配置模板")
+ @ApiOperation("下载政策服务事项配置模板")
+ public void downloadGovServiceMatterTemplate(HttpServletResponse response) {
+ matterManage.downloadGovServiceMatterTemplate(response);
+ }
+
}
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/manage/AdminMatterManage.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/manage/AdminMatterManage.java
index 8bae300..3181002 100644
--- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/manage/AdminMatterManage.java
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/manage/AdminMatterManage.java
@@ -1,21 +1,53 @@
package com.ningdatech.kqapi.admin.manage;
+import cn.hutool.core.io.resource.ClassPathResource;
+import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.ContentType;
+import cn.hutool.poi.excel.ExcelUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.ExcelReader;
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.IdVo;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;
+import com.ningdatech.basic.util.ValidUtil;
+import com.ningdatech.basic.util.ValidatorUtil;
+import com.ningdatech.kqapi.admin.mapper.ZoneMapper;
+import com.ningdatech.kqapi.admin.model.dto.GovServiceMatterImportDTO;
+import com.ningdatech.kqapi.admin.model.entity.Window;
+import com.ningdatech.kqapi.admin.model.entity.Zone;
import com.ningdatech.kqapi.admin.model.req.MatterListReq;
import com.ningdatech.kqapi.admin.model.vo.MatterDetailDTO;
import com.ningdatech.kqapi.admin.model.vo.MatterListVO;
+import com.ningdatech.kqapi.admin.service.IWindowService;
+import com.ningdatech.kqapi.common.exception.BizException;
+import com.ningdatech.kqapi.zzsfw.enumeration.ItemTypeEnum;
import com.ningdatech.kqapi.zzsfw.model.entity.KqZzsfwMenu;
import com.ningdatech.kqapi.zzsfw.service.IKqZzsfwMenuService;
import lombok.RequiredArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
*
@@ -29,7 +61,10 @@ import java.util.List;
@RequiredArgsConstructor
public class AdminMatterManage {
+ private static final Logger log = LoggerFactory.getLogger(AdminMatterManage.class);
private final IKqZzsfwMenuService zzsfwMenuService;
+ private final ZoneMapper zoneMapper;
+ private final IWindowService windowService;
public PageVo pageMatter(MatterListReq req) {
Wrapper query = Wrappers.lambdaQuery(KqZzsfwMenu.class)
@@ -121,4 +156,85 @@ public class AdminMatterManage {
zzsfwMenuService.saveOrUpdate(matter);
}
+ public void govServiceMatterImport(MultipartFile file) {
+ try (InputStream is = file.getInputStream()) {
+ List imports = EasyExcel.read(is,
+ new AnalysisEventListener() {
+ @Override
+ public void invoke(GovServiceMatterImportDTO data, AnalysisContext context) {
+ String errMsg = ValidUtil.validFast(data);
+ if (errMsg != null) {
+ throw BizException.wrap(errMsg);
+ }
+ }
+
+ @Override
+ public void doAfterAllAnalysed(AnalysisContext context) {
+ // do nothing
+ }
+ })
+ .headRowNumber(1)
+ .head(GovServiceMatterImportDTO.class)
+ .excelType(ExcelTypeEnum.XLSX)
+ .ignoreEmptyRow(true)
+ .autoCloseStream(true)
+ .doReadAllSync();
+ Map> mattersByZone = CollUtils.group(imports, GovServiceMatterImportDTO::getZoneName);
+ Wrapper zoneQuery = Wrappers.lambdaQuery(Zone.class)
+ .in(Zone::getZoneName, mattersByZone.keySet());
+ List zones = zoneMapper.selectList(zoneQuery);
+ if (zones.size() != mattersByZone.size()) {
+ throw BizException.wrap("导入失败:服务专区不存在");
+ }
+ Map zoneMap = CollUtils.listToMap(zones, Zone::getZoneName);
+ List newMatters = new ArrayList<>();
+ mattersByZone.forEach((zoneName, matters) -> {
+ Zone zone = zoneMap.get(zoneName);
+ Assert.notNull(zone, "服务专区不存在");
+ Map> mattersByWin = CollUtils.group(matters, GovServiceMatterImportDTO::getWindowName);
+ Wrapper windowQuery = Wrappers.lambdaQuery(Window.class)
+ .eq(Window::getZoneId, zone.getId())
+ .in(Window::getWindowName, mattersByWin.keySet());
+ List windows = windowService.list(windowQuery);
+ if (windows.size() != mattersByWin.size()) {
+ throw BizException.wrap("导入失败:服务窗口不存在");
+ }
+ Map windowMap = CollUtils.listToMap(windows, Window::getWindowName);
+ for (GovServiceMatterImportDTO matter : matters) {
+ Window window = windowMap.get(matter.getWindowName());
+ Assert.notNull(window, "服务窗口不存在");
+ KqZzsfwMenu menu = new KqZzsfwMenu();
+ menu.setWindowId(window.getId());
+ menu.setZoneId(zone.getId());
+ menu.setItemName(matter.getMatterName());
+ menu.setWebapplyurl(matter.getWebApplyUrl());
+ menu.setWindow(window.getWindowName());
+ menu.setZoneName(zone.getZoneName());
+ menu.setDepartment(matter.getDepartment());
+ menu.setSort(99);
+ menu.setType(ItemTypeEnum.GOV.getCode());
+ newMatters.add(menu);
+ }
+ });
+ zzsfwMenuService.saveBatch(newMatters);
+ } catch (IOException e) {
+ log.error("导入失败:", e);
+ throw BizException.wrap("政务服务事项导入失败");
+ }
+ }
+
+ public void downloadGovServiceMatterTemplate(HttpServletResponse response) {
+ final ClassPathResource resource = new ClassPathResource("/template/政策服务事项配置模板.xlsx");
+ try (ServletOutputStream os = response.getOutputStream()) {
+ response.setContentType(ExcelUtil.XLSX_CONTENT_TYPE);
+ String fileName = URLEncoder.encode(resource.getFile().getName(), "UTF-8");
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName);
+ os.write(resource.readBytes());
+ os.flush();
+ } catch (IOException e) {
+ log.error("下载失败:", e);
+ throw BizException.wrap("政策服务事项配置模板下载失败");
+ }
+ }
+
}
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/dto/GovServiceMatterImportDTO.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/dto/GovServiceMatterImportDTO.java
new file mode 100644
index 0000000..07dc419
--- /dev/null
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/dto/GovServiceMatterImportDTO.java
@@ -0,0 +1,48 @@
+package com.ningdatech.kqapi.admin.model.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ *
+ * GovServiceMatterImportDTO
+ *
+ *
+ * @author WendyYang
+ * @since 15:27 2024/4/23
+ */
+@Data
+public class GovServiceMatterImportDTO {
+
+ @ExcelProperty(value = "序号")
+ @ExcelIgnore
+ private Integer rowNo;
+
+ @ExcelProperty(value = "服务专区")
+ @NotBlank(message = "服务专区不能为空")
+ private String zoneName;
+
+ @ExcelProperty(value = "服务窗口")
+ @NotBlank(message = "服务窗口不能为空")
+ private String windowName;
+
+ @ExcelProperty(value = "服务事项名称")
+ @NotBlank(message = "服务事项名称不能为空")
+ private String matterName;
+
+ @ExcelProperty(value = "办理渠道")
+ @NotBlank(message = "办理渠道不能为空")
+ private String handleChannel;
+
+ @ExcelProperty(value = "政务服务链接")
+ @NotBlank(message = "政务服务链接不能为空")
+ private String webApplyUrl;
+
+ @ExcelProperty(value = "牵头部门")
+ @NotBlank(message = "牵头部门不能为空")
+ private String department;
+
+}
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/vo/WebMatterDetailVO.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/vo/WebMatterDetailVO.java
new file mode 100644
index 0000000..2df41af
--- /dev/null
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/vo/WebMatterDetailVO.java
@@ -0,0 +1,25 @@
+package com.ningdatech.kqapi.admin.model.vo;
+
+import com.ningdatech.file.entity.vo.result.FileResultVO;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ *
+ * WebMatterDetailVO
+ *
+ *
+ * @author WendyYang
+ * @since 14:42 2024/4/23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WebMatterDetailVO extends MatterDetailDTO {
+
+ @ApiModelProperty("宣传材料访文件信息")
+ private List publicityMaterialsFiles;
+
+}
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/controller/KqZzsfwMenuController.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/controller/KqZzsfwMenuController.java
index 99fa367..084beb3 100644
--- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/controller/KqZzsfwMenuController.java
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/controller/KqZzsfwMenuController.java
@@ -1,10 +1,10 @@
package com.ningdatech.kqapi.zzsfw.controller;
+import com.ningdatech.kqapi.admin.model.vo.WebMatterDetailVO;
import com.ningdatech.kqapi.common.exception.BizException;
import com.ningdatech.kqapi.zzsfw.model.dto.KqZzsfwMattersDeduplicateDTO;
import com.ningdatech.kqapi.zzsfw.model.dto.KqZzsfwMenuDTO;
import com.ningdatech.kqapi.zzsfw.model.vo.MatterTopVO;
-import com.ningdatech.kqapi.zzsfw.model.vo.MattersVO;
import com.ningdatech.kqapi.zzsfw.model.vo.TreeVO;
import com.ningdatech.kqapi.zzsfw.manage.MatterManage;
import lombok.RequiredArgsConstructor;
@@ -55,7 +55,7 @@ public class KqZzsfwMenuController {
}
@GetMapping("/matter-list")
- public List matterList(@RequestParam(required = false) String windowName,
+ public List matterList(@RequestParam(required = false) String windowName,
@RequestParam(required = false) String zoneName,
@RequestParam(required = false) String department,
@RequestParam(required = false) Integer type) {
@@ -63,7 +63,7 @@ public class KqZzsfwMenuController {
}
@GetMapping("/matter/{id}")
- public MattersVO matter(@PathVariable Long id) {
+ public WebMatterDetailVO matter(@PathVariable Long id) {
return matterManage.matter(id);
}
@@ -114,5 +114,11 @@ public class KqZzsfwMenuController {
public String update4_10() {
return matterManage.update4_10();
}
+
+ @PostMapping("/initOldData")
+ public void initOldData(){
+ matterManage.initOldData();
+ }
+
}
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java
index 5758003..ecc6ff4 100644
--- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java
@@ -4,10 +4,18 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
+import com.ningdatech.file.entity.File;
+import com.ningdatech.file.entity.vo.result.AttachFileVo;
+import com.ningdatech.file.entity.vo.result.FileResultVO;
+import com.ningdatech.file.service.FileService;
+import com.ningdatech.kqapi.admin.manage.AdminMatterManage;
import com.ningdatech.kqapi.admin.model.entity.Window;
import com.ningdatech.kqapi.admin.model.entity.Zone;
+import com.ningdatech.kqapi.admin.model.vo.MatterDetailDTO;
+import com.ningdatech.kqapi.admin.model.vo.WebMatterDetailVO;
import com.ningdatech.kqapi.admin.service.IWindowService;
import com.ningdatech.kqapi.admin.service.IZoneService;
import com.ningdatech.kqapi.zzsfw.constants.ZzsfwMenuConstant;
@@ -17,7 +25,6 @@ import com.ningdatech.kqapi.zzsfw.model.dto.KqZzsfwMenuDTO;
import com.ningdatech.kqapi.zzsfw.model.entity.KqZzsfwMattersDeduplicate;
import com.ningdatech.kqapi.zzsfw.model.entity.KqZzsfwMenu;
import com.ningdatech.kqapi.zzsfw.model.vo.MatterTopVO;
-import com.ningdatech.kqapi.zzsfw.model.vo.MattersVO;
import com.ningdatech.kqapi.zzsfw.model.vo.TreeVO;
import com.ningdatech.kqapi.zzsfw.service.IKqZzsfwMatterDeduplicateService;
import com.ningdatech.kqapi.zzsfw.service.IKqZzsfwMenuService;
@@ -31,6 +38,7 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@@ -39,10 +47,13 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.text.DecimalFormat;
+import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
+import static com.ningdatech.kqapi.zzsfw.enumeration.ItemTypeEnum.GOV;
+
/**
* @Classname MatterManage
* @Description
@@ -66,6 +77,8 @@ public class MatterManage {
private final IKqZzsfwMenuService menuService;
private final IZoneService zoneService;
private final IWindowService windowService;
+ private final FileService fileService;
+ private final AdminMatterManage adminMatterManage;
private final IKqZzsfwMatterDeduplicateService matterDeduplicateService;
@@ -78,17 +91,16 @@ public class MatterManage {
//如果是政府类型的 就隐藏 没有链接的
List finalMatters = matters.stream().filter(m -> Objects.nonNull(m.getType()) &&
- (!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
+ (!m.getType().equals(GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
.collect(Collectors.toList());
Set zoneSet = new HashSet<>();
- List res = finalMatters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> {
+ return finalMatters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> {
TreeVO zone = new TreeVO();
zone.setName(m.getZoneName());
zone.setChilren(generateWindows(m, finalMatters));
zone.setType(ZzsfwMenuConstant.MENU_TYPE_ZONE);
return zone;
}).collect(Collectors.toList());
- return res;
}
/**
@@ -98,8 +110,29 @@ public class MatterManage {
*/
public List getZones() {
List zones = zoneService.list();
+ if (zones.isEmpty()) {
+ return Collections.emptyList();
+ }
+ Map fileIdMap = new HashMap<>();
+ zones.forEach(zone -> {
+ if (StrUtil.isNotBlank(zone.getZoneIcon())) {
+ List files = JSONUtil.toList(zone.getZoneIcon(), AttachFileVo.class);
+ if (files != null && !files.isEmpty()) {
+ fileIdMap.put(files.get(0).getFileId(), zone.getId());
+ }
+ }
+ });
+ Map iconUrlMap = new HashMap<>();
+ if (!fileIdMap.isEmpty()) {
+ for (File file : fileService.listByIds(fileIdMap.keySet())) {
+ String fileUrl = fileService.findUrlByFile(file, Duration.ofDays(30));
+ iconUrlMap.put(fileIdMap.get(file.getId()), fileUrl);
+ }
+ }
+
return CollUtils.convert(zones, w -> TreeVO.builder()
.name(w.getZoneName())
+ .zoneIcon(iconUrlMap.get(w.getId()))
.type(ZzsfwMenuConstant.MENU_TYPE_ZONE)
.build());
}
@@ -113,7 +146,7 @@ public class MatterManage {
//如果是政府类型的 就隐藏 没有链接的
List finalMatters = matters.stream().filter(m -> Objects.nonNull(m.getType()) &&
- (!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
+ (!m.getType().equals(GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
.collect(Collectors.toList());
Set zoneSet = new HashSet<>();
return finalMatters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> {
@@ -144,7 +177,7 @@ public class MatterManage {
//如果是政府类型的 就隐藏 没有链接的
List finalMatters = matters.stream().filter(m -> Objects.nonNull(m.getType()) &&
- (!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
+ (!m.getType().equals(GOV.getCode()) || Objects.nonNull(m.getWebapplyurl())))
.collect(Collectors.toList());
Set windowSet = new HashSet<>();
@@ -169,7 +202,7 @@ public class MatterManage {
}
Set departMentSet = new HashSet<>();
return matters.stream()
- .filter(m -> m.getType() != null && (!ItemTypeEnum.GOV.eq(m.getType()) || m.getWebapplyurl() != null))
+ .filter(m -> m.getType() != null && (!GOV.eq(m.getType()) || m.getWebapplyurl() != null))
.filter(m -> departMentSet.add(m.getDepartment()))
.map(m -> {
TreeVO department = new TreeVO();
@@ -179,7 +212,7 @@ public class MatterManage {
}).collect(Collectors.toList());
}
- public List matterList(String zoneName, String windowName, String department, Integer type) {
+ public List matterList(String zoneName, String windowName, String department, Integer type) {
List matters = menuService.list(Wrappers.lambdaQuery(KqZzsfwMenu.class)
.eq(StringUtils.isNotBlank(windowName), KqZzsfwMenu::getWindow, windowName)
.eq(StringUtils.isNotBlank(zoneName), KqZzsfwMenu::getZoneName, zoneName)
@@ -192,24 +225,59 @@ public class MatterManage {
//如果是政府类型的 就隐藏 没有链接的
return matters.stream().filter(m -> Objects.nonNull(m.getType())
- && (!ItemTypeEnum.GOV.eq(m.getType()) || Objects.nonNull(m.getWebapplyurl())))
+ && (!GOV.eq(m.getType()) || Objects.nonNull(m.getWebapplyurl())))
.map(m -> {
- MattersVO mattersVO = BeanUtil.copyProperties(m, MattersVO.class);
- mattersVO.setMatterName(m.getItemName());
- mattersVO.setId(m.getId());
- return mattersVO;
+ WebMatterDetailVO build = new WebMatterDetailVO();
+ build.setId(m.getId());
+ build.setMatterName(m.getItemName());
+ build.setMatterType(m.getType());
+ build.setWindowName(m.getWindow());
+ build.setWindowId(m.getWindowId());
+ build.setZoneId(m.getZoneId());
+ build.setZoneName(m.getZoneName());
+ build.setDepartment(m.getDepartment());
+ build.setWebApplyUrl(m.getWebapplyurl());
+ build.setPublicityMaterials(m.getPublicityMaterials());
+ // 处理宣传材料
+ buildPublicityMaterials(build);
+ return build;
}).collect(Collectors.toList());
}
- public MattersVO matter(Long id) {
- KqZzsfwMenu matter = menuService.getById(id);
- if (Objects.isNull(matter)) {
+ public WebMatterDetailVO matter(Long id) {
+ MatterDetailDTO detail = adminMatterManage.detail(id);
+ if (detail == null) {
return null;
}
- MattersVO mattersVO = BeanUtil.copyProperties(matter, MattersVO.class);
- mattersVO.setMatterName(matter.getItemName());
- mattersVO.setId(matter.getId());
- return mattersVO;
+ WebMatterDetailVO matter = BeanUtil.copyProperties(detail, WebMatterDetailVO.class);
+ buildPublicityMaterials(matter);
+ return matter;
+ }
+
+ private void buildPublicityMaterials(WebMatterDetailVO detail) {
+ if (ItemTypeEnum.SPECIAL.eq(detail.getMatterType())) {
+ String materials = detail.getPublicityMaterials();
+ if (StrUtil.isNotBlank(materials)) {
+ List attachFiles = JSONUtil.toList(materials, AttachFileVo.class);
+ Map filesMap = CollUtils.listToMap(attachFiles, AttachFileVo::getFileId);
+ List files = fileService.listByIds(filesMap.keySet());
+ List materialsFiles = new ArrayList<>();
+ for (File file : files) {
+ String fileUrl = fileService.findUrlByFile(file);
+ FileResultVO build = FileResultVO.builder()
+ .id(file.getId())
+ .url(fileUrl)
+ .contentType(file.getContentType())
+ .fileType(file.getFileType())
+ .originalFileName(file.getOriginalFileName())
+ .size(file.getSize())
+ .suffix(file.getSuffix())
+ .build();
+ materialsFiles.add(build);
+ }
+ detail.setPublicityMaterialsFiles(materialsFiles);
+ }
+ }
}
private List generateWindows(KqZzsfwMenu menu, List matters) {
@@ -227,8 +295,11 @@ public class MatterManage {
private List generateDepartment(KqZzsfwMenu menu, List matters) {
Set departmentSet = new HashSet<>();
- return matters.stream().filter(m -> StringUtils.isNotBlank(m.getWindow()) && m.getWindow().equals(menu.getWindow()) &&
- m.getZoneName().equals(menu.getZoneName()) && departmentSet.add(m.getDepartment()))
+ return matters.stream()
+ .filter(m -> StringUtils.isNotBlank(m.getWindow())
+ && m.getWindow().equals(menu.getWindow())
+ && m.getZoneName().equals(menu.getZoneName())
+ && departmentSet.add(m.getDepartment()))
.map(m -> {
TreeVO department = new TreeVO();
department.setName(m.getDepartment());
@@ -240,8 +311,12 @@ public class MatterManage {
private List generateItemType(KqZzsfwMenu menu, List matters) {
Set typeSet = new HashSet<>();
- return matters.stream().filter(m -> StringUtils.isNotBlank(m.getWindow()) && m.getWindow().equals(menu.getWindow()) &&
- m.getZoneName().equals(menu.getZoneName()) && Objects.nonNull(m.getType()) && typeSet.add(m.getType()))
+ return matters.stream()
+ .filter(m -> StringUtils.isNotBlank(m.getWindow())
+ && m.getWindow().equals(menu.getWindow())
+ && m.getZoneName().equals(menu.getZoneName())
+ && Objects.nonNull(m.getType())
+ && typeSet.add(m.getType()))
.map(m -> {
TreeVO menuType = new TreeVO();
ItemTypeEnum itemTypeEnum = ItemTypeEnum.match(m.getType());
@@ -259,7 +334,7 @@ public class MatterManage {
private List generateMatters(KqZzsfwMenu menu, List matters) {
return matters.stream().filter(m -> Objects.nonNull(m.getType()) && m.getType().equals(menu.getType()) &&
- (!m.getType().equals(ItemTypeEnum.GOV.getCode()) || Objects.nonNull(m.getHasUrl()) && m.getHasUrl() == 1) &&
+ (!m.getType().equals(GOV.getCode()) || Objects.nonNull(m.getHasUrl()) && m.getHasUrl() == 1) &&
StringUtils.isNotBlank(m.getDepartment()) &&
m.getDepartment().equals(menu.getDepartment()) && m.getWindow().equals(menu.getWindow()) &&
m.getZoneName().equals(menu.getZoneName()))
@@ -425,4 +500,37 @@ public class MatterManage {
}
return "success!";
}
+
+ @Transactional(rollbackFor = Exception.class)
+ public void initOldData() {
+ List matters = menuService.list();
+ if (CollUtil.isEmpty(matters)) {
+ return;
+ }
+ //如果是政府类型的 就隐藏 没有链接的
+ List tmpMatters = matters.stream()
+ .filter(m -> Objects.nonNull(m.getType())
+ && (!GOV.eq(m.getType()) || m.getWebapplyurl() != null))
+ .filter(w -> w.getWindowId() == null && w.getZoneId() == null)
+ .collect(Collectors.toList());
+ CollUtils.group(tmpMatters, KqZzsfwMenu::getZoneName)
+ .forEach((zone, mattersByZone) -> {
+ Zone entity = new Zone();
+ entity.setZoneName(zone);
+ zoneService.save(entity);
+ CollUtils.group(mattersByZone, KqZzsfwMenu::getWindow)
+ .forEach((window, mattersByWindow) -> {
+ Window win = new Window();
+ win.setWindowName(window);
+ win.setZoneName(zone);
+ win.setZoneId(entity.getId());
+ windowService.save(win);
+ for (KqZzsfwMenu menu : mattersByWindow) {
+ menu.setZoneId(win.getZoneId());
+ menu.setWindowId(win.getId());
+ }
+ menuService.updateBatchById(mattersByWindow);
+ });
+ });
+ }
}
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/MattersVO.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/MattersVO.java
deleted file mode 100644
index 24b4d13..0000000
--- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/MattersVO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.ningdatech.kqapi.zzsfw.model.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- *
- * 事项
- *
- *
- * @author ZPF
- * @since 2023-10-25
- */
-@Data
-@ApiModel(value = "MattersVO", description = "事项")
-public class MattersVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("id主键")
- private Long id;
-
- @ApiModelProperty("id")
- private String rowguid;
-
- @ApiModelProperty("事项名称")
- private String matterName;
-
- @ApiModelProperty("事项链接")
- private String webapplyurl;
-
- @ApiModelProperty("排序编号")
- private Integer sort;
-
- @ApiModelProperty("类型 1.政府服务 2.增值服务 3.特殊")
- private Integer type;
-
- @ApiModelProperty("服务内容")
- private String serviceContent;
-
- @ApiModelProperty("服务流程")
- private String serviceProcess;
-
- @ApiModelProperty("咨询电话")
- private String telephone;
-}
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java
index 94f2d14..8953692 100644
--- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java
@@ -30,6 +30,8 @@ public class TreeVO {
@ApiModelProperty("类型")
private String type;
+ private String zoneIcon;
+
@ApiModelProperty("链接")
private String url;
@@ -45,6 +47,9 @@ public class TreeVO {
@ApiModelProperty("服务内容")
private String serviceContent;
+ @ApiModelProperty("办理渠道")
+ private Integer handleChannel;
+
@ApiModelProperty("服务流程")
private String serviceProcess;
diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/WindowVO.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/WindowVO.java
index f982b95..d9d892b 100644
--- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/WindowVO.java
+++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/WindowVO.java
@@ -1,5 +1,6 @@
package com.ningdatech.kqapi.zzsfw.model.vo;
+import com.ningdatech.kqapi.admin.model.vo.WebMatterDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -25,5 +26,5 @@ public class WindowVO implements Serializable {
private String windowName;
@ApiModelProperty("事项")
- private List matters;
+ private List matters;
}
diff --git a/kq-vas-api/src/main/resources/template/政策服务事项配置模板.xlsx b/kq-vas-api/src/main/resources/template/政策服务事项配置模板.xlsx
new file mode 100644
index 0000000..db33d10
Binary files /dev/null and b/kq-vas-api/src/main/resources/template/政策服务事项配置模板.xlsx differ
diff --git a/pom.xml b/pom.xml
index fb29858..a8afe52 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
-
+
com.alibaba
fastjson