|
|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package com.biutag.lan.service; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.extra.spring.SpringUtil; |
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
@ -14,26 +13,27 @@ import com.biutag.constants.AppConstants;
|
|
|
|
|
import com.biutag.core.AjaxResult; |
|
|
|
|
import com.biutag.entity.setting.DictData; |
|
|
|
|
import com.biutag.entity.system.Dept; |
|
|
|
|
import com.biutag.enums.MailState; |
|
|
|
|
import com.biutag.enums.RoleEnum; |
|
|
|
|
import com.biutag.exception.BusinessException; |
|
|
|
|
import com.biutag.lan.config.AdminThreadLocal; |
|
|
|
|
import com.biutag.lan.domain.*; |
|
|
|
|
import com.biutag.lan.domain.Mail; |
|
|
|
|
import com.biutag.lan.domain.MailCategory; |
|
|
|
|
import com.biutag.lan.domain.Work; |
|
|
|
|
import com.biutag.lan.domain.bo.MailOuter; |
|
|
|
|
import com.biutag.lan.domain.bo.MailQuery; |
|
|
|
|
import com.biutag.lan.domain.vo.LedgerExcel; |
|
|
|
|
import com.biutag.lan.domain.vo.MailExcel; |
|
|
|
|
import com.biutag.lan.domain.vo.QueryMailVo; |
|
|
|
|
import com.biutag.lan.domain.vo.WorkVo; |
|
|
|
|
import com.biutag.lan.enums.AppealState; |
|
|
|
|
import com.biutag.lan.enums.MailCategoryEnums; |
|
|
|
|
import com.biutag.lan.enums.SatisfactionEnum; |
|
|
|
|
import com.biutag.lan.enums.WorkType; |
|
|
|
|
import com.biutag.lan.flow.Flow; |
|
|
|
|
import com.biutag.lan.flow.FlowNameEnum; |
|
|
|
|
import com.biutag.lan.flow.FlowNodeEnum; |
|
|
|
|
import com.biutag.lan.flow.node.FirstSignFlow; |
|
|
|
|
import com.biutag.lan.mapper.*; |
|
|
|
|
import com.biutag.lan.mapper.MailCategoryMapper; |
|
|
|
|
import com.biutag.lan.mapper.MailMapper; |
|
|
|
|
import com.biutag.lan.mapper.WorkMapper; |
|
|
|
|
import com.biutag.mapper.system.DeptMapper; |
|
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
@ -47,17 +47,11 @@ import java.io.OutputStream;
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@Service |
|
|
|
|
public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final MailLabelMapper mailLabelMapper; |
|
|
|
|
|
|
|
|
|
private final MailAppealMapper mailAppealMapper; |
|
|
|
|
|
|
|
|
|
private final MailCategoryMapper mailCategoryMapper; |
|
|
|
|
|
|
|
|
|
private final MailMapper mailMapper; |
|
|
|
|
@ -68,14 +62,9 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
|
|
|
|
|
|
|
|
|
|
private final NoticeService noticeService; |
|
|
|
|
|
|
|
|
|
private final MailMarkService mailMarkService; |
|
|
|
|
|
|
|
|
|
private final IDictDataService dictDataService; |
|
|
|
|
|
|
|
|
|
private final MailReturnService mailReturnService; |
|
|
|
|
|
|
|
|
|
private final MailBlameService mailBlameService; |
|
|
|
|
|
|
|
|
|
public boolean save(MailOuter mail) { |
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
Work work = new Work(); |
|
|
|
|
@ -386,171 +375,7 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
|
|
|
|
|
return list(new LambdaQueryWrapper<Work>().eq(Work::getMailId, mailId).eq(Work::getSignRoleId, roleId).eq(Work::getWorkType, workType)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Page<QueryMailVo> queryPage(Page<Mail> page, MailQuery mailQuery) { |
|
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
if (CollectionUtil.isNotEmpty(mailQuery.getReturnRole())) { |
|
|
|
|
List<MailReturn> list = mailReturnService.list(new LambdaQueryWrapper<MailReturn>().eq(MailReturn::getSignFlag, false).in(MailReturn::getHandlerRoleId, mailQuery.getReturnRole())); |
|
|
|
|
if (list.isEmpty()) { |
|
|
|
|
return new Page<QueryMailVo>().setRecords(new ArrayList<>()).setTotal(0); |
|
|
|
|
} |
|
|
|
|
queryWrapper.in("m.id", list.stream().map(MailReturn::getMailId).collect(Collectors.toSet())); |
|
|
|
|
} |
|
|
|
|
queryWrapper.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "m.mail_time", mailQuery.getMailTimeStart()) |
|
|
|
|
.le(StrUtil.isNotBlank(mailQuery.getMailTimeEnd()), "m.mail_time", mailQuery.getMailTimeEnd()) |
|
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) |
|
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) |
|
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailState()), "m.mail_state", mailQuery.getMailState()) |
|
|
|
|
.like(StrUtil.isNotBlank(mailQuery.getQueryById()), "m.id", mailQuery.getQueryById()) |
|
|
|
|
.eq(Objects.nonNull(mailQuery.getSignRoleId()), "w.sign_role_id", mailQuery.getSignRoleId()) |
|
|
|
|
.eq(Objects.nonNull(mailQuery.getSignDeptId()), "w.sign_dept_id", mailQuery.getSignDeptId()) |
|
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getVerifyIsTrue()), "m.verify_is_true", mailQuery.getVerifyIsTrue()) |
|
|
|
|
.eq(Objects.nonNull(mailQuery.getVerifyNeedAccountability()), "m.verify_need_accountability", mailQuery.getVerifyNeedAccountability()) |
|
|
|
|
.eq(Objects.nonNull(mailQuery.getSimpleFlowFlag()), "m.simple_flow_flag", mailQuery.getSimpleFlowFlag()) |
|
|
|
|
.in(CollectionUtil.isNotEmpty(mailQuery.getSatisfactionStatus()), "m.satisfaction_status", mailQuery.getSatisfactionStatus()) |
|
|
|
|
.in(CollectionUtil.isNotEmpty(mailQuery.getPoliceType()), "m.police_type", mailQuery.getPoliceType()); |
|
|
|
|
// 责任追究
|
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getVerifyPunish())) { |
|
|
|
|
List<MailBlame> mailBlames = mailBlameService.list(new LambdaQueryWrapper<MailBlame>().like(MailBlame::getVerifyPunish, mailQuery.getVerifyPunish())); |
|
|
|
|
if (mailBlames.isEmpty()) { |
|
|
|
|
return new Page<QueryMailVo>().setRecords(new ArrayList<>()).setTotal(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (Objects.nonNull(mailQuery.getExtensionFlag())) { |
|
|
|
|
if (mailQuery.getExtensionFlag()) { |
|
|
|
|
queryWrapper.gt("m.extension_days", 0); |
|
|
|
|
} else { |
|
|
|
|
queryWrapper.and(q -> { |
|
|
|
|
q.eq("m.extension_days", 0).or().isNull("m.extension_days"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getQueryByContent())) { |
|
|
|
|
queryWrapper.and(query -> { |
|
|
|
|
query.like("m.content", mailQuery.getQueryByContent()) |
|
|
|
|
.or() |
|
|
|
|
.like("m.interview_details", mailQuery.getQueryByContent()) |
|
|
|
|
.or() |
|
|
|
|
.like("m.verify_details", mailQuery.getQueryByContent()) |
|
|
|
|
.or() |
|
|
|
|
.like("m.completion_comment", mailQuery.getQueryByContent()); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getCountMails())) { |
|
|
|
|
switch (mailQuery.getCountMails()) { |
|
|
|
|
case "1": |
|
|
|
|
queryWrapper.and(i -> i.notIn("m.flow_key", Arrays.asList(FlowNodeEnum.FIRST_SIGN.getKey(), FlowNodeEnum.FIRST_DISTRIBUTE.getKey()))//防止二级专班退回市局专班的信件未被签收,但是仍然存在于mail表中
|
|
|
|
|
.ne("m.mail_state", MailState.terminated.getValue())); |
|
|
|
|
break; |
|
|
|
|
case "2": |
|
|
|
|
queryWrapper.nested(i -> i.eq("mm.completed", "1")); |
|
|
|
|
break; |
|
|
|
|
case "3": |
|
|
|
|
queryWrapper.nested(i -> i.eq("mm.satisfied", "1")); |
|
|
|
|
break; |
|
|
|
|
case "4": |
|
|
|
|
queryWrapper.nested(i -> i.eq("mm.resolved", "1")); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getFlowKey())) { |
|
|
|
|
List<String> flowKeyList = StrUtil.split(mailQuery.getFlowKey(), ',', true, true); |
|
|
|
|
|
|
|
|
|
//判断是否需要查询mail_source表内容
|
|
|
|
|
boolean nullFlag = false; |
|
|
|
|
for (String flowKey : flowKeyList) { |
|
|
|
|
if (flowKey.equals("first_sign")) { |
|
|
|
|
nullFlag = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (nullFlag) |
|
|
|
|
queryWrapper.nested(i -> i.isNull("m.flow_key").or().in("m.flow_key", flowKeyList)); |
|
|
|
|
else |
|
|
|
|
queryWrapper.in("m.flow_key", flowKeyList); |
|
|
|
|
} |
|
|
|
|
mailCategorySearch(mailQuery, queryWrapper); |
|
|
|
|
deptSearch(mailQuery, queryWrapper); |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getMailLabels())) { |
|
|
|
|
List<String> labelIds = mailQuery.handleMailLabels(); |
|
|
|
|
for (String labelId : labelIds) { |
|
|
|
|
queryWrapper.like("m.mail_labels", labelId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
roleCheck(queryWrapper); |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) { |
|
|
|
|
switch (mailQuery.getContactField()) { |
|
|
|
|
case "name": |
|
|
|
|
queryWrapper.like("m.contact_name", mailQuery.getContactFieldValue()); |
|
|
|
|
break; |
|
|
|
|
case "idCard": |
|
|
|
|
queryWrapper.like("m.contact_id_card", mailQuery.getContactFieldValue()); |
|
|
|
|
break; |
|
|
|
|
case "phone": |
|
|
|
|
queryWrapper.like("m.contact_phone", mailQuery.getContactFieldValue()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getTimeout())) { |
|
|
|
|
// 超时查询
|
|
|
|
|
switch (mailQuery.getTimeout()) { |
|
|
|
|
// 签收超时
|
|
|
|
|
case "1": |
|
|
|
|
queryWrapper.eq("mm.sign_timeout", true); |
|
|
|
|
break; |
|
|
|
|
// 联系群众超时
|
|
|
|
|
case "2": |
|
|
|
|
queryWrapper.eq("mm.contact_writer_timeout", true); |
|
|
|
|
break; |
|
|
|
|
// 办理超时
|
|
|
|
|
case "3": |
|
|
|
|
queryWrapper.eq("mm.process_timeout", true); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 办结时间
|
|
|
|
|
if (!mailQuery.getCompletionTime().isEmpty()) { |
|
|
|
|
queryWrapper.ge("mm.completion_time", mailQuery.getCompletionTime().get(0)) |
|
|
|
|
.le("mm.completion_time", mailQuery.getCompletionTime().get(1)); |
|
|
|
|
} |
|
|
|
|
// 申诉状态
|
|
|
|
|
if (AppealState.UN_APPEAL.getValue().equals(mailQuery.getAppealState())) { |
|
|
|
|
queryWrapper.eq("mm.satisfied", AppConstants.FALSE).eq("mm.completed", AppConstants.TRUE).isNull("ma.appeal_state"); |
|
|
|
|
} else { |
|
|
|
|
queryWrapper.eq(StrUtil.isNotBlank(mailQuery.getAppealState()), "ma.appeal_state", mailQuery.getAppealState()); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getReturnReason())) { |
|
|
|
|
List<MailReturn> list = mailReturnService.list(new LambdaQueryWrapper<MailReturn>().like(MailReturn::getReason, mailQuery.getReturnReason())); |
|
|
|
|
queryWrapper.in(!list.isEmpty(), "m.id", list.stream().map(MailReturn::getMailId).toList()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 排序
|
|
|
|
|
queryWrapper.orderByDesc("m.mail_time"); |
|
|
|
|
Page<QueryMailVo> result = baseMapper.selectQueryPage(page, queryWrapper, mailQuery.getCountMails()); |
|
|
|
|
for (QueryMailVo workVo : result.getRecords()) { |
|
|
|
|
List<MailLabel> labelNames = mailLabelMapper.selectList(null); |
|
|
|
|
if (StrUtil.isNotBlank(workVo.getMailLabels())) { |
|
|
|
|
String[] labelIds = workVo.getMailLabels().split(","); |
|
|
|
|
String labelNamesStr = ""; |
|
|
|
|
for (String labelId : labelIds) { |
|
|
|
|
for (MailLabel label : labelNames) { |
|
|
|
|
if (label.getId().equals(Integer.parseInt(labelId))) { |
|
|
|
|
labelNamesStr += label.getLabelName() + ","; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
workVo.setMailLabels(labelNamesStr.substring(0, labelNamesStr.length() - 1)); |
|
|
|
|
} |
|
|
|
|
if (Objects.nonNull(workVo.getLimitedTime())) { |
|
|
|
|
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(workVo.getLimitedTime(), workVo.getFlowLimitedLastHandlerTime(), workVo.getExtensionDays())); |
|
|
|
|
} else { |
|
|
|
|
Flow flow = SpringUtil.getBean(FirstSignFlow.class); |
|
|
|
|
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(flow.getFlowNode().getLimitedTime(), workVo.getCreateTime(), workVo.getExtensionDays())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void mailCategorySearch(MailQuery mailQuery, QueryWrapper<Mail> queryWrapper) { |
|
|
|
|
public void mailCategorySearch(MailQuery mailQuery, QueryWrapper<Mail> queryWrapper) { |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getMailCategory())) { |
|
|
|
|
MailCategory mailCategory = mailCategoryMapper.selectById(mailQuery.getMailCategory()); |
|
|
|
|
switch (mailCategory.getLevel()) { |
|
|
|
|
@ -567,7 +392,7 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void deptSearch(MailQuery mailQuery, QueryWrapper queryWrapper) { |
|
|
|
|
public void deptSearch(MailQuery mailQuery, QueryWrapper queryWrapper) { |
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getDeptId())) { |
|
|
|
|
Dept dept = deptMapper.selectById(mailQuery.getDeptId()); |
|
|
|
|
switch (dept.getLevel()) { |
|
|
|
|
@ -778,137 +603,6 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
|
|
|
|
|
return AjaxResult.success(excelService.getResult()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String nullToEmpty(Object value) { |
|
|
|
|
return value == null ? "" : value.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void exportLedger(HttpServletResponse response, MailQuery mailQuery) { |
|
|
|
|
List<QueryMailVo> data = queryPage(new Page<>(1, 10000), mailQuery).getRecords(); |
|
|
|
|
export(response, data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void export(HttpServletResponse response, List<QueryMailVo> data) { |
|
|
|
|
List<String> mailIds = data.stream().map(QueryMailVo::getId).collect(Collectors.toList()); |
|
|
|
|
List<Mail> mailList = mailMapper.selectBatchIds(mailIds); |
|
|
|
|
List<MailMark> mailMarks = mailMarkService.listByIds(mailIds); |
|
|
|
|
List<MailAppeal> appealList = mailAppealMapper.selectList(new LambdaQueryWrapper<MailAppeal>().in(MailAppeal::getMailId, mailIds)); |
|
|
|
|
List<MailBlame> mailBlames = mailBlameService.list(mailIds); |
|
|
|
|
List<DictData> dictData = dictDataService.listByDateTypeAndValue(AppConstants.MAIL_SOURCE); |
|
|
|
|
List<LedgerExcel> list = new ArrayList<>(); |
|
|
|
|
int i = 1; |
|
|
|
|
for (QueryMailVo q : data) { |
|
|
|
|
Mail m = mailList.stream().filter(item -> item.getId().equals(q.getId())).findFirst().orElse(new Mail()); |
|
|
|
|
LedgerExcel ledgerExcel = new LedgerExcel(); |
|
|
|
|
ledgerExcel.setSerialNumber(i++); |
|
|
|
|
ledgerExcel.setId(nullToEmpty(q.getId())); |
|
|
|
|
ledgerExcel.setSource((dictData.stream() |
|
|
|
|
.filter(r -> r.getValue().equals(nullToEmpty(q.getSource()))) |
|
|
|
|
.toList().get(0).getName())); |
|
|
|
|
ledgerExcel.setMailTime(m.getMailTime()); |
|
|
|
|
ledgerExcel.setCreateTime(m.getCreateTime()); |
|
|
|
|
// 办结时间
|
|
|
|
|
MailMark mailMark = mailMarks.stream().filter(item -> item.getMailId().equals(q.getId())).findFirst().orElse(null); |
|
|
|
|
ledgerExcel.setCompletionTime(Optional.ofNullable(mailMark).map(MailMark::getCompletionTime).orElse(null)); |
|
|
|
|
ledgerExcel.setContactName(nullToEmpty(q.getContactName())); |
|
|
|
|
ledgerExcel.setContactPhone(nullToEmpty(q.getContactPhone())); |
|
|
|
|
ledgerExcel.setInvolvedDeptName(m.getInvolvedDeptName()); |
|
|
|
|
ledgerExcel.setSecondDeptName(nullToEmpty(m.getSecondDeptName())); |
|
|
|
|
ledgerExcel.setThreeDeptName(m.getThreeDeptName()); |
|
|
|
|
ledgerExcel.setContent(nullToEmpty(q.getContent())); |
|
|
|
|
|
|
|
|
|
// 超时时长
|
|
|
|
|
long signTimeoutDuration = Optional.ofNullable(mailMark).map(MailMark::getSignTimeoutDuration).orElse(0L); |
|
|
|
|
String secondSignFlag = signTimeoutDuration <= 0 ? AppConstants.YES : AppConstants.NO; |
|
|
|
|
ledgerExcel.setSignTimoutFlag(secondSignFlag); |
|
|
|
|
ledgerExcel.setSignTimeoutDuration(parseTimeStr(signTimeoutDuration)); |
|
|
|
|
|
|
|
|
|
Long contactWriterTimeoutDuration = Optional.ofNullable(mailMark).map(MailMark::getContactWriterTimeoutDuration).orElse(0L); |
|
|
|
|
ledgerExcel.setContactWriterTimeoutDuration(parseTimeStr(contactWriterTimeoutDuration)); |
|
|
|
|
|
|
|
|
|
// 逾期办结
|
|
|
|
|
String processTimeout = Optional.ofNullable(mailMark) |
|
|
|
|
.map(item -> Objects.nonNull(item.getProcessTimeout()) && item.getProcessTimeout() ? AppConstants.YES : AppConstants.NO) |
|
|
|
|
.orElse(""); |
|
|
|
|
ledgerExcel.setProcessTimeout(processTimeout); |
|
|
|
|
|
|
|
|
|
ledgerExcel.setIsTrue(nullToEmpty(m.getVerifyIsTrue())); |
|
|
|
|
ledgerExcel.setVerifyFeedback(m.getVerifyFeedback()); |
|
|
|
|
ledgerExcel.setCategory(nullToEmpty(m.getMailFirstCategory()) + Optional.ofNullable(m.getMailSecondCategory()).map(item -> " -> " + item).orElse("") + Optional.ofNullable(m.getMailThreeCategory()).map(item -> " -> " + item).orElse("")); |
|
|
|
|
ledgerExcel.setTellDate(m.getContactTime()); |
|
|
|
|
ledgerExcel.setTellTime(m.getContactTime()); |
|
|
|
|
|
|
|
|
|
ledgerExcel.setResolved(Optional.ofNullable(m.getProblemSolvingStatus()).map(item -> item ? "已解决": "未解决").orElse("")); |
|
|
|
|
ledgerExcel.setSatisfied(Optional.ofNullable(m.getSatisfaction()).map(SatisfactionEnum::getLabel).orElse(m.getSatisfactionStatus())); |
|
|
|
|
ledgerExcel.setCompletionComment(m.getCompletionComment()); |
|
|
|
|
boolean isAppeal = appealList.stream().anyMatch(item -> item.getMailId().equals(q.getId())); |
|
|
|
|
ledgerExcel.setIsAppeal(isAppeal ? AppConstants.YES : AppConstants.NO); |
|
|
|
|
if (isAppeal) { |
|
|
|
|
String appealResult = appealList.stream().anyMatch(item -> item.getMailId().equals(q.getId()) && item.getAppealState().equals(AppealState.SUCCESS.getValue())) ? "成功" : "失败"; |
|
|
|
|
ledgerExcel.setAppealResult(appealResult); |
|
|
|
|
} |
|
|
|
|
ledgerExcel.setIsQualify(nullToEmpty(m.getQualifiedProcessingStatus())); |
|
|
|
|
// 被举报人
|
|
|
|
|
if (Objects.nonNull(m.getVerifyNeedAccountability())) { |
|
|
|
|
ledgerExcel.setVerifyNeedAccountability(m.getVerifyNeedAccountability() ? "是" : "否"); |
|
|
|
|
} |
|
|
|
|
List<MailBlame> blames = mailBlames.stream().filter(item -> item.getMailId().equals(q.getId())).toList(); |
|
|
|
|
ledgerExcel.setVerifyBlameNumber(blames.size()); |
|
|
|
|
ledgerExcel.setVerifyBlames(blames.stream().map(item -> item.getBlameName() + "-" + item.getBlameEmpNo()).collect(Collectors.joining("、"))); |
|
|
|
|
ledgerExcel.setVerifyProblem(blames.stream().filter(item -> StrUtil.isNotBlank(item.getVerifyProblem())).map(item -> String.join("/", JSON.parseArray(item.getVerifyProblem(), String.class))).collect(Collectors.joining("、"))); |
|
|
|
|
ledgerExcel.setVerifyPunish(blames.stream().filter(item -> StrUtil.isNotBlank(item.getVerifyPunish())).map(item -> String.join("/", JSON.parseArray(item.getVerifyPunish(), String.class))).collect(Collectors.joining("、"))); |
|
|
|
|
// -------------------
|
|
|
|
|
list.add(ledgerExcel); |
|
|
|
|
} |
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
try (OutputStream out = response.getOutputStream()) { |
|
|
|
|
// 使用EasyExcel写入数据到输出流
|
|
|
|
|
EasyExcel.write(out, LedgerExcel.class).inMemory(Boolean.TRUE).sheet("“厅(局)长信箱即接即办工作汇总台账").doWrite(list); |
|
|
|
|
} 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); |
|
|
|
|
try { |
|
|
|
|
response.getWriter().write("Failed to export data due to an internal error."); |
|
|
|
|
} catch (IOException ex) { |
|
|
|
|
log.error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String parseTimeStr(long time) { |
|
|
|
|
if (time <= 0) { |
|
|
|
|
return "未超时"; |
|
|
|
|
} |
|
|
|
|
if (time < 60) { |
|
|
|
|
return String.format("超时%s秒", time); |
|
|
|
|
} |
|
|
|
|
if (time < 3600) { |
|
|
|
|
long m = time % 60; |
|
|
|
|
if (m == 0) { |
|
|
|
|
return String.format("超时%s分", time / 60); |
|
|
|
|
} |
|
|
|
|
return String.format("超时%s分%s秒", time / 60, m); |
|
|
|
|
} |
|
|
|
|
if (time < 86400) { |
|
|
|
|
long m = time % 3600; |
|
|
|
|
if (m == 0) { |
|
|
|
|
return String.format("超时%s时", time / 3600); |
|
|
|
|
} |
|
|
|
|
return String.format("超时%s时%s分", time / 3600, m / 60); |
|
|
|
|
} |
|
|
|
|
long m = time % 86400; |
|
|
|
|
if (m == 0) { |
|
|
|
|
return String.format("超时%s天", time / 86400); |
|
|
|
|
} |
|
|
|
|
return String.format("超时%s天%s时", time / 86400, m / 3600); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 新增省厅专班待办(待审批)
|
|
|
|
|
public void addApprovalByProvincialClasses(Mail mail) { |
|
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
|
|