Commit 57232dab authored by huyuchen's avatar huyuchen

huych-含风险项目商险不购买申请提交

parent 02534896
package com.yifu.cloud.plus.v1.yifu.salary.service.impl; package com.yifu.cloud.plus.v1.yifu.salary.service.impl;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
...@@ -29,7 +28,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchaseApplyServi ...@@ -29,7 +28,10 @@ import com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchaseApplyServi
import com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchasePersonService; import com.yifu.cloud.plus.v1.yifu.salary.service.TInsuranceUnpurchasePersonService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAttaService; import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAttaService;
import com.yifu.cloud.plus.v1.yifu.salary.service.impl.process.TInsuranceUnpurchaseApplyAuditProcess; import com.yifu.cloud.plus.v1.yifu.salary.service.impl.process.TInsuranceUnpurchaseApplyAuditProcess;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*; import com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchaseApplySearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchaseApplyVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchasePersonAddVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TInsuranceUnpurchasePersonCardVo;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -40,7 +42,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -40,7 +42,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -118,22 +119,18 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance ...@@ -118,22 +119,18 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
if (count > CommonConstants.EXCEL_EXPORT_LIMIT_NEW) { for (int i = 0; i <= count; i = i + CommonConstants.EXCEL_EXPORT_LIMIT_NEW) {
exportError(response, "数据超过2万条,请联系管理员后端导出"); // 获取实际记录
} else { searchVo.setLimitStart(i);
for (int i = 0; i <= count; i = i + CommonConstants.EXCEL_EXPORT_LIMIT_NEW) { searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_NEW);
// 获取实际记录 list = baseMapper.getTInsuranceUnpurchaseApplyExportList(searchVo);
searchVo.setLimitStart(i); if (Common.isNotNull(list)) {
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_NEW); WriteSheet writeSheet = EasyExcel.writerSheet("含风险项目不购买申请表" + index).build();
list = baseMapper.getTInsuranceUnpurchaseApplyExportList(searchVo); excelWriter.write(list, writeSheet);
if (Common.isNotNull(list)) { index++;
WriteSheet writeSheet = EasyExcel.writerSheet("含风险项目不购买申请表" + index).build(); }
excelWriter.write(list, writeSheet); if (Common.isNotNull(list)) {
index++; list.clear();
}
if (Common.isNotNull(list)) {
list.clear();
}
} }
} }
} else { } else {
...@@ -562,39 +559,4 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance ...@@ -562,39 +559,4 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
return tInsuranceUnpurchaseApplyAuditProcess.auditUserList(insuranceUnpurchaseApply.getId(), approvalResult, approvalOpinion, user, CommonConstants.ZERO_STRING, return tInsuranceUnpurchaseApplyAuditProcess.auditUserList(insuranceUnpurchaseApply.getId(), approvalResult, approvalOpinion, user, CommonConstants.ZERO_STRING,
insuranceUnpurchaseApply, insuranceUnpurchaseApply.getCreateUserDeptId()); insuranceUnpurchaseApply, insuranceUnpurchaseApply.getCreateUserDeptId());
} }
private void exportError(HttpServletResponse response, String errorMessage) {
String fileName = "导出异常" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<ExportErrorVo> list = new ArrayList<>();
list.add(new ExportErrorVo(errorMessage));
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, ExportErrorVo.class).build();
int index = 0;
WriteSheet writeSheet = EasyExcelFactory.writerSheet("异常信息" + index).build();
excelWriter.write(list, writeSheet);
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
} }
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
a.DELETE_FLAG = '0' a.DELETE_FLAG = '0'
<include refid="tInsuranceUnpurchaseApply_where"/> <include refid="tInsuranceUnpurchaseApply_where"/>
</where> </where>
ifnull(a.CREATE_TIME_ZC,'2999-12-31 00:00:00') DESC order by ifnull(a.CREATE_TIME_ZC,'2999-12-31 00:00:00') DESC
<if test="tInsuranceUnpurchaseApply.limitStart != null"> <if test="tInsuranceUnpurchaseApply.limitStart != null">
limit #{tInsuranceUnpurchaseApply.limitStart},#{tInsuranceUnpurchaseApply.limitEnd} limit #{tInsuranceUnpurchaseApply.limitStart},#{tInsuranceUnpurchaseApply.limitEnd}
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment