diff --git a/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java b/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java index 8c46149..dc26472 100644 --- a/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java +++ b/mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java @@ -40,4 +40,8 @@ public enum RoleEnum { return null; } + public static boolean isClasses(Integer roleId) { + return MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId) || SECOND_DEPT_CLASSES.getRoleId().equals(roleId) || THREE_DEPT_CLASSES.getRoleId().equals(roleId); + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/NoticeController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/NoticeController.java index cd5ff99..bf8d8a7 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/NoticeController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/NoticeController.java @@ -5,9 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.aop.NotPower; import com.biutag.core.AjaxResult; +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.bo.MailQuery; import com.biutag.lan.domain.vo.NoticeTotalVo; +import com.biutag.lan.domain.vo.QueryMailVo; +import com.biutag.lan.domain.vo.WorkVo; import com.biutag.lan.flow.FlowNameEnum; import com.biutag.lan.service.NoticeService; import com.biutag.lan.service.WorkService; @@ -28,14 +33,28 @@ public class NoticeController { @NotPower @GetMapping("total") public AjaxResult total() { - IPage noticeIPage = noticeService.pageByCurrentUser(new Page<>(1, 1)); - return AjaxResult.success(new NoticeTotalVo().setTotal(noticeIPage.getTotal()).setNotice(noticeIPage.getRecords().stream().findFirst().orElse(null))); + Page workVoPage = workService.page(Work.State.todo.name(), new Page<>(1, 1), new MailQuery()); + NoticeTotalVo vo = new NoticeTotalVo().setTotal(workVoPage.getTotal()); + if (vo.getTotal() > 0) { + IPage noticeIPage = noticeService.pageByCurrentUser(new Page<>(1, 1)); + vo.setNotice(noticeIPage.getRecords().stream().findFirst().orElse(null)); + } + return AjaxResult.success(vo); } @NotPower @GetMapping("newMailAudio") public AjaxResult newMailAudio() { - long count = workService.count(new LambdaQueryWrapper().eq(Work::getFlowName, FlowNameEnum.PENDING_SIGN.getName()).eq(Work::getWorkState, Work.State.todo.name())); + Integer roleId = AdminThreadLocal.getRoleId(); + if (!RoleEnum.isClasses(roleId)) { + return AjaxResult.success(false); + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(Work::getFlowName, FlowNameEnum.PENDING_SIGN.getName()) + .eq(Work::getWorkState, Work.State.todo.name()) + .eq(Work::getSignDeptId, AdminThreadLocal.getDeptId()) + .eq(Work::getSignRoleId, roleId); + long count = workService.count(queryWrapper); return AjaxResult.success(count > 0); } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java index f9fd52c..eb66b8e 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/DeptController.java @@ -2,6 +2,7 @@ package com.biutag.lan.controller.system; import com.alibaba.fastjson2.JSONArray; import com.biutag.aop.NotPower; +import com.biutag.core.AjaxResult; import com.biutag.entity.system.Dept; import com.biutag.lan.service.IDeptService; import com.biutag.lan.validate.commons.IdValidate; @@ -9,21 +10,19 @@ import com.biutag.lan.validate.system.DeptCreateValidate; import com.biutag.lan.validate.system.DeptSearchValidate; import com.biutag.lan.validate.system.DeptUpdateValidate; import com.biutag.lan.vo.system.DeptVo; -import com.biutag.core.AjaxResult; import com.biutag.validator.annotation.IDMust; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; import java.util.List; @RestController @RequestMapping("api/system/dept") @Api(tags = "系统部门管理") public class DeptController { - @Resource IDeptService iDeptService; @@ -35,6 +34,14 @@ public class DeptController { return AjaxResult.success(list); } + @NotPower + @GetMapping("/all/tree") + @ApiOperation(value="部门树结构") + public AjaxResult allTree() { + JSONArray list = iDeptService.allTree(); + return AjaxResult.success(list); + } + @NotPower @GetMapping("/list") @ApiOperation(value="部门列表") diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java index 23ecf2d..44d62c9 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/system/PoliceUserController.java @@ -154,9 +154,16 @@ public class PoliceUserController { @GetMapping("/listByCurrentEmpNo") @ApiOperation(value="当前人员信息") public AjaxResult> listByCurrentEmpNo(String departId ,String EmpNo) { - return AjaxResult.success(iPoliceUserService.listByCurrentEmpNo(departId,EmpNo)); } + @NotPower + @GetMapping("/listByCoHanding") + @ApiOperation(value="") + public AjaxResult> listByCoHanding() { + return AjaxResult.success(iPoliceUserService.listByCoHanding()); + + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java index 077a99e..e6705a0 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/work/WorkController.java @@ -82,7 +82,7 @@ public class WorkController { @NotPower @NotLogin @GetMapping("send") - public String getFlow(@RequestParam String msg) { + public String getFlow(@RequestParam String msg) throws Exception { return SmsLan.send("15973160301", msg, "TEST01"); } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/SmsSend.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/SmsSend.java new file mode 100644 index 0000000..91d5acd --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/SmsSend.java @@ -0,0 +1,34 @@ +package com.biutag.lan.domain; + + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +@Accessors(chain = true) +@Setter +@Getter +public class SmsSend { + + private Integer id; + /** + * 手机号 + */ + private String phone; + /** + * 内容 + */ + private String content; + /** + * + */ + private LocalDateTime createTime; + /** + * + */ + private String mailId; + + private Boolean success; +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/enums/WorkType.java b/mailbox-lan/src/main/java/com/biutag/lan/enums/WorkType.java index 8884f41..b60ba80 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/enums/WorkType.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/enums/WorkType.java @@ -10,6 +10,6 @@ public enum WorkType { extension_approval, // 协办 - co_organizers; + co_handling; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java index 582da5a..7577891 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java @@ -181,7 +181,7 @@ public class FlowConfig { .setFlowNode(getFlowNode(flowNodes, FlowNodeEnum.COUNTERSIGN)); - coHandlingFlow.setFlowNode(getFlowNode(flowNodes, FlowNodeEnum.CO_HANDLING)) + coHandlingFlow.setFlowNode(getFlowNode(flowNodes, FlowNodeEnum.SECONDARY_VERIFY)) .setActions(Collections.singletonList(coReportAction)); } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java index 094aaad..feb5f1f 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNameEnum.java @@ -28,7 +28,7 @@ public enum FlowNameEnum { MAIL_RETURN("信件退回", "信件退回"), RETURN_RECTIFICATION("退回整改", "退回整改"), - CO_HANDLING("协查办理", "协查办理"); + SECONDARY_VERIFY("协办核查", "协办核查"); private String name; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java index e921fd2..b3e74b1 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/FlowNodeEnum.java @@ -24,10 +24,9 @@ public enum FlowNodeEnum { FIRST_APPROVAL("first_approval", "市局专班认定办结", 15), COUNTERSIGN("countersign", "部门会签", 16), COMPLETION("completion", "已办结", 17), - CO_HANDLING("co_handling", "协查办理", 18), + SECONDARY_VERIFY("co_handling", "协办核查", 18), CHANGE_TODO("change_todo", "转为待办", 19); - private String key; private String fullName; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CoHandlingFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CoHandlingFlow.java index 2e11985..27b9168 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CoHandlingFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/CoHandlingFlow.java @@ -38,7 +38,7 @@ public class CoHandlingFlow extends Flow { .setCreateTime(now) .setVerifyDetails(verifyDetails) .setVerifyAttachments(verifyAttachments.toJSONString()) - .setCoType(WorkType.co_organizers.name().equals(work.getWorkType()) ? CoType.co_organizers.name() : CoType.secondary.name()); + .setCoType(CoType.secondary.name()); mailCoHandlingService.save(mailCoHandling); work.setWorkState(Work.State.done.name()).setUpdateTime(now); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java index cd54abc..2f3bc86 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstSignFlow.java @@ -32,6 +32,7 @@ public class FirstSignFlow extends Flow { private final MailApprovalService mailApprovalService; private final MailExtensionApprovalService mailExtensionApprovalService; private final MailCountersignService mailCountersignService; + private final NoticeService noticeService; @Override @Transactional(rollbackFor = Exception.class) @@ -88,6 +89,7 @@ public class FirstSignFlow extends Flow { .setFlowName(nextNode.getFlowNode().getBeforeName()) .setFlowLimitedLastHandlerTime(mailSource.getCreateTime()); mailService.save(mail); + noticeService.sendNoticeDoneByRole(); return nextNode; } @@ -112,6 +114,7 @@ public class FirstSignFlow extends Flow { mailService.save(mail); // 更新为已办 workService.updateDoneByRole(mailId, null); + noticeService.sendNoticeDoneByRole(); return null; } @@ -133,6 +136,7 @@ public class FirstSignFlow extends Flow { mailService.save(mail); // 更新为已办 workService.updateDoneByRole(mailId, null); + noticeService.sendNoticeDoneByRole(); return null; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java index 17ec672..b23d1ec 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java @@ -62,15 +62,15 @@ public class SecondDistributeFlow extends Flow { } else { // 非主责 workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), mainDeptId, now, false, - FlowNameEnum.CO_HANDLING.getName(), - FlowNodeEnum.CO_HANDLING.getKey()); + FlowNameEnum.SECONDARY_VERIFY.getName(), + FlowNodeEnum.VERIFY.getKey()); } Integer secondDeptId1 = data.getInteger("secondDeptId1"); if (Objects.nonNull(secondDeptId1)) { // 下发信件(次责单位1) workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId1, now, false, FlowNameEnum.PENDING_SIGN_CO.getName(), - FlowNodeEnum.CO_HANDLING.getKey()); + FlowNodeEnum.VERIFY.getKey()); secondDistributeInfo.put("secondDept1", JSONObject.of("id", secondDeptId1)); } Integer secondDeptId2 = data.getInteger("secondDeptId2"); @@ -78,7 +78,7 @@ public class SecondDistributeFlow extends Flow { // 下发信件(次责单位2) workService.saveOrUpdate(mail, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), secondDeptId2, now, false, FlowNameEnum.PENDING_SIGN_CO.getName(), - FlowNodeEnum.CO_HANDLING.getKey()); + FlowNodeEnum.VERIFY.getKey()); secondDistributeInfo.put("secondDept2", JSONObject.of("id", secondDeptId2)); } Flow nextNode = next.get(nextActionKey); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java index bc93391..7d38390 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java @@ -11,10 +11,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.transaction.annotation.Transactional; @@ -38,6 +35,8 @@ public class SecondSignFlow extends Flow { private final MailMarkService mailMarkService; + private final NoticeService noticeService; + @Override @Transactional(rollbackFor = Exception.class) public Flow next(String nextActionKey, String mailId, JSONObject data) { @@ -93,6 +92,8 @@ public class SecondSignFlow extends Flow { mailService.updateById(mail); // 删除统计表 mailMarkService.removeById(mailId); + // 通知 + noticeService.sendNoticeDoneByRole(); return null; } @@ -125,6 +126,8 @@ public class SecondSignFlow extends Flow { .setFlowName(nextNode.getFlowNode().getBeforeName()); mailService.updateById(mail); } + // 通知 + noticeService.sendNoticeDoneByRole(); return nextNode; } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java index 87286b3..f2d5a98 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java @@ -15,6 +15,7 @@ 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 lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; @@ -40,6 +41,8 @@ public class ThreeSignFlow extends Flow { private final MailReturnService mailReturnService; + private final NoticeService noticeService; + @Override @Transactional(rollbackFor = Exception.class) public Flow next(String nextActionKey, String mailId, JSONObject data) { @@ -51,16 +54,14 @@ public class ThreeSignFlow extends Flow { public Flow mailReturn(String mailId, JSONObject data) { LocalDateTime now = LocalDateTime.now(); - Integer roleId = AdminThreadLocal.getRoleId(); Integer deptId = AdminThreadLocal.getDeptId(); - Work work = workService.getOne(mailId, roleId ,deptId); + Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(),deptId); if (work.getWorkState().equals(Work.State.done.name())) { throw new BusinessException("该信件已被其他专班处理"); } String reason = data.getString("reason"); Assert.hasText(reason, "参数错误"); Mail mail = mailService.getById(mailId); - MailReturn mailReturn = new MailReturn() .setMailId(mailId) .setReason(reason) @@ -73,6 +74,8 @@ public class ThreeSignFlow extends Flow { // 更新已办 work.setUpdateTime(now).setWorkState(Work.State.done.name()).setFlowName(FlowNameEnum.MAIL_RETURN.getDoneName()); workService.updateById(work); + // 将所有协办的待办更新为已办 + workService.updateDoneByCoHandling(mailId); // 更新二级机构专班的待办 workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.MAIL_RETURN.getName()); // 更新信件 @@ -80,6 +83,8 @@ public class ThreeSignFlow extends Flow { .setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey()) .setFlowName(FlowNameEnum.MAIL_RETURN.getName()); mailService.updateById(mail); + // 通知 + noticeService.sendNoticeDoneByRole(); return null; } @@ -104,6 +109,8 @@ public class ThreeSignFlow extends Flow { .setFlowKey(nextNode.getFlowNode().getKey()) .setFlowName(nextNode.getFlowNode().getBeforeName()); mailService.updateById(mail); + // 通知 + noticeService.sendNoticeDoneByRole(); return nextNode; } @@ -114,7 +121,11 @@ public class ThreeSignFlow extends Flow { if (Objects.nonNull(coHandlingPolices) && coHandlingPolices.size() > 0) { for (Object coHandingPolice : coHandlingPolices) { Map obj = (LinkedHashMap) coHandingPolice; - String empNo = obj.get("empNo").toString(); + Object empNoObj = obj.get("empNo"); + if (Objects.isNull(empNoObj)) { + continue; + } + String empNo = empNoObj.toString(); Work coWork = workService.getOne(mail.getId(), empNo); if (Objects.nonNull(coWork)) { continue; @@ -125,9 +136,7 @@ public class ThreeSignFlow extends Flow { .setPoliceEmpNo(empNo) .setCreateTime(now) .setWorkState(Work.State.todo.name()) - .setFlowName(FlowNameEnum.CO_HANDLING.getName()) - .setWorkType(WorkType.co_organizers.name()) - .setFlowKey(FlowNodeEnum.CO_HANDLING.getKey()).setUpdateTime(now); + .setWorkType(WorkType.co_handling.name()); workService.save(work); } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java index caebdf1..b5d210c 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java @@ -18,6 +18,7 @@ import com.biutag.lan.enums.WorkType; 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.IPoliceUserService; import com.biutag.lan.service.MailService; import com.biutag.lan.service.SmsService; @@ -87,12 +88,6 @@ public class ThreeVerifyFlow extends Flow { } public Flow save(String mailId, JSONObject data) { - JSONObject verifyFollowupPoliceObj = data.getJSONObject("verifyFollowupPolice"); - Assert.notNull(verifyFollowupPoliceObj, "请填写回访人信息"); - String verifyFollowupPolice = JSONObject - .of("name", verifyFollowupPoliceObj.getString("name"), - "empNo", verifyFollowupPoliceObj.getString("empNo"), - "mobile", verifyFollowupPoliceObj.getString("mobile")).toJSONString(); JSONObject contactPolice = data.getJSONObject("contactPolice"); Mail mail = mailService.getById(mailId); Mail source = new Mail() @@ -120,14 +115,20 @@ public class ThreeVerifyFlow extends Flow { .setVerifyPunish(data.getString("verifyPunish")) .setVerifyIsResolved(data.getBoolean("verifyIsResolved")) .setVerifyFeedback(data.getString("verifyFeedback")) - .setVerifyFollowupPolice(verifyFollowupPolice) .setVerifyAttachments(data.getString("verifyAttachments")); + JSONObject verifyFollowupPoliceObj = data.getJSONObject("verifyFollowupPolice"); + if (Objects.nonNull(verifyFollowupPoliceObj)) { + String verifyFollowupPolice = JSONObject + .of("name", verifyFollowupPoliceObj.getString("name"), + "empNo", verifyFollowupPoliceObj.getString("empNo"), + "mobile", verifyFollowupPoliceObj.getString("mobile")).toJSONString(); + source.setVerifyFollowupPolice(verifyFollowupPolice); + } BeanUtil.copyProperties(source, mail, CopyOptions.create().setIgnoreNullValue(true)); - - // 处理协办民警 - threeSignFlow.saveCoHandling(mail, data); JSONArray coHandlingPolices = data.getJSONArray("coHandlingPolices"); if (Objects.nonNull(coHandlingPolices) && !coHandlingPolices.isEmpty()) { + // 处理协办民警 + threeSignFlow.saveCoHandling(mail, data); mail.setCoHandlingPolices(coHandlingPolices.toJSONString()); } mailService.updateById(mail); @@ -135,11 +136,13 @@ public class ThreeVerifyFlow extends Flow { } public void applicationCompleted(String nextActionKey, Mail mail, JSONObject data, LocalDateTime now) { + // 校验信件流程环节 + if (!mail.getFlowKey().equals(FlowNodeEnum.VERIFY.getKey())) { + throw new BusinessException("该信件已被其他人处理,请刷新后重试"); + } JSONObject verifyFollowupPoliceObj = data.getJSONObject("verifyFollowupPolice"); Assert.notNull(verifyFollowupPoliceObj, "参数异常"); - Flow nextNode = next.get(nextActionKey); - JSONObject contactPolice = data.getJSONObject("contactPolice"); String verifyFollowupPolice = JSONObject .of("name", verifyFollowupPoliceObj.getString("name"), @@ -186,19 +189,14 @@ public class ThreeVerifyFlow extends Flow { PoliceUser policeUser = policeUserService.getOneByEmpNo(leaderEmpNo); mail.setCurrentOperator(String.format("%s %s", mail.getThreeDeptName(), policeUser.getName())); } - // 将本人下的件改为已办 - workService.updateDoneByRole(mail.getId(), FlowNameEnum.VERIFY.getDoneName()); - // 处理协办民警 - threeSignFlow.saveCoHandling(mail, data); - JSONArray coHandlingPolices = data.getJSONArray("coHandlingPolices"); - if (Objects.nonNull(coHandlingPolices) && !coHandlingPolices.isEmpty()) { - mail.setCoHandlingPolices(coHandlingPolices.toJSONString()); - } + workService.updateDoneByRole(mail.getId(), RoleEnum.THREE_DEPT_CLASSES.getRoleId(), FlowNameEnum.VERIFY.getDoneName()); + // 将所有协办改为已办 + workService.updateDoneByCoHandling(mail.getId()); // 更新信件 mailService.updateById(mail); // 发送通知短信 - smsService.sendNotification(mail.getContactPhone()); + smsService.sendNotification(mail.getContactPhone(), mail.getId()); } public Flow offline(String nextActionKey, String mailId, JSONObject data) { diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/PoliceUserMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/PoliceUserMapper.java index b88143a..ae56f60 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/mapper/PoliceUserMapper.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/mapper/PoliceUserMapper.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.biutag.core.basics.IBaseMapper; import com.biutag.entity.system.PoliceUser; import com.biutag.lan.vo.system.PoliceUserListedVo; -import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -15,7 +14,6 @@ import java.util.List; /** * 系统管理员Mapper */ -@Mapper public interface PoliceUserMapper extends IBaseMapper { /** diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/SmsSendMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/SmsSendMapper.java new file mode 100644 index 0000000..24745aa --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/mapper/SmsSendMapper.java @@ -0,0 +1,7 @@ +package com.biutag.lan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.lan.domain.SmsSend; + +public interface SmsSendMapper extends BaseMapper { +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java index a10fb7c..49d27d9 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IDeptService.java @@ -23,6 +23,8 @@ public interface IDeptService { */ List all(); + JSONArray allTree(); + /** * 部门列表 * diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java index f48cd81..ba59f9f 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/IPoliceUserService.java @@ -166,4 +166,6 @@ public interface IPoliceUserService { List listByCurrentDeptAndDeptPid(String departId ,String name); List listByCurrentEmpNo(String departId ,String EmpNo); + + List listByCoHanding(); } 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 ce85c0c..39f9ca4 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 @@ -184,7 +184,7 @@ public class MailService extends ServiceImpl { public MailFlowDetail getMailFlowDetailByWork(String mailId, Integer workId) { MailFlowDetail mailDetail = getMailFlowDetailByWork(mailId); Work work = workService.getById(workId); - if (!work.getMainDeptFlag() || work.getWorkType().equals(WorkType.co_organizers.name())) { + if (!work.getMainDeptFlag()) { Flow flow = flowNodes.stream() .filter(item -> work.getFlowKey().equals(item.getFlowNode().getKey())) .findFirst().orElseThrow(() -> new BusinessException("没有该流程节点")); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java index c62d08e..e9a0282 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/NoticeService.java @@ -29,7 +29,7 @@ public class NoticeService extends ServiceImpl { 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); save(notice); - messagingTemplate.convertAndSend(String.format("/topic/role/%s/%s", roleId, deptId), ""); + messagingTemplate.convertAndSend(String.format("/topic/role/%s/%s", roleId, deptId), Work.State.todo.name()); log.info("发送通知:{}", String.format("/topic/role/%s/%s", roleId, deptId)); } @@ -37,10 +37,18 @@ public class NoticeService extends ServiceImpl { 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); save(notice); - messagingTemplate.convertAndSend(String.format("/topic/user/%s", empNo), ""); + messagingTemplate.convertAndSend(String.format("/topic/user/%s", empNo), Work.State.todo.name()); log.info("发送通知:{}", String.format("/topic/user/%s", empNo)); } + @Async + public void sendNoticeDoneByRole() { + Integer roleId = AdminThreadLocal.getRoleId(); + Integer deptId = AdminThreadLocal.getDeptId(); + log.info("发送通知:{}", String.format("/topic/role/%s/%s", roleId, deptId)); + messagingTemplate.convertAndSend(String.format("/topic/role/%s/%s", roleId, deptId), Work.State.done.name()); + } + public void save(Work work, String content) { if (Objects.nonNull(work.getSignRoleId())) { save(work.getSignRoleId(), work.getSignDeptId(), content, work.getId()); @@ -52,7 +60,7 @@ public class NoticeService extends ServiceImpl { public IPage pageByCurrentUser(IPage page) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(Notice::getReadFlag, AppConstants.NO); Integer roleId = AdminThreadLocal.getRoleId(); - if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || roleId.equals(RoleEnum.SECOND_DEPT_CLASSES.getRoleId()) || roleId.equals(RoleEnum.THREE_DEPT_CLASSES.getRoleId())) { + if (RoleEnum.isClasses(roleId)) { queryWrapper.eq(Notice::getRoleId, roleId).eq(Notice::getDeptId, AdminThreadLocal.getDeptId()); } else { queryWrapper.eq(Notice::getEmpNo, AdminThreadLocal.getEmpNo()); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/SmsService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/SmsService.java index 201affc..531c3e9 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/SmsService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/SmsService.java @@ -1,19 +1,38 @@ package com.biutag.lan.service; import cn.hutool.core.util.PhoneUtil; +import com.biutag.lan.domain.SmsSend; +import com.biutag.lan.mapper.SmsSendMapper; import com.biutag.lan.util.SmsLan; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; +import java.time.LocalDateTime; + +@Slf4j +@RequiredArgsConstructor @Component public class SmsService { + private final SmsSendMapper smsSendMapper; + @Async - public void sendNotification(String phone) { + public void sendNotification(String phone, String mailId) { if (!PhoneUtil.isPhone(phone)) { return; } - SmsLan.send(phone, "请您及时登录局长信箱即接即办,并对您写的信件进行满意度评价,谢谢您的支持!"); + String content = "请您及时登录局长信箱即接即办,并对您写的信件进行满意度评价,谢谢您的支持!"; + try { + SmsLan.send(phone, content); + SmsSend smsSend = new SmsSend().setPhone(phone).setMailId(mailId).setContent(content).setCreateTime(LocalDateTime.now()).setSuccess(true); + smsSendMapper.insert(smsSend); + } catch (Exception e) { + SmsSend smsSend = new SmsSend().setPhone(phone).setMailId(mailId).setContent(content).setCreateTime(LocalDateTime.now()).setSuccess(false); + smsSendMapper.insert(smsSend); + log.error(e.getMessage(), e); + } } } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java index 85da926..ec519d0 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java @@ -171,7 +171,11 @@ public class WorkService extends ServiceImpl { } public boolean updateDoneByRole(String mailId, String flowName) { - Work work = getOne(mailId, AdminThreadLocal.getRoleId(), AdminThreadLocal.getDeptId()); + return updateDoneByRole(mailId, AdminThreadLocal.getRoleId(), flowName); + } + + public boolean updateDoneByRole(String mailId, Integer roleId, String flowName) { + Work work = getOne(mailId, roleId, AdminThreadLocal.getDeptId()); if (work.getWorkState().equals(Work.State.done.name())) { throw new BusinessException("该信件已被其他专班处理"); } @@ -179,6 +183,16 @@ public class WorkService extends ServiceImpl { return updateById(work); } + public boolean updateDoneByCoHandling(String mailId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(Work::getMailId, mailId) + .eq(Work::getWorkType, WorkType.co_handling.name()) + .eq(Work::getWorkState, Work.State.todo.name()); + List works = list(queryWrapper); + works.forEach(item -> { + item.setWorkState(Work.State.done.name()).setUpdateTime(LocalDateTime.now()); + }); + return updateBatchById(works); + } public boolean updateDone(String mailId, String empNo, String flowName) { Work work = getOne(mailId, empNo); diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java index 15c2ddb..9280bf3 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/DeptServiceImpl.java @@ -1,6 +1,7 @@ package com.biutag.lan.service.impl; import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Assert; @@ -55,18 +56,7 @@ class DeptServiceImpl implements IDeptService { .gt("pid", 0) .eq("is_delete", 0) .orderByAsc((Arrays.asList("sort", "id"))); - Integer roleId = AdminThreadLocal.getRoleId(); - Integer deptId = AdminThreadLocal.getDeptId(); - if (RoleEnum.SECOND_DEPT_CLASSES.getRoleId().equals(roleId)) { - queryWrapper.and(query -> { - query.eq("id", deptId).or().eq("pid", deptId); - }); - } - if (RoleEnum.THREE_DEPT_CLASSES.getRoleId().equals(roleId)) { - queryWrapper.eq("id", deptId); - } List DeptList = deptMapper.selectList(queryWrapper); - List list = new ArrayList<>(); for (Dept dept : DeptList) { DeptVo vo = new DeptVo(); @@ -78,6 +68,40 @@ class DeptServiceImpl implements IDeptService { return list; } + @Override + public JSONArray allTree() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_delete", 0); + queryWrapper.orderByAsc(Arrays.asList("sort", "id")); + queryWrapper.select(Dept.class, info -> + !info.getColumn().equals("is_delete") && + !info.getColumn().equals("delete_time")); + + deptMapper.setSearch(queryWrapper, new JSONObject(), new String[]{ + "like:name:str", + "=:isStop@is_stop:int" + }); + List DeptList = deptMapper.selectList(queryWrapper); + List dictDataList = dictDataMapper.selectList(new QueryWrapper() + .select("id,type_id,name,value,remark,sort,status,create_time,update_time") + .eq("type_id", AppConstants.DEPT_TYPE_CATEGORY)//机构类型 + .eq("is_delete", 0).orderByAsc("sort")); + List list = new LinkedList<>(); + for (Dept dept : DeptList) { + DeptVo vo = new DeptVo(); + BeanUtils.copyProperties(dept, vo); + if(StringUtils.isNotEmpty(dept.getCategory()) ){ + vo.setCategoryName(dictDataList.stream().filter(entity -> + entity.getValue().equals(dept.getCategory())).findFirst().get().getName()); ; + } + vo.setCreateTime(TimeUtils.timestampToDate(dept.getCreateTime())); + vo.setUpdateTime(TimeUtils.timestampToDate(dept.getUpdateTime())); + list.add(vo); + } + JSONArray jsonArray = JSONArray.parseArray(JSONArray.toJSONString(list)); + return ListUtils.listToTree(jsonArray, "id", "pid", "children"); + } + /** * 部门列表 * diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java index bb89c2a..d245b05 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java @@ -615,4 +615,12 @@ public class PoliceUserServiceImpl implements IPoliceUserService { } + @Override + public List listByCoHanding() { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(PoliceUser::getDataDeptId, AdminThreadLocal.getDeptId()) + .eq(PoliceUser::getRoleIds, RoleEnum.NORMAL_POLICE.getRoleId()); + return policeUserMapper.selectList(queryWrapper); + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/util/SmsLan.java b/mailbox-lan/src/main/java/com/biutag/lan/util/SmsLan.java index 35dba6a..8f66695 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/util/SmsLan.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/util/SmsLan.java @@ -27,7 +27,7 @@ public class SmsLan { private SmsLan() { } - public static String send(String mobile, String content) { + public static String send(String mobile, String content) throws Exception { return send(mobile, content, IdUtil.fastSimpleUUID()); } @@ -105,29 +105,25 @@ public class SmsLan { * @param orderNo 批次号 【必填】 * @return */ - public static String send(String mobiles, String content, String orderNo) { - try { - Map dataMap = new HashMap<>(); - long timeStamp = System.currentTimeMillis() / 1000; - dataMap.put("timeStamp", timeStamp); - log.info("timeStamp: {}", timeStamp); - dataMap.put("mobiles", mobiles); - dataMap.put("content", content); - dataMap.put("orderNo", orderNo); - dataMap.put("appendID", ""); - dataMap.put("sendTime", ""); - dataMap.put("validTime", ""); - String jsonStr = JSON.toJSONString(dataMap); - log.info("jsonStr: {}", jsonStr); - String key = encrypt(jsonStr, PASSWORD); - key = URLEncoder.encode(key, "UTF-8"); - log.info("key: {}", key); - String response = httpUtilPost(BASE_URL, "userid=" + USERNAME + "&key=" + key); - log.info(response); - } catch (Exception e) { - e.printStackTrace(); - } - return null; + public static String send(String mobiles, String content, String orderNo) throws Exception { + Map dataMap = new HashMap<>(); + long timeStamp = System.currentTimeMillis() / 1000; + dataMap.put("timeStamp", timeStamp); + log.info("timeStamp: {}", timeStamp); + dataMap.put("mobiles", mobiles); + dataMap.put("content", content); + dataMap.put("orderNo", orderNo); + dataMap.put("appendID", ""); + dataMap.put("sendTime", ""); + dataMap.put("validTime", ""); + String jsonStr = JSON.toJSONString(dataMap); + log.info("jsonStr: {}", jsonStr); + String key = encrypt(jsonStr, PASSWORD); + key = URLEncoder.encode(key, "UTF-8"); + log.info("key: {}", key); + String response = httpUtilPost(BASE_URL, "userid=" + USERNAME + "&key=" + key); + log.info(response); + return response; } /** diff --git a/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java b/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java index 346deba..7dfe4f4 100644 --- a/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java +++ b/mailbox-outer/src/main/java/com/biutag/outer/job/Job.java @@ -51,7 +51,7 @@ public class Job { private final String key = "mailbox"; // 30s - @Scheduled(fixedRate = 30000) + @Scheduled(fixedRate = 10000) public void pushMailData() { System.out.println(LocalDateTime.now()); List mails = mailMapper.listByMailEtl(); @@ -125,9 +125,9 @@ public class Job { } /** - * 更新信件状态 30分钟 + * 更新信件状态 30s */ - @Scheduled(fixedRate = 1800000) + @Scheduled(fixedRate = 30000) public void updateMailState() { List mails = mailMapper.listByMailState(); for (Mail mail : mails) {