Browse Source

BUG修复

master
wxc 2 years ago
parent
commit
74f68c0bf5
  1. 9
      mailbox-common/src/main/java/com/biutag/constants/AppConstants.java
  2. 26
      mailbox-lan/sql/0326.sql
  3. 2
      mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java
  4. 5
      mailbox-lan/src/main/java/com/biutag/lan/domain/Favorite.java
  5. 15
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailMark.java
  6. 32
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailSourceEtl.java
  7. 3
      mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailQuery.java
  8. 2
      mailbox-lan/src/main/java/com/biutag/lan/domain/vo/FavoriteVo.java
  9. 22
      mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java
  10. 14
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java
  11. 10
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java
  12. 17
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java
  13. 7
      mailbox-lan/src/main/java/com/biutag/lan/mapper/MailSourceEtlMapper.java
  14. 27
      mailbox-lan/src/main/java/com/biutag/lan/service/FavoriteService.java
  15. 5
      mailbox-lan/src/main/java/com/biutag/lan/service/IHolidayService.java
  16. 4
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  17. 28
      mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceEtlService.java
  18. 24
      mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java
  19. 60
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java
  20. 37
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/HolidayServiceImpl.java
  21. 16
      mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml

9
mailbox-common/src/main/java/com/biutag/constants/AppConstants.java

@ -7,10 +7,15 @@ public class AppConstants {
public static final String DEPT_TYPE_CATEGORY="6"; //是机构类型 数据字段 类型为6
public static final String YES = "Y";
public static final String Y = "Y";
public static final String NO = "N";
public static final String N = "N";
public static final String YES = "是";
public static final String NO = "否";
public static final String TRUE = "1";

26
mailbox-lan/sql/0326.sql

@ -0,0 +1,26 @@
DROP TABLE mail_source_etl;
ALTER TABLE "mailbox"."mail_mark"
ADD COLUMN "sign_timeout" bool DEFAULT false,
ADD COLUMN "contact_writer_timeout" bool DEFAULT false,
ADD COLUMN "process_timeout" bool DEFAULT false;
COMMENT ON COLUMN "mailbox"."mail_mark"."sign_timeout" IS '签收超时';
COMMENT ON COLUMN "mailbox"."mail_mark"."contact_writer_timeout" IS '联系群众超时';
COMMENT ON COLUMN "mailbox"."mail_mark"."process_timeout" IS '办理超时';
update mail_mark mm set mm.sign_timeout = true from mail_flow mf left join mail_flow mf2 on mf.mail_id = mf2.mail_id and mf2.flow_key = 'three_sign' where mm.mail_id = mf.mail_id and mf.flow_key = 'first_distribute' and
EXTRACT(EPOCH FROM mf2.create_time - mf.create_time) > 600;
update mail_mark mm set mm.contact_writer_timeout = true from mail m where mm.mail_id = m.id and m.contact_duration > 1800;
ALTER TABLE "mailbox"."favorite"
ADD COLUMN "role_id" int4,
ADD COLUMN "dept_id" int4;
COMMENT ON COLUMN "mailbox"."favorite"."role_id" IS '角色ID';
COMMENT ON COLUMN "mailbox"."favorite"."dept_id" IS '部门ID';

2
mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java

@ -116,7 +116,7 @@ public class ApiV1Controller {
return AjaxResult.success(JSONObject.of("id", mailId, "mailState", "terminated"));
}
MailMark mailMark = mailMarkService.getById(mailId);
if (Objects.isNull(mailMark) || AppConstants.NO.equals(mailMark.getCompleted())) {
if (Objects.isNull(mailMark) || AppConstants.N.equals(mailMark.getCompleted())) {
new AjaxResult<>(ErrorEnum.SUCCESS.getCode(), ErrorEnum.SUCCESS.getMsg());
}
return AjaxResult.success(JSONObject.of("id", mailId, "mailState", "completion"));

5
mailbox-lan/src/main/java/com/biutag/lan/domain/Favorite.java

@ -20,6 +20,11 @@ public class Favorite {
* 警号
*/
private String policeEmpNo;
private Integer roleId;
private Integer deptId;
/**
* 信件ID
*/

15
mailbox-lan/src/main/java/com/biutag/lan/domain/MailMark.java

@ -53,4 +53,19 @@ public class MailMark {
*/
private LocalDateTime completionTime;
/**
* 签收超时
*/
private Boolean signTimeout;
/**
* 联系群众超时
*/
private Boolean contactWriterTimeout;
/**
* 办结超时
*/
private Boolean processTimeout;
}

32
mailbox-lan/src/main/java/com/biutag/lan/domain/MailSourceEtl.java

@ -1,32 +0,0 @@
package com.biutag.lan.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
@Accessors(chain = true)
@Setter
@Getter
public class MailSourceEtl {
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 抽取时间
*/
private LocalDateTime etlTime;
/**
* 抽取总数
*/
private Long total;
/**
* 是否成功 Y / N
*/
private String success;
}

3
mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailQuery.java

@ -69,6 +69,9 @@ public class MailQuery {
*/
private String queryById;
private String timeout;
public List<String> handleMailLabels() {
if (mailLabels == null) {
return null;

2
mailbox-lan/src/main/java/com/biutag/lan/domain/vo/FavoriteVo.java

@ -96,4 +96,6 @@ public class FavoriteVo {
@ExcelProperty("信件标签")
private String mailLabels;
private String mailLevel;
}

22
mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java

@ -55,6 +55,11 @@ public enum FlowNodeEnum {
return false;
}
/**
* 小于联系群众
* @param key
* @return
*/
public static boolean lessInterviewWriter(String key) {
if (StrUtil.isBlank(key)) {
return false;
@ -67,4 +72,21 @@ public enum FlowNodeEnum {
return false;
}
/**
* 主单位签收
* @param key
* @return
*/
public static boolean isMainDeptSign(String key) {
if (StrUtil.isBlank(key)) {
return false;
}
for (FlowNodeEnum value : values()) {
if (value.getKey().equals(key)) {
return value == SECOND_SIGN || value == SECOND_DISTRIBUTE || value == THREE_SIGN;
}
}
return false;
}
}

14
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java

@ -14,10 +14,7 @@ import com.biutag.lan.flow.ActionEnum;
import com.biutag.lan.flow.Flow;
import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.flow.FlowNodeEnum;
import com.biutag.lan.service.MailMarkService;
import com.biutag.lan.service.MailReturnService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.WorkService;
import com.biutag.lan.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
@ -38,6 +35,8 @@ public class FirstApprovalFlow extends Flow {
private final MailMarkService mailMarkService;
private final IHolidayService holidayService;
@Override
public Flow next(String nextActionKey, String mailId, JSONObject data) {
// 退回整改
@ -75,6 +74,7 @@ public class FirstApprovalFlow extends Flow {
.setProblemSolvingStatus(problemSolvingStatus)
.setSatisfactionStatus(satisfactionStatus)
.setCompletionComment(data.getString("completionComment"))
.setVerifyProblem(data.getString("verifyProblem"))
.setFlowKey(FlowNodeEnum.COMPLETION.getKey())
.setFlowName(FlowNodeEnum.COMPLETION.getFullName())
// 信件状态改为已办结
@ -96,7 +96,9 @@ public class FirstApprovalFlow extends Flow {
.setCompleted(AppConstants.TRUE)
.setCompletionTime(now)
.setResolved(problemSolvingStatus ? AppConstants.TRUE : AppConstants.FALSE)
.setSatisfied("非常满意".equals(satisfactionStatus) || "基本满意".equals(satisfactionStatus) ? AppConstants.TRUE : AppConstants.FALSE);
.setSatisfied("非常满意".equals(satisfactionStatus) || "基本满意".equals(satisfactionStatus) ? AppConstants.TRUE : AppConstants.FALSE)
// 办理超时
.setProcessTimeout(holidayService.getFlowRemainingTimeByNow(345600, mail.getMailTime(), mail.getExtensionFlag(), mail.getExtensionDays()) < 0);
mailMarkService.saveOrUpdate(mailMark);
// 认定办结后 将所有的已办更新为代码
workService.updateAllDone(mailId);
@ -133,4 +135,4 @@ public class FirstApprovalFlow extends Flow {
return null;
}
}
}

10
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java

@ -7,11 +7,13 @@ import com.alibaba.fastjson2.JSONObject;
import com.biutag.enums.RoleEnum;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailMark;
import com.biutag.lan.domain.Work;
import com.biutag.lan.flow.ActionEnum;
import com.biutag.lan.flow.Flow;
import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.flow.FlowNodeEnum;
import com.biutag.lan.service.MailMarkService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.WorkService;
import lombok.RequiredArgsConstructor;
@ -20,6 +22,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Objects;
@ -36,6 +39,8 @@ public class ThreeContactWriterFlow extends Flow {
private final ThreeSignFlow threeSignFlow;
private final MailMarkService mailMarkService;
@Override
@Transactional(rollbackFor = Exception.class)
public Flow next(String nextActionKey, String mailId, JSONObject data) {
@ -78,6 +83,11 @@ public class ThreeContactWriterFlow extends Flow {
workService.updateById(work);
mailService.updateById(mail);
MailMark mailMark = mailMarkService.getById(mailId);
// 联系群众超时
mailMark.setContactWriterTimeout(data.getLong("contactDuration") > 1800);
mailMarkService.updateById(mailMark);
return nextNode;
}

17
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java

@ -5,21 +5,20 @@ import com.biutag.enums.RoleEnum;
import com.biutag.exception.BusinessException;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailMark;
import com.biutag.lan.domain.MailReturn;
import com.biutag.lan.domain.Work;
import com.biutag.lan.flow.ActionEnum;
import com.biutag.lan.flow.Flow;
import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.flow.FlowNodeEnum;
import com.biutag.lan.service.MailReturnService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.NoticeService;
import com.biutag.lan.service.WorkService;
import com.biutag.lan.service.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.time.Duration;
import java.time.LocalDateTime;
/**
@ -37,6 +36,8 @@ public class ThreeSignFlow extends Flow {
private final NoticeService noticeService;
private final MailMarkService mailMarkService;
@Override
@Transactional(rollbackFor = Exception.class)
public Flow next(String nextActionKey, String mailId, JSONObject data) {
@ -82,10 +83,10 @@ public class ThreeSignFlow extends Flow {
// 更新操作时间
.setFlowLimitedLastHandlerTime(now);
mailService.updateById(mail);
}
// 非主责
else {
MailMark mailMark = mailMarkService.getById(mailId);
// 签收超过10分钟则签收超时
mailMark.setSignTimeout(Duration.between(mail.getMailTime(), now).getSeconds() > 600);
mailMarkService.updateById(mailMark);
}
// 通知
noticeService.sendNoticeDoneByRole();

7
mailbox-lan/src/main/java/com/biutag/lan/mapper/MailSourceEtlMapper.java

@ -1,7 +0,0 @@
package com.biutag.lan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.lan.domain.MailSourceEtl;
public interface MailSourceEtlMapper extends BaseMapper<MailSourceEtl> {
}

27
mailbox-lan/src/main/java/com/biutag/lan/service/FavoriteService.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.enums.RoleEnum;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Favorite;
import com.biutag.lan.domain.MailSource;
@ -35,8 +36,14 @@ public class FavoriteService extends ServiceImpl<FavoriteMapper, Favorite> {
.eq(StrUtil.isNotBlank(mailQuery.getMailCategory()), "m.mail_category", mailQuery.getMailCategory())
.like(StrUtil.isNotBlank(mailQuery.getThreeDeptName()), "m.three_dept_name", mailQuery.getThreeDeptName())
.eq(StrUtil.isNotBlank(mailQuery.getFlowKey()), "m.flow_key", mailQuery.getFlowKey());
String empNo = AdminThreadLocal.getEmpNo();
queryWrapper.eq("f.police_emp_no", empNo);
Integer roleId = AdminThreadLocal.getRoleId();
if (RoleEnum.isClasses(roleId)) {
queryWrapper.eq("f.role_id", roleId).eq("f.dept_id", AdminThreadLocal.getDeptId());
} else {
queryWrapper.eq("f.police_emp_no", AdminThreadLocal.getEmpNo());
}
if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) {
switch (mailQuery.getContactField()) {
case "name":
@ -55,7 +62,6 @@ public class FavoriteService extends ServiceImpl<FavoriteMapper, Favorite> {
public boolean save(String mailId) {
MailSource mailSource = mailSourceService.getById(mailId);
Favorite favorite = new Favorite()
.setPoliceEmpNo(AdminThreadLocal.getEmpNo())
.setMailId(mailId)
.setContactName(mailSource.getContactName())
.setContactPhone(mailSource.getContactPhone())
@ -63,11 +69,24 @@ public class FavoriteService extends ServiceImpl<FavoriteMapper, Favorite> {
.setCreateTime(LocalDateTime.now())
.setSource(mailSource.getSource())
.setMailTime(mailSource.getMailTime());
Integer roleId = AdminThreadLocal.getRoleId();
if (RoleEnum.isClasses(roleId)) {
favorite.setRoleId(roleId).setDeptId(AdminThreadLocal.getDeptId());
} else {
favorite.setPoliceEmpNo(AdminThreadLocal.getEmpNo());
}
return save(favorite);
}
public boolean remove(String mailId) {
return remove(new LambdaQueryWrapper<Favorite>().eq(Favorite::getMailId, mailId).eq(Favorite::getPoliceEmpNo, AdminThreadLocal.getEmpNo()));
LambdaQueryWrapper<Favorite> queryWrapper = new LambdaQueryWrapper<Favorite>().eq(Favorite::getMailId, mailId);
Integer roleId = AdminThreadLocal.getRoleId();
if (RoleEnum.isClasses(roleId)) {
queryWrapper.eq(Favorite::getRoleId, roleId).eq(Favorite::getDeptId, AdminThreadLocal.getDeptId());
} else {
queryWrapper.eq(Favorite::getPoliceEmpNo, AdminThreadLocal.getEmpNo());
}
return remove(queryWrapper);
}
}

5
mailbox-lan/src/main/java/com/biutag/lan/service/IHolidayService.java

@ -10,7 +10,6 @@ import com.biutag.lan.vo.system.HolidayDetailVo;
import com.biutag.core.PageResult;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
@ -64,6 +63,8 @@ public interface IHolidayService {
*/
void del(Integer id);
long getFlowRemainingTime(long limitedTime, LocalDateTime flowLimitedLastHandlerTime, Boolean extensionFlag, Integer extensionDays);
long getFlowRemainingTimeByNow(long limitedTime, LocalDateTime flowLimitedLastHandlerTime, Boolean extensionFlag, Integer extensionDays);
long getFlowRemainingTime(LocalDateTime beginTime, LocalDateTime endTime, long limitedTime);
}

4
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -142,7 +142,7 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
FlowNode flowNode = flow.getFlowNode();
int limitedTime = flowNode.getLimitedTime().intValue();
// 剩余时间
long flowRemainingTime = holidayService.getFlowRemainingTime(limitedTime,
long flowRemainingTime = holidayService.getFlowRemainingTimeByNow(limitedTime,
FlowNodeEnum.lessInterviewWriter(mail.getFlowKey()) ? mail.getFlowLimitedLastHandlerTime(): mail.getMailTime(),
mail.getExtensionFlag(),
mail.getExtensionDays());
@ -180,7 +180,7 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
}
if (Objects.nonNull(mail.getFlowKey()) && FlowNodeEnum.get(mail.getFlowKey()).getIndex() >= FlowNodeEnum.THREE_LEADER_APPROVAL.getIndex()) {
// 主单位签收时长
long mainDeptSignTime = flows.stream().filter(item -> item.getFlowKey().contains("_sign") || item.getFlowKey().contains("_distribute")).mapToLong(MailFlow::getConsumingTime).sum();
long mainDeptSignTime = flows.stream().filter(item -> FlowNodeEnum.isMainDeptSign(item.getFlowKey())).mapToLong(MailFlow::getConsumingTime).sum();
mailVo.setMainDeptSignTime(mainDeptSignTime);
}
// 信件标签

28
mailbox-lan/src/main/java/com/biutag/lan/service/MailSourceEtlService.java

@ -1,28 +0,0 @@
package com.biutag.lan.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.constants.AppConstants;
import com.biutag.lan.domain.MailSourceEtl;
import com.biutag.lan.mapper.MailSourceEtlMapper;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MailSourceEtlService extends ServiceImpl<MailSourceEtlMapper, MailSourceEtl> {
/**
* 获取最新一条成功数据
* @return
*/
public MailSourceEtl getLatestSuccess() {
LambdaQueryWrapper<MailSourceEtl> queryWrapper = new LambdaQueryWrapper<MailSourceEtl>()
.eq(MailSourceEtl::getSuccess, AppConstants.YES)
.orderByDesc(MailSourceEtl::getEtlTime);
Page<MailSourceEtl> page = page(new Page<>(1, 1), queryWrapper);
return page.getRecords().isEmpty() ? null : page.getRecords().get(0);
}
}

24
mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java

@ -1,40 +1,24 @@
package com.biutag.lan.service;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.constants.AppConstants;
import com.biutag.core.PageResult;
import com.biutag.entity.system.Duty;
import com.biutag.entity.system.PoliceUser;
import com.biutag.enums.RoleEnum;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Notice;
import com.biutag.lan.domain.Work;
import com.biutag.lan.domain.vo.NoticeTotalVo;
import com.biutag.lan.domain.vo.NoticeVo;
import com.biutag.lan.domain.vo.WorkVo;
import com.biutag.lan.flow.Flow;
import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.flow.node.FirstSignFlow;
import com.biutag.lan.mapper.NoticeMapper;
import com.biutag.lan.validate.commons.PageValidate;
import com.biutag.lan.validate.system.NoticeSearchValidate;
import com.biutag.lan.vo.system.DutyListedVo;
import com.biutag.util.StringUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedList;
@ -50,7 +34,7 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
public void save(Integer roleId, Integer deptId, String content, Integer workId) {
Notice notice = new Notice().setRoleId(roleId).setDeptId(deptId).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId);
Notice notice = new Notice().setRoleId(roleId).setDeptId(deptId).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.N).setWorkId(workId);
save(notice);
messagingTemplate.convertAndSend(String.format("/topic/role/%s/%s", roleId, deptId), Work.State.todo.name());
log.info("发送通知:{}", String.format("/topic/role/%s/%s", roleId, deptId));
@ -58,7 +42,7 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
public void save(String empNo, String content, Integer workId) {
Notice notice = new Notice().setEmpNo(empNo).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.NO).setWorkId(workId);
Notice notice = new Notice().setEmpNo(empNo).setContent(content).setCreateTime(LocalDateTime.now()).setReadFlag(AppConstants.N).setWorkId(workId);
save(notice);
messagingTemplate.convertAndSend(String.format("/topic/user/%s", empNo), Work.State.todo.name());
log.info("发送通知:{}", String.format("/topic/user/%s", empNo));
@ -81,7 +65,7 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
}
public IPage<Notice> pageByCurrentUser(IPage<Notice> page) {
LambdaQueryWrapper<Notice> queryWrapper = new LambdaQueryWrapper<Notice>().eq(Notice::getReadFlag, AppConstants.NO);
LambdaQueryWrapper<Notice> queryWrapper = new LambdaQueryWrapper<Notice>().eq(Notice::getReadFlag, AppConstants.N);
Integer roleId = AdminThreadLocal.getRoleId();
if (RoleEnum.isClasses(roleId)) {
queryWrapper.eq(Notice::getRoleId, roleId).eq(Notice::getDeptId, AdminThreadLocal.getDeptId());
@ -93,7 +77,7 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
}
public Page<NoticeVo> list(Page<Notice> page, @Validated NoticeSearchValidate searchValidate){
LambdaQueryWrapper<Notice> queryWrapper = new LambdaQueryWrapper<Notice>().eq(Notice::getReadFlag, AppConstants.NO);
LambdaQueryWrapper<Notice> queryWrapper = new LambdaQueryWrapper<Notice>().eq(Notice::getReadFlag, AppConstants.N);
Integer roleId = AdminThreadLocal.getRoleId();
if (RoleEnum.isClasses(roleId)) {
queryWrapper.eq(Notice::getRoleId, roleId).eq(Notice::getDeptId, AdminThreadLocal.getDeptId());

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

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.constants.AppConstants;
import com.biutag.core.AjaxResult;
import com.biutag.entity.setting.DictData;
import com.biutag.entity.system.Dept;
@ -21,6 +22,7 @@ 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.MailState;
import com.biutag.lan.enums.SatisfactionEnum;
import com.biutag.lan.enums.WorkType;
import com.biutag.lan.flow.Flow;
@ -240,6 +242,13 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
return update(updateWrapper);
}
/**
* 我的工作
* @param workState
* @param page
* @param todoQuery
* @return
*/
public Page<WorkVo> page(String workState, Page<Work> page, MailQuery todoQuery) {
QueryWrapper<Work> queryWrapper = new QueryWrapper<Work>()
.eq("w.work_state", workState)
@ -247,7 +256,6 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
.le(StrUtil.isNotBlank(todoQuery.getMailTimeEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeEnd())
.eq(StrUtil.isNotBlank(todoQuery.getSource()), "m.source", todoQuery.getSource())
.eq(StrUtil.isNotBlank(todoQuery.getMailLevel()), "m.mail_level", todoQuery.getMailLevel())
// .eq(StrUtil.isNotBlank(todoQuery.getMailCategory()), "m.mail_category", todoQuery.getMailCategory())
.eq(StrUtil.isNotBlank(todoQuery.getMailState()), "m.mail_state", todoQuery.getMailState())
.like(StrUtil.isNotBlank(todoQuery.getThreeDeptName()), "m.three_dept_name", todoQuery.getThreeDeptName())
.eq(StrUtil.isNotBlank(todoQuery.getFlowKey()), "m.flow_key", todoQuery.getFlowKey())
@ -327,10 +335,10 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
}
}
if (Objects.nonNull(item.getLimitedTime())) {
item.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(item.getLimitedTime(), item.getFlowLimitedLastHandlerTime(), item.getExtensionFlag(), item.getExtensionDays()));
item.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(item.getLimitedTime(), item.getFlowLimitedLastHandlerTime(), item.getExtensionFlag(), item.getExtensionDays()));
} else {
Flow flow = SpringUtil.getBean(FirstSignFlow.class);
item.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(flow.getFlowNode().getLimitedTime(), item.getCreateTime(), item.getExtensionFlag(), item.getExtensionDays()));
item.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(flow.getFlowNode().getLimitedTime(), item.getCreateTime(), item.getExtensionFlag(), item.getExtensionDays()));
}
});
return workVoPage;
@ -457,6 +465,24 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
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;
}
}
// 排序
queryWrapper.orderByDesc("m.mail_time");
Page<QueryMailVo> result = baseMapper.selectQueryPage(page, queryWrapper, mailQuery.getCountMails());
@ -476,10 +502,10 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
}
if (Objects.nonNull(workVo.getLimitedTime())) {
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(workVo.getLimitedTime(), workVo.getFlowLimitedLastHandlerTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(workVo.getLimitedTime(), workVo.getFlowLimitedLastHandlerTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
} else {
Flow flow = SpringUtil.getBean(FirstSignFlow.class);
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(flow.getFlowNode().getLimitedTime(), workVo.getCreateTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(flow.getFlowNode().getLimitedTime(), workVo.getCreateTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
}
}
return result;
@ -619,10 +645,10 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
break;
}
if (Objects.nonNull(workVo.getLimitedTime())) {
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(workVo.getLimitedTime(), workVo.getFlowLimitedLastHandlerTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(workVo.getLimitedTime(), workVo.getFlowLimitedLastHandlerTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
} else {
Flow flow = SpringUtil.getBean(FirstSignFlow.class);
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTime(flow.getFlowNode().getLimitedTime(), workVo.getCreateTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
workVo.setFlowLimitedRemainingTime(holidayService.getFlowRemainingTimeByNow(flow.getFlowNode().getLimitedTime(), workVo.getCreateTime(), workVo.getExtensionFlag(), workVo.getExtensionDays()));
}
}
return result;
@ -684,9 +710,16 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
ledgerExcel.setSecondDeptName(nullToEmpty(m.getSecondDeptName()));
ledgerExcel.setThreeDeptName(m.getThreeDeptName());
ledgerExcel.setContent(nullToEmpty(q.getContent()));
ledgerExcel.setIsThirtyMinutes(Optional.ofNullable(m.getContactDuration()).map(item -> item < 1800 ? "是" : "否").orElse(""));
ledgerExcel.setIsVisit(m.getInterviewIsLeader() != null && m.getInterviewIsLeader() ? "是" : "否");
ledgerExcel.setIsThirtyMinutes(Optional.ofNullable(m.getContactDuration()).map(item -> item < 1800 ? AppConstants.YES : AppConstants.NO).orElse(""));
ledgerExcel.setIsVisit(m.getInterviewIsLeader() != null && m.getInterviewIsLeader() ? AppConstants.YES : AppConstants.NO);
// 是否四天内办结
if (MailState.completion.getValue().equals(m.getMailState())) {
ledgerExcel.setIsFourDays(holidayService.getFlowRemainingTime(m.getMailTime(), m.getUpdateTime(), 345600) >= 0 ? AppConstants.YES : AppConstants.NO);
}
// 逾期办结
if (AppConstants.NO.equals(MailState.completion.getValue())) {
ledgerExcel.setIsOverdue(AppConstants.YES);
}
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(""));
@ -697,7 +730,7 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
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 ? "是" : "否");
ledgerExcel.setIsAppeal(isAppeal ? AppConstants.YES : AppConstants.NO);
if (isAppeal) {
String appealResult = appealList.stream().anyMatch(item -> item.getMailId().equals(q.getId()) && item.getAppealState().equals("2")) ? "成功" : "失败";
ledgerExcel.setAppealResult(appealResult);
@ -707,10 +740,7 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
list.add(ledgerExcel);
}
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
// 这里URLEncoder.encode可以防止中文乱码
String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
response.setCharacterEncoding("UTF-8");
try (OutputStream out = response.getOutputStream()) {
// 使用EasyExcel写入数据到输出流
EasyExcel.write(out, LedgerExcel.class).inMemory(Boolean.TRUE).sheet("局长信箱即接即办工作汇总台账").doWrite(list);

37
mailbox-lan/src/main/java/com/biutag/lan/service/impl/HolidayServiceImpl.java

@ -158,7 +158,7 @@ public class HolidayServiceImpl implements IHolidayService {
* 获取剩余时间
* @return
*/
public long getFlowRemainingTime(long limitedTime, LocalDateTime flowLimitedLastHandlerTime, Boolean extensionFlag, Integer extensionDays) {
public long getFlowRemainingTimeByNow(long limitedTime, LocalDateTime flowLimitedLastHandlerTime, Boolean extensionFlag, Integer extensionDays) {
if (Objects.isNull(flowLimitedLastHandlerTime)) {
return 0;
}
@ -169,21 +169,30 @@ public class HolidayServiceImpl implements IHolidayService {
if (extensionFlag) {
return limitedTime + (extensionDays * 86400) - Duration.between(flowLimitedLastHandlerTime, LocalDateTime.now()).getSeconds();
} else {
LocalDateTime now = LocalDateTime.now();
String nowDate = now.format(DatePattern.NORM_DATE_FORMATTER);
ArrayList<String> dates = new ArrayList<>();
for (LocalDateTime dateTime = flowLimitedLastHandlerTime; dateTime.isBefore(now); dateTime = dateTime.plusDays(1)) {
dates.add(dateTime.format(DatePattern.NORM_DATE_FORMATTER));
}
List<Holiday> list = list(dates);
long holidays = list.stream().filter(item -> item.getHolidayFlag().equals(AppConstants.YES) && !item.getDate().equals(nowDate)).count();
long todaySeconds = list.stream().anyMatch(item -> item.getHolidayFlag().equals(AppConstants.YES) && item.getDate().equals(nowDate)) ?
// 当天的时间差
Duration.between(now.toLocalDate().atStartOfDay(), now).getSeconds() : 0;
limitedTime += 86400 * holidays + todaySeconds;
return limitedTime - Duration.between(flowLimitedLastHandlerTime, LocalDateTime.now()).getSeconds();
return getFlowRemainingTime(flowLimitedLastHandlerTime, LocalDateTime.now(), limitedTime);
}
}
/**
* 是否在限时内办结
* @param beginTime 开始时间
* @param endTime 结束时间
* @param limitedTime 限时
* @return
*/
public long getFlowRemainingTime(LocalDateTime beginTime, LocalDateTime endTime, long limitedTime) {
String endDate = endTime.format(DatePattern.NORM_DATE_FORMATTER);
ArrayList<String> dates = new ArrayList<>();
for (LocalDateTime dateTime = beginTime; dateTime.isBefore(endTime); dateTime = dateTime.plusDays(1)) {
dates.add(dateTime.format(DatePattern.NORM_DATE_FORMATTER));
}
List<Holiday> list = list(dates);
long holidays = list.stream().filter(item -> item.getHolidayFlag().equals(AppConstants.Y) && !item.getDate().equals(endDate)).count();
long todaySeconds = list.stream().anyMatch(item -> item.getHolidayFlag().equals(AppConstants.Y) && item.getDate().equals(endDate)) ?
// 当天的时间差
Duration.between(endTime.toLocalDate().atStartOfDay(), endTime).getSeconds() : 0;
limitedTime += 86400 * holidays + todaySeconds;
return limitedTime - Duration.between(beginTime, endTime).getSeconds();
}
}

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

@ -53,10 +53,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getStationCompletedRateByDept" resultType="java.util.Map" parameterType="String">
select a.name,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
CONCAT(rateNumber,'%') rate,
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
SELECT A.NAME,
SUM ( COALESCE ( b.completed, 0 ) ) completed,
COUNT ( b.mail_id ) SUM,
CASE
WHEN SUM = 0 THEN
0 ELSE ROUND( SUM * 100 / SUM, 0 )
END rateNumber,
CONCAT ( rateNumber, '%' ) rate
from dept a left join mail_mark b on a.id=b.three_dept_id where a.pid=#{deptId}
GROUP BY a.name order by rateNumber desc ,sum desc
</select>
@ -64,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.name,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
CONCAT(rateNumber,'%') rate,
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
SUM(COALESCE(b.resolved, 0)) resolved,count(b.mail_id) sum
from dept a left join mail_mark b on a.id=b.three_dept_id where a.pid=#{deptId}
GROUP BY a.name order by rateNumber desc ,sum desc
</select>
@ -72,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.name,
ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0) rateNumber,
CONCAT(rateNumber,'%') rate,
SUM(COALESCE(b.satisfied, 0)) satisfied,count(1) sum
SUM(COALESCE(b.satisfied, 0)) satisfied,count(b.mail_id) sum
from dept a left join mail_mark b on a.id=b.three_dept_id where a.pid=#{deptId}
GROUP BY a.name order by rateNumber desc ,sum desc
</select>

Loading…
Cancel
Save