Browse Source

会议室列别magic-api

大数据与最优化研究所 2 weeks ago
parent
commit
62c569a60d

+ 1 - 4
src/main/java/com/xjrsoft/module/oa/controller/WfMeetingApplyController.java

@@ -112,10 +112,7 @@ public class WfMeetingApplyController {
     @SaCheckPermission("wfmeetingapply:edit")
     @XjrLog(value = "撤销会议申请")
     public RT<Boolean> updateRevocationMeeting(@Valid @RequestBody UpdateRevocationMeetingDto dto){
-        WfMeetingApply wfMeetingApply = new WfMeetingApply();
-        wfMeetingApply.setId(dto.getId());
-        wfMeetingApply.setMeetingStatus(1);
-        return RT.ok(wfMeetingApplyService.updateById(wfMeetingApply));
+        return RT.ok(wfMeetingApplyService.updateRevocationMeeting(dto));
     }
 
 //    @GetMapping(value = "/info")

+ 3 - 4
src/main/java/com/xjrsoft/module/oa/service/IWfMeetingApplyService.java

@@ -2,10 +2,7 @@ package com.xjrsoft.module.oa.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.base.MPJBaseService;
-import com.xjrsoft.module.oa.dto.MeetingConfereeListDto;
-import com.xjrsoft.module.oa.dto.MeetingConfereeOpinionListDto;
-import com.xjrsoft.module.oa.dto.MeetingRoomListDto;
-import com.xjrsoft.module.oa.dto.WfMeetingApplyPageDto;
+import com.xjrsoft.module.oa.dto.*;
 import com.xjrsoft.module.oa.entity.WfMeetingApply;
 import com.xjrsoft.module.oa.vo.*;
 
@@ -31,4 +28,6 @@ public interface IWfMeetingApplyService extends MPJBaseService<WfMeetingApply> {
     List<MeetingConfereeOpinionListVo> listMeetingConfereeOpinion(MeetingConfereeOpinionListDto dto);
 
     void noticeParticipants(Long id);
+
+    Boolean updateRevocationMeeting(UpdateRevocationMeetingDto dto);
 }

+ 108 - 6
src/main/java/com/xjrsoft/module/oa/service/impl/WfMeetingApplyServiceImpl.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.oa.service.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.IdUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,10 +14,8 @@ import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseOfficeBuild;
-import com.xjrsoft.module.oa.dto.MeetingConfereeListDto;
-import com.xjrsoft.module.oa.dto.MeetingConfereeOpinionListDto;
-import com.xjrsoft.module.oa.dto.MeetingRoomListDto;
-import com.xjrsoft.module.oa.dto.WfMeetingApplyPageDto;
+import com.xjrsoft.module.ledger.vo.WorkflowRecordVo;
+import com.xjrsoft.module.oa.dto.*;
 import com.xjrsoft.module.oa.entity.*;
 import com.xjrsoft.module.oa.mapper.MeetingConfereeMapper;
 import com.xjrsoft.module.oa.mapper.MeetingConfereeOpinionMapper;
@@ -29,10 +28,15 @@ import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.organization.service.IWeChatService;
 import com.xjrsoft.module.system.entity.DictionaryDetail;
+import com.xjrsoft.module.system.entity.File;
+import com.xjrsoft.module.system.mapper.FileMapper;
 import com.xjrsoft.module.teacher.entity.XjrUser;
 import com.xjrsoft.module.workflow.entity.WorkflowExtra;
 import com.xjrsoft.module.workflow.entity.WorkflowFormRelation;
+import com.xjrsoft.module.workflow.entity.WorkflowRecord;
+import com.xjrsoft.module.workflow.mapper.WorkflowExtraMapper;
 import com.xjrsoft.module.workflow.mapper.WorkflowFormRelationMapper;
+import com.xjrsoft.module.workflow.mapper.WorkflowRecordMapper;
 import com.xjrsoft.module.workflow.service.IWorkflowExtraService;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.ObjectUtils;
@@ -72,11 +76,23 @@ public class WfMeetingApplyServiceImpl extends MPJBaseServiceImpl<WfMeetingApply
 
     private final MeetingConfereeOpinionMapper meetingConfereeOpinionMapper;
 
+    private final WorkflowRecordMapper workflowRecordMapper;
+
+    private final WorkflowExtraMapper workflowExtraMapper;
+
+    private final FileMapper fileMapper;
+
     @Override
     public List<MeetingRoomListVo> listMeetingRoom(MeetingRoomListDto dto) {
+        if(ObjectUtils.isEmpty(dto.getMeetingApplyDate())
+                || ObjectUtils.isEmpty(dto.getMeetingApplyS())
+                || ObjectUtils.isEmpty(dto.getMeetingApplyE())
+        ){
+            return new ArrayList<>();
+        }
+
         // 处理时间
         LocalDate meetingApplyDate = LocalDate.parse(dto.getMeetingApplyDate());
-
         LocalTime startTime =  LocalTime.parse(dto.getMeetingApplyS());
         LocalTime endTime =  LocalTime.parse(dto.getMeetingApplyE());
 
@@ -242,6 +258,9 @@ public class WfMeetingApplyServiceImpl extends MPJBaseServiceImpl<WfMeetingApply
         wfMeetingApplyPageVoMPJLambdaWrapper
                 .disableSubLogicDel()
                 .select(WfMeetingApply::getId)
+                .select(" (SELECT GROUP_CONCAT(a.name) FROM xjr_user a" +
+                        " LEFT JOIN meeting_conferee b ON b.user_id = a.id" +
+                        " WHERE b.delete_mark = 0 AND b.wf_meeting_apply_id = t.id) as meetingApplyParticipantsCn")
                 .select(WfMeetingApply.class, x -> VoToColumnUtil.fieldsToColumns(WfMeetingApplyInWorkflowVo.class).contains(x.getProperty()))
                 .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, WfMeetingApply::getMeetingApplyFormat,
                         wrapper -> wrapper
@@ -257,7 +276,38 @@ public class WfMeetingApplyServiceImpl extends MPJBaseServiceImpl<WfMeetingApply
                 )
                 .eq(WfMeetingApply::getId, id)
         ;
-        return null;
+
+        WfMeetingApplyInWorkflowVo info = this.selectJoinOne(WfMeetingApplyInWorkflowVo.class, wfMeetingApplyPageVoMPJLambdaWrapper);
+
+        if(ObjectUtils.isNotEmpty(info)){
+            List<File> fileList = fileMapper.selectList(Wrappers.<File>query().lambda().eq(File::getFolderId, info.getPreMeetingInfoFileId()));
+            info.setFileInfos(fileList);
+
+            List<WorkflowRecord> recordList = workflowRecordMapper.selectList(
+                    new MPJLambdaWrapper<WorkflowRecord>()
+                            .select(WorkflowRecord.class, x -> VoToColumnUtil.fieldsToColumns(WorkflowRecordVo.class).contains(x.getProperty()))
+                            .innerJoin(WorkflowFormRelation.class, WorkflowFormRelation::getProcessId, WorkflowRecord::getProcessId)
+                            .eq(WorkflowFormRelation::getFormKeyValue, id)
+            );
+            info.setWorkflowRecordList(BeanUtil.copyToList(recordList, WorkflowRecordVo.class));
+            List<WorkflowFormRelation> relations = workflowFormRelationMapper.selectList(new QueryWrapper<WorkflowFormRelation>().lambda().eq(WorkflowFormRelation::getFormKeyValue, id.toString()));
+
+            if (!relations.isEmpty()) {
+                info.setProcessId(relations.get(0).getProcessId());
+            }
+
+            //查询最后一个节点的taskId
+            List<WorkflowExtra> taskList = workflowExtraMapper.selectList(
+                    new QueryWrapper<WorkflowExtra>().lambda()
+                            .eq(WorkflowExtra::getProcessId, info.getProcessId())
+                            .orderByDesc(WorkflowExtra::getStartTime)
+            );
+            if (!taskList.isEmpty()) {
+                info.setTaskId(taskList.get(0).getTaskId());
+            }
+        }
+
+        return info;
     }
 
     @Override
@@ -412,4 +462,56 @@ public class WfMeetingApplyServiceImpl extends MPJBaseServiceImpl<WfMeetingApply
             this.updateById(updateWorkflowStatus);
         }
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean updateRevocationMeeting(UpdateRevocationMeetingDto dto) {
+        MPJLambdaWrapper<WfMeetingApply> wrapper = new MPJLambdaWrapper<>();
+        wrapper
+                .disableSubLogicDel()
+                .select(WfMeetingApply::getId)
+                .selectAs(XjrUser::getName, WfMeetingApply::getMonogramTheme) // 将会议发起人名称暂时放在会标主题字段中
+                .select(WfMeetingApply.class,x -> VoToColumnUtil.fieldsToColumns(WfMeetingApply.class).contains(x.getProperty()))
+                .leftJoin(XjrUser.class, XjrUser::getId, WfMeetingApply::getSponsorId)
+                .eq(WfMeetingApply::getId, dto.getId())
+        ;
+        WfMeetingApply oldWfMeetingApply = this.selectJoinOne(WfMeetingApply.class, wrapper);
+
+        WfMeetingApply updateWfMeetingApply = new WfMeetingApply();
+        updateWfMeetingApply.setId(dto.getId());
+        updateWfMeetingApply.setMeetingStatus(1);
+        this.updateById(updateWfMeetingApply);
+
+        if(StringUtils.isNotEmpty(oldWfMeetingApply.getMeetingApplyParticipants())){
+            List<String> userIds = Arrays.asList(oldWfMeetingApply.getMeetingApplyParticipants().split(","));
+            List<User> userList = userService.list(new QueryWrapper<User>().lambda().in(User::getId, userIds).isNotNull(User::getOpenId));
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            LocalDateTime startLocalDateTime = LocalDateTime.of(oldWfMeetingApply.getMeetingApplyDate(), oldWfMeetingApply.getMeetingApplyS());
+            String startTime = startLocalDateTime.format(formatter);
+            // 发送消息通知
+            for (User user : userList) {
+                WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
+                weChatSendMessageDto.setUserId(user.getOpenId());
+                weChatSendMessageDto.setTemplateId("sZcnORXfcQZf8zy5K16N3dsPgQomyQALqUeEzYvTwxo");
+                weChatSendMessageDto.setMsgId(IdUtil.getSnowflakeNextId() + "");
+                JSONObject paramJson = new JSONObject();
+
+                JSONObject thing1 = new JSONObject();
+                thing1.put("value", oldWfMeetingApply.getMeetingApplyTheme());
+                paramJson.put("thing1", thing1);
+
+                JSONObject time6 = new JSONObject();
+                time6.put("value", startTime);
+                paramJson.put("time6", time6);
+
+                JSONObject thing8 = new JSONObject();
+                thing8.put("value", oldWfMeetingApply.getMonogramTheme());
+                paramJson.put("thing8", thing8);
+
+                weChatSendMessageDto.setContent(paramJson);
+                weChatService.sendTemplateMessage(weChatSendMessageDto);
+            }
+        }
+        return true;
+    }
 }