Commit ee02eaae authored by huyuchen's avatar huyuchen

实缴合并导出限制

parents f1e8430a bd21db13
......@@ -146,6 +146,8 @@ public interface CacheConstants {
String PAYMENT_SOCIAL_PUSH = "payment_social_push";
String PAYMENT_SOCIAL_EXPORT = "payment_social_export";
String PAYMENT_DISPATCH_BATCH_ADD_IMPORT = "payment_dispatch_batch_add_import";
String PAYMENT_DISPATCH_BATCH_REDUCE_IMPORT = "payment_dispatch_batch_reduce_import";
......
......@@ -578,6 +578,10 @@ public interface CommonConstants {
String HRO_EMPLOYEE_NULL = "Hro人员列表为空";
int THIRTY_INT_NEGATIVE = -30;
public static final String SOCIAL_EXPORT_CONTINUE="当前用户有未完成的实缴导出任务不可重复操作";
public static final String SOCIAL_EXPORT_LIMIT="导出量过大,请选择更多查询条件!如果确定要导出这些数据请联系系统管理员操作";
/*
* 启用停用状态
*/
......
......@@ -306,6 +306,7 @@ public class TPaymentInfoController {
* @author huyc
* @date 2022-07-22
**/
@SysLog("实缴导入列表不合并导出")
@Operation(description = "导出缴费库 hasPermission('social_tpaymentinfo_export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')")
......@@ -336,6 +337,7 @@ public class TPaymentInfoController {
@Operation(description = "缴费库查询合并导出 hasPermission('social_tpaymentinfo_export')")
@PostMapping("/sumSearchExport")
@PreAuthorize("@pms.hasPermission('social_tpaymentinfo_export')")
@SysLog("实缴查询列表合并导出")
public void sumSearchExport(HttpServletResponse response, @RequestBody TPaymentInfoSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
......
......@@ -184,11 +184,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentInfoBatchVo> list = new ArrayList<>();
Integer count = baseMapper.selectCountTPaymentInfo(searchVo);
ServletOutputStream out = null;
YifuUser user = SecurityUtils.getUser();
String key = CacheConstants.PAYMENT_SOCIAL_EXPORT + CommonConstants.DOWN_LINE_STRING +user.getId() ;
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"));
if (Common.isNotNull(redisUtil.get(key))) {
out.write(CommonConstants.SOCIAL_EXPORT_CONTINUE.getBytes("GBK"));
out.close();
return;
} else {
redisUtil.set(key, user.getId(), 600L);
}
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfoBatchVo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0;
......@@ -220,13 +229,16 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
excelWriter.finish();
}
} catch (Exception e) {
redisUtil.remove(key);
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
redisUtil.remove(key);
} catch (IOException e) {
redisUtil.remove(key);
log.error("执行异常", e);
}
}
......@@ -245,11 +257,26 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentInfoExportVo> list = new ArrayList<>();
Integer count = baseMapper.selectCountSumPaymentInfo(searchVo);
ServletOutputStream out = null;
YifuUser user = SecurityUtils.getUser();
String key = CacheConstants.PAYMENT_SOCIAL_EXPORT + CommonConstants.DOWN_LINE_STRING +user.getId() ;
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"));
if (Common.isNotNull(redisUtil.get(key))) {
out.write(CommonConstants.SOCIAL_EXPORT_CONTINUE.getBytes("GBK"));
out.close();
return;
} else {
redisUtil.set(key, user.getId(), 600L);
}
if (count > 150000 && !CommonConstants.ONE_STRING.equals(user.getId())) {
out.write(CommonConstants.SOCIAL_EXPORT_LIMIT.getBytes("GBK"));
out.close();
redisUtil.remove(key);
return;
}
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TPaymentInfoExportVo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0;
......@@ -279,13 +306,16 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
out.flush();
excelWriter.finish();
} catch (Exception e) {
redisUtil.remove(key);
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
redisUtil.remove(key);
} catch (IOException e) {
redisUtil.remove(key);
log.error("执行异常", e);
}
}
......@@ -305,14 +335,23 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentInfoNewExportVo> list = new ArrayList<>();
Integer count = baseMapper.selectCountPaymentSearchInfo(searchVo);
ServletOutputStream out = null;
String key = CacheConstants.PAYMENT_SOCIAL_EXPORT + CommonConstants.DOWN_LINE_STRING +user.getId() ;
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"));
if (Common.isNotNull(redisUtil.get(key))) {
out.write(CommonConstants.SOCIAL_EXPORT_CONTINUE.getBytes("GBK"));
out.close();
return;
} else {
redisUtil.set(key, user.getId(), 600L);
}
if (count > 150000 && !CommonConstants.ONE_STRING.equals(user.getId())) {
out.write("导出量过大,请选择更多查询条件!如果确定要导出这些数据请联系管理员操作".getBytes("GBK"));
out.write(CommonConstants.SOCIAL_EXPORT_LIMIT.getBytes("GBK"));
out.close();
redisUtil.remove(key);
return;
}
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
......@@ -344,13 +383,16 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
out.flush();
excelWriter.finish();
} catch (Exception e) {
redisUtil.remove(key);
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
redisUtil.remove(key);
} catch (IOException e) {
redisUtil.remove(key);
log.error("执行异常", e);
}
}
......
......@@ -1981,7 +1981,6 @@
)
) w
GROUP BY w.keyGroup
ORDER BY w.SOCIAL_CREATE_TIME desc
limit #{tPaymentInfo.limitStart},#{tPaymentInfo.limitEnd}
</select>
......
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