diff --git a/kq-vas-api/pom.xml b/kq-vas-api/pom.xml index ac9145a..d482dbd 100644 --- a/kq-vas-api/pom.xml +++ b/kq-vas-api/pom.xml @@ -80,6 +80,11 @@ org.springframework.boot spring-boot-starter-aop + + com.fasterxml.jackson.core + jackson-databind + 2.16.1 + com.github.ben-manes.caffeine 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 4ae618e..14f3304 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 @@ -59,7 +59,7 @@ public class MatterController { matterManage.saveOrUpdate(req); } - @PostMapping("/importMatter") + @PostMapping("/importGovServiceMatter") @WebLog("导入政务服务事项") @ApiOperation("导入政务服务事项") public void importMatter(@RequestParam("file") MultipartFile file, @@ -67,7 +67,7 @@ public class MatterController { matterManage.importMatter(file, matterType); } - @GetMapping("/downloadMatterTemplate") + @GetMapping("/downloadGovServiceMatterTemplate") @WebLog("下载政策服务事项配置模板") @ApiOperation("下载政策服务事项配置模板") public void downloadMatterTemplate(HttpServletResponse 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 0a6a75f..b864eff 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 @@ -19,6 +19,7 @@ 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.enumerization.HandleChannelEnum; import com.ningdatech.kqapi.admin.model.req.MatterListReq; import com.ningdatech.kqapi.admin.model.vo.MatterDetailDTO; import com.ningdatech.kqapi.admin.model.vo.MatterListVO; @@ -42,6 +43,7 @@ import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; /** *

@@ -162,6 +164,12 @@ public class AdminMatterManage { if (errMsg != null) { throw BizException.wrap(errMsg); } + Optional handleChannel = IEnum.getByDesc(HandleChannelEnum.class, data.getHandleChannel()); + if (handleChannel.isPresent()) { + data.setHandleChannelEnum(handleChannel.get()); + } else { + throw BizException.wrap("不支持的办理渠道"); + } } @Override @@ -207,6 +215,7 @@ public class AdminMatterManage { menu.setWindow(window.getWindowName()); menu.setZoneName(zone.getZoneName()); menu.setDepartment(matter.getDepartment()); + menu.setHandleChannel(matter.getHandleChannelEnum().getCode()); menu.setSort(99); menu.setType(type.getCode()); newMatters.add(menu); @@ -223,7 +232,7 @@ public class AdminMatterManage { 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"); + String fileName = URLEncoder.encode(resource.getName(), "UTF-8"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName); os.write(resource.readBytes()); os.flush(); 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 index 07dc419..dfdc14b 100644 --- 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 @@ -2,6 +2,7 @@ package com.ningdatech.kqapi.admin.model.dto; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; +import com.ningdatech.kqapi.admin.model.enumerization.HandleChannelEnum; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -45,4 +46,7 @@ public class GovServiceMatterImportDTO { @NotBlank(message = "牵头部门不能为空") private String department; + @ExcelIgnore + private HandleChannelEnum handleChannelEnum; + } diff --git a/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java b/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java index 044f4e3..024701f 100644 --- a/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java +++ b/kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java @@ -44,5 +44,8 @@ public interface IEnum { return getByCode(eclass, code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY); } + static & IEnum> Optional getByDesc(Class eclass, String code) { + return all(eclass).stream().filter(w -> w.getDesc().equals(code)).findFirst(); + } }