|
|
@@ -1,25 +1,22 @@
|
|
|
package com.xunmei.core.letter.service.impl;
|
|
|
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.xunmei.common.core.constant.ErrorMsgConstants;
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.letter.domain.CoreIntroduceLetter;
|
|
|
-import com.xunmei.common.core.domain.letter.domain.CoreIntroduceLetterCheckLog;
|
|
|
+import com.xunmei.common.core.domain.letter.domain.CoreIntroduceLetterApproveLog;
|
|
|
import com.xunmei.common.core.domain.letter.domain.CoreIntroduceLetterToOrg;
|
|
|
import com.xunmei.common.core.domain.letter.domain.CoreIntroduceLetterUser;
|
|
|
-import com.xunmei.common.core.domain.letter.dto.CoreIntroduceLetterAddDto;
|
|
|
-import com.xunmei.common.core.domain.letter.dto.CoreIntroduceLetterUserAddDto;
|
|
|
-import com.xunmei.common.core.domain.letter.vo.CoreIntroduceLetterCheckLogVo;
|
|
|
-import com.xunmei.common.core.domain.letter.vo.CoreIntroduceLetterInfoVo;
|
|
|
-import com.xunmei.common.core.domain.letter.vo.CoreIntroduceLetterVo;
|
|
|
+import com.xunmei.common.core.domain.letter.dto.*;
|
|
|
+import com.xunmei.common.core.domain.letter.vo.*;
|
|
|
import com.xunmei.common.core.util.BeanHelper;
|
|
|
-import com.xunmei.common.core.utils.DateUtils;
|
|
|
+import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.letter.mapper.CoreIntroduceLetterMapper;
|
|
|
import com.xunmei.core.letter.service.ICoreIntroduceLetterService;
|
|
|
@@ -27,13 +24,11 @@ import com.xunmei.system.api.RemoteOrgService;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 介绍信Service业务层处理
|
|
|
@@ -49,23 +44,21 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
private RemoteOrgService orgService;
|
|
|
|
|
|
@Override
|
|
|
- public TableDataInfo<CoreIntroduceLetterVo> selectPage(CoreIntroduceLetter coreIntroduceLetter) {
|
|
|
+ public TableDataInfo<CoreIntroduceLetterVo> selectPage(CoreIntroduceLetterRequestDto request) {
|
|
|
//未删除
|
|
|
Page<CoreIntroduceLetterVo> page;
|
|
|
//分页
|
|
|
- if (coreIntroduceLetter.getPageNum()!=null&&coreIntroduceLetter.getPageSize()!=null)
|
|
|
+ if (request.getPageNum()!=null&&request.getPageSize()!=null)
|
|
|
{
|
|
|
- page = new Page<>(coreIntroduceLetter.getPageNum(), coreIntroduceLetter.getPageSize());
|
|
|
+ page = new Page<>(request.getPageNum(), request.getPageSize());
|
|
|
}else{
|
|
|
page = new Page<>();
|
|
|
}
|
|
|
- /* if (coreIntroduceLetter.getCheckSub()) {
|
|
|
- SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectSysOrgById(coreIntroduceLetter.getOrgId(),SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
- coreIntroduceLetter.setOrgPath(sysOrg.getPath());
|
|
|
- coreIntroduceLetter.setOrgId(null);
|
|
|
- }*/
|
|
|
+// if (ObjectUtil.isNotNull(request.getRequestFromWeb()) && request.getRequestFromWeb() ) {
|
|
|
+// request.setType(1);
|
|
|
+// }
|
|
|
//获取数据
|
|
|
- page = coreIntroduceLetterMapper.selectPageList(page, coreIntroduceLetter);
|
|
|
+ page = coreIntroduceLetterMapper.selectPageList(page, request);
|
|
|
if(CollectionUtils.isNotEmpty(page.getRecords())){
|
|
|
List<SysOrg> orgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.findAllOrg(SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
page = this.buildPageVo(page, orgList);
|
|
|
@@ -79,26 +72,25 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TableDataInfo<CoreIntroduceLetterVo> selectAuditListPage(CoreIntroduceLetter coreIntroduceLetter) {
|
|
|
+ public TableDataInfo<CoreIntroduceLetterApproveVo> selectApproveListPage(CoreIntroduceLetterApproveRequestDto requestDto) {
|
|
|
//未删除
|
|
|
- Page<CoreIntroduceLetterVo> page;
|
|
|
+ Page<CoreIntroduceLetterApproveVo> page;
|
|
|
//分页
|
|
|
- if (coreIntroduceLetter.getPageNum()!=null&&coreIntroduceLetter.getPageSize()!=null)
|
|
|
+ if (requestDto.getPageNum()!=null&&requestDto.getPageSize()!=null)
|
|
|
{
|
|
|
- page = new Page<>(coreIntroduceLetter.getPageNum(), coreIntroduceLetter.getPageSize());
|
|
|
+ page = new Page<>(requestDto.getPageNum(), requestDto.getPageSize());
|
|
|
}else{
|
|
|
page = new Page<>();
|
|
|
}
|
|
|
- /* if (coreIntroduceLetter.getCheckSub()) {
|
|
|
- SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectSysOrgById(coreIntroduceLetter.getOrgId(),SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
- coreIntroduceLetter.setOrgPath(sysOrg.getPath());
|
|
|
- coreIntroduceLetter.setOrgId(null);
|
|
|
- }*/
|
|
|
//获取数据
|
|
|
- page = coreIntroduceLetterMapper.selectAuditListPage(page, coreIntroduceLetter);
|
|
|
+ page = coreIntroduceLetterMapper.selectApproveListPage(page, requestDto);
|
|
|
if(CollectionUtils.isNotEmpty(page.getRecords())){
|
|
|
- List<SysOrg> orgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.findAllOrg(SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
- page = this.buildPageVo(page, orgList);
|
|
|
+ page.getRecords().stream().forEach(vo->{
|
|
|
+ vo.setLetterFile(ObjectUtil.isNotEmpty(vo.getLetterFileStr()) ? JSON.parseArray(vo.getLetterFileStr(), String.class) : null);
|
|
|
+ });
|
|
|
+
|
|
|
+// List<SysOrg> orgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.findAllOrg(SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//抓换为TableDataInfo适配前端
|
|
|
@@ -112,14 +104,22 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void auditLetter(CoreIntroduceLetterAddDto coreIntroduceLetter) {
|
|
|
-
|
|
|
- CoreIntroduceLetterCheckLog checkLog =coreIntroduceLetter.getCheckLog();
|
|
|
- checkLog.setCheckTime(new Date());
|
|
|
- checkLog.setCheckUser(SecurityUtils.getUsername());
|
|
|
- checkLog.setStatus(1);
|
|
|
- coreIntroduceLetterMapper.updateCheckLog(checkLog);
|
|
|
+ public List<CoreIntroduceLetterApprovedPersonVo> getOutInApprovedPersonList(CoreIntroduceLetterApproveRequestDto requestDto) {
|
|
|
+ List<CoreIntroduceLetterApprovedPersonVo> outInApprovedPersonList = coreIntroduceLetterMapper.getOutInApprovedPersonList(requestDto);
|
|
|
+ if(ObjectUtil.isNotEmpty(outInApprovedPersonList)){
|
|
|
+ outInApprovedPersonList.stream().forEach(vo->{
|
|
|
+ vo.setLetterFile(ObjectUtil.isNotEmpty(vo.getLetterFileStr()) ? JSON.parseArray(vo.getLetterFileStr(), String.class) : null);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return outInApprovedPersonList;
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void auditLetter(CoreIntroduceLetterApproveLog approveLog) {
|
|
|
+ approveLog.setApproveTime(new Date());
|
|
|
+ approveLog.setApproveUser(SecurityUtils.getUsername());
|
|
|
+ approveLog.setApproveUserId(SecurityUtils.getUserId());
|
|
|
+ coreIntroduceLetterMapper.approveLetter(approveLog);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -129,9 +129,9 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
List<CoreIntroduceLetterVo> records = page.getRecords();
|
|
|
for (CoreIntroduceLetterVo record : records) {
|
|
|
List<Long> orgIds = toOrgList.stream().filter(toOrg -> toOrg.getLetterId().equals(record.getId())).map(CoreIntroduceLetterToOrg::getOrgId).collect(Collectors.toList());
|
|
|
- String orgNames = orgIds.stream().map(orgId -> orgList.stream().filter(org -> org.getId().equals(orgId)).findFirst().get().getName()).collect(Collectors.joining(","));
|
|
|
- record.setOrgNames(orgNames);
|
|
|
- record.setOrgIds(orgIds);
|
|
|
+ String orgNames = orgIds.stream().map(orgId -> orgList.stream().filter(org -> org.getId().equals(orgId)).findFirst().get().getShortName()).collect(Collectors.joining(","));
|
|
|
+ record.setReceptionOrgIds(orgIds);
|
|
|
+ record.setReceptionOrgNames(orgNames);
|
|
|
}
|
|
|
return page;
|
|
|
}
|
|
|
@@ -157,18 +157,18 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
List<CoreIntroduceLetterToOrg> toOrgList = coreIntroduceLetterMapper.findToOrgListB(list);
|
|
|
if(CollectionUtils.isNotEmpty(toOrgList)){
|
|
|
List<Long> orgIds = toOrgList.stream().filter(toOrg -> toOrg.getLetterId().equals(coreIntroduceLetterVo.getId())).map(CoreIntroduceLetterToOrg::getOrgId).collect(Collectors.toList());
|
|
|
- String orgNames = orgIds.stream().map(orgId -> orgList.stream().filter(org -> org.getId().equals(orgId)).findFirst().get().getName()).collect(Collectors.joining(","));
|
|
|
- coreIntroduceLetterVo.setOrgIds(orgIds);
|
|
|
- coreIntroduceLetterVo.setOrgNames(orgNames);
|
|
|
+ String orgNames = orgIds.stream().map(orgId -> orgList.stream().filter(org -> org.getId().equals(orgId)).findFirst().get().getShortName()).collect(Collectors.joining(","));
|
|
|
+ coreIntroduceLetterVo.setReceptionOrgIds(orgIds);
|
|
|
+ coreIntroduceLetterVo.setReceptionOrgNames(orgNames);
|
|
|
}
|
|
|
//获取人员信息
|
|
|
List<CoreIntroduceLetterUserAddDto> userList = coreIntroduceLetterMapper.findUserList(list);
|
|
|
if (CollectionUtils.isNotEmpty(userList)){
|
|
|
coreIntroduceLetterVo.setUserInfos(userList);
|
|
|
}
|
|
|
- CoreIntroduceLetterCheckLog
|
|
|
+ CoreIntroduceLetterApproveLog
|
|
|
checkLog = coreIntroduceLetterMapper.findCheckLog(id,SecurityUtils.getLoginUser().getOrgId());
|
|
|
- coreIntroduceLetterVo.setCheckLog(checkLog);
|
|
|
+ coreIntroduceLetterVo.setApproveLog(checkLog);
|
|
|
return coreIntroduceLetterVo;
|
|
|
}
|
|
|
|
|
|
@@ -197,7 +197,7 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
CoreIntroduceLetter introduceLetter = (CoreIntroduceLetter) map.get("introduceLetter");
|
|
|
List<CoreIntroduceLetterUser> userList = (List<CoreIntroduceLetterUser>)map.get("userList");
|
|
|
List<CoreIntroduceLetterToOrg> toOrgList = (List<CoreIntroduceLetterToOrg>)map.get("toOrgList");
|
|
|
- List<CoreIntroduceLetterCheckLog> checkLogs = (List<CoreIntroduceLetterCheckLog>) map.get("checkLogs");
|
|
|
+ List<CoreIntroduceLetterApproveLog> checkLogs = (List<CoreIntroduceLetterApproveLog>) map.get("checkLogs");
|
|
|
coreIntroduceLetterMapper.insert(introduceLetter);
|
|
|
coreIntroduceLetterMapper.saveUserList(userList);
|
|
|
coreIntroduceLetterMapper.saveToOrgList(toOrgList);
|
|
|
@@ -217,11 +217,14 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
introduceLetter.setId(letterId);
|
|
|
introduceLetter.setCreateTime(date);
|
|
|
introduceLetter.setCreateBy(username);
|
|
|
+// introduceLetter.setStatus(0);
|
|
|
}
|
|
|
introduceLetter.setLetterFile( ObjectUtil.isNotEmpty(coreIntroduceLetter.getLetterFile()) ? JSON.toJSONString(coreIntroduceLetter.getLetterFile()) : null);
|
|
|
introduceLetter.setOrgId(sysOrg.getId());
|
|
|
introduceLetter.setOrgPath(sysOrg.getPath());
|
|
|
introduceLetter.setOrgName(sysOrg.getName());
|
|
|
+ introduceLetter.setStartTime(coreIntroduceLetter.getRange().get(0));
|
|
|
+ introduceLetter.setEndTime(coreIntroduceLetter.getRange().get(1));
|
|
|
|
|
|
//封装人员信息
|
|
|
List<CoreIntroduceLetterUserAddDto> userAddVoList =coreIntroduceLetter.getUserInfos();
|
|
|
@@ -239,19 +242,19 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
});
|
|
|
//封装接待机构
|
|
|
List<CoreIntroduceLetterToOrg> toOrgList =new ArrayList<>();
|
|
|
- List<CoreIntroduceLetterCheckLog> checkLogs = new ArrayList<>();
|
|
|
- List<Long> orgIds = coreIntroduceLetter.getOrgIds();
|
|
|
+ List<CoreIntroduceLetterApproveLog> checkLogs = new ArrayList<>();
|
|
|
+ List<Long> orgIds = coreIntroduceLetter.getReceptionOrgIds();
|
|
|
orgIds.forEach(r->{
|
|
|
CoreIntroduceLetterToOrg toOrg = new CoreIntroduceLetterToOrg();
|
|
|
toOrg.setLetterId(introduceLetter.getId());
|
|
|
toOrg.setOrgId(r);
|
|
|
toOrgList.add(toOrg);
|
|
|
|
|
|
- CoreIntroduceLetterCheckLog checkLog = new CoreIntroduceLetterCheckLog();
|
|
|
+ CoreIntroduceLetterApproveLog checkLog = new CoreIntroduceLetterApproveLog();
|
|
|
checkLog.setId(IdWorker.getId());
|
|
|
checkLog.setOrgId(r);
|
|
|
checkLog.setLetterId(introduceLetter.getId());
|
|
|
- checkLog.setStatus(0);
|
|
|
+ checkLog.setApproveStatus(0);
|
|
|
checkLogs.add(checkLog);
|
|
|
});
|
|
|
|
|
|
@@ -275,7 +278,7 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
CoreIntroduceLetter introduceLetter = (CoreIntroduceLetter) map.get("introduceLetter");
|
|
|
List<CoreIntroduceLetterUser> userList = (List<CoreIntroduceLetterUser>)map.get("userList");
|
|
|
List<CoreIntroduceLetterToOrg> toOrgList = (List<CoreIntroduceLetterToOrg>)map.get("toOrgList");
|
|
|
- List<CoreIntroduceLetterCheckLog> checkLogs = (List<CoreIntroduceLetterCheckLog>) map.get("checkLogs");
|
|
|
+ List<CoreIntroduceLetterApproveLog> checkLogs = (List<CoreIntroduceLetterApproveLog>) map.get("checkLogs");
|
|
|
|
|
|
coreIntroduceLetterMapper.updateById(introduceLetter);
|
|
|
coreIntroduceLetterMapper.deleteUserList(introduceLetter.getId());
|
|
|
@@ -286,9 +289,13 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
|
|
|
//删除审核信息
|
|
|
coreIntroduceLetterMapper.deleteCheckLogs(introduceLetter.getId());
|
|
|
coreIntroduceLetterMapper.saveCheckLogs(checkLogs);
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public void updateCoreIntroduceLetterStatus(CoreIntroduceLetterUpdateStatusDto letterDto) {
|
|
|
+ CoreIntroduceLetter coreIntroduceLetter = coreIntroduceLetterMapper.selectById(letterDto.getId());
|
|
|
+ coreIntroduceLetter.setStatus(letterDto.getStatus());
|
|
|
+ coreIntroduceLetterMapper.updateById(coreIntroduceLetter);
|
|
|
}
|
|
|
|
|
|
/**
|