Browse Source

fix: 修复局长信箱多次延期申请,第二次会覆盖第一次的问题(修改为累计延期天数)

master
wxc 6 months ago
parent
commit
82660aa93b
  1. 29
      mailbox-lan/sql/20250527.sql
  2. 5
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailExtension.java
  3. 3
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java
  4. 1
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

29
mailbox-lan/sql/20250527.sql

@ -0,0 +1,29 @@
ALTER TABLE "mailbox"."mail_label"
ADD COLUMN "sort" int;
CREATE TABLE "mailbox"."mail_extension" (
"id" varchar(40) NOT NULL,
"mail_id" varchar(40) NOT NULL,
"days" int2,
"extension_reason" text,
"create_time" datatime,
CONSTRAINT "mail_extension_pkey" PRIMARY KEY ("id")
);
COMMENT ON COLUMN "mailbox"."mail_extension"."days" IS '延期天数';
COMMENT ON COLUMN "mailbox"."mail_extension"."extension_reason" IS '延期理由';
COMMENT ON TABLE "mailbox"."mail_extension" IS '信件延期';
INSERT INTO mail_extension ( ID, mail_id, days, extension_reason )
SELECT
extension_request_id,
ID,
extension_days,
extension_reason
FROM
mail
WHERE
extension_state = 'applying'

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

@ -1,6 +1,5 @@
package com.biutag.lan.domain; package com.biutag.lan.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter; import lombok.Getter;
@ -14,8 +13,8 @@ import java.time.LocalDateTime;
@Getter @Getter
public class MailExtension { public class MailExtension {
@TableId(type = IdType.AUTO) @TableId
private Integer id; private String id;
/** /**
* 信件ID * 信件ID

3
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java

@ -84,6 +84,7 @@ public class ThreeVerifyFlow extends Flow {
work.setWorkType(WorkType.extension_approval.name()).setFlowName("待审批(申请延期)").setUpdateTime(now); work.setWorkType(WorkType.extension_approval.name()).setFlowName("待审批(申请延期)").setUpdateTime(now);
workService.updateTodoById(work); workService.updateTodoById(work);
MailExtension mailExtension = new MailExtension(); MailExtension mailExtension = new MailExtension();
mailExtension.setId(IdUtil.simpleUUID());
mailExtension.setMailId(mailId); mailExtension.setMailId(mailId);
mailExtension.setExtensionReason(reason); mailExtension.setExtensionReason(reason);
mailExtension.setDays(extensionDays); mailExtension.setDays(extensionDays);
@ -91,7 +92,7 @@ public class ThreeVerifyFlow extends Flow {
mailExtensionMapper.insert(mailExtension); mailExtensionMapper.insert(mailExtension);
mail.setUpdateTime(now) mail.setUpdateTime(now)
.setExtensionState(ExtensionState.applying.name()) .setExtensionState(ExtensionState.applying.name())
.setExtensionRequestId(mailExtension.getId().toString()); .setExtensionRequestId(mailExtension.getId());
mailService.updateById(mail); mailService.updateById(mail);
return null; return null;
} }

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

@ -400,6 +400,7 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
MailExtension mailExtension = mailExtensionMapper.selectById(mail.getExtensionRequestId()); MailExtension mailExtension = mailExtensionMapper.selectById(mail.getExtensionRequestId());
mail.setExtensionState(ExtensionState.completion.name()) mail.setExtensionState(ExtensionState.completion.name())
.setExtensionDays(NumberUtil.nullToZero(mail.getExtensionDays()) + mailExtension.getDays()) .setExtensionDays(NumberUtil.nullToZero(mail.getExtensionDays()) + mailExtension.getDays())
.setExtensionFlag(true)
// 信件状态(已延期) // 信件状态(已延期)
.setMailState(MailState.delayed.name()); .setMailState(MailState.delayed.name());
return updateById(mail); return updateById(mail);

Loading…
Cancel
Save