diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ProjectLibApiResponseToExcelUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ProjectLibApiResponseToExcelUtil.java new file mode 100644 index 0000000..3aa5da7 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/ProjectLibApiResponseToExcelUtil.java @@ -0,0 +1,44 @@ +package com.hz.pm.api.common.util; + +import cn.hutool.core.lang.UUID; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import cn.hutool.poi.excel.ExcelUtil; +import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * ProjectLibApiResponseToExcelUtil + *

+ * + * @author WendyYang + * @since 10:14 2024/11/1 + */ +public class ProjectLibApiResponseToExcelUtil { + + public static void main(String[] args) { + String str = ""; + JSONObject parse = JSONUtil.toBean(str, JSONObject.class); + List objects = parse.getJSONObject("data").getBeanList("records", JSONObject.class); + List> projects = objects.stream().map(w -> { + Map map = new HashMap<>(); + map.put("项目名称", w.getStr("projectName")); + map.put("建设单位", w.getStr("buildOrg")); + map.put("申报总投资", w.getStr("declaredAmount")); + map.put("项目年度", w.getStr("projectYear")); + map.put("项目状态", ProjectStatus.getDesc(w.getInt("status"))); + return map; + }).collect(Collectors.toList()); + ExcelUtil.getWriter() + .write(projects, true) + .flush(new File("/Users/wendy/Desktop/" + UUID.randomUUID().toString(true) + ".xlsx")) + .close(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiMeetingExpertInfoController.java b/hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiMeetingExpertInfoController.java index dce3e8c..f8ac40a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiMeetingExpertInfoController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiMeetingExpertInfoController.java @@ -12,7 +12,10 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List;