Browse Source

信件查询流程显示逻辑更改

master
21819 2 years ago
parent
commit
2ea84e56d1
  1. 6
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java
  2. 36
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java
  3. 16
      mailbox-lan/src/main/resources/mapper/WorkMapper.xml

6
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/QueryMailVo.java

@ -86,6 +86,12 @@ public class QueryMailVo {
@ExcelProperty("流程限时") @ExcelProperty("流程限时")
private Long flowLimitedRemainingTime; private Long flowLimitedRemainingTime;
private LocalDateTime flowLimitedLastHandlerTime;
private Long limitedTime;
private LocalDateTime createTime;
/** /**
* 办理单位ID三级单位 * 办理单位ID三级单位
*/ */

36
mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

@ -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;
} }

16
mailbox-lan/src/main/resources/mapper/WorkMapper.xml

@ -28,7 +28,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.current_operator, m.current_operator,
f.limited_time, f.limited_time,
m.flow_limited_last_handler_time, m.flow_limited_last_handler_time,
w.create_time w.create_time,
m.extension_flag,
m.extension_days,
from work w from work w
left join mail m on w.mail_id = m.id left join mail m on w.mail_id = m.id
left join flow_node f on m.flow_key = f.key left join flow_node f on m.flow_key = f.key
@ -51,11 +53,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.contact_name,m.contact_phone,m.contact_id_card,m.contact_sex,m.content,m.source,m.mail_time,m.id,m.mail_state, m.contact_name,m.contact_phone,m.contact_id_card,m.contact_sex,m.content,m.source,m.mail_time,m.id,m.mail_state,
m.mail_category ,m.mail_level,m.three_dept_id,m.three_dept_name,m.flow_key,m.flow_before_name,m.mail_labels,m.flow_name,m.current_operator, m.mail_category ,m.mail_level,m.three_dept_id,m.three_dept_name,m.flow_key,m.flow_before_name,m.mail_labels,m.flow_name,m.current_operator,
m.flow_limited_last_handler_time,m.second_dept_id,m.mail_first_category,m.mail_second_category,m.mail_three_category, m.flow_limited_last_handler_time,m.second_dept_id,m.mail_first_category,m.mail_second_category,m.mail_three_category,
f.limited_time - ROUND(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) flow_limited_remaining_time f.limited_time,m.flow_limited_last_handler_time,m.extension_flag,
m.extension_days,
from mail m from mail m
</when> </when>
<otherwise> <otherwise>
m.*,f.limited_time - ROUND(extract(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) AS flow_limited_remaining_time m.*,f.limited_time
FROM FROM
(SELECT (SELECT
COALESCE(a.contact_name, ms.contact_name) AS contact_name,COALESCE(a.contact_phone, ms.contact_phone) AS contact_phone, COALESCE(a.contact_name, ms.contact_name) AS contact_name,COALESCE(a.contact_phone, ms.contact_phone) AS contact_phone,
@ -64,7 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
COALESCE(a.mail_time, ms.mail_time) AS mail_time,COALESCE(a.id, ms.id) AS id, COALESCE(a.mail_time, ms.mail_time) AS mail_time,COALESCE(a.id, ms.id) AS id,
a.mail_state,a.mail_category,a.mail_level,a.three_dept_id,a.three_dept_name,a.flow_key,a.flow_before_name, a.mail_state,a.mail_category,a.mail_level,a.three_dept_id,a.three_dept_name,a.flow_key,a.flow_before_name,
a.mail_labels,a.flow_name,a.current_operator,a.flow_limited_last_handler_time,a.second_dept_id,a.mail_first_category, a.mail_labels,a.flow_name,a.current_operator,a.flow_limited_last_handler_time,a.second_dept_id,a.mail_first_category,
a.mail_second_category,a.mail_three_category a.mail_second_category,a.mail_three_category,a.flow_limited_last_handler_time,a.extension_flag,
a.extension_days,
FROM FROM
mail_source ms mail_source ms
LEFT JOIN mail a ON ms.id = a.id LEFT JOIN mail a ON ms.id = a.id
@ -82,7 +86,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.mail_category ,m.mail_level,m.three_dept_id,m.three_dept_name,m.flow_key,m.flow_before_name,m.mail_labels,m.flow_name, m.mail_category ,m.mail_level,m.three_dept_id,m.three_dept_name,m.flow_key,m.flow_before_name,m.mail_labels,m.flow_name,
m.current_operator, m.current_operator,
ma.appeal_state,ma.handling_dept,ma.step, ma.appeal_state,ma.handling_dept,ma.step,
f.limited_time - ROUND(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - m.flow_limited_last_handler_time))) flow_limited_remaining_time f.limited_time,m.flow_limited_last_handler_time,
m.extension_flag,
m.extension_days,
from mail m from mail m
left join mail_appeal ma on ma.mail_id = m.id left join mail_appeal ma on ma.mail_id = m.id
left join mail_mark mm on mm.mail_id = m.id left join mail_mark mm on mm.mail_id = m.id

Loading…
Cancel
Save