Browse Source

事项导入修改

master
WendyYang 8 months ago
parent
commit
700912b5c5
5 changed files with 24 additions and 3 deletions
  1. +5
    -0
      kq-vas-api/pom.xml
  2. +2
    -2
      kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/controller/MatterController.java
  3. +10
    -1
      kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/manage/AdminMatterManage.java
  4. +4
    -0
      kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/dto/GovServiceMatterImportDTO.java
  5. +3
    -0
      kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java

+ 5
- 0
kq-vas-api/pom.xml View File

@@ -80,6 +80,11 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId> <artifactId>spring-boot-starter-aop</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.16.1</version>
</dependency>
<!--cache--> <!--cache-->
<dependency> <dependency>
<groupId>com.github.ben-manes.caffeine</groupId> <groupId>com.github.ben-manes.caffeine</groupId>


+ 2
- 2
kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/controller/MatterController.java View File

@@ -59,7 +59,7 @@ public class MatterController {
matterManage.saveOrUpdate(req); matterManage.saveOrUpdate(req);
} }


@PostMapping("/importMatter")
@PostMapping("/importGovServiceMatter")
@WebLog("导入政务服务事项") @WebLog("导入政务服务事项")
@ApiOperation("导入政务服务事项") @ApiOperation("导入政务服务事项")
public void importMatter(@RequestParam("file") MultipartFile file, public void importMatter(@RequestParam("file") MultipartFile file,
@@ -67,7 +67,7 @@ public class MatterController {
matterManage.importMatter(file, matterType); matterManage.importMatter(file, matterType);
} }


@GetMapping("/downloadMatterTemplate")
@GetMapping("/downloadGovServiceMatterTemplate")
@WebLog("下载政策服务事项配置模板") @WebLog("下载政策服务事项配置模板")
@ApiOperation("下载政策服务事项配置模板") @ApiOperation("下载政策服务事项配置模板")
public void downloadMatterTemplate(HttpServletResponse response) { public void downloadMatterTemplate(HttpServletResponse response) {


+ 10
- 1
kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/manage/AdminMatterManage.java View File

@@ -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.dto.GovServiceMatterImportDTO;
import com.ningdatech.kqapi.admin.model.entity.Window; import com.ningdatech.kqapi.admin.model.entity.Window;
import com.ningdatech.kqapi.admin.model.entity.Zone; 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.req.MatterListReq;
import com.ningdatech.kqapi.admin.model.vo.MatterDetailDTO; import com.ningdatech.kqapi.admin.model.vo.MatterDetailDTO;
import com.ningdatech.kqapi.admin.model.vo.MatterListVO; import com.ningdatech.kqapi.admin.model.vo.MatterListVO;
@@ -42,6 +43,7 @@ import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;


/** /**
* <p> * <p>
@@ -162,6 +164,12 @@ public class AdminMatterManage {
if (errMsg != null) { if (errMsg != null) {
throw BizException.wrap(errMsg); throw BizException.wrap(errMsg);
} }
Optional<HandleChannelEnum> handleChannel = IEnum.getByDesc(HandleChannelEnum.class, data.getHandleChannel());
if (handleChannel.isPresent()) {
data.setHandleChannelEnum(handleChannel.get());
} else {
throw BizException.wrap("不支持的办理渠道");
}
} }


@Override @Override
@@ -207,6 +215,7 @@ public class AdminMatterManage {
menu.setWindow(window.getWindowName()); menu.setWindow(window.getWindowName());
menu.setZoneName(zone.getZoneName()); menu.setZoneName(zone.getZoneName());
menu.setDepartment(matter.getDepartment()); menu.setDepartment(matter.getDepartment());
menu.setHandleChannel(matter.getHandleChannelEnum().getCode());
menu.setSort(99); menu.setSort(99);
menu.setType(type.getCode()); menu.setType(type.getCode());
newMatters.add(menu); newMatters.add(menu);
@@ -223,7 +232,7 @@ public class AdminMatterManage {
final ClassPathResource resource = new ClassPathResource("/template/政策服务事项配置模板.xlsx"); final ClassPathResource resource = new ClassPathResource("/template/政策服务事项配置模板.xlsx");
try (ServletOutputStream os = response.getOutputStream()) { try (ServletOutputStream os = response.getOutputStream()) {
response.setContentType(ExcelUtil.XLSX_CONTENT_TYPE); 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); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName);
os.write(resource.readBytes()); os.write(resource.readBytes());
os.flush(); os.flush();


+ 4
- 0
kq-vas-api/src/main/java/com/ningdatech/kqapi/admin/model/dto/GovServiceMatterImportDTO.java View File

@@ -2,6 +2,7 @@ package com.ningdatech.kqapi.admin.model.dto;


import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.ningdatech.kqapi.admin.model.enumerization.HandleChannelEnum;
import lombok.Data; import lombok.Data;


import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@@ -45,4 +46,7 @@ public class GovServiceMatterImportDTO {
@NotBlank(message = "牵头部门不能为空") @NotBlank(message = "牵头部门不能为空")
private String department; private String department;


@ExcelIgnore
private HandleChannelEnum handleChannelEnum;

} }

+ 3
- 0
kq-vas-api/src/main/java/com/ningdatech/kqapi/common/enumeration/IEnum.java View File

@@ -44,5 +44,8 @@ public interface IEnum {
return getByCode(eclass, code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY); return getByCode(eclass, code).flatMap(w -> Optional.of(w.getDesc())).orElse(StrUtil.EMPTY);
} }


static <E extends Enum<E> & IEnum> Optional<E> getByDesc(Class<E> eclass, String code) {
return all(eclass).stream().filter(w -> w.getDesc().equals(code)).findFirst();
}


} }

Loading…
Cancel
Save