From 87bfbcd9c51727c1aa965e4f9894a4f7326a6534 Mon Sep 17 00:00:00 2001 From: laishajiang <12977614+laishajiang@user.noreply.gitee.com> Date: Tue, 19 Mar 2024 16:09:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E4=B8=8B=E5=8F=91=E5=88=B0=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E6=9C=BA=E6=9E=84=E7=9A=84=E4=BF=A1=E4=BB=B6=E5=8F=AF?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biutag/lan/controller/MailController.java | 8 +++++++ .../com/biutag/lan/service/MailService.java | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java index 9ab1241..5ad03af 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java @@ -11,9 +11,11 @@ import com.biutag.lan.domain.bo.InvalidCompletion; import com.biutag.lan.domain.bo.MailOuter; import com.biutag.lan.domain.vo.MailFlowDetail; import com.biutag.lan.service.MailService; +import com.biutag.lan.validate.commons.MailIdValidate; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.simpleframework.xml.core.Validate; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @Validate @@ -42,6 +44,12 @@ public class MailController { return AjaxResult.success(mailService.next(action)); } + @NotPower + @PostMapping("delete") + public AjaxResult delete(@RequestBody @Valid MailIdValidate id) { + return AjaxResult.success(mailService.delete(id)); + } + /** * 延期审批 * @param body diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java index 787dc70..61fa8ed 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java @@ -29,7 +29,10 @@ import com.biutag.lan.enums.WorkType; import com.biutag.lan.flow.*; import com.biutag.lan.flow.node.FirstSignFlow; import com.biutag.lan.mapper.MailMapper; +import com.biutag.lan.mapper.MailSourceMapper; import com.biutag.lan.mapper.WorkMapper; +import com.biutag.lan.validate.commons.MailIdValidate; +import jakarta.annotation.Resource; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -75,6 +78,9 @@ public class MailService extends ServiceImpl { private final IHolidayService holidayService; + @Resource + private MailSourceMapper mailSourceMapper; + @Lazy @Autowired private List flowNodes; @@ -438,4 +444,21 @@ public class MailService extends ServiceImpl { } return true; } + + + public boolean delete(MailIdValidate mailId) { + if (mailId.getId()==null||mailId.getId().equals("")){ + return false; + } + Mail mail = baseMapper.selectById(mailId.getId()); + if (mailId.getId()!=null||!mailId.getId().equals("")){ + if (mail.getFlowKey().equals(FlowNodeEnum.FIRST_SIGN.getKey())||mail.getFlowKey().equals(FlowNodeEnum.FIRST_DISTRIBUTE.getKey())){ + baseMapper.deleteById(mailId.getId()); + mailSourceMapper.deleteById(mailId.getId()); + workMapper.delete(new LambdaQueryWrapper().eq(Work::getMailId, mailId.getId())); + } + } + return true; + } + }