|
|
|
@ -37,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.OutputStream; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
@ -382,8 +383,8 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
|
|
|
|
|
|
|
|
public Page<QueryMailVo> queryPage(Page<Mail> page, MailQuery mailQuery) { |
|
|
|
public Page<QueryMailVo> queryPage(Page<Mail> page, MailQuery mailQuery) { |
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>() |
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>() |
|
|
|
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) |
|
|
|
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD HH24:MI:SS')", mailQuery.getMailTimeStart()) |
|
|
|
.le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd()) |
|
|
|
.le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD HH24:MI:SS')", mailQuery.getMailTimeStartEnd()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailState()), "m.mail_state", mailQuery.getMailState()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailState()), "m.mail_state", mailQuery.getMailState()) |
|
|
|
@ -464,6 +465,13 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
} |
|
|
|
} |
|
|
|
workVo.setMailLabels(labelNamesStr.substring(0, labelNamesStr.length() - 1)); |
|
|
|
workVo.setMailLabels(labelNamesStr.substring(0, labelNamesStr.length() - 1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Objects.nonNull(workVo.getLimitedTime())) { |
|
|
|
|
|
|
|
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(workVo.getLimitedTime(), workVo.getFlowLimitedLastHandlerTime())); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Flow flow = SpringUtil.getBean(FirstSignFlow.class); |
|
|
|
|
|
|
|
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(flow.getFlowNode().getLimitedTime(), workVo.getCreateTime())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -526,13 +534,25 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
// 这里URLEncoder.encode可以防止中文乱码
|
|
|
|
// 这里URLEncoder.encode可以防止中文乱码
|
|
|
|
String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20"); |
|
|
|
String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20"); |
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|
|
|
EasyExcel.write(response.getOutputStream(), MailExcel.class).sheet("模板").doWrite(mailList); |
|
|
|
try (OutputStream out = response.getOutputStream()) { |
|
|
|
|
|
|
|
// 使用EasyExcel写入数据到输出流
|
|
|
|
|
|
|
|
EasyExcel.write(out, MailExcel.class).sheet("模板").doWrite(mailList); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("Exception occurred while exporting mail data" + e.getMessage(), e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果response还没有被提交,返回一个错误信息
|
|
|
|
|
|
|
|
if (!response.isCommitted()) { |
|
|
|
|
|
|
|
response.reset(); |
|
|
|
|
|
|
|
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); |
|
|
|
|
|
|
|
response.getWriter().write("Failed to export data due to an internal error."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Page<QueryMailVo> dissatisfied(Page<Mail> page, MailQuery mailQuery) { |
|
|
|
public Page<QueryMailVo> dissatisfied(Page<Mail> page, MailQuery mailQuery) { |
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>() |
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>() |
|
|
|
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) |
|
|
|
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "m.mail_time", mailQuery.getMailTimeStart()) |
|
|
|
.le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd()) |
|
|
|
.le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "m.mail_time", mailQuery.getMailTimeStartEnd()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) |
|
|
|
.nested(i -> |
|
|
|
.nested(i -> |
|
|
|
@ -587,6 +607,12 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (Objects.nonNull(workVo.getLimitedTime())) { |
|
|
|
|
|
|
|
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(workVo.getLimitedTime(), workVo.getFlowLimitedLastHandlerTime())); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Flow flow = SpringUtil.getBean(FirstSignFlow.class); |
|
|
|
|
|
|
|
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(flow.getFlowNode().getLimitedTime(), workVo.getCreateTime())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|