feat: 企标计划-导出
This commit is contained in:
+9
@@ -20,6 +20,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 企标计划
|
||||
@@ -88,4 +90,11 @@ public class EnterpriseStandardPlanController extends JeroController<EnterpriseS
|
||||
}
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
@AutoLog(value = "企标计划-导出")
|
||||
@ApiOperation(value="企标计划-导出", notes="企标计划-导出")
|
||||
@GetMapping("/exportData")
|
||||
public void exportData(HttpServletResponse response, ESPlanQueryDTO esPlanQueryDTO) {
|
||||
esPlanService.export(response, esPlanQueryDTO, "企标计划", "企标计划");
|
||||
}
|
||||
}
|
||||
|
||||
+21
@@ -1,5 +1,7 @@
|
||||
package com.jero.modules.laws.enterprise.entity.dto;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -9,6 +11,7 @@ import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
@@ -21,6 +24,13 @@ import java.util.Date;
|
||||
@AllArgsConstructor
|
||||
public class ESPlanQueryDTO {
|
||||
|
||||
@ApiModelProperty(value = "选择的主键Id")
|
||||
private String selections;
|
||||
|
||||
@ApiModelProperty(value = "选中的主键集合")
|
||||
@JSONField(serialize = false)
|
||||
private List<String> idList;
|
||||
|
||||
@ApiModelProperty(value = "原企标编号")
|
||||
private String originEnStandardNo;
|
||||
|
||||
@@ -77,4 +87,15 @@ public class ESPlanQueryDTO {
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createEndDate;
|
||||
|
||||
public void transIdsToList() {
|
||||
if (StrUtil.isBlank(this.selections)) {
|
||||
return;
|
||||
}
|
||||
this.idList = StrUtil.split(this.selections, StrUtil.COMMA);
|
||||
}
|
||||
|
||||
public void setSelections(String selections) {
|
||||
this.selections = selections;
|
||||
this.transIdsToList();
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -23,96 +24,120 @@ public class EnterpriseStandardPlanVo {
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
private String id;
|
||||
|
||||
@Excel(name = "申请类别", width = 15, orderNum = "1", dicCode = "esp_application_category")
|
||||
@Dict(dicCode = "esp_application_category")
|
||||
@ApiModelProperty(value = "申请类别(制订/修订,立项/变更)")
|
||||
private String applicationCategory;
|
||||
|
||||
@Excel(name = "原企标编号", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "原企标编号")
|
||||
private String originEnStandardNo;
|
||||
|
||||
@Excel(name = "新企标编号", width = 15, orderNum = "2")
|
||||
@ApiModelProperty(value = "新企标编号")
|
||||
private String newEnStandardNo;
|
||||
|
||||
@Excel(name = "原企标名称", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "原企标名称")
|
||||
private String originEnStandardName;
|
||||
|
||||
@Excel(name = "新企标名称", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "新企标名称")
|
||||
private String newEnStandardName;
|
||||
|
||||
@Excel(name = "授权部门", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "授权部门")
|
||||
private String authDeparts;
|
||||
|
||||
@Excel(name = "企业标准代号", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "企业标准代号")
|
||||
private String enStandardCode;
|
||||
|
||||
@Excel(name = "配合单位", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "配合单位")
|
||||
private String cooperateDeparts;
|
||||
|
||||
@Excel(name = "主起草人", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "主起草人")
|
||||
private String mainDraftingUser;
|
||||
|
||||
@Excel(name = "主起草单位", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "主起草单位")
|
||||
private String mainDraftingUnit;
|
||||
|
||||
@Excel(name = "主起草单位责任人", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "主起草单位责任人")
|
||||
private String mainDraftingUnitResponsiblePerson;
|
||||
|
||||
@Excel(name = "标准推进人", width = 15, orderNum = "1")
|
||||
@ApiModelProperty(value = "标准推进人")
|
||||
private String standardPromoter;
|
||||
|
||||
@Excel(name = "草稿计划完成日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "草稿计划完成日期")
|
||||
private Date draftPlannedCompleteDate;
|
||||
|
||||
@Excel(name = "征求意见稿计划完成日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "征求意见稿计划完成日期")
|
||||
private Date solicitationDraftPlanCompleteDate;
|
||||
|
||||
@Excel(name = "计划报批日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "计划报批日期")
|
||||
private Date planApprovalDate;
|
||||
|
||||
@Excel(name = "草稿完成日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "草稿完成日期")
|
||||
private Date draftCompletionDate;
|
||||
|
||||
@Excel(name = "提交草稿日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "提交草稿日期")
|
||||
private Date draftSubmissionDate;
|
||||
|
||||
@Excel(name = "是否征求意见", width = 15, orderNum = "1", dicCode = "yn")
|
||||
@Dict(dicCode = "yn")
|
||||
@ApiModelProperty(value = "是否征求意见")
|
||||
private String solicitationOpinionEnabled;
|
||||
|
||||
@Excel(name = "征求意见稿完成日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "征求意见稿完成日期")
|
||||
private Date solicitationDraftCompletionDate;
|
||||
|
||||
@Excel(name = "评审日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "评审日期")
|
||||
private Date reviewDate;
|
||||
|
||||
@Excel(name = "报批日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "报批日期")
|
||||
private Date approvalDate;
|
||||
|
||||
@Excel(name = "发布日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "发布日期")
|
||||
private Date releaseDate;
|
||||
|
||||
@Excel(name = "项目状态", width = 15, orderNum = "1", dicCode = "esp_project_status")
|
||||
@Dict(dicCode = "esp_project_status")
|
||||
@ApiModelProperty(value = "项目状态")
|
||||
private String projectStatus;
|
||||
|
||||
@Excel(name = "变更状态", width = 15, orderNum = "1", dicCode = "esp_change_status")
|
||||
@Dict(dicCode = "esp_change_status")
|
||||
@ApiModelProperty(value = "变更状态")
|
||||
private String changeStatus;
|
||||
|
||||
+6
@@ -182,6 +182,12 @@
|
||||
<if test="param.createStartDate != null and param.createEndDate != null">
|
||||
AND p.create_time BETWEEN #{param.createStartDate} AND #{param.createEndDate}
|
||||
</if>
|
||||
<if test="param.idList != null and param.idList.size() > 0">
|
||||
AND p.id IN
|
||||
<foreach item="item" index="index" collection="param.idList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDetailById" resultType="com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan">
|
||||
|
||||
+11
@@ -6,6 +6,8 @@ import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardPlanVo;
|
||||
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author ThinkBook
|
||||
* @description 针对表【laws_enterprise_standard_plan】的数据库操作Service
|
||||
@@ -34,4 +36,13 @@ public interface EnterpriseStandardPlanService extends IService<EnterpriseStanda
|
||||
* @return
|
||||
*/
|
||||
EnterpriseStandardPlan getDetailById(String planId);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param response
|
||||
* @param esPlanQueryDTO
|
||||
* @param fileName
|
||||
* @param sheetName
|
||||
*/
|
||||
void export(HttpServletResponse response, ESPlanQueryDTO esPlanQueryDTO, String fileName, String sheetName);
|
||||
}
|
||||
|
||||
+34
@@ -13,11 +13,21 @@ import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
|
||||
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
|
||||
import com.jero.modules.laws.enterprise.mapper.EnterpriseStandardPlanMapper;
|
||||
import com.jero.modules.projectLibrary.entity.LawsProjectLibrary;
|
||||
import com.jero.modules.tag.entity.LawsTag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -64,6 +74,30 @@ public class EnterpriseStandardPlanServiceImpl extends ServiceImpl<EnterpriseSta
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void export(HttpServletResponse response, ESPlanQueryDTO esPlanQueryDTO, String fileName, String sheetName) {
|
||||
try {
|
||||
// 获取数据
|
||||
IPage<EnterpriseStandardPlanVo> enterpriseStandardPlanVoIPage = this.queryPageList(esPlanQueryDTO, 1, Integer.MAX_VALUE);
|
||||
List<EnterpriseStandardPlanVo> records = enterpriseStandardPlanVoIPage.getRecords();
|
||||
|
||||
// 设置导出参数
|
||||
ExportParams exportParams = new ExportParams(null, sheetName); // 可以为标题添加更多的配置
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, EnterpriseStandardPlanVo.class, records);
|
||||
|
||||
// 设置响应头和内容类型
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");
|
||||
|
||||
// 写出到响应流
|
||||
workbook.write(response.getOutputStream());
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
log.error("导出excel异常", e);
|
||||
throw new JeroBootException("导出excel异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 转换列表中的状态值为中文
|
||||
private void transDict(List<EnterpriseStandardPlan> list) {
|
||||
if (list.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user