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>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.16.1</version>
</dependency>
<!--cache-->
<dependency>
<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);
}

@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) {


+ 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.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;

/**
* <p>
@@ -162,6 +164,12 @@ public class AdminMatterManage {
if (errMsg != null) {
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
@@ -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();


+ 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.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;

}

+ 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);
}

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