瀏覽代碼

增加模版下载接口

master
WendyYang 8 月之前
父節點
當前提交
13c23fce14
共有 12 個檔案被更改,包括 362 行新增88 行删除
  1. +4
    -8
      kq-vas-api/pom.xml
  2. +18
    -0
      kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/controller/MatterController.java
  3. +116
    -0
      kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/manage/AdminMatterManage.java
  4. +48
    -0
      kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/dto/GovServiceMatterImportDTO.java
  5. +25
    -0
      kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/vo/WebMatterDetailVO.java
  6. +9
    -3
      kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/controller/KqZzsfwMenuController.java
  7. +133
    -25
      kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/manage/MatterManage.java
  8. +0
    -49
      kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/MattersVO.java
  9. +5
    -0
      kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/TreeVO.java
  10. +2
    -1
      kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/WindowVO.java
  11. 二進制
      kq-vas-api/src/main/resources/template/政策服务事项配置模板.xlsx
  12. +2
    -2
      pom.xml

+ 4
- 8
kq-vas-api/pom.xml 查看文件

@@ -27,6 +27,10 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel-core</artifactId>
</dependency>
<!-- mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
@@ -85,14 +89,6 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</dependency>
<!-- 阿里云oss -->
<dependency>
<groupId>com.aliyun.oss</groupId>


+ 18
- 0
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;

/**
* <p>
@@ -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);
}

}

+ 116
- 0
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;

/**
* <p>
@@ -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<MatterListVO> pageMatter(MatterListReq req) {
Wrapper<KqZzsfwMenu> 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<GovServiceMatterImportDTO> imports = EasyExcel.read(is,
new AnalysisEventListener<GovServiceMatterImportDTO>() {
@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<String, List<GovServiceMatterImportDTO>> mattersByZone = CollUtils.group(imports, GovServiceMatterImportDTO::getZoneName);
Wrapper<Zone> zoneQuery = Wrappers.lambdaQuery(Zone.class)
.in(Zone::getZoneName, mattersByZone.keySet());
List<Zone> zones = zoneMapper.selectList(zoneQuery);
if (zones.size() != mattersByZone.size()) {
throw BizException.wrap("导入失败:服务专区不存在");
}
Map<String, Zone> zoneMap = CollUtils.listToMap(zones, Zone::getZoneName);
List<KqZzsfwMenu> newMatters = new ArrayList<>();
mattersByZone.forEach((zoneName, matters) -> {
Zone zone = zoneMap.get(zoneName);
Assert.notNull(zone, "服务专区不存在");
Map<String, List<GovServiceMatterImportDTO>> mattersByWin = CollUtils.group(matters, GovServiceMatterImportDTO::getWindowName);
Wrapper<Window> windowQuery = Wrappers.lambdaQuery(Window.class)
.eq(Window::getZoneId, zone.getId())
.in(Window::getWindowName, mattersByWin.keySet());
List<Window> windows = windowService.list(windowQuery);
if (windows.size() != mattersByWin.size()) {
throw BizException.wrap("导入失败:服务窗口不存在");
}
Map<String, Window> 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("政策服务事项配置模板下载失败");
}
}

}

+ 48
- 0
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;

/**
* <p>
* GovServiceMatterImportDTO
* </p>
*
* @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;

}

+ 25
- 0
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;

/**
* <p>
* WebMatterDetailVO
* </p>
*
* @author WendyYang
* @since 14:42 2024/4/23
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WebMatterDetailVO extends MatterDetailDTO {

@ApiModelProperty("宣传材料访文件信息")
private List<FileResultVO> publicityMaterialsFiles;

}

+ 9
- 3
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<MattersVO> matterList(@RequestParam(required = false) String windowName,
public List<WebMatterDetailVO> 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();
}

}


+ 133
- 25
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<KqZzsfwMenu> 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<String> zoneSet = new HashSet<>();
List<TreeVO> 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<TreeVO> getZones() {
List<Zone> zones = zoneService.list();
if (zones.isEmpty()) {
return Collections.emptyList();
}
Map<Long, Integer> fileIdMap = new HashMap<>();
zones.forEach(zone -> {
if (StrUtil.isNotBlank(zone.getZoneIcon())) {
List<AttachFileVo> files = JSONUtil.toList(zone.getZoneIcon(), AttachFileVo.class);
if (files != null && !files.isEmpty()) {
fileIdMap.put(files.get(0).getFileId(), zone.getId());
}
}
});
Map<Integer, String> 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<KqZzsfwMenu> 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<String> zoneSet = new HashSet<>();
return finalMatters.stream().filter(m -> zoneSet.add(m.getZoneName())).map(m -> {
@@ -144,7 +177,7 @@ public class MatterManage {

//如果是政府类型的 就隐藏 没有链接的
List<KqZzsfwMenu> 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<String> windowSet = new HashSet<>();
@@ -169,7 +202,7 @@ public class MatterManage {
}
Set<String> 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<MattersVO> matterList(String zoneName, String windowName, String department, Integer type) {
public List<WebMatterDetailVO> matterList(String zoneName, String windowName, String department, Integer type) {
List<KqZzsfwMenu> 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<AttachFileVo> attachFiles = JSONUtil.toList(materials, AttachFileVo.class);
Map<Long, AttachFileVo> filesMap = CollUtils.listToMap(attachFiles, AttachFileVo::getFileId);
List<File> files = fileService.listByIds(filesMap.keySet());
List<FileResultVO> 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<TreeVO> generateWindows(KqZzsfwMenu menu, List<KqZzsfwMenu> matters) {
@@ -227,8 +295,11 @@ public class MatterManage {

private List<TreeVO> generateDepartment(KqZzsfwMenu menu, List<KqZzsfwMenu> matters) {
Set<String> 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<TreeVO> generateItemType(KqZzsfwMenu menu, List<KqZzsfwMenu> matters) {
Set<Integer> 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<TreeVO> generateMatters(KqZzsfwMenu menu, List<KqZzsfwMenu> 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<KqZzsfwMenu> matters = menuService.list();
if (CollUtil.isEmpty(matters)) {
return;
}
//如果是政府类型的 就隐藏 没有链接的
List<KqZzsfwMenu> 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);
});
});
}
}

+ 0
- 49
kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/MattersVO.java 查看文件

@@ -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;

/**
* <p>
* 事项
* </p>
*
* @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;
}

+ 5
- 0
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;



+ 2
- 1
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<MattersVO> matters;
private List<WebMatterDetailVO> matters;
}

二進制
kq-vas-api/src/main/resources/template/政策服务事项配置模板.xlsx 查看文件


+ 2
- 2
pom.xml 查看文件

@@ -27,7 +27,7 @@

<dependencyManagement>
<dependencies>
<dependency>
<!--<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.2</version>
@@ -36,7 +36,7 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
</dependency>
</dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>


Loading…
取消
儲存