fix(稽查稽查): 导出延期数据、导出整改计划

This commit is contained in:
yjz
2023-12-19 11:51:04 +08:00
parent ee378bda9d
commit dfb33c2a30
9 changed files with 364 additions and 30 deletions
@@ -23,10 +23,11 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@@ -156,15 +157,15 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
@AutoLog(value = "企标稽查-导出延期数据")
@ApiOperation(value="企标稽查-导出延期数据", notes="企标稽查-导出延期数据")
@GetMapping("/exportDataWithDelay")
public void exportDataWithDelay(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo) {
esInspectService.exportDataWithDelay(response, enterpriseStandardInspectVo, "企标稽查-延期数据", "企标稽查-延期数据");
public ModelAndView exportDataWithDelay(HttpServletRequest request, EnterpriseStandardInspectVo enterpriseStandardInspectVo) {
return esInspectService.exportDataWithDelay(request, enterpriseStandardInspectVo);
}
@RequiresPermissions("enterpriseStandardLibrary:check:exportRectificationPlan")
@AutoLog(value = "企标稽查-导出整改计划")
@ApiOperation(value="企标稽查-导出整改计划", notes="企标稽查-导出整改计划")
@GetMapping("/exportDataRectifyPlan")
public void exportDataRectifyPlan(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo) throws IOException {
esInspectService.exportDataRectifyPlan(response, enterpriseStandardInspectVo, "企标稽查-整改计划", "企标稽查-整改计划");
public ModelAndView exportDataRectifyPlan(HttpServletRequest request, EnterpriseStandardInspectVo enterpriseStandardInspectVo) {
return esInspectService.exportDataRectifyPlan(request, enterpriseStandardInspectVo);
}
}
@@ -4,17 +4,18 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName laws_enterprise_standard_inspect_delay
@@ -71,6 +72,7 @@ public class EnterpriseStandardInspectDelay implements Serializable {
/**
* 申请延期日期
*/
@Excel(name = "申请延期日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "申请延期日期")
@@ -80,6 +82,7 @@ public class EnterpriseStandardInspectDelay implements Serializable {
* 延期说明
*/
@ApiModelProperty(value = "延期说明")
@Excel(name = "延期说明", width = 15)
private String delayDescription;
@TableField(exist = false)
@@ -80,21 +80,21 @@ public class EnterpriseStandardInspectRectifyPlan implements Serializable {
/**
* 存在问题
*/
@Excel(name = "存在问题", width = 15, orderNum = "1")
@Excel(name = "存在问题", width = 15)
@ApiModelProperty(value = "存在问题")
private String issue;
/**
* 整改措施
*/
@Excel(name = "整改措施", width = 15, orderNum = "1")
@Excel(name = "整改措施", width = 15)
@ApiModelProperty(value = "整改措施")
private String rectifyMeasure;
/**
* 整改负责人
*/
@Excel(name = "整改负责人", width = 15, orderNum = "1")
@Excel(name = "整改负责人", width = 15)
@ApiModelProperty(value = "整改负责人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String responseUser;
@@ -109,7 +109,6 @@ public class EnterpriseStandardInspectRectifyPlan implements Serializable {
/**
* 整改单位
*/
@Excel(name = "整改单位", width = 15, orderNum = "1")
@ApiModelProperty(value = "整改单位")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
private String responseDepart;
@@ -117,7 +116,7 @@ public class EnterpriseStandardInspectRectifyPlan implements Serializable {
/**
* 整改计划完成时间
*/
@Excel(name = "整改计划完成时间", width = 15, orderNum = "1", format = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "整改计划完成时间", width = 18, format = "yyyy-MM-dd")
@ApiModelProperty(value = "整改计划完成时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@@ -126,7 +125,7 @@ public class EnterpriseStandardInspectRectifyPlan implements Serializable {
/**
* 整改实际完成时间
*/
@Excel(name = "整改实际完成时间", width = 15, orderNum = "1", format = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "整改实际完成时间", width = 18, format = "yyyy-MM-dd")
@ApiModelProperty(value = "整改实际完成时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@@ -135,7 +134,7 @@ public class EnterpriseStandardInspectRectifyPlan implements Serializable {
/**
* 整改状态
*/
@Excel(name = "整改状态", width = 15, orderNum = "1", dicCode = "inspect_rectify_status")
@Excel(name = "整改状态", width = 15, dicCode = "inspect_rectify_status")
@Dict(dicCode = "inspect_rectify_status")
@ApiModelProperty(value = "整改状态")
private String rectifyStatus;
@@ -3,12 +3,16 @@ package com.jero.modules.laws.enterprise.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectRectifyPlan;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* @author: Mzaxd
@@ -26,21 +30,21 @@ public class EnterpriseStandardInspectVo {
/**
* 稽查依据标准号
*/
@Excel(name = "稽查依据标准号", width = 15, orderNum = "1")
@Excel(name = "稽查依据标准号", width = 15, needMerge = true)
@ApiModelProperty(value = "稽查依据标准号")
private String inspectNo;
/**
* 稽查依据标准名称
*/
@Excel(name = "稽查依据标准名称", width = 15, orderNum = "1")
@Excel(name = "稽查依据标准名称", width = 18, needMerge = true)
@ApiModelProperty(value = "稽查依据标准名称")
private String inspectName;
/**
* 计划稽查对象
*/
@Excel(name = "计划稽查对象", width = 15, orderNum = "1", dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Excel(name = "计划稽查对象", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id", needMerge = true)
@ApiModelProperty(value = "计划稽查对象")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
private String planInspectObject;
@@ -48,14 +52,14 @@ public class EnterpriseStandardInspectVo {
/**
* 主责标准化工作组
*/
@Excel(name = "主责标准化工作组", width = 15, orderNum = "1")
@Excel(name = "主责标准化工作组", width = 18, needMerge = true)
@ApiModelProperty(value = "主责标准化工作组")
private String standardizationWorkGroup;
/**
* 所属部门
*/
@Excel(name = "所属部门", width = 15, orderNum = "1", dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Excel(name = "所属部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id", needMerge = true)
@ApiModelProperty(value = "所属部门")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
private String belongDept;
@@ -63,7 +67,7 @@ public class EnterpriseStandardInspectVo {
/**
* 计划稽查日期
*/
@Excel(name = "计划稽查日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
@Excel(name = "计划稽查日期", width = 15, format = "yyyy-MM-dd", needMerge = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "计划稽查日期")
@@ -72,7 +76,6 @@ public class EnterpriseStandardInspectVo {
/**
* 稽查负责人
*/
@Excel(name = "稽查负责人", width = 15, orderNum = "1", dictTable = "sys_user", dicCode = "id", dicText = "realname")
@ApiModelProperty(value = "稽查负责人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String inspectUser;
@@ -80,21 +83,29 @@ public class EnterpriseStandardInspectVo {
/**
* 稽查负责人 翻译
*/
@Excel(name = "稽查负责人", width = 15, needMerge = true)
@ApiModelProperty(value = "稽查负责人 翻译")
private String inspectUserDictText;
/**
* 标准化组对接人
*/
@Excel(name = "标准化组对接人", width = 15, orderNum = "1", dictTable = "sys_user", dicCode = "id", dicText = "realname")
@ApiModelProperty(value = "标准化组对接人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String standardizationDockingUser;
/**
* 标准化组对接人 翻译
*/
@Excel(name = "标准化组对接人", width = 15, needMerge = true)
@ApiModelProperty(value = "标准化组对接人 翻译")
@TableField(exist = false)
private String standardizationDockingUserDictText;
/**
* 实际稽查完成日期
*/
@Excel(name = "实际稽查完成日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
@Excel(name = "实际稽查完成日期", width = 16, format = "yyyy-MM-dd", needMerge = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "实际稽查完成日期")
@@ -103,15 +114,21 @@ public class EnterpriseStandardInspectVo {
/**
* 实际稽查人
*/
@Excel(name = "实际稽查人", width = 15, orderNum = "1", dictTable = "sys_user", dicCode = "id", dicText = "realname")
@ApiModelProperty(value = "实际稽查人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String actualInspectUser;
/**
* 实际稽查人 翻译
*/
@Excel(name = "实际稽查人", width = 15, needMerge = true)
@ApiModelProperty(value = "实际稽查人 翻译")
private String actualInspectUserDictText;
/**
* 稽查状态
*/
@Excel(name = "稽查状态", width = 15, orderNum = "1", dicCode = "inspect_status")
@Excel(name = "稽查状态", width = 15, dicCode = "inspect_status", needMerge = true)
@Dict(dicCode = "inspect_status")
@ApiModelProperty(value = "稽查状态")
private String inspectStatus;
@@ -119,7 +136,7 @@ public class EnterpriseStandardInspectVo {
/**
* 创建时间
*/
@Excel(name = "创建日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
@Excel(name = "创建日期", width = 15, format = "yyyy-MM-dd", needMerge = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "创建时间")
@@ -131,6 +148,12 @@ public class EnterpriseStandardInspectVo {
@ApiModelProperty(value = "延期稽查标识")
private boolean delayFlag;
/**
* 整改计划
*/
@ApiModelProperty(value = "整改计划")
@ExcelCollection(name = "")
private List<EnterpriseStandardInspectRectifyPlan> enterpriseStandardInspectRectifyPlanList = Collections.emptyList();
//=================================
/**
* ids 查询用
@@ -0,0 +1,148 @@
package com.jero.modules.laws.enterprise.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName: ExportDataWithDelayVo
* @Description:
* @Author: yjz
* @Date: 2023-12-19 11:33
* @Version: 1.0
**/
@Data
public class ExportDataWithDelayVo {
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
private String id;
/**
* 稽查依据标准号
*/
@Excel(name = "稽查依据标准号", width = 15, needMerge = true)
@ApiModelProperty(value = "稽查依据标准号")
private String inspectNo;
/**
* 稽查依据标准名称
*/
@Excel(name = "稽查依据标准名称", width = 16, needMerge = true)
@ApiModelProperty(value = "稽查依据标准名称")
private String inspectName;
/**
* 计划稽查对象
*/
@Excel(name = "计划稽查对象", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id", needMerge = true)
@ApiModelProperty(value = "计划稽查对象")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
private String planInspectObject;
/**
* 主责标准化工作组
*/
@Excel(name = "主责标准化工作组", width = 15, needMerge = true)
@ApiModelProperty(value = "主责标准化工作组")
private String standardizationWorkGroup;
/**
* 所属部门
*/
@Excel(name = "所属部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id", needMerge = true)
@ApiModelProperty(value = "所属部门")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
private String belongDept;
/**
* 计划稽查日期
*/
@Excel(name = "计划稽查日期", width = 15, format = "yyyy-MM-dd", needMerge = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "计划稽查日期")
private Date planInspectDate;
/**
* 稽查负责人
*/
@ApiModelProperty(value = "稽查负责人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String inspectUser;
/**
* 稽查负责人 翻译
*/
@Excel(name = "稽查负责人", width = 15, needMerge = true)
@ApiModelProperty(value = "稽查负责人 翻译")
private String inspectUserDictText;
/**
* 标准化组对接人
*/
@ApiModelProperty(value = "标准化组对接人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String standardizationDockingUser;
/**
* 标准化组对接人 翻译
*/
@Excel(name = "标准化组对接人", width = 15, needMerge = true)
@ApiModelProperty(value = "标准化组对接人 翻译")
@TableField(exist = false)
private String standardizationDockingUserDictText;
/**
* 实际稽查完成日期
*/
@Excel(name = "实际稽查完成日期", width = 16, format = "yyyy-MM-dd", needMerge = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "实际稽查完成日期")
private Date completeDate;
/**
* 实际稽查人
*/
@ApiModelProperty(value = "实际稽查人")
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
private String actualInspectUser;
/**
* 实际稽查人 翻译
*/
@Excel(name = "实际稽查人", width = 15, needMerge = true)
@ApiModelProperty(value = "实际稽查人 翻译")
private String actualInspectUserDictText;
/**
* 稽查状态
*/
@Excel(name = "稽查状态", width = 15, dicCode = "inspect_status", needMerge = true)
@Dict(dicCode = "inspect_status")
@ApiModelProperty(value = "稽查状态")
private String inspectStatus;
/**
* 申请延期日期
*/
@Excel(name = "申请延期日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "申请延期日期")
private Date requestDelayDate;
/**
* 延期说明
*/
@ApiModelProperty(value = "延期说明")
@Excel(name = "延期说明", width = 15)
private String delayDescription;
}
@@ -1,10 +1,12 @@
package com.jero.modules.laws.enterprise.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectRectifyPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author ThinkBook
* @description 针对表【laws_enterprise_standard_inspect_rectify_plan】的数据库操作Mapper
@@ -14,6 +16,8 @@ import org.apache.ibatis.annotations.Param;
public interface EnterpriseStandardInspectRectifyPlanMapper extends BaseMapper<EnterpriseStandardInspectRectifyPlan> {
IPage<EnterpriseStandardInspectRectifyPlan> page(IPage<EnterpriseStandardInspectRectifyPlan> page, @Param("inspectId") String inspectId);
List<EnterpriseStandardInspectRectifyPlan> list(@Param("inspectId") String inspectId);
}
@@ -30,11 +30,20 @@
<select id="page"
resultType="com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectRectifyPlan">
<include refid="select_inspect_rectify_plan"/>
</select>
<select id="list"
resultType="com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectRectifyPlan">
<include refid="select_inspect_rectify_plan"/>
</select>
<sql id="select_inspect_rectify_plan">
SELECT
irp.id,
irp.issue,
irp.rectify_measure,
u.realname AS responseUser,
(concat(u.realname,'(',u.username,')')) AS responseUser,
irp.plan_complete_date,
irp.actual_complete_date,
irp.rectify_status
@@ -45,5 +54,5 @@
irp.inspect_id = #{inspectId}
ORDER BY
irp.create_time DESC
</select>
</sql>
</mapper>
@@ -5,7 +5,9 @@ import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspect;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.laws.enterprise.entity.dto.ESQueryCommonDTO;
import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardInspectVo;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@@ -70,4 +72,18 @@ public interface EnterpriseStandardInspectService extends IService<EnterpriseSta
* @return
*/
List<EnterpriseStandardInspectVo> queryByList(EnterpriseStandardInspectVo enterpriseStandardInspectVo);
/**
* 企标稽查-导出整改计划
* @param request
* @param enterpriseStandardInspectVo
*/
ModelAndView exportDataRectifyPlan(HttpServletRequest request, EnterpriseStandardInspectVo enterpriseStandardInspectVo);
/**
* 企标稽查-导出延期数据
* @param request
* @param enterpriseStandardInspectVo
*/
ModelAndView exportDataWithDelay(HttpServletRequest request, EnterpriseStandardInspectVo enterpriseStandardInspectVo);
}
@@ -1,29 +1,42 @@
package com.jero.modules.laws.enterprise.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.BeanCopyUtils;
import com.jero.common.util.oConvertUtils;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspect;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectDelay;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectRectifyPlan;
import com.jero.modules.laws.enterprise.entity.dto.ESQueryCommonDTO;
import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardInspectDelayVo;
import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardInspectVo;
import com.jero.modules.laws.enterprise.entity.vo.ExportDataWithDelayVo;
import com.jero.modules.laws.enterprise.mapper.EnterpriseStandardInspectMapper;
import com.jero.modules.laws.enterprise.mapper.EnterpriseStandardInspectRectifyPlanMapper;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectDelayService;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectService;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -32,9 +45,13 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static com.jero.common.system.base.controller.JeroController.*;
/**
* @author ThinkBook
* @description 针对表【laws_enterprise_standard_inspect(企业标准)】的数据库操作Service实现
@@ -55,6 +72,9 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
@Resource
private ISysUserService sysUserService;
@Resource
private EnterpriseStandardInspectDelayService enterpriseStandardInspectDelayService;
@Override
public IPage<EnterpriseStandardInspectVo> queryPageList(ESQueryCommonDTO esInspect, Integer pageNo, Integer pageSize) {
IPage<EnterpriseStandardInspectVo> page = new Page<>(pageNo, pageSize);
@@ -208,10 +228,121 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
return esInspectMapper.queryByList(queryWrapper);
}
@Override
public ModelAndView exportDataRectifyPlan(HttpServletRequest request, EnterpriseStandardInspectVo enterpriseStandardInspectVo) {
String title = "企标稽查-整改计划";
// Step.1 组装查询条件
// Step.2 获取导出数据
List<EnterpriseStandardInspectVo> pageList = queryByList(enterpriseStandardInspectVo);
// 整改计划查询
for (EnterpriseStandardInspectVo standardInspectVo : pageList) {
List<EnterpriseStandardInspectRectifyPlan> list = esInspectRectifyPlanMapper.list(standardInspectVo.getId());
if (CollectionUtils.isNotEmpty(list)){
standardInspectVo.setEnterpriseStandardInspectRectifyPlanList(list);
}
}
List<EnterpriseStandardInspectVo> exportList = null;
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = pageList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
} else {
exportList = pageList;
}
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(CLASS, EnterpriseStandardInspectVo.class);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(null, title);
exportParams.setType(ExcelType.XSSF);
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
@Override
public ModelAndView exportDataWithDelay(HttpServletRequest request, EnterpriseStandardInspectVo enterpriseStandardInspectVo) {
String title = "企标稽查-延期数据";
// Step.1 组装查询条件
// Step.2 获取导出数据
List<EnterpriseStandardInspectVo> pageList = queryByList(enterpriseStandardInspectVo);
pageList = pageList.stream().filter(EnterpriseStandardInspectVo::isDelayFlag).collect(Collectors.toList());
List<ExportDataWithDelayVo> exportDataWithDelayVos = BeanCopyUtils.copyBeanList(pageList, ExportDataWithDelayVo.class);
// 延期数据查询
for (ExportDataWithDelayVo exportDataWithDelayVo : exportDataWithDelayVos) {
EnterpriseStandardInspectDelay enterpriseStandardInspectDelay = enterpriseStandardInspectDelayService.getOne(
new LambdaQueryWrapper<EnterpriseStandardInspectDelay>()
.eq(EnterpriseStandardInspectDelay::getInspectId, exportDataWithDelayVo.getId())
.orderByDesc(EnterpriseStandardInspectDelay::getCreateTime)
.last("limit 1"), false);
if (!Objects.isNull(enterpriseStandardInspectDelay)){
exportDataWithDelayVo.setRequestDelayDate(enterpriseStandardInspectDelay.getRequestDelayDate());
exportDataWithDelayVo.setDelayDescription(enterpriseStandardInspectDelay.getDelayDescription());
}
}
List<ExportDataWithDelayVo> exportList = null;
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = exportDataWithDelayVos.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
} else {
exportList = exportDataWithDelayVos;
}
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(CLASS, ExportDataWithDelayVo.class);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(null, title);
exportParams.setType(ExcelType.XSSF);
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
/**
* 获取对象ID
*
* @return
*/
private String getId(EnterpriseStandardInspectVo item) {
try {
return PropertyUtils.getProperty(item, "id").toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 获取对象ID
*
* @return
*/
private String getId(ExportDataWithDelayVo item) {
try {
return PropertyUtils.getProperty(item, "id").toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private void setProperty(List<EnterpriseStandardInspectVo> list) {
for (EnterpriseStandardInspectVo enterpriseStandardInspectVo : list) {
// 翻译
enterpriseStandardInspectVo.setInspectUserDictText(sysUserService.dictByIdsOrUserNames(enterpriseStandardInspectVo.getInspectUser(), ""));
enterpriseStandardInspectVo.setStandardizationDockingUserDictText(sysUserService.dictByIdsOrUserNames(enterpriseStandardInspectVo.getStandardizationDockingUser(), ""));
enterpriseStandardInspectVo.setActualInspectUserDictText(sysUserService.dictByIdsOrUserNames(enterpriseStandardInspectVo.getActualInspectUser(), ""));
}
}