From 5a6bd66035a684af510bd2e13806b4f40b800ff2 Mon Sep 17 00:00:00 2001 From: 21819 Date: Tue, 5 Mar 2024 19:02:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B3=E8=AF=89=E6=B5=81=E7=A8=8B=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lan/controller/MailAppealController.java | 29 +++++++++ .../com/biutag/lan/domain/MailAppeal.java | 16 +++-- .../biutag/lan/service/MailAppealService.java | 59 +++++++++++++++++-- 3 files changed, 96 insertions(+), 8 deletions(-) diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java index 917e36e..7425522 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/MailAppealController.java @@ -1,9 +1,13 @@ package com.biutag.lan.controller; +import com.biutag.aop.NotPower; +import com.biutag.core.AjaxResult; +import com.biutag.lan.domain.MailAppeal; import com.biutag.lan.service.MailAppealService; import jakarta.annotation.Resource; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,5 +18,30 @@ import org.springframework.web.bind.annotation.RestController; public class MailAppealController { private final MailAppealService mailAppealService; + @NotPower + @RequestMapping("launchAppeal") + public AjaxResult launchAppeal(@RequestBody MailAppeal appeal) { + return mailAppealService.launchAppeal(appeal); + } + + @NotPower + @RequestMapping("getAppeal") + public AjaxResult getAppeal(String appealId) { + return mailAppealService.getAppeal(appealId); + } + + + @NotPower + @RequestMapping("overruleAppeal") + public AjaxResult overruleAppeal(@RequestBody MailAppeal appeal) { + return mailAppealService.overruleAppeal(appeal.getMailId(), appeal.getOverruleReason()); + } + + + @NotPower + @RequestMapping("approved") + public AjaxResult approved(String userId) { + return mailAppealService.approved(userId); + } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/MailAppeal.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/MailAppeal.java index 3b19947..6b32b59 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/domain/MailAppeal.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/MailAppeal.java @@ -13,18 +13,22 @@ public class MailAppeal { * 邮件id */ private String mailId; + /** + * 正在处理机构 + */ + private Integer handlingDept; /** * 三级机构id */ - private String threeDept; + private Integer threeDept; /** * 二级机构id */ - private String secondDept; + private Integer secondDept; /** * 一级机构id */ - private String firstDept; + private Integer firstDept; /** * 申诉理由 */ @@ -38,7 +42,11 @@ public class MailAppeal { */ private String attachments; /** - * 申诉状态 + * 申诉状态:0,未审诉;1,正在申诉;2申诉成功;3,申诉失败 */ private String appealStatus; + /** + * 申诉步骤:1,发起;2,二级机构;3,市局 + */ + private String step; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java index 78990d7..92a3665 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/MailAppealService.java @@ -1,45 +1,96 @@ package com.biutag.lan.service; import com.biutag.core.AjaxResult; +import com.biutag.entity.system.Dept; +import com.biutag.lan.config.AdminThreadLocal; import com.biutag.lan.domain.MailAppeal; +import com.biutag.lan.mapper.MailAppealMapper; +import com.biutag.mapper.system.DeptMapper; +import jakarta.annotation.Resource; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +@RequiredArgsConstructor @Service public class MailAppealService { + @Resource + private final MailAppealMapper mailAppealMapper; + + @Resource + private final DeptMapper deptMapper; + /** * 发起申请 + * * @param appeal * @return */ public AjaxResult launchAppeal(MailAppeal appeal) { - return null; + appeal.setHandlingDept(AdminThreadLocal.getDeptId()) + .setAppealStatus("1") + .setThreeDept(AdminThreadLocal.getDeptId()); + + mailAppealMapper.insert(appeal); + return AjaxResult.success(); } /** * 获取申请详情 + * * @param id * @return */ public AjaxResult getAppeal(String id) { - return null; + return AjaxResult.success(mailAppealMapper.selectById(id)); } /** * 驳回申请 + * * @param id * @param overruleReason * @return */ public AjaxResult overruleAppeal(String id, String overruleReason) { - return null; + MailAppeal appeal = mailAppealMapper.selectById(id); + Integer deptId = AdminThreadLocal.getDeptId(); + Dept dept = deptMapper.selectById(deptId); + switch (dept.getLevel()) { + case 1: + appeal.setStep("3"); + break; + case 2: + appeal.setSecondDept(deptId).setStep("2"); + break; + } + appeal.setHandlingDept(deptId) + .setOverruleReason(overruleReason) + .setAppealStatus("3"); + + mailAppealMapper.updateById(appeal); + return AjaxResult.success(); } /** * 通过申请 + * * @param id * @return */ public AjaxResult approved(String id) { - return null; + MailAppeal appeal = mailAppealMapper.selectById(id); + Integer deptId = AdminThreadLocal.getDeptId(); + Dept dept = deptMapper.selectById(deptId); + appeal.setHandlingDept(deptId); + switch (dept.getLevel()) { + case 1: + appeal.setStep("3").setAppealStatus("2"); + break; + case 2: + appeal.setSecondDept(deptId).setStep("2"); + break; + } + mailAppealMapper.updateById(appeal); + return AjaxResult.success(); } }