feat: 企标稽查根据新版列表接口导入

This commit is contained in:
2023-12-12 15:25:57 +08:00
parent 650a66a442
commit 56d37a22fc
6 changed files with 97 additions and 41 deletions
@@ -2,6 +2,7 @@ package com.jero.modules.activiti.process.esAnnualInit.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.CommonAPI;
import com.jero.common.constant.enums.YesOrNoEnum;
@@ -253,6 +254,11 @@ public class ProcessEsAnnualInitServiceImpl extends ServiceImpl<ProcessEsAnnualI
dataList.forEach(d -> approvalUserList.add(d.getApprovalUser()));
taskService.setVariable(taskId, "approvalUserList", approvalUserList);
} else {
// 更新所有数据为驳回
LambdaQueryWrapper<ProcessEsAnnualInit> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ProcessEsAnnualInit::getContactUser, userId);
wrapper.eq(ProcessEsAnnualInit::getProcessInstanceId, processInstanceId);
dataList = list(wrapper);
dataList.forEach(d -> d.setRejectFlag(YesOrNoEnum.YES.getValue()));
}
dataList.forEach(data -> data.setExecutionId(executionId));
@@ -202,6 +202,12 @@ public class ProcessEsRecheckServiceImpl extends ServiceImpl<ProcessEsRecheckMap
actFlowCommonService.setProcessVariables(processInstanceId, actVariables);
// 保存选人信息
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, this.getUserMap(variables));
// 根据流程实例id更新流程总表
String prcName = commonVO.getPrcName();
String prcMes = commonVO.getPrcMes();
Date dueTime = commonVO.getDueTime();
Integer prcType = ProcessTypeEnum.ES_RECHECK.getValue();
actFlowCommonService.updateProcessAll(processInstanceId, userId, prcName, prcMes, prcType, dueTime);
}
}
// 设置流程变量
@@ -60,6 +60,7 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
*
* @return
*/
@Deprecated
@RequiresPermissions("enterpriseStandardLibrary:check:search")
@AutoLog(value = "企标稽查-分页列表查询")
@ApiOperation(value="企标稽查-分页列表查询", notes="企标稽查-分页列表查询")
@@ -150,8 +151,8 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
@AutoLog(value = "企标稽查-导出")
@ApiOperation(value="企标稽查-导出", notes="企标稽查-导出")
@GetMapping("/exportData")
public void exportData(HttpServletResponse response, ESQueryCommonDTO esQueryCommonDTO) {
esInspectService.export(response, esQueryCommonDTO, "企标稽查", "企标稽查");
public void exportData(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo) {
esInspectService.export(response, enterpriseStandardInspectVo, "企标稽查", "企标稽查");
}
@RequiresPermissions("enterpriseStandardLibrary:check:exportPostponeData")
@@ -166,7 +167,7 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
@AutoLog(value = "企标稽查-导出整改计划")
@ApiOperation(value="企标稽查-导出整改计划", notes="企标稽查-导出整改计划")
@GetMapping("/exportDataRectifyPlan")
public void exportDataRectifyPlan(HttpServletResponse response, ESQueryCommonDTO esQueryCommonDTO) throws IOException {
esInspectService.exportDataRectifyPlan(response, esQueryCommonDTO, "企标稽查-整改计划", "企标稽查-整改计划");
public void exportDataRectifyPlan(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo) throws IOException {
esInspectService.exportDataRectifyPlan(response, enterpriseStandardInspectVo, "企标稽查-整改计划", "企标稽查-整改计划");
}
}
@@ -17,92 +17,124 @@ import java.util.Date;
@Data
public class EnterpriseStandardInspectVo {
/** 主键ID */
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
private String id;
/** 稽查依据标准号 */
/**
* 稽查依据标准号
*/
@Excel(name = "稽查依据标准号", width = 15, orderNum = "1")
@ApiModelProperty(value = "稽查依据标准号")
private String inspectNo;
/** 计划稽查对象 */
@Excel(name = "计划稽查对象", width = 15, orderNum = "1")
/**
* 计划稽查对象
*/
@Excel(name = "计划稽查对象", width = 15, orderNum = "1", dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "计划稽查对象")
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
private String planInspectObject;
/** 稽查依据标准名称 */
/**
* 稽查依据标准名称
*/
@Excel(name = "稽查依据标准名称", width = 15, orderNum = "1")
@ApiModelProperty(value = "稽查依据标准名称")
private String inspectName;
/** 主责标准化工作组 */
/**
* 主责标准化工作组
*/
@Excel(name = "主责标准化工作组", width = 15, orderNum = "1")
@ApiModelProperty(value = "主责标准化工作组")
private String standardizationWorkGroup;
/** 所属部门 */
@Excel(name = "所属部门", width = 15, orderNum = "1")
/**
* 所属部门
*/
@Excel(name = "所属部门", width = 15, orderNum = "1", dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "所属部门")
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
private String belongDept;
/** 计划稽查日期 */
/**
* 计划稽查日期
*/
@Excel(name = "计划稽查日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "计划稽查日期")
private Date planInspectDate;
/** 稽查负责人 */
@Excel(name = "稽查负责人", width = 15, orderNum = "1")
/**
* 稽查负责人
*/
@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;
/** 稽查负责人 翻译*/
/**
* 稽查负责人 翻译
*/
@ApiModelProperty(value = "稽查负责人 翻译")
private String inspectUserDictText;
/** 标准化组对接人 */
@Excel(name = "标准化组对接人", width = 15, orderNum = "1")
/**
* 标准化组对接人
*/
@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, orderNum = "1", format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "实际稽查完成日期")
private Date completeDate;
/** 实际稽查人 */
@Excel(name = "实际稽查人", width = 15, orderNum = "1")
/**
* 实际稽查人
*/
@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, orderNum = "1", dicCode = "inspect_status")
@Dict(dicCode = "inspect_status")
@ApiModelProperty(value = "稽查状态")
private String inspectStatus;
/** 创建时间 */
/**
* 创建时间
*/
@Excel(name = "创建日期", width = 15, orderNum = "1", format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/** 延期稽查标识 */
/**
* 延期稽查标识
*/
@ApiModelProperty(value = "延期稽查标识")
private boolean delayFlag;
//=================================
/**ids 查询用*/
/**
* ids 查询用
*/
@ApiModelProperty(value = "ids 查询用")
@TableField(exist = false)
private String ids;
@@ -29,11 +29,11 @@ public interface EnterpriseStandardInspectService extends IService<EnterpriseSta
/**
* 企标稽查-导出
* @param response
* @param esQueryCommonDTO
* @param enterpriseStandardInspectVo
* @param fileName
* @param sheetName
*/
void export(HttpServletResponse response, ESQueryCommonDTO esQueryCommonDTO, String fileName, String sheetName);
void export(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo, String fileName, String sheetName);
/**
* 企标稽查-导出
@@ -49,11 +49,11 @@ public interface EnterpriseStandardInspectService extends IService<EnterpriseSta
*
* 这里导出的是压缩包
* @param response
* @param esQueryCommonDTO
* @param enterpriseStandardInspectVo
* @param sheetName
* @param fileName
*/
void exportDataRectifyPlan(HttpServletResponse response, ESQueryCommonDTO esQueryCommonDTO, String sheetName, String fileName) throws IOException;
void exportDataRectifyPlan(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo, String sheetName, String fileName) throws IOException;
/**
* 企标稽查-分页列表查询2
@@ -27,6 +27,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -61,19 +63,22 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
}
@Override
public void export(HttpServletResponse response, ESQueryCommonDTO esQueryCommonDTO, String fileName, String sheetName) {
public void export(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo, String fileName, String sheetName) {
try {
// 获取数据
IPage<EnterpriseStandardInspectVo> enterpriseStandardInspectVoIPage = this.queryPageList(esQueryCommonDTO, 1, Integer.MAX_VALUE);
IPage<EnterpriseStandardInspectVo> enterpriseStandardInspectVoIPage = this.queryByPage(enterpriseStandardInspectVo, 1, Integer.MAX_VALUE);
List<EnterpriseStandardInspectVo> records = enterpriseStandardInspectVoIPage.getRecords();
// 设置导出参数
ExportParams exportParams = new ExportParams(null, sheetName); // 可以为标题添加更多的配置
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, EnterpriseStandardInspectVo.class, records);
// 编码文件名以兼容各种浏览器
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
// 设置响应头和内容类型
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");
response.setHeader("Content-Disposition", "attachment; filename=" + encodedFileName + ".xls");
// 写出到响应流
workbook.write(response.getOutputStream());
@@ -96,9 +101,12 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
ExportParams exportParams = new ExportParams(null, sheetName); // 可以为标题添加更多的配置
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, EnterpriseStandardInspectDelayVo.class, records);
// 编码文件名以兼容各种浏览器
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
// 设置响应头和内容类型
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");
response.setHeader("Content-Disposition", "attachment; filename=" + encodedFileName + ".xls");
// 写出到响应流
workbook.write(response.getOutputStream());
@@ -110,13 +118,13 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
}
@Override
public void exportDataRectifyPlan(HttpServletResponse response, ESQueryCommonDTO esQueryCommonDTO, String sheetName, String fileName) {
public void exportDataRectifyPlan(HttpServletResponse response, EnterpriseStandardInspectVo enterpriseStandardInspectVo, String sheetName, String fileName) throws UnsupportedEncodingException {
// 在内存中创建一个 Zip 输出流
ByteArrayOutputStream zipOutputStream = new ByteArrayOutputStream();
try (ZipOutputStream zos = new ZipOutputStream(zipOutputStream)) {
// 获取需要导出的稽查报告
IPage<EnterpriseStandardInspectVo> enterpriseStandardInspectVoIPage = this.queryPageList(esQueryCommonDTO, 1, Integer.MAX_VALUE);
IPage<EnterpriseStandardInspectVo> enterpriseStandardInspectVoIPage = this.queryByPage(enterpriseStandardInspectVo, 1, Integer.MAX_VALUE);
List<EnterpriseStandardInspectVo> records = enterpriseStandardInspectVoIPage.getRecords();
// 处理 inspectNo
@@ -164,9 +172,12 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
log.error("创建ZIP文件时发生错误", e);
}
// 编码文件名以兼容各种浏览器
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
// 将 Zip 文件写出到响应流中
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".zip");
response.setHeader("Content-Disposition", "attachment; filename=" + encodedFileName + ".zip");
try {
response.getOutputStream().write(zipOutputStream.toByteArray());
} catch (IOException e) {