From 13c23fce14ab2967c159707144f9826d2e61a512 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 23 Apr 2024 17:30:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A8=A1=E7=89=88=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kq-vas-api/pom.xml | 12 +- .../kqapi/admin/controller/MatterController.java | 18 +++ .../kqapi/admin/manage/AdminMatterManage.java | 116 +++++++++++++++ .../admin/model/dto/GovServiceMatterImportDTO.java | 48 +++++++ .../kqapi/admin/model/vo/WebMatterDetailVO.java | 25 ++++ .../zzsfw/controller/KqZzsfwMenuController.java | 12 +- .../kqapi/zzsfw/manage/MatterManage.java | 158 +++++++++++++++++---- .../ningdatech/kqapi/zzsfw/model/vo/MattersVO.java | 49 ------- .../ningdatech/kqapi/zzsfw/model/vo/TreeVO.java | 5 + .../ningdatech/kqapi/zzsfw/model/vo/WindowVO.java | 3 +- .../template/政策服务事项配置模板.xlsx | Bin 0 -> 9775 bytes pom.xml | 4 +- 12 files changed, 362 insertions(+), 88 deletions(-) create mode 100644 kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/dto/GovServiceMatterImportDTO.java create mode 100644 kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/vo/WebMatterDetailVO.java delete mode 100644 kq-vas-api/src/main/java/com/ningdatech/kqapi/zzsfw/model/vo/MattersVO.java create mode 100644 kq-vas-api/src/main/resources/template/政策服务事项配置模板.xlsx diff --git a/kq-vas-api/pom.xml b/kq-vas-api/pom.xml index f47a8c7..ac9145a 100644 --- a/kq-vas-api/pom.xml +++ b/kq-vas-api/pom.xml @@ -27,6 +27,10 @@ org.projectlombok lombok + + com.alibaba + easyexcel-core + com.baomidou @@ -85,14 +89,6 @@ org.apache.httpcomponents httpclient - - org.apache.poi - poi - - - org.apache.poi - poi-ooxml - 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 0000000000000000000000000000000000000000..db33d10b5df2ad35758a5749e558184182b7b42f GIT binary patch literal 9775 zcma)i1yCGY(>Ctz!QE|fcX#(7!QD0l2?Tfd;1V1H1PSiJ3GPmSAi-HA5crqmyO#IX zt^ZW*%+}1)r)Qqt?sK-g)fAy&kRYB$n97#e)A^5q2>xQ>Y_8_!?BdR*28Q8)FChGc zwel`jvqM5aa6v&pVEi3s=HkNY>FAK1(5(Osz>&TVe8l+R%*jHj!NCw1E(mY%l7!QF zsY?kf@$1BQ7FHm|4ZPE(v(`NdC-y{HliMqkoB*VHt+PgHRmow%vhjYnRn{Q4=HH z_QmG@mxqwLO+iuU#ntC>M?o7bpAFP(gb}~<7>g8b8^G-mx-ThI7j-YJe43g#T!Ova z`f+=91Y%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